Exemple #1
0
        public ActionResult Bug()
        {
            string     user_id    = HttpContext.User.Identity.Name;
            BugManager bugManager = new BugManager(int.Parse(user_id));
            BPageData  data       = new BPageData();
            int        page       = 0;
            int        pageSize   = 0;
            int        u_id       = 0;
            int        feature_id = 0;
            int        total      = 0;
            int        status_id  = 0;

            int.TryParse(Request["page"], out page);
            int.TryParse(Request["pageSize"], out pageSize);
            int.TryParse(Request["status"], out status_id);
            int.TryParse(Request["feature"], out feature_id);
            int.TryParse(Request["user"], out u_id);

            if (pageSize <= 0)
            {
                pageSize = 20;
            }

            if (page <= 0)
            {
                page = 1;
            }
            data.Data               = bugManager.SearchBugs(u_id, feature_id, status_id, page, pageSize, out total);
            data.Page               = page;
            data.TotalRecords       = total;
            data.PageSize           = pageSize;
            data.URL                = Request.RawUrl;
            ViewData["CurrentUser"] = bugManager.CurrentUser;
            return(View(data));
        }
Exemple #2
0
        public ActionResult Product()
        {
            string      user_id     = HttpContext.User.Identity.Name;
            UserManager userMgr     = new UserManager(int.Parse(user_id), null);
            BUser       user        = userMgr.CurrentUser;
            ShopManager shopManager = new ShopManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission, userMgr);
            int         total       = 0;
            int         page        = 1;
            int         pageSize    = 30;
            bool?       connected   = null;

            int.TryParse(Request["page"], out page);
            int.TryParse(Request["pageSize"], out pageSize);
            string keyword = Request["txt_product_name"];
            int    shop    = 0;

            int.TryParse(Request["txt_product_shop"], out shop);
            if (page <= 0)
            {
                page = 1;
            }

            if (pageSize <= 0)
            {
                pageSize = 30;
            }

            if (Request["connected"] != null)
            {
                if (Request["connected"] == "1")
                {
                    connected = true;
                }
                else if (Request["connected"] == "0")
                {
                    connected = false;
                }
            }
            BMallSync           lastSync = shopManager.GetMallSync(0, 0);
            List <BMallProduct> products = shopManager.SearchOnSaleMallProducts(keyword, page, pageSize, out total, connected, shop);
            BPageData           data     = new BPageData();

            data.Data            = products;
            data.TotalRecords    = total;
            data.Page            = page;
            data.PageSize        = pageSize;
            data.URL             = Request.RawUrl;
            ViewData["LastSync"] = lastSync;

            ViewData["ChildShop"]   = shopManager.ChildShops;
            ViewData["CurrentShop"] = shopManager.Shop;
            return(View(data));
        }
Exemple #3
0
        public ActionResult Log()
        {
            string user_id = HttpContext.User.Identity.Name;
            UserActionLogManager logManager = new UserActionLogManager(new BUser()
            {
                ID = int.Parse(user_id)
            });
            int  page      = 0;
            int  pageSize  = 30;
            int  total     = 0;
            int  userid    = 0;
            int  action_id = 0;
            long stime     = 0;
            long etime     = 0;

            int.TryParse(Request["page"], out page);
            int.TryParse(Request["pageSize"], out pageSize);
            int.TryParse(Request["log_user"], out userid);
            int.TryParse(Request["log_action"], out action_id);

            if (!string.IsNullOrEmpty(Request["log_startdate"]))
            {
                DateTime tmp = DateTime.MinValue;
                DateTime.TryParse(Request["log_startdate"], out tmp);
                if (tmp != DateTime.MinValue)
                {
                    stime = DateTimeUtil.ConvertDateTimeToInt(tmp);
                }
            }

            if (!string.IsNullOrEmpty(Request["log_enddate"]))
            {
                DateTime tmp = DateTime.MinValue;
                DateTime.TryParse(Request["log_enddate"], out tmp);
                if (tmp != DateTime.MinValue)
                {
                    etime = DateTimeUtil.ConvertDateTimeToInt(tmp);
                }
            }

            if (page <= 0)
            {
                page = 1;
            }
            if (pageSize <= 0)
            {
                pageSize = 30;
            }
            List <BUserActionLog> logs = logManager.SearchUserActionLog(userid, action_id, stime, etime, page, pageSize, out total);
            BPageData             data = new BPageData();

            data.Data         = logs;
            data.TotalRecords = total;
            data.Page         = page;
            data.PageSize     = pageSize;
            data.URL          = Request.RawUrl;

            List <BUserAction> actions = logManager.GetActions();

            ViewData["action_list"] = actions;

            UserManager  userMgr   = new UserManager(int.Parse(user_id), null);
            int          totalUser = 0;
            List <BUser> users     = userMgr.GetUsers(1, 1, out totalUser, 0, false);

            ViewData["user_list"] = users;
            return(View(data));
        }
