//[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 List <BE_TBL_MENU> LISTAR_MENU(BE_TBL_MENU _obj) { DA_CARGO DA = new DA_CARGO(); try { return(DA.LISTAR_MENU(_obj)); } catch (Exception excepcion) { throw (excepcion); } }
public List <BE_TBL_MENU> LISTAR_MENU(BE_TBL_MENU _Obj) { BE_TBL_MENU ITEM; List <BE_TBL_MENU> List = new List <BE_TBL_MENU>(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["cnBDAl4k0"].ConnectionString)) { try { cn.Open(); using (SqlCommand cm = new SqlCommand("[dbo].[SP_CARGA_MENU]", cn)) { cm.CommandType = CommandType.StoredProcedure; cm.Parameters.AddWithValue("@iCodEmpresa", _Obj.iCodEmpresa); cm.Parameters.AddWithValue("@iCodPerfil", _Obj.iCodPerfil); cm.Parameters.AddWithValue("@iCodEmpleado", _Obj.iCodEmpleado); using (SqlDataReader DR = cm.ExecuteReader()) { while (DR.Read()) { ITEM = new BE_TBL_MENU(); if (!DR.IsDBNull(DR.GetOrdinal("vIconMaterialize"))) { ITEM.vIconMaterialize = DR.GetString(DR.GetOrdinal("vIconMaterialize")); } if (!DR.IsDBNull(DR.GetOrdinal("vNombreMenu"))) { ITEM.vNombreMenu = DR.GetString(DR.GetOrdinal("vNombreMenu")); } if (!DR.IsDBNull(DR.GetOrdinal("vNombreAction"))) { ITEM.vNombreAction = DR.GetString(DR.GetOrdinal("vNombreAction")); } if (!DR.IsDBNull(DR.GetOrdinal("vNombreControlador"))) { ITEM.vNombreControlador = DR.GetString(DR.GetOrdinal("vNombreControlador")); } List.Add(ITEM); } } } cn.Close(); } catch (Exception excepcion) { throw (excepcion); } return(List); } }