// 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());
        }
示例#2
0
        // GET: GetSubCategoryAdmin
        public ActionResult GetSubCategoryAdmin()
        {
            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();

            ViewData["numOfOrder"]            = numOfOrder;
            ViewData["listSubCategory"]       = listSubCategory;
            ViewData["listStatusProduct"]     = listStatusProduct;
            ViewData["listStatusCategory"]    = listStatusCategory;
            ViewData["listStatusSubCategory"] = listStatusSubCategory;
            return(View());
        }
        // GET: ProcessOrderAdmin
        public ActionResult ProcessOrderAdmin()
        {
            Account                  account               = (Account)Session["account"];
            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 <StatusAccount>     listStatusAccount     = new StatusAccountDao().getAll();
            int          check            = NumberHelper.getInt(Request.QueryString["check"]);
            List <Order> listOrderWatting = null;

            if (check == 0)
            {
                listOrderWatting = new OrderDao().getAllSucces();
            }
            else
            {
                if (check == 1)
                {
                    listOrderWatting = new OrderDao().getAllOrderShipping();
                }
                else
                {
                    listOrderWatting = new OrderDao().getAllOrderNotAcceptYet();
                }
            }

            int numOfOrder = new OrderDao().countOrderWatting();

            ViewData["check"]                 = check;
            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"]     = listStatusSubCategory;

            return(View());
        }
        // GET: GetChartAdmin
        public ActionResult GetChartAdmin()
        {
            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.getUserName(), 4);
            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     label          = "";
            string     soluong        = "";
            List <int> soluongProduct = new ProductDao().countProductGroupByCategoryId();

            foreach (Category C in listCategory)
            {
                label += "" + C.category + ",";
            }
            label.Remove(label.Length - 1);
            label.Substring(0, label.Length - 1);
            foreach (int integer in soluongProduct)
            {
                soluong += (double)Math.Round((((double)integer / count2) * 100) * 100) / 100 + ",";
            }
            soluong.Substring(0, soluong.Length - 1);
            List <double> listRevenue = new List <double>();

            double a = new OrderDao().calRevenueInMonth(4);

            listRevenue.Add(a);

            string revenue = "";

            foreach (Double double1 in listRevenue)
            {
                revenue += (double)Math.Round(double1 * 100) / 100 + ",";
            }
            revenue.Substring(0, revenue.Length - 1);


            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["label"]   = label;
            ViewData["soluong"] = soluong;
            ViewData["revenue"] = revenue;

            ViewData["view"]           = count;
            ViewData["numSubCategory"] = count4;
            ViewData["numAccount"]     = count3;
            ViewData["numProduct"]     = count2;

            ViewData["numOfOrder"]            = numOfOrder;
            ViewData["listProduct"]           = listProduct;
            ViewData["listCategory"]          = listCategory;
            ViewData["listSubCategory"]       = listSubCategory;
            ViewData["listSubCategory"]       = listSubCategory;
            ViewData["listStatusCategory"]    = listStatusCategory;
            ViewData["listStatusSubCategory"] = listStatusSubCategory;

            return(View());
        }
示例#5
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());
        }