public ActionResult AddSubCategoryAdmin()
        {
            string name     = Request.Form["username"];
            int    category = NumberHelper.getInt(Request.Form["category"]);
            int    status   = NumberHelper.getInt(Request.Form["status"]);

            SubCategory subCategory = new SubCategory(category, name, status);

            bool check = new SubCategoryDao().insert(subCategory);

            if (check)
            {
                //response.sendRedirect("get-sub-category");
                Response.Redirect("https://localhost:44394/GetSubCategoryAdmin/GetSubCategoryAdmin");
            }
            else
            {
                ViewData["error"]   = "Add Sub Category Failed!";
                ViewData["message"] = "Please go to dashboard and try again!";

                //todo
                //Response.Redirect("https://localhost:44394/admin/ErrorAdmin.jsp");
            }
            return(View());
        }
        // 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());
        }
Пример #3
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());
        }
Пример #5
0
        // GET: Filter
        public ActionResult FilterByCategory()
        {
            SubCategoryDao subCategoryDao = new SubCategoryDao();

            int        pageindex = NumberHelper.getInt(Request.QueryString["page"]);
            List <int> listCount = new List <int>();
            int        pageCount;

            if (pageindex == -1)
            {
                pageindex = 1;
            }
            int id  = NumberHelper.getInt(Request.QueryString["id"]);
            int cid = NumberHelper.getInt(Request.QueryString["cid"]);

            if (id == -1 && cid == -1)
            {
                Response.Redirect("Error");
            }
            else
            {
                List <Product>  listProduct;
                List <Category> listCategory;
                if (cid == -1)
                {
                    if (id == 0)
                    {
                        listProduct = new ProductDao().getAllPaging(pageindex, 20);
                        pageCount   = new ProductDao().countPage();
                    }
                    else
                    {
                        listProduct = new ProductDao().getAllByCategoryIdPaging(id, pageindex, 20);
                        pageCount   = new ProductDao().countPageByCategory(id);
                    }
                }
                else
                {
                    if (cid == 0)
                    {
                        listProduct = new ProductDao().getAllPaging(pageindex, 20);
                        pageCount   = new ProductDao().countPage();
                    }
                    else
                    {
                        listProduct = new ProductDao().getAllBySubCategoryIdPaging(cid, pageindex, 20);
                        pageCount   = new ProductDao().countPageBySubCategory(id);
                    }
                }
                pageCount = (pageCount % 20 == 0) ? pageCount / 20 : pageCount / 20 + 1;
                for (int i = 1; i <= pageCount; i++)
                {
                    listCount.Add(i);
                }
                listCategory = new CategoryDao().getAll();

                ViewData["id"]           = id;
                ViewData["cid"]          = id;
                ViewData["page"]         = pageindex;
                ViewData["listCount"]    = listCount;
                ViewData["listProduct"]  = listProduct;
                ViewData["listCategory"] = listCategory;
            }
            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());
        }
Пример #7
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());
        }