// GET: GetAccountAdmin
        public ActionResult GetAccountAdmin()
        {
            List <Account>       listAccount       = new AccountDao().getAll();
            List <StatusAccount> listStatusAccount = new StatusAccountDao().getAll();
            List <RoleAccount>   listRoleAccount   = new RoleAccountDao().getAll();

            List <Product>           listProduct           = new ProductDao().getAll();
            List <Category>          listCategory          = new CategoryDao().getAll();
            List <SubCategory>       listSubCategory       = new SubCategoryDao().getAll();
            List <StatusProduct>     listStatusProduct     = new StatusProductDao().getAll();
            List <StatusCategory>    listStatusCategory    = new StatusCategoryDao().getAll();
            List <StatusSubCategory> listStatusSubCategory = new StatusSubCategoryDao().getAll();

            int     numOfOrder  = new OrderDao().countOrderWatting();
            Account accountEdit = TempData["accountEdit"] as Account;

            ViewData["accountEdit"] = accountEdit;

            ViewData["numOfOrder"]            = numOfOrder;
            ViewData["listAccount"]           = listAccount;
            ViewData["listStatusAccount"]     = listStatusAccount;
            ViewData["listRoleAccount"]       = listRoleAccount;
            ViewData["listProduct"]           = listProduct;
            ViewData["listCategory"]          = listCategory;
            ViewData["listSubCategory"]       = listSubCategory;
            ViewData["listStatusProduct"]     = listStatusProduct;
            ViewData["listStatusCategory"]    = listStatusCategory;
            ViewData["listStatusSubCategory"] = listStatusSubCategory;

            return(View());
        }
        // GET: EditAccountAdmin
        public ActionResult EditAccount()
        {
            string  userName    = Request.QueryString["user"];
            Account accountEdit = new AccountDao().getOne(userName);
            //List<Account> listAccount = new AccountDao().getAll();
            //List<StatusAccount> listStatusAccount = new StatusAccountDao().getAll();

            List <RoleAccount> listRoleAccount = new RoleAccountDao().getAll();

            TempData["accountEdit"] = accountEdit;
            //ViewData["listAccount"] = listAccount;
            //ViewData["listStatusAccount"] = listStatusAccount;
            //ViewData["listRoleAccount"] = listRoleAccount;

            //request.getRequestDispatcher("admin/Account.jsp").forward(request, response);

            return(Redirect("~/GetAccountAdmin/GetAccountAdmin"));
        }
Beispiel #3
0
        // GET: Manager
        public ActionResult ManagerAdmin()
        {
            Account account = (Account)Session["account"];

            if (account != null)
            {
                List <Account> listAccounts = new AccountDao().getAll();
                int            check        = 0;
                foreach (Account A in listAccounts)
                {
                    if (A.userName.Equals(account.userName) &&
                        A.password.Equals(account.password) && account.roleId == 1)
                    {
                        check = 1;
                        List <Product>           listProduct           = new ProductDao().getAll();
                        List <Category>          listCategory          = new CategoryDao().getAll();
                        List <SubCategory>       listSubCategory       = new SubCategoryDao().getAll();
                        List <StatusProduct>     listStatusProduct     = new StatusProductDao().getAll();
                        List <StatusCategory>    listStatusCategory    = new StatusCategoryDao().getAll();
                        List <StatusSubCategory> listStatusSubCategory = new StatusSubCategoryDao().getAll();
                        List <Order>             listOrderWatting      = new OrderDao().getOrderNotSuccesYetByCustomer(account.userName, 4);

                        List <StatusAccount> listStatusAccount = new StatusAccountDao().getAll();
                        List <RoleAccount>   listRoleAccount   = new RoleAccountDao().getAll();
                        int numOfOrder = new OrderDao().countOrderWatting();
                        int count      = new ViewDao().getView();
                        int count2     = new ProductDao().countProduct();
                        int count3     = new AccountDao().countAccount();
                        int count4     = new SubCategoryDao().countSubCategory();

                        string thu  = "";
                        string data = "";
                        List <ThongkeOrder> listThongKe = new ThongKeOrderDao().getAll();
                        foreach (ThongkeOrder T in listThongKe)
                        {
                            thu  += T.thu + ",";
                            data += T.numOfOrder + ",";
                        }
                        thu = thu.Remove(thu.Length - 1);

                        ViewData["thu"]  = thu;
                        ViewData["data"] = data;

                        ViewData["view"]                  = count;
                        ViewData["numSubCategory"]        = count4;
                        ViewData["numAccount"]            = count3;
                        ViewData["numProduct"]            = count2;
                        ViewData["numOfOrder"]            = numOfOrder;
                        ViewData["listOrderWatting"]      = listOrderWatting;
                        ViewData["listProduct"]           = listProduct;
                        ViewData["listCategory"]          = listCategory;
                        ViewData["listSubCategory"]       = listSubCategory;
                        ViewData["listStatusProduct"]     = listStatusProduct;
                        ViewData["listStatusCategory"]    = listStatusCategory;
                        ViewData["listStatusSubCategory"] = listStatusSubCategory;
                        ViewData["listStatusAccount"]     = listStatusAccount;
                        ViewData["listRoleAccount"]       = listRoleAccount;
                    }
                }
                if (check == 0)
                {
                    //response.sendRedirect("client/error.jsp");
                }
            }
            else
            {
                //response.sendRedirect("login");
                Response.Redirect("~/Login/Login");
            }
            return(View());
        }