Exemple #4
0
        //
        // GET: /Sale/

        public ActionResult Search()
        {
            string sCreated     = Request["trade_sdate"];
            string sHours       = Request["trade_sdate_hour"];
            string sMinutes     = Request["trade_sdate_minute"];
            string eCreated     = Request["trade_edate"];
            string eHours       = Request["trade_edate_hour"];
            string eMinutes     = Request["trade_edate_minute"];
            string productName  = Request["pdt_name"];
            string buyer_nick   = Request["buyer_nick"];
            string trade_num    = Request["trade_num"];
            string trade_status = Request["trade_status"];
            int    shop         = 0;
            int    page         = 1;
            int    pageSize     = 30;

            int.TryParse(Request["page"], out page);
            int.TryParse(Request["pagesize"], out pageSize);
            int.TryParse(Request["trade_shop"], out shop);
            if (page <= 0)
            {
                page = 1;
            }

            if (pageSize <= 0)
            {
                pageSize = 30;
            }
            DateTime sDate = DateTime.MinValue;
            DateTime eDate = DateTime.MinValue;

            if (!string.IsNullOrEmpty(sCreated) && !string.IsNullOrEmpty(sHours) && !string.IsNullOrEmpty(sMinutes))
            {
                sDate = Convert.ToDateTime(sCreated);
                int h = 0;
                int m = 0;
                int.TryParse(sHours, out h);
                int.TryParse(sMinutes, out m);
                sDate = new DateTime(sDate.Year, sDate.Month, sDate.Day, h, m, 0);
            }

            if (!string.IsNullOrEmpty(eCreated) && !string.IsNullOrEmpty(eHours) && !string.IsNullOrEmpty(eMinutes))
            {
                eDate = Convert.ToDateTime(eCreated);
                int h = 0;
                int m = 0;
                int.TryParse(eHours, out h);
                int.TryParse(eMinutes, out m);
                eDate = new DateTime(eDate.Year, eDate.Month, eDate.Day, h, m, 0);
            }
            string       user_id      = HttpContext.User.Identity.Name;
            UserManager  userMgr      = new UserManager(int.Parse(user_id), null);
            BUser        user         = userMgr.CurrentUser;
            StockManager stockManager = new StockManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            SalesManager saleManager  = new SalesManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            ShopManager  shopManager  = new ShopManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission, userMgr);
            int          total        = 0;
            long         sTime        = 0;
            long         eTime        = 0;

            if (sDate != DateTime.MinValue)
            {
                sTime = DateTimeUtil.ConvertDateTimeToInt(sDate);
            }
            if (eDate != DateTime.MinValue)
            {
                eTime = DateTimeUtil.ConvertDateTimeToInt(eDate);
            }

            string[] nums = null;
            if (!string.IsNullOrEmpty(trade_num))
            {
                nums = trade_num.Split(',');
            }
            string[] status = null;
            if (!string.IsNullOrEmpty(trade_status))
            {
                status = trade_status.Split(',');
            }

            List <BSale> sales = saleManager.SearchSales(null, productName, nums, status, null, buyer_nick, sTime, eTime, page, pageSize, out total, shop);
            BPageData    data  = new BPageData();

            data.Data         = sales;
            data.TotalRecords = total;
            data.Page         = page;
            data.PageSize     = pageSize;
            data.URL          = Request.RawUrl;
            List <BShop> childShops = shopManager.SearchChildShops();

            ViewData["ChildShop"]   = childShops;
            ViewData["CurrentShop"] = userMgr.Shop;
            ViewData["MainShop"]    = userMgr.Main_Shop;
            return(View(data));
        }