Ejemplo n.º 1
0
        public ActionResult ProcessLoginForm()
        {
            #region Form Data
            string Username = Request.Form["Username"];
            string Password = Request.Form["Password"];
            Username = Username.Replace(" ", string.Empty);
            Username = Username.Replace("\'", string.Empty);
            Password = Password.Replace(" ", string.Empty);
            Password = Password.Replace("\'", string.Empty);
            #endregion

            System.Diagnostics.Debug.WriteLine(Password);

            LoginAuthorization l = new LoginAuthorization();
            if (l.checkUser(Username, Password))
            {
                int UserID      = l.getUserID();
                int AccessLevel = l.getAccessLevel();

                Session["CurrentUserID"] = UserID;
                Session["LoginSession"]  = null;

                if (AccessLevel == 1)
                {
                    //14 and 29 reset RequestActive
                    if (DateTime.Now.Day == 14 || DateTime.Now.Day == 29)
                    {
                        db.ChangeByQuery("delete from RequestActive");
                        //In-Active Count
                        Tree t = new Tree();
                        t.InactiveCount();
                        db.ChangeByQuery("update Member set Active='False'");
                    }
                    return(RedirectToAction("Dashboard", "MyanmarITStar"));//Changes_second parioty
                }
                else if (AccessLevel == 2)
                {
                    //Wallet Balance Update
                    Tree t = new Tree();
                    t.updateWalletBalance(UserID);
                    return(RedirectToAction("Dashboard", "Member"));//Most Important
                }
                else if (AccessLevel == 3)
                {
                    return(RedirectToAction("Dashboard", "Staff"));//Most Important
                }
                else
                {
                    return(RedirectToAction("Index", "Customer"));
                }
            }
            else
            {
                Session["RegisterSession"] = "wrong";
                return(RedirectToAction("LoginForm", "Account"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult CheckUsernameAndPassword()
        {
            string Username = Request.Form["Username"];
            string Password = Request.Form["Password"];

            Username = Username.Replace(" ", string.Empty);
            Username = Username.Replace("\'", string.Empty);
            Password = Password.Replace(" ", string.Empty);
            Password = Password.Replace("\'", string.Empty);

            System.Diagnostics.Debug.WriteLine(Password);

            LoginAuthorization l = new LoginAuthorization();

            if (l.checkUser(Username, Password))
            {
                int UserID      = l.getUserID();
                int AccessLevel = l.getAccessLevel();
                //System.Diagnostics.Debug.WriteLine(UserID);
                //System.Diagnostics.Debug.WriteLine(AccessLevel);

                Session["CurrentUserID"] = UserID;
                Session["LoginSession"]  = null;

                //Access Level 1 is CR Manager
                //Access Level 2 is Hte Shop
                //Access Level 3 is MyanmarItStar

                if (AccessLevel == 1)
                {
                    return(RedirectToAction("AddNewCustomerForm", "Staff"));//Changes_second parioty
                }
                else if (AccessLevel == 2)
                {
                    return(RedirectToAction("CheckHoleSaleForDifferent", "Shop"));//Most Important
                }
                else if (AccessLevel == 3)
                {
                    return(RedirectToAction("AllShop", "MyanmarITStar"));//Most Important
                }
                else
                {
                    return(RedirectToAction("Index", "Customer"));
                }
            }
            else
            {
                Session["LoginSession"] = "error";
                return(RedirectToAction("LoginForm", "Login"));
            }
        }
Ejemplo n.º 3
0
        public ActionResult checkUsernameAndPassword()
        {
            string             username = Request.Form["username"];
            string             password = Request.Form["password"];
            LoginAuthorization l        = new LoginAuthorization();

            if (l.checkUser(username, password))
            {
                int EmpID = l.getEmpID();
                Session["EmpID"] = EmpID;
                //Actually, it is needed to redirect to pending/approved leave request
                Response.Redirect("/LeaveApply/ApplicationForm");
            }
            return(View());
        }