Advertisement
comercio1

Untitled

Jul 31st, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | None | 0 0
  1. VIEWMODELS
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Web;
  6. using Empresa_adm.Models;
  7.  
  8. namespace Empresa_adm.ViewModels
  9. {
  10. public class AgregarEmpleadoViewModel
  11. {
  12. public Empleado empleado { get; set; }
  13. public List<Categoria> categorias { get; set; }
  14. public List<EstadoCivil> estadosCiviles { get; set; }
  15.  
  16. }
  17. }
  18. EDITARWIESMODELS
  19. using System;
  20. using System.Collections.Generic;
  21. using System.Linq;
  22. using System.Web;
  23. using Empresa_adm.Models;
  24.  
  25. namespace Empresa_adm.ViewModels
  26. {
  27. public class EditarSolicitudLicenciaViewModel
  28. {
  29. public SolicitudLicencia solicitudLicencia { get; set; }
  30. public List<TipoLicencia> tiposLicencias { get; set; }
  31. public List<Empleado> empleados { get; set; }
  32.  
  33. }
  34. }
  35. AGREGAR
  36. @using Empresa_adm.ViewModels;
  37. @using Empresa_adm.Models;
  38.  
  39. @model AgregarEmpleadoViewModel
  40.  
  41.  
  42. @{
  43. ViewBag.Title = "Agregar";
  44. }
  45.  
  46. <!DOCTYPE html>
  47.  
  48. <html>
  49. <head>
  50. <meta name="viewport" content="width=device-width" />
  51. <title>Agregar empleado</title>
  52. <link href="~/Content/empresa_adm_estilos.css" rel="stylesheet" />
  53. </head>
  54. <body>
  55. <h2>Agregar empleado</h2>
  56.  
  57. <table>
  58. @Html.ValidationSummary()
  59.  
  60. @using (Html.BeginForm())
  61. {
  62.  
  63. <tr><td>Nombre</td><td>@Html.TextBoxFor(a => a.empleado.Nombre)</td></tr>
  64. <tr><td rowspan=2>Sexo </td><td>@Html.RadioButtonFor(a => a.empleado.Sexo, true) Masculino </td></tr>
  65. <tr> <td>@Html.RadioButtonFor(a => a.empleado.Sexo, false) Femenino <td></tr>
  66. <tr>
  67. <td>@Html.LabelFor(a => a.empleado.IdCategoria)</td>
  68. <td>
  69. @Html.DropDownListFor(a => a.empleado.IdCategoria,
  70. new SelectList(@Model.categorias, "idCategoria", "nombreCategoria"))
  71. </td>
  72. </tr>
  73. <tr>
  74. <td>@Html.LabelFor(a => a.empleado.IdEstadoCivil)</td>
  75. <td>
  76. @Html.DropDownListFor(a => a.empleado.IdEstadoCivil,
  77. new SelectList(@Model.estadosCiviles, "idEstadoCivil", "nombreEstadoCivil"))
  78. </td>
  79. </tr>
  80. <tr><td>Cantidad de hijos</td><td>@Html.TextBoxFor(a => a.empleado.CantidadHijos)</td></tr>
  81. <tr><td>Sueldo diario promedio</td><td>@Html.TextBoxFor(a => a.empleado.SueldoDiarioPromedio)</td></tr>
  82.  
  83.  
  84. <tr><td></td><td><input type="submit" value="Agregar" /></td></tr>
  85.  
  86.  
  87. }
  88.  
  89. </table>
  90.  
  91. <br />
  92. <a href="/Empleados/AdministracionEmpleados">Volver</a>
  93. <br />
  94.  
  95. </body>
  96. </html>
  97.  
  98. CONSULTAR
  99. @model Empresa_adm.Models.Empleado
  100.  
  101. @{
  102. Layout = null;
  103. }
  104.  
  105. <!DOCTYPE html>
  106.  
  107. <html>
  108. <head>
  109. <meta name="viewport" content="width=device-width" />
  110. <title>Consultar empleado</title>
  111. <link href="~/Content/empresa_adm_estilos.css" rel="stylesheet" />
  112. </head>
  113. <body>
  114. @if (Model != null)
  115. {
  116. <h1>Consulta de empleado (codigo=@Model.IdLegajo)</h1>
  117. <table>
  118. <tr><td>Legajo</td><td>@Model.IdLegajo</td></tr>
  119. <tr><td>Nombre</td><td>@Model.Nombre</td></tr>
  120. <tr><td>Sexo</td><td>@Model.sexoToString()</td></tr>
  121. <tr><td>Categoria</td><td>@Model.categoriaToString()</td></tr>
  122. <tr><td>Estado civil</td><td>@Model.estadoCivilToString()</td></tr>
  123. <tr><td>Cantidad de hijos</td><td>@Model.CantidadHijos</td></tr>
  124. <tr><td>Sueldo diario promedio</td> <td>@Model.SueldoDiarioPromedio</td></tr>
  125. </table>
  126. }
  127. else
  128. {
  129. <h1>El empleado no existe</h1>
  130. }
  131.  
  132. <br />
  133. <a href="/Empleados/AdministracionEmpleados">Volver</a>
  134. <br />
  135.  
  136. </body>
  137. </html>
  138.  
  139. EDITAR
  140. @using Empresa_adm.ViewModels;
  141. @using Empresa_adm.Models;
  142.  
  143. @model EditarEmpleadoViewModel
  144.  
  145. @{
  146. ViewBag.Title = "Editar";
  147. }
  148.  
  149. <!DOCTYPE html>
  150.  
  151. <html>
  152. <head>
  153. <meta name="viewport" content="width=device-width" />
  154. <title>Editar empleado</title>
  155. <link href="~/Content/empresa_adm_estilos.css" rel="stylesheet" />
  156. </head>
  157. <body>
  158.  
  159. <h2>Editar empleado</h2>
  160.  
  161. <table>
  162. @Html.ValidationSummary()
  163.  
  164. @using (Html.BeginForm())
  165. {
  166. <tr><td>Legajo</td><td>@Html.TextBoxFor(modelo => modelo.empleado.IdLegajo, new { @readonly = true }) </td></tr>
  167. <tr><td>Nombre</td><td>@Html.TextBoxFor(m => m.empleado.Nombre)</td></tr>
  168. <tr><td rowspan=2>Sexo </td><td>@Html.RadioButtonFor(m => m.empleado.Sexo, true) Masculino </td></tr>
  169. <tr> <td>@Html.RadioButtonFor(m => m.empleado.Sexo, false) Femenino <td></tr>
  170. <tr>
  171. <td>@Html.LabelFor(m => m.empleado.IdCategoria)</td>
  172. <td>
  173. @Html.DropDownListFor(m => m.empleado.IdCategoria,
  174. new SelectList(@Model.categorias, "IdCategoria", "nombreCategoria"))
  175. </td>
  176. </tr>
  177. <tr>
  178. <td>@Html.LabelFor(m => m.empleado.IdEstadoCivil)</td>
  179. <td>
  180. @Html.DropDownListFor(m => m.empleado.IdEstadoCivil,
  181. new SelectList(@Model.estadosCiviles, "IdEstadoCivil", "nombreEstadoCivil"))
  182. </td>
  183. </tr>
  184. <tr><td>Cantidad de hijos</td><td>@Html.TextBoxFor(m => m.empleado.CantidadHijos)</td></tr>
  185. <tr><td>Sueldo diario promedio</td><td>@Html.TextBoxFor(m => m.empleado.SueldoDiarioPromedio)</td></tr>
  186.  
  187. <tr><td></td><td><input type="submit" value="Modificar" /></td></tr>
  188.  
  189. }
  190.  
  191. </table>
  192.  
  193. <br />
  194. <a href="/Empleados/AdministracionEmpleados">Volver</a>
  195. <br />
  196.  
  197. </body>
  198. </html>
  199. LISTAR
  200. @using Empresa_adm.Models;
  201. @model List<Empleado>
  202.  
  203. @{
  204. ViewBag.Title = "Listar";
  205. }
  206.  
  207. <!DOCTYPE html>
  208.  
  209. <html>
  210. <head>
  211. <meta name="viewport" content="width=device-width" />
  212. <title>Listado de empleados</title>
  213. <link href="~/Content/empresa_adm_estilos.css" rel="stylesheet" />
  214. </head>
  215. <body>
  216. <h1>Listado completo de empleados </h1>
  217.  
  218.  
  219.  
  220. <table>
  221.  
  222. <tr><th colspan="10">Listado de empleados</th></tr>
  223. <tr>
  224. <td>Legajo</td>
  225. <td>Empleado</td>
  226. <td>Sexo</td>
  227. <td>Categoría</td>
  228. <td>Estado civil</td>
  229. <td>Cantidad de hijos</td>
  230. <td>Sueldo diario promedio</td>
  231. <td>Consultar empleado</td>
  232. <td>Editar empleado</td>
  233. <td>Eliminar empleado</td>
  234.  
  235. </tr>
  236.  
  237. @foreach (Empleado e in Model)
  238. {
  239. <tr>
  240. <td>@e.IdLegajo</td>
  241. <td>@e.Nombre</td>
  242. <td>@e.sexoToString()</td>
  243. <td>@e.categoriaToString()</td>
  244. <td>@e.estadoCivilToString()</td>
  245. <td>@e.CantidadHijos</td>
  246. <td>@e.SueldoDiarioPromedio</td>
  247. <td><a href="/Empleados/Consultar/@e.IdLegajo">Consultar</a></td>
  248. <td><a href="/Empleados/Editar/@e.IdLegajo">Editar</a></td>
  249. <td><a href="/Empleados/Eliminar/@e.IdLegajo">Eliminar</a></td>
  250. </tr>
  251. }
  252. </table>
  253.  
  254. <br />
  255. <a href="/Empleados/Agregar">Agregar Empleado</a>
  256. <br />
  257. <br />
  258. <a href="/Empleados/AdministracionEmpleados">Volver</a>
  259. <br />
  260.  
  261. </body>
  262. </html>
  263. INDEX
  264. @{
  265. Layout = null;
  266. }
  267.  
  268. <!DOCTYPE html>
  269.  
  270. <html>
  271. <head>
  272. <meta name="viewport" content="width=device-width" />
  273. <title>Index</title>
  274. </head>
  275. <body>
  276. <h1>Menú de personas</h1>
  277. <div>
  278. <a href="/Personas/Listar">Listado de personas</a>
  279. <a href="/Personas/ReporteMayores">Listado de mayores de edad</a>
  280. </div>
  281. </body>
  282. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement