예제 #1
0
        public ActionResult Login(POS_USER userModel)
        {
            POS_USER objUser = new POS_USER();

            try
            {
                POS_USER   _objUser         = _objBALUser.Login(userModel);
                POS_BRANCH _objBranchDetail = _objBALCompBranch.GetBranchInfo(Formatter.SetValidValueToInt(_objUser.BRANCH_ID));
                objUser = _objUser;
                if (objUser.NotifyMessage == "user")
                {
                    Session[SessionVariables.Session_UserInfo]   = _objUser;
                    Session[SessionVariables.Session_BranchInfo] = _objBranchDetail;


                    SessionHandling.UserId     = _objUser.USER_ID;
                    SessionHandling.LoginLevel = _objUser.LOGIN_TYPE;

                    ShowAlert(AlertType.Success, "Welcome " + SessionHandling.UserInformation.USERNAME);
                    return(RedirectToAction("IndexUser", "Home"));
                }
                else if (objUser.NotifyMessage == "admin" || objUser.NotifyMessage == "superadmin")
                {
                    Session[SessionVariables.Session_UserInfo] = _objUser;
                    SessionHandling.UserId     = _objUser.USER_ID;
                    SessionHandling.LoginLevel = _objUser.LOGIN_TYPE;

                    ShowAlert(AlertType.Success, "Welcome " + SessionHandling.UserInformation.USERNAME);
                    return(RedirectToAction("IndexAdmin", "Home"));
                }
                else
                {
                    ModelState.AddModelError("", userModel.NotifyMessage);
                }
                return(View(userModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }