// GET: Informe/EmpleadoI public ActionResult Index(string Estatus, string buscarPor, string buscar, string Page) { if (buscarPor == "Departamento") { return(View(empldn.GetAll().Where(x => x.Departamento.CodigoDep.StartsWith(buscar) || buscar == null))); } else if (buscarPor == "Nombre") { return(View(empldn.GetAll().Where(x => x.Nombre.StartsWith(buscar) || buscar == null))); } ViewBag.Estatus = (Estatus == null ? "A" : Estatus); if (Estatus == "A") { return(View(empldn.GetActives())); } else if (Estatus == "I") { return(View(empldn.GetInactives())); } var abc = empldn.GetActives(); ViewBag.TotalPages = Math.Ceiling(abc.Count() / 10.0); int page = int.Parse(Page == null ? "1" : Page); ViewBag.Page = page; abc = abc.Skip((page - 1) * 10).Take(10); return(View(abc)); }
public ActionResult Create(SalidaEmpleado salidaEmpleado) { ViewBag.EmpleadoId = empleldn.GetAll().Where(y => y.Estatus == "A").Select(x => new SelectListItem() { Text = x.Nombre + " " + x.Apellido + " (" + x.CodigoEmp + ") ", Value = x.Id.ToString() }); if (ModelState.IsValid) { var x = empleldn.GetActives().Where(y => y.Id == salidaEmpleado.EmpleadoId); var instanciavalor = x.First(); instanciavalor.Estatus = "I"; empleldn.Update(instanciavalor); saliempleldn.Insert(salidaEmpleado); return(RedirectToAction("Index", "SalidaEmpleado", new { area = "Admin" })); } return(View()); }
public ActionResult Create(int?valorMes, int?valorAnio) { List <SelectListItem> meses = new List <SelectListItem>() { new SelectListItem() { Text = "Enero", Value = "1", Selected = true }, new SelectListItem() { Text = "Febrero", Value = "2", Selected = false }, new SelectListItem() { Text = "Marzo", Value = "3", Selected = false }, new SelectListItem() { Text = "Abril", Value = "4", Selected = false }, new SelectListItem() { Text = "Mayo", Value = "5", Selected = false }, new SelectListItem() { Text = "Junio", Value = "6", Selected = false }, new SelectListItem() { Text = "Julio", Value = "7", Selected = false }, new SelectListItem() { Text = "Agosto", Value = "8", Selected = false }, new SelectListItem() { Text = "Septiembre", Value = "9", Selected = false }, new SelectListItem() { Text = "Octubre", Value = "10", Selected = false }, new SelectListItem() { Text = "Noviembre", Value = "11", Selected = false }, new SelectListItem() { Text = "Diciembre", Value = "12", Selected = false } }; ViewBag.ListaMeses = meses; List <SelectListItem> anios = new List <SelectListItem>() { new SelectListItem() { Text = "2019", Value = "2019", Selected = true }, new SelectListItem() { Text = "2018", Value = "2018", Selected = false }, new SelectListItem() { Text = "2017", Value = "2017", Selected = false }, new SelectListItem() { Text = "2016", Value = "2016", Selected = false }, }; ViewBag.ListaAnios = anios; string elMes = ""; if (valorMes != null) { meses.First(x => x.Value == valorMes.ToString()).Selected = true; } if (valorAnio != null) { anios.First(x => x.Value == valorAnio.ToString()).Selected = true; } decimal total = empleadoLdn.GetActives().Sum(x => x.Salario); ViewBag.Total = total; ViewBag.MesId = new SelectList(mesldn.GetAll(), "Id", "Descripcion"); return(View()); }