Guest User

Untitled

a guest
Feb 11th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.11 KB | None | 0 0
  1. protected void Application_Error(object sender, EventArgs e)
  2. {
  3. Exception exception = Server.GetLastError();
  4. Response.Clear();
  5.  
  6. HttpException httpException = exception as HttpException;
  7.  
  8. int error = httpException != null ? httpException.GetHttpCode() : 0;
  9.  
  10. Server.ClearError();
  11. Response.Redirect(String.Format("~/Error/?error={0}", error, exception.Message));
  12. }
  13.  
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Linq;
  17. using System.Web;
  18. using System.Web.Mvc;
  19. using macpartner.Models;
  20.  
  21. namespace macpartner.Controllers
  22. {
  23. public class ErrorController : Controller
  24. {
  25. private MacPartnerContext db = new MacPartnerContext();
  26. // GET: Error
  27. public ActionResult Index(int error = 0)
  28. {
  29. switch (error)
  30. {
  31. case 500:
  32. ViewBag.Imagem = "https://i.imgur.com/JUtjbnQ.png";
  33. break;
  34.  
  35. case 404:
  36. ViewBag.Imagem = "https://i.imgur.com/6hW4WwF.png";
  37. break;
  38.  
  39. default:
  40. ViewBag.Imagem = "https://i.imgur.com/nBbSpyD.png";
  41. break;
  42. }
  43.  
  44. return View("~/views/error/_ErrorPage.cshtml");
  45. }
  46. }
  47. }
  48.  
  49. @model IEnumerable<macpartner.Models.LeadCashBack>
  50.  
  51. @{
  52. ViewBag.Title = "Meus Bônus";
  53. }
  54.  
  55. @section Scripts{
  56.  
  57.  
  58. <script type="text/javascript" src="/Scripts/jquery-1.8.3.min.js" charset="utf-8"></script>
  59. <script type="text/javascript" src="/Scripts/jquery.maskedinput.js"></script>
  60. <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  61.  
  62. <script>
  63. $(".has-load").on('click', function () {
  64.  
  65. $("#load").show();
  66.  
  67. });
  68. </script>
  69.  
  70.  
  71.  
  72. <script type="text/javascript">
  73.  
  74. $('.count').each(function (index) {
  75. $(this).text($(this).text().replace(',', '.'));
  76.  
  77. $(this).prop('Counter', 0).animate({
  78. Counter: $(this).text()
  79. }, {
  80. duration: 1000,
  81. easing: 'swing',
  82. step: function (now) {
  83. $(this).text(parseFloat(now).toFixed(2));
  84. $(this).text('R$ ' + $(this).text().replace('.', ','));
  85. $(this).text($(this).text().replace('.', ','));
  86. }
  87. });
  88. });
  89.  
  90. </script>
  91.  
  92. <script>
  93. $(function () {
  94. $("#PontosDisponiveis").click(function () {
  95.  
  96. var id = $(this).attr("data-id");
  97. $("#modalBonusDisponiveis").load("Details?id=" + id, function () {
  98. $("#modalBonusDisponiveis").modal();
  99. })
  100.  
  101. });
  102. })
  103.  
  104. $(function () {
  105. $("#PontosUtilizados").click(function () {
  106.  
  107. var id = $(this).attr("data-id");
  108. $("#modalBonusResgatados").load("Details?id=" + id, function () {
  109. $("#modalBonusResgatados").modal();
  110. })
  111.  
  112. });
  113. })
  114.  
  115. $(function () {
  116. $("#TotalPontos").click(function () {
  117.  
  118. var id = $(this).attr("data-id");
  119. $("#modalBonusTotal").load("Details?id=" + id, function () {
  120. $("#modalBonusTotal").modal();
  121. })
  122.  
  123. });
  124. })
  125. </script>
  126.  
  127. <script type="text/javascript">
  128.  
  129. $("#BtnResgataValor").click(function () {
  130.  
  131. if ($('#hasContaBancaria').text() == "True") {
  132.  
  133.  
  134.  
  135. location.href = '@Url.Action("ResgataBonusAsync", "LeadCashBacks")';
  136.  
  137. swal({
  138. title: "Pronto!",
  139. text: "Solicitação confirmada, agora é só esperar o pessoal da Manchester depositar a grana pra você ;)",
  140. icon: "success",
  141. button: "Entendi!",
  142. });
  143. }
  144. else {
  145.  
  146. swal({
  147. title: "Ops!",
  148. text: "Antes de solicitar o resgate dos seus bonus é necessário cadastrar seus dados bancários. Tô te direcionando...",
  149. icon: "warning",
  150. });
  151.  
  152. setTimeout(
  153. function () {
  154. location.href = '@Url.Action("Create", "UserDadosBancarios")';
  155. }, 7000);
  156.  
  157.  
  158. }
  159.  
  160.  
  161. });
  162.  
  163. </script>
  164.  
  165.  
  166. }
  167.  
  168. @{
  169. Layout = "~/Views/Shared/_Layout.cshtml";
  170. decimal TotalValor = 0;
  171. decimal ValoresDisponiveis = 0;
  172. decimal ValoresUtilizados = 0;
  173. var hasContaBancaria = false;
  174.  
  175. macpartner.Models.MacPartnerContext db = new macpartner.Models.MacPartnerContext();
  176. macpartner.Models.User user = new macpartner.Models.User();
  177. user = db.Users.Where(u => u.UserName == User.Identity.Name).First();
  178. var userDadosBancarios = db.UserDadosBancarios.Where(u => u.UserId == user.UserId).ToList();
  179.  
  180. if (userDadosBancarios.Count > 0)
  181. {
  182. hasContaBancaria = true;
  183. }
  184. else
  185. {
  186. hasContaBancaria = false;
  187. }
  188.  
  189. foreach (var item in Model)
  190. {
  191. if (!item.Contemplado)
  192. {
  193. ValoresDisponiveis += item.ValorProdutos + item.ValorServicos;
  194. }
  195. else
  196. {
  197. ValoresUtilizados += item.ValorProdutos + item.ValorServicos;
  198. }
  199.  
  200. TotalValor += item.ValorProdutos + item.ValorServicos;
  201. }
  202. }
  203.  
  204. <div class="jumbotron">
  205. <img class="banner_full" src="https://i.imgur.com/0acNo2Y.png" />
  206. <img class="banner_reduzido" src="~/Content/Resources/bonus_reduzido.png" />
  207. </div>
  208.  
  209. <div class="MyContent" style="margin-top:-40px">
  210.  
  211. <h4>Resumo de Bonus</h4>
  212.  
  213. <center>
  214. <div class="MyHeaderContent">
  215. <table class="table-bordered">
  216. <thead>
  217.  
  218. </thead>
  219. <tbody>
  220. <tr>
  221. <td>
  222. <div class="MyDashboardDiv" id="PontosDisponiveis">
  223. <center><h4>Bônus Disponíveis</h4></center>
  224. <center><h3 class="count">@ValoresDisponiveis</h3></center>
  225. </div>
  226. </td>
  227. <td>
  228. <div class="MyDashboardDiv" id="PontosUtilizados">
  229. <center><h4>Bônus Utilizados</h4></center>
  230. <center><h3 class="count">@ValoresUtilizados</h3></center>
  231. </div>
  232. </td>
  233. <td>
  234. <div class="MyDashboardDiv" id="TotalPontos">
  235. <center><h4>Bônus Totais</h4></center>
  236. <center><h3 class="count">@TotalValor</h3></center>
  237. </div>
  238. </td>
  239. </tr>
  240. </tbody>
  241. </table>
  242. </div>
  243. </center>
  244.  
  245. <h4>Últimos Leads Convertidos</h4>
  246.  
  247. <div>
  248. <table class="table">
  249. <thead>
  250. <tr>
  251. <th class="MyTh">
  252. <h5>Nome Fantasia</h5>
  253. </th>
  254.  
  255. <th class="MyTh">
  256. <h5>Documento</h5>
  257. </th>
  258.  
  259. <th class="MyTh">
  260. <h5>Total Produtos</h5>
  261. </th>
  262.  
  263. <th class="MyTh">
  264. <h5>Total Serviços</h5>
  265. </th>
  266.  
  267. <th class="MyTh">
  268. <h5>CashBack Produtos</h5>
  269. </th>
  270.  
  271. <th class="MyTh">
  272. <h5>CashBack Servicos</h5>
  273. </th>
  274.  
  275. <th class="MyTh">
  276. <h5>Resgatado</h5>
  277. </th>
  278. </tr>
  279. </thead>
  280. @foreach (var item in Model)
  281. {
  282. macpartner.Models.Lead lead = macpartner.Helpers.LeadHelper.LeadPontosById(item.LeadId);
  283. var contemplado = "";
  284. if (item.Contemplado)
  285. {
  286. contemplado = "Sim";
  287. }
  288. else
  289. {
  290. contemplado = "Não";
  291. }
  292. <tbody>
  293. <tr>
  294. <td class="MyTrTd">
  295. <h5>@lead.fantasia</h5>
  296. </td>
  297.  
  298. <td class="MyTrTd">
  299. <h5>@lead.cnpj_cpf</h5>
  300. </td>
  301.  
  302. <td class="MyTrTd">
  303. <h5>R$ @lead.ValorProdutos</h5>
  304. </td>
  305.  
  306. <td class="MyTrTd">
  307. <h5>R$ @lead.ValorServicos</h5>
  308. </td>
  309.  
  310. <td class="MyTrTd">
  311. <h5>R$ @item.ValorProdutos</h5>
  312. </td>
  313.  
  314. <td class="MyTrTd">
  315. <h5>@item.ValorServicos</h5>
  316. </td>
  317.  
  318. <td class="MyTrTd">
  319. <h5>@contemplado</h5>
  320. </td>
  321. </tr>
  322. </tbody>
  323. }
  324. </table>
  325. </div>
  326.  
  327. </div>
  328.  
  329. <div class="modal fade" id="modalBonusDisponiveis">
  330. <p id="hasContaBancaria" hidden>@hasContaBancaria</p>
  331. <div class="modal-dialog" style="width:60%">
  332. <div class="modal-content">
  333. <div class="modal-header">
  334. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Fechar</span></button>
  335. <h4 class="modal-title">Bônus Disponíveis</h4>
  336. </div>
  337. <div class="modal-body">
  338. <h4>Extrato de Bônus Disponíveis</h4>
  339. <div>
  340. <table class="table">
  341. <thead>
  342. <tr>
  343. <th class="MyTh">
  344. <h5>Nome Fantasia</h5>
  345. </th>
  346.  
  347. <th class="MyTh">
  348. <h5>Documento</h5>
  349. </th>
  350.  
  351. <th class="MyTh">
  352. <h5>Total Produtos</h5>
  353. </th>
  354.  
  355. <th class="MyTh">
  356. <h5>Total Serviços</h5>
  357. </th>
  358.  
  359. <th class="MyTh">
  360. <h5>CashBack Produtos</h5>
  361. </th>
  362.  
  363. <th class="MyTh">
  364. <h5>CashBack Servicos</h5>
  365. </th>
  366. </tr>
  367. </thead>
  368. @foreach (var item in Model)
  369. {
  370. macpartner.Models.Lead lead = macpartner.Helpers.LeadHelper.LeadPontosById(item.LeadId);
  371.  
  372. if (!item.Contemplado)
  373. {
  374. <tbody>
  375. <tr>
  376. <td class="MyTrTd">
  377. <h5>@lead.fantasia</h5>
  378. </td>
  379.  
  380. <td class="MyTrTd">
  381. <h5>@lead.cnpj_cpf</h5>
  382. </td>
  383.  
  384. <td class="MyTrTd">
  385. <h5>R$ @lead.ValorProdutos</h5>
  386. </td>
  387.  
  388. <td class="MyTrTd">
  389. <h5>R$ @lead.ValorServicos</h5>
  390. </td>
  391.  
  392. <td class="MyTrTd">
  393. <h5>R$ @item.ValorProdutos</h5>
  394. </td>
  395.  
  396. <td class="MyTrTd">
  397. <h5>@item.ValorServicos</h5>
  398. </td>
  399. </tr>
  400. </tbody>
  401. }
  402. }
  403. </table>
  404. </div>
  405. </div>
  406. <div class="modal-footer">
  407.  
  408. <button type="button" class="btn btn-info" data-dismiss="modal">Fechar</button>
  409.  
  410. @if (ValoresDisponiveis > 0)
  411. {
  412. <button type="button" class="has-load btn btn-success" id="BtnResgataValor">Resgatar Valor</button>
  413. }
  414.  
  415. </div>
  416. </div><!-- /.modal-content -->
  417. </div><!-- /.modal-dialog -->
  418. </div><!-- /.modal -->
  419.  
  420.  
  421.  
  422. <div class="modal fade" id="modalBonusResgatados">
  423. <div class="modal-dialog" style="width:60%">
  424. <div class="modal-content">
  425. <div class="modal-header">
  426. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Fechar</span></button>
  427. <h4 class="modal-title">Bônus Resgatados</h4>
  428. </div>
  429. <div class="modal-body">
  430. <h4>Extrato de Bônus Resgatados</h4>
  431. <div>
  432. <table class="table">
  433. <thead>
  434. <tr>
  435. <th class="MyTh">
  436. <h5>Nome Fantasia</h5>
  437. </th>
  438.  
  439. <th class="MyTh">
  440. <h5>Documento</h5>
  441. </th>
  442.  
  443. <th class="MyTh">
  444. <h5>Total Produtos</h5>
  445. </th>
  446.  
  447. <th class="MyTh">
  448. <h5>Total Serviços</h5>
  449. </th>
  450.  
  451. <th class="MyTh">
  452. <h5>CashBack Produtos</h5>
  453. </th>
  454.  
  455. <th class="MyTh">
  456. <h5>CashBack Servicos</h5>
  457. </th>
  458.  
  459. <th class="MyTh">
  460. <h5>Data de Resgate</h5>
  461. </th>
  462. </tr>
  463. </thead>
  464. @foreach (var item in Model)
  465. {
  466. macpartner.Models.Lead lead = macpartner.Helpers.LeadHelper.LeadPontosById(item.LeadId);
  467. macpartner.Models.LeadCashBack leadcb = db.LeadCashBacks.Where(l => l.LeadId == lead.LeadID).FirstOrDefault();
  468. var lote = db.LeadCashBackLotes.SqlQuery("SELECT * FROM LeadCashBackLotes t1, LeadCashBacks t2 WHERE t1.LeadCashBackLoteId = t2.LeadCashBackLote_LeadCashBackLoteId and t2.LeadCashBackId = " + leadcb.LeadCashBackId).FirstOrDefault();
  469.  
  470. if (item.Contemplado)
  471. {
  472. <tbody>
  473. <tr>
  474. <td class="MyTrTd">
  475. <h5>@lead.fantasia</h5>
  476. </td>
  477.  
  478. <td class="MyTrTd">
  479. <h5>@lead.cnpj_cpf</h5>
  480. </td>
  481.  
  482. <td class="MyTrTd">
  483. <h5>R$ @lead.ValorProdutos</h5>
  484. </td>
  485.  
  486. <td class="MyTrTd">
  487. <h5>R$ @lead.ValorServicos</h5>
  488. </td>
  489.  
  490. <td class="MyTrTd">
  491. <h5>R$ @item.ValorProdutos</h5>
  492. </td>
  493.  
  494. <td class="MyTrTd">
  495. <h5>@item.ValorServicos</h5>
  496. </td>
  497.  
  498. <td class="MyTrTd">
  499. <h5>@lote.data</h5>
  500. </td>
  501. </tr>
  502. </tbody>
  503. }
  504.  
  505.  
  506. }
  507. </table>
  508. </div>
  509. </div>
  510. <div class="modal-footer">
  511. <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
  512. </div>
  513. </div><!-- /.modal-content -->
  514. </div><!-- /.modal-dialog -->
  515. </div><!-- /.modal -->
  516.  
  517.  
  518.  
  519. <div class="modal fade" id="modalBonusTotal">
  520. <div class="modal-dialog" style="width:60%">
  521. <div class="modal-content">
  522. <div class="modal-header">
  523. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Fechar</span></button>
  524. <h4 class="modal-title">Bônus Totais</h4>
  525. </div>
  526. <div class="modal-body">
  527. <h4>Extrato Total de Bônus</h4>
  528. <div>
  529. <table class="table">
  530. <thead>
  531. <tr>
  532. <th class="MyTh">
  533. <h5>Nome Fantasia</h5>
  534. </th>
  535.  
  536. <th class="MyTh">
  537. <h5>Documento</h5>
  538. </th>
  539.  
  540. <th class="MyTh">
  541. <h5>Total Produtos</h5>
  542. </th>
  543.  
  544. <th class="MyTh">
  545. <h5>Total Serviços</h5>
  546. </th>
  547.  
  548. <th class="MyTh">
  549. <h5>CashBack Produtos</h5>
  550. </th>
  551.  
  552. <th class="MyTh">
  553. <h5>CashBack Servicos</h5>
  554. </th>
  555.  
  556. <th class="MyTh">
  557. <h5>Resgatado</h5>
  558. </th>
  559.  
  560. <th class="MyTh">
  561. <h5>Data de Resgate</h5>
  562. </th>
  563. </tr>
  564. </thead>
  565. @foreach (var item in Model)
  566. {
  567. macpartner.Models.Lead lead = macpartner.Helpers.LeadHelper.LeadPontosById(item.LeadId);
  568. macpartner.Models.LeadCashBack leadcb = db.LeadCashBacks.Where(l => l.LeadId == lead.LeadID).FirstOrDefault();
  569. var lote = db.LeadCashBackLotes.SqlQuery("SELECT * FROM LeadCashBackLotes t1, LeadCashBacks t2 WHERE t1.LeadCashBackLoteId = t2.LeadCashBackLote_LeadCashBackLoteId and t2.LeadCashBackId = " + leadcb.LeadCashBackId).FirstOrDefault();
  570. var contemplado = "";
  571. if (item.Contemplado)
  572. {
  573. contemplado = "Sim";
  574. }
  575. else
  576. {
  577. contemplado = "Não";
  578. }
  579. <tbody>
  580. <tr>
  581. <td class="MyTrTd">
  582. <h5>@lead.fantasia</h5>
  583. </td>
  584.  
  585. <td class="MyTrTd">
  586. <h5>@lead.cnpj_cpf</h5>
  587. </td>
  588.  
  589. <td class="MyTrTd">
  590. <h5>R$ @lead.ValorProdutos</h5>
  591. </td>
  592.  
  593. <td class="MyTrTd">
  594. <h5>R$ @lead.ValorServicos</h5>
  595. </td>
  596.  
  597. <td class="MyTrTd">
  598. <h5>R$ @item.ValorProdutos</h5>
  599. </td>
  600.  
  601. <td class="MyTrTd">
  602. <h5>@item.ValorServicos</h5>
  603. </td>
  604.  
  605. <td class="MyTrTd">
  606. <h5>@contemplado</h5>
  607. </td>
  608. @if (contemplado.Equals("Sim"))
  609. {
  610. <td class="MyTrTd">
  611. <h5>@lote.data</h5>
  612. </td>
  613. }
  614. else
  615. {
  616. <td class="MyTrTd">
  617. <h5> -- </h5>
  618. </td>
  619. }
  620.  
  621. </tr>
  622. </tbody>
  623. }
  624. </table>
  625. </div>
  626. </div>
  627. <div class="modal-footer">
  628. <button type="button" class="btn btn-default" data-dismiss="modal">Fechar</button>
  629. </div>
  630. </div><!-- /.modal-content -->
  631. </div><!-- /.modal-dialog -->
  632. </div><!-- /.modal -->
Add Comment
Please, Sign In to add comment