Exemplo n.º 1
0
        public ActionResult Login(FormCollection frm)
        {
            String LoginResult = string.Empty;

            if (ModelState.IsValid)
            {
                try
                {
                    String LoginID = frm["LoginID"];
                    String pwd     = frm["password"];
                    LoginResult = RoleUtil.CheckUserFrofile(LoginID, pwd);
                    if (LoginResult == "PASS")
                    {
                        var list        = RoleUtil.GetMenusOfRoleId(Convert.ToInt32(STUtil.GetSessionValue(UserInfo.RoleID.ToString())), Convert.ToInt32(STUtil.GetSessionValue(UserInfo.CompanyID.ToString()))).ToList();
                        var menuObjects = (Session[UserInfo.MenuList.ToString()] as List <TreeNode>) ?? new List <TreeNode>();
                        menuObjects.AddRange(list);
                        Session[UserInfo.MenuList.ToString()] = menuObjects;
                        TempData["Login"] = "******";
                        return(RedirectToAction("Index/", "DashBoard"));
                    }
                    ViewBag.result = LoginResult;
                }
                catch (Exception ex)
                {
                    //  ExceptionLogging.SendErrorToText(ex);
                    ViewBag.result = ex.Message;
                }
            }
            else
            {
                ViewBag.result = STUtil.GetValidationMessage(ModelState);
            }
            return(RedirectToAction("Login", new { Result = LoginResult, MessageType = "Error" }));
            //return View();
        }