//[ValidateAntiForgeryToken] public ActionResult Login(LoginModel model, string returnUrl) { BE_CARGO x = new BE_CARGO(); Service1Client client = new Service1Client(); try { x.vNombreCargo = model.UserName; x.vPassword = model.Password; x = client.Login(x); if (x.iCodEmpleado > 0) { FormsAuthentication.SetAuthCookie(model.UserName, false); Session["Cargo_Empleado"] = x; BE_TBL_MENU y = new BE_TBL_MENU(); List <BE_TBL_MENU> List = new List <BE_TBL_MENU>(); y.iCodEmpleado = x.iCodEmpleado; y.iCodEmpresa = x.iCodEmpresa; y.iCodPerfil = x.iCodPerfil; List = client.LISTAR_MENU(y); Session["ListaMenus"] = List; return(RedirectToAction(List[0].vNombreAction, List[0].vNombreControlador)); } else { Session["Error_Messague"] = "Usuario y/o clave incorrectos!"; return(RedirectToAction("Login", "Account")); } } catch (Exception e) { throw(e); } }
public ActionResult LISTAR_PERSONAL(BE_CARGO obj) { List <BE_CARGO> oLista = new List <BE_CARGO>(); Service1Client Servicio = new Service1Client(); var draw = Request.Form.GetValues("draw").FirstOrDefault(); var start = Request.Form.GetValues("start").FirstOrDefault(); var length = Request.Form.GetValues("length").FirstOrDefault(); string filter = Request.Form.GetValues("search[value]").FirstOrDefault(); int pageSize = length != null?Convert.ToInt32(length) : 0; int skip = start != null?Convert.ToInt32(start) : 0; int recordsTotal = 0; SenorPezPrincipal.ServiceReference1.BE_CARGO Obj = (SenorPezPrincipal.ServiceReference1.BE_CARGO)Session["Cargo_Empleado"]; obj.iCodEmpresa = Obj.iCodEmpresa; try { oLista = Servicio.LISTAR_PERSONAL(obj); } catch (Exception ex) { throw ex; } Servicio.Close(); recordsTotal = oLista.Count(); var data = oLista.Skip(skip).Take(pageSize).ToList(); return(Json(new { draw = draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, data = data }, JsonRequestBehavior.AllowGet));; }