Exemple #1
0
 public ActionResult AccountManager()
 {
     if (Session["role"] != null && (string)Session["role"] == "Manager")
     {
         var tmp = AccountAction.Get_Account();
         ViewBag.Account = tmp;
         ViewBag.Member  = MemberAction.Get_Account_Member();
         List <string> lst_account = new List <string>();
         for (int i = 0; i < tmp.Count; i++)
         {
             if (MemberAction.Find_By_Id_User(tmp[i].username) == null)
             {
                 lst_account.Add(tmp[i].username);
             }
         }
         ViewBag.Username = lst_account;
         using (var db = new DBConnection())
         {
             int cnt = db.DbMemberShip.Count();
             ViewBag.Page = cnt / 10 + (cnt % 10 == 0 ? 0 : 1);
             db.Dispose();
         }
         return(View());
     }
     else
     {
         return(Redirect("~/Home/Index"));
     }
 }
Exemple #2
0
        public ActionResult Login(string Username, string Password)
        {
            var result = AccountAction.Check_Login(Username, Password);

            if (result != null)
            {
                Session["id"] = result.username;
                var name = MemberAction.Find_By_Id_User(result.username);
                if (name != null)
                {
                    Session["name"] = name.fullname;
                }

                Session["role"] = result.role;
                if (result.role == "Manager")
                {
                    return(Redirect("~/Manager/ProductManager"));
                }
                else
                {
                    return(Redirect("~/Home/ShowProduct"));
                }
            }
            else
            {
                return(Redirect("~/Home/Index"));
            }
        }
 public JsonResult Get_Member(string Id)
 {
     return(Json(MemberAction.Find_By_Id_User(Id), JsonRequestBehavior.AllowGet));
 }
Exemple #4
0
 public JsonResult Validation_Member(string Username)
 {
     return(Json(MemberAction.Find_By_Id_User(Username), JsonRequestBehavior.AllowGet));
 }