// 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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 4
0
        // GET: Match
        public ActionResult Index(int?matchStatus, string searchString, int pageIndex = 1, int pageSize = 10)
        {
            int totalRecord = 0;
            var model       = new MatchDao().ListAll(matchStatus, searchString, ref totalRecord, pageIndex, pageSize);

            ViewBag.SearchString = searchString;

            StatusCategory selectedMatchStatus = new StatusCategory()
            {
                Stt = 0, Name = "---Select one---"
            };

            if (matchStatus != null)
            {
                selectedMatchStatus = new StatusCategoryDao().GetByStt("Match", (int)matchStatus);
            }
            ViewBag.SelectedMatchStatus = selectedMatchStatus;

            ViewBag.Total = totalRecord;
            ViewBag.Page  = pageIndex;

            int maxPage   = 5;
            int totalPage = 0;

            if (totalRecord % pageSize != 0)
            {
                totalPage = (int)(totalRecord / pageSize) + 1;
            }
            else
            {
                totalPage = (int)(totalRecord / pageSize);
            }

            ViewBag.TotalPage = totalPage;
            ViewBag.MaxPage   = maxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = totalPage;
            ViewBag.Next      = pageIndex + 1;
            ViewBag.Prev      = pageIndex - 1;

            return(View(model));
        }
        //Set options value for select list
        public JsonResult SetOption(string forTable, int type)
        {
            var dao  = new StatusCategoryDao();
            var list = dao.ListStatus(forTable, type);

            if (list != null)
            {
                return(Json(new
                {
                    data = list,
                    status = true
                }));
            }
            else
            {
                return(Json(new
                {
                    status = false
                }));
            }
        }
        // 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());
        }
Ejemplo n.º 7
0
        ////Other methods
        //Set ViewBag for Status options
        public void SetStatusViewBag(long?selectedId = null)
        {
            var dao = new StatusCategoryDao();

            ViewBag.Status = new SelectList(dao.ListStatus(1), "ID", "Name");
        }
Ejemplo n.º 8
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());
        }