Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.70 KB | None | 0 0
  1. public ActionResult EditarMes()
  2. {
  3. return View();
  4. }
  5.  
  6. [HttpPost]
  7. [ValidateAntiForgeryToken]
  8. [AcceptVerbs(HttpVerbs.Post)]
  9. public ActionResult EditarMes(IList<ClientePrestacaoViewModel> prestacaoViewModel)
  10. {
  11. if (!ModelState.IsValid) return View("Index");
  12. foreach (var item in prestacaoViewModel.Where(item => item != null))
  13. {
  14. _cliente.Atualizar(item);
  15. TempData["MensagemSuccess"] = "Cliente alterado com sucesso!";
  16.  
  17. }
  18. return Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString());
  19. }
  20.  
  21. @using PrestacaoWeb.Application.ViewModels
  22. @model List<PrestacaoWeb.Application.ViewModels.ClientePrestacaoViewModel>
  23. @{
  24. ViewBag.Title = "Obrigações";
  25. }
  26. @using (Html.BeginForm("EditarMes", "Cliente", FormMethod.Post))
  27. {
  28. @Html.AntiForgeryToken()
  29. <div class="modal-dialog modal-lg">
  30. <div class="modal-content-Listar">
  31. <div class="modal-header">
  32. <h4 class="modal-title" id="myModalLabel"> </h4>
  33. </div>
  34. <div class="row">
  35. <div class="container">
  36. <div class="checkBoxTips">
  37. <div class="form-horizontal">
  38. <br />
  39. <table style="width:1149px;" id="tblPrestacao" class="table-striped cell-border tblCompleta ">
  40. <thead>
  41. <tr bgcolor="#F1F1F1">
  42. <th><p align="center">Cliente</p></th>
  43. @if (ViewBag.Janeiro == true)
  44. {
  45. <th bgcolor="#F0E68C"><p align="center">1</p></th>
  46. }
  47. else
  48. {
  49. <th><p align="center">1</p></th>
  50.  
  51. }
  52. @if (ViewBag.Fevereiro == true)
  53. {
  54. <th bgcolor="#F0E68C"><p align="center">2</p></th>
  55. }
  56. else
  57. {
  58. <th><p align="center">2</p></th>
  59.  
  60. }
  61. @if (ViewBag.Marco == true)
  62. {
  63. <th bgcolor="#F0E68C"><p align="center">3</p></th>
  64. }
  65. else
  66. {
  67. <th><p align="center">3</p></th>
  68.  
  69. }
  70. @if (ViewBag.Abril == true)
  71. {
  72. <th bgcolor="#F0E68C"><p align="center">4</p></th>
  73. }
  74. else
  75. {
  76. <th><p align="center">4</p></th>
  77.  
  78. }
  79. <th><p align="center">Cidade</p></th>
  80. <th><p align="center">Pendência</p></th>
  81. <th><p align="center">Responsável</p></th>
  82. <th><p align="center">Observação</p></th>
  83. </tr>
  84. </thead>
  85. <tbody>
  86. @if (ViewBag.TipoPrestacao != null)
  87. {
  88. @Html.Partial("_MesesQuadrimestralPrestacao")
  89. }
  90. </tbody>
  91. </table>
  92. </div>
  93. <hr />
  94. </div>
  95. </div>
  96.  
  97. </div>
  98. </div>
  99. </div>
  100.  
  101.  
  102. }
  103.  
  104. <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  105. @Html.Partial("Atualizar", new ClienteViewModel());
  106. </div>
  107.  
  108. <div class="modal fade" id="myModalAdd" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  109. @Html.Partial("Adicionar", new ClienteViewModel());
  110. </div>
  111.  
  112. @section Scripts {
  113. <script>
  114. $(document).ready(function () {
  115. $('#tblPrestacao').DataTable({
  116. "scrollCollapse": false,
  117. "paging": false,
  118. "info": false,
  119. "bSort": false,
  120. language: {
  121. "search": "Filtrar:",
  122. "emptyTable": "Nenhum registro encontrado utilizando este filtro.",
  123. "zeroRecords": "Nenhum registro encontrado utilizando este filtro."
  124. },
  125. "columnDefs": [
  126. {
  127. "targets": 5,
  128. "visible": false,
  129. "searchable": true
  130. }
  131. ],
  132. });
  133. });
  134. </script>
  135. }
  136.  
  137. @using PrestacaoWeb.UI.Helpers
  138. @model List<PrestacaoWeb.Application.ViewModels.ClientePrestacaoViewModel>
  139.  
  140. @for (int i = 0; i < Model.Count(); i++)
  141. {
  142. <tr>
  143. @Html.HiddenFor(model => model[i].ClienteId)
  144. <td style="width: 400px">@Html.DisplayFor(model => model[i].Cliente.NomeEntidade)</td>
  145.  
  146. <td><p align="center"> <b>@Html.CheckBoxFor(model => Model[i].EnvioPrestacao.bJaneiro, new { disabled = "disabled" })</b> </p> </td>
  147.  
  148. <td><p align="center"> <b>@Html.CheckBoxFor(model => Model[i].EnvioPrestacao.bFevereiro, new { disabled = "disabled" })</b> </p> </td>
  149.  
  150. <td><p align="center"> <b>@Html.CheckBoxFor(model => Model[i].EnvioPrestacao.bMarco, new { disabled = "disabled" })</b> </p> </td>
  151.  
  152. <td><p align="center"> <b>@Html.CheckBoxFor(model => Model[i].EnvioPrestacao.bAbril, new { disabled = "disabled" })</b> </p> </td>
  153.  
  154. <td> @Model[i].Cliente.Cidade.Nome</td>
  155.  
  156. <td align="center" style="width: 20px">
  157. <input type="text" value=" " disabled style="width: 77px" title="Cliente sem pendências." />
  158. </td>
  159.  
  160. <td style="width: 100px">
  161. <p align="center">@Model[i].Cliente.Responsavel</p>
  162. </td>
  163.  
  164. <td style="width: 210px">
  165. <p align="center">@Model[i].Cliente.Observacao.DisplayText(30)</p>
  166. </td>
  167. </tr>
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement