Beispiel #1
0
        public PQGridData SearchExpressFee()
        {
            PQGridData      data        = new PQGridData();
            HttpContextBase context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request     = context.Request;
            string          user_id     = 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             express_id  = 0;
            int             page        = 0;
            int             pageSize    = 0;
            long            total       = 0;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            int.TryParse(request["express_id"], out express_id);
            if (page <= 0)
            {
                page = 1;
            }
            if (pageSize <= 0)
            {
                pageSize = 30;
            }
            data.data         = shopManager.SearchExpressFee(express_id, 0, 0, page, pageSize, out total);
            data.totalRecords = total;
            data.curPage      = page;
            return(data);
        }
Beispiel #2
0
        public PQGridData GetBuys()
        {
            PQGridData      data       = new PQGridData();
            HttpContextBase context    = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request    = context.Request;
            string          user_id    = User.Identity.Name;
            UserManager     userMgr    = new UserManager(int.Parse(user_id), null);
            BUser           user       = userMgr.CurrentUser;
            BuyManager      buyManager = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             total      = 0;
            int             page       = 1;
            int             pageSize   = 30;

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

            if (pageSize <= 0)
            {
                pageSize = 30;
            }
            data.data         = buyManager.SearchBuys(null, null, null, null, null, 0, 0, page, pageSize, out total);
            data.totalRecords = total;
            return(data);
        }
Beispiel #3
0
        public PQGridData SearchEnterStock()
        {
            PQGridData      data         = new PQGridData();
            HttpContextBase context      = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request      = context.Request;
            string          user_id      = 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);
            BuyManager      buyManager   = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             page         = 1;
            int             pageSize     = 30;
            int             category     = 0;
            int             storeHouse   = 0;


            int.TryParse(request["cid"], out category);
            int.TryParse(request["house"], out storeHouse);
            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            string keyword = request["keyword"];
            int    total   = 0;

            data.data         = stockManager.SearchEnterStocks(0, 0, 0, 0, 0, 0, storeHouse, page, pageSize, out total);
            data.curPage      = page;
            data.totalRecords = total;
            return(data);
        }
Beispiel #4
0
        public PQGridData GetPropertiesT()
        {
            string              user_id = User.Identity.Name;
            UserManager         userMgr = new UserManager(int.Parse(user_id), null);
            ApiMessage          message = new ApiMessage();
            BUser               user    = userMgr.CurrentUser;
            ShopCategoryManager cateMgr = new ShopCategoryManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             categoryId  = 0;
            HttpContextBase context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request     = context.Request;

            int.TryParse(request["cid"], out categoryId);
            string sortBy = "";
            string dir    = "";

            if (request["sortBy"] != null)
            {
                sortBy = request["sortBy"];
            }
            if (request["dir"] != null)
            {
                sortBy = request["dir"];
            }
            List <BProperty> properties = cateMgr.GetProperties(categoryId, 0, sortBy, dir);
            PQGridData       grid       = new PQGridData();

            grid.curPage      = 1;
            grid.totalRecords = properties.Count;
            grid.data         = properties;
            message.Item      = grid;
            message.Status    = "ok";
            return(grid);
        }
Beispiel #5
0
        public PQGridData GetCategories()
        {
            PQGridData          data     = new PQGridData();
            string              user_id  = User.Identity.Name;
            UserManager         userMgr  = new UserManager(int.Parse(user_id), null);
            BUser               user     = userMgr.CurrentUser;
            Shop                MainShop = userMgr.Main_Shop;
            ShopCategoryManager cateMgr  = new ShopCategoryManager(userMgr.CurrentUser, MainShop, userMgr.CurrentUserPermission);


            HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request = context.Request;
            int             id      = 0;

            if (!string.IsNullOrEmpty(request["parent_id"]))
            {
                id = int.Parse(request["parent_id"].ToString());
            }

            List <BCategory> categories = new List <BCategory>();

            categories        = cateMgr.GetCategories(id);
            data.curPage      = 1;
            data.totalRecords = categories.Count;
            data.data         = categories;
            return(data);
        }
Beispiel #6
0
        public PQGridData SearchTradeSyncLog()
        {
            PQGridData      data        = new PQGridData();
            HttpContextBase context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request     = context.Request;
            string          user_id     = User.Identity.Name;
            UserManager     userMgr     = new UserManager(int.Parse(user_id), null);
            BUser           user        = userMgr.CurrentUser;
            SalesManager    saleManager = new SalesManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             page        = 1;

            int.TryParse(request["page"], out page);
            if (page == 0)
            {
                page = 1;
            }
            int pageSize = 20;

            int.TryParse(request["pageSize"], out pageSize);
            if (pageSize == 0)
            {
                pageSize = 20;
            }
            int total = 0;

            data.data         = saleManager.SearchTradeSyncLog(0, 0, 0, null, page, pageSize, out total);
            data.totalRecords = total;
            data.curPage      = page;
            return(data);
        }
Beispiel #7
0
        public PQGridData SearchBatches()
        {
            PQGridData      data         = new PQGridData();
            HttpContextBase context      = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request      = context.Request;
            string          user_id      = 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);
            int             page         = 1;
            int             pageSize     = 30;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            string keyword = request["product_key"];
            int    total   = 0;

            if (page <= 0)
            {
                page = 1;
            }

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

            data.data     = stockManager.SearchBatches(0, null, keyword, page, pageSize, out total);
            data.curPage  = page;
            data.pageSize = pageSize;
            return(data);
        }
Beispiel #8
0
        public PQGridData SearchBugs()
        {
            PQGridData      data       = new PQGridData();
            HttpContextBase context    = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request    = context.Request;
            string          user_id    = User.Identity.Name;
            BugManager      bugManager = new BugManager(int.Parse(user_id));

            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.curPage      = page;
            data.totalRecords = total;
            return(data);
        }
Beispiel #9
0
        public PQGridData SearchExpresses()
        {
            PQGridData      data        = new PQGridData();
            HttpContextBase context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request     = context.Request;
            string          user_id     = 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);

            data.data = shopManager.SearchExpresses();
            return(data);
        }
Beispiel #10
0
        public PQGridData GetPropertyValues()
        {
            string              user_id = User.Identity.Name;
            UserManager         userMgr = new UserManager(int.Parse(user_id), null);
            PQGridData          data    = new PQGridData();
            BUser               user    = userMgr.CurrentUser;
            ShopCategoryManager cateMgr = new ShopCategoryManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             property_id = 0;
            HttpContextBase context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request     = context.Request;

            int.TryParse(request["pid"], out property_id);
            data.data = cateMgr.GetPropertyValues(property_id);
            return(data);
        }
Beispiel #11
0
        public PQGridData SearchReceivedChildRequets()
        {
            PQGridData              data        = new PQGridData();
            HttpContextBase         context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase         request     = context.Request;
            string                  user_id     = 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);
            List <BAddChildRequest> requests    = shopManager.SearchReceivedAddChildRequests();

            data.data         = requests;
            data.totalRecords = requests.Count;
            data.curPage      = 1;
            return(data);
        }
Beispiel #12
0
        public PQGridData GetStockAnalysis()
        {
            PQGridData            data         = new PQGridData();
            HttpContextBase       context      = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase       request      = context.Request;
            string                user_id      = 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);
            List <BStockAnalysis> analysis     = stockManager.StockAnalysis(0, true, true);

            data.data         = analysis;
            data.curPage      = 1;
            data.totalRecords = analysis.Count;
            return(data);
        }
Beispiel #13
0
        public PQGridData SearchOnSaleProducts()
        {
            PQGridData      data        = new PQGridData();
            HttpContextBase context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request     = context.Request;
            string          user_id     = 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["keyword"];

            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;
                }
            }

            List <BMallProduct> products = shopManager.SearchOnSaleMallProducts(keyword, page, pageSize, out total, connected);

            data.data         = products;
            data.curPage      = page;
            data.totalRecords = total;
            return(data);
        }
Beispiel #14
0
        public PQGridData GetBuyOrders()
        {
            PQGridData      data       = new PQGridData();
            HttpContextBase context    = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request    = context.Request;
            string          user_id    = User.Identity.Name;
            UserManager     userMgr    = new UserManager(int.Parse(user_id), null);
            BUser           user       = userMgr.CurrentUser;
            BuyManager      buyManager = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             total      = 0;
            int             page       = 1;
            int             pageSize   = 30;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            int order_id    = 0;
            int supplier_id = 0;

            int.TryParse(request["order_id"], out order_id);
            int.TryParse(request["supplier_id"], out supplier_id);
            string keyword = request["keyword"];

            int[] orders = null;
            if (order_id > 0)
            {
                orders = new int[] { order_id };
            }
            int[] suppliers = null;
            if (supplier_id > 0)
            {
                suppliers = new int[] { supplier_id };
            }
            if (page <= 0)
            {
                page = 1;
            }

            if (pageSize <= 0)
            {
                pageSize = 30;
            }
            data.data         = buyManager.SearchBuyOrders(orders, null, suppliers, null, keyword, 0, 0, page, pageSize, out total);
            data.totalRecords = total;
            return(data);
        }
Beispiel #15
0
        public PQGridData GetUsers()
        {
            PQGridData      data    = new PQGridData();
            HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request = context.Request;
            string          user_id = User.Identity.Name;
            UserManager     userMgr = new UserManager(int.Parse(user_id), null);

            int page     = 1;
            int pageSize = 30;
            int total    = 0;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            data.data         = userMgr.GetUsers(page, pageSize, out total);
            data.totalRecords = total;
            return(data);
        }
Beispiel #16
0
        public PQGridData GetSuppliers()
        {
            PQGridData      data            = new PQGridData();
            HttpContextBase context         = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request         = context.Request;
            string          user_id         = User.Identity.Name;
            UserManager     userMgr         = new UserManager(int.Parse(user_id), null);
            BUser           user            = userMgr.CurrentUser;
            SupplierManager supplierManager = new SupplierManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             page            = 1;
            int             pageSize        = 30;
            int             total           = 0;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);

            data.data = supplierManager.SearchSupplies(0, page, pageSize, out total);
            return(data);
        }
Beispiel #17
0
        public PQGridData GetBuyPrices()
        {
            PQGridData      data       = new PQGridData();
            HttpContextBase context    = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request    = context.Request;
            string          user_id    = User.Identity.Name;
            UserManager     userMgr    = new UserManager(int.Parse(user_id), null);
            BUser           user       = userMgr.CurrentUser;
            BuyManager      buyManager = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            string          keyword    = request["keyword"];
            int             total      = 0;
            int             page       = 1;
            int             pageSize   = 30;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            int price_user_id = 0;
            int supplier_id   = 0;

            int.TryParse(request["user_id"], out price_user_id);
            int.TryParse(request["supplier_id"], out supplier_id);
            int buyPriceId = 0;

            int.TryParse(request["price_id"], out buyPriceId);
            string keyWord = request["keyword"];

            if (page <= 0)
            {
                page = 1;
            }

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

            data.data         = buyManager.SearchBuyPrices(buyPriceId, price_user_id, supplier_id, 0, keyword, page, pageSize, out total);
            data.totalRecords = total;
            data.curPage      = page;
            data.pageSize     = pageSize;
            return(data);
        }
Beispiel #18
0
        public PQGridData SearchSales()
        {
            PQGridData      data         = new PQGridData();
            HttpContextBase context      = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request      = context.Request;
            string          user_id      = 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);
            int             page         = 1;
            int             pageSize     = 30;
            long            stime        = 0;
            long            etime        = 0;

            if (!string.IsNullOrEmpty(request["sdate"]))
            {
                DateTime sdate = DateTime.MinValue;
                DateTime.TryParse(request["sdate"], out sdate);
                if (sdate != DateTime.MinValue)
                {
                    stime = DateTimeUtil.ConvertDateTimeToInt(sdate);
                }
            }
            if (!string.IsNullOrEmpty(request["edate"]))
            {
                DateTime edate = DateTime.MinValue;
                DateTime.TryParse(request["edate"], out edate);
                if (edate != DateTime.MinValue)
                {
                    etime = DateTimeUtil.ConvertDateTimeToInt(edate);
                }
            }

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            int total = 0;

            data.data         = saleManager.SearchSales(null, null, null, null, null, null, stime, etime, page, pageSize, out total);
            data.totalRecords = total;
            return(data);
        }
Beispiel #19
0
        public PQGridData SearchProductWastage()
        {
            PQGridData      data         = new PQGridData();
            HttpContextBase context      = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request      = context.Request;
            string          user_id      = 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);
            BuyManager      buyManager   = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             page         = 1;
            int             pageSize     = 30;
            int?            category_id  = null;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            string keyword = request["keyword"];

            int[]  sids      = null;
            string suppliers = request["suppliers"];

            sids = base.ConvertToIntArrar(suppliers);
            if (request["cid"] != null && request["cid"].ToString() != "" && request["cid"].ToString() != "0")
            {
                int cid = 0;
                int.TryParse(request["cid"], out cid);
                if (cid > 0)
                {
                    category_id = cid;
                }
            }
            int total = 0;

            data.data         = stockManager.SearchProductWastage(sids, keyword, category_id, page, pageSize, out total);
            data.curPage      = page;
            data.totalRecords = total;
            return(data);
        }
Beispiel #20
0
        public PQGridData SearchProducts()
        {
            PQGridData      data        = new PQGridData();
            int             page        = 0;
            int             pageSize    = 30;
            int             total       = 0;
            int?            category_id = null;
            string          keyword     = "";
            HttpContextBase context     = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request     = context.Request;
            string          user_id     = User.Identity.Name;
            UserManager     userMgr     = new UserManager(int.Parse(user_id), null);
            BUser           user        = userMgr.CurrentUser;
            ProductManager  pdtManager  = new ProductManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);

            if (page <= 0)
            {
                page = 1;
            }

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

            if (request["cid"] != null && request["cid"].ToString() != "" && request["cid"].ToString() != "0")
            {
                int cid = 0;
                int.TryParse(request["cid"], out cid);
                if (cid > 0)
                {
                    category_id = cid;
                }
            }
            keyword = request["keyword"];
            int[]  sids      = null;
            string suppliers = request["suppliers"];

            if (!string.IsNullOrEmpty(suppliers))
            {
                string[] ss = suppliers.Split(',');
                sids = new int[ss.Length];
                for (int i = 0; i < ss.Length; i++)
                {
                    sids[i] = int.Parse(ss[i]);
                }
            }
            bool includeProps = false;

            if (!string.IsNullOrEmpty(request["include_prop"]) && request["include_prop"] == "1")
            {
                includeProps = true;
            }
            else
            {
                includeProps = false;
            }

            int[] product_ids = null;
            if (!string.IsNullOrEmpty(request["product_ids"]))
            {
                product_ids = base.ConvertToIntArrar(request["product_ids"]);
            }

            bool paging = true;

            if (!string.IsNullOrEmpty(request["paging"]) && request["paging"] == "0")
            {
                paging = false;
            }

            bool includeSupplier = false;

            if (!string.IsNullOrEmpty(request["include_supplier"]) && request["include_supplier"] == "1")
            {
                includeSupplier = true;
            }
            else
            {
                includeSupplier = false;
            }
            data.data         = pdtManager.SearchProducts(product_ids, sids, keyword, "", 0, 0, category_id, page, pageSize, out total, includeProps, paging, includeSupplier);
            data.totalRecords = total;
            data.curPage      = page;
            data.pageSize     = pageSize;
            return(data);
        }
Beispiel #21
0
        public PQGridData GetStockReport()
        {
            PQGridData      data          = new PQGridData();
            HttpContextBase context       = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request       = context.Request;
            string          user_id       = User.Identity.Name;
            UserManager     userMgr       = new UserManager(int.Parse(user_id), null);
            BUser           user          = userMgr.CurrentUser;
            ReportFactory   reportManager = new ReportFactory(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);

            int page          = 1;
            int pageSize      = 50;
            int totalProducts = 0;

            int[] product_id = null;
            bool  paging     = false;

            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);

            if (!string.IsNullOrEmpty(request["products"]))
            {
                product_id = base.ConvertToIntArrar(request["products"]);
            }

            if (page <= 0)
            {
                page = 1;
            }

            if (pageSize <= 0)
            {
                pageSize = 50;
            }
            if (!string.IsNullOrEmpty(request["paging"]) && request["paging"] == "1")
            {
                paging = true;
            }
            else
            {
                paging = false;
            }
            try
            {
                string json = reportManager.GetStockReport(product_id, page, pageSize, out totalProducts, paging);
                data.totalRecords = totalProducts;
                if (!string.IsNullOrEmpty(json))
                {
                    data.data = JArray.Parse(json);
                }
                data.curPage = page;
            }
            catch (Exception ex)
            {
                data.data         = JArray.Parse("[]");
                data.totalRecords = 0;
                data.curPage      = 1;
            }
            finally
            {
            }
            return(data);
        }
Beispiel #22
0
        public PQGridData SearchStocks()
        {
            PQGridData      data         = new PQGridData();
            HttpContextBase context      = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request      = context.Request;
            string          user_id      = 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);
            BuyManager      buyManager   = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             page         = 1;
            int             pageSize     = 30;
            int             storeHouse   = 0;
            bool            paging       = false;
            string          product_ids  = request["products"];

            int.TryParse(request["house"], out storeHouse);
            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            string     keyword     = request["keyword"];
            int        total       = 0;
            List <int> storeHouses = new List <int>();

            if (storeHouse > 0)
            {
                storeHouses.Add(storeHouse);
            }

            List <int> products = new List <int>();

            if (!string.IsNullOrEmpty(product_ids))
            {
                string[] ids = product_ids.Split(',');
                foreach (string id in ids)
                {
                    products.Add(int.Parse(id));
                }
            }

            if (!string.IsNullOrEmpty(request["paging"]) && request["paging"] == "1")
            {
                paging = true;
            }
            else
            {
                paging = false;
            }
            if (page <= 0)
            {
                page = 1;
            }

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

            data.data         = stockManager.SearchStocks(products, storeHouses, page, pageSize, out total, paging);
            data.curPage      = page;
            data.totalRecords = total;
            return(data);
        }
Beispiel #23
0
        public PQGridData SearchBackStock()
        {
            PQGridData      data         = new PQGridData();
            HttpContextBase context      = (HttpContextBase)Request.Properties["MS_HttpContext"];
            HttpRequestBase request      = context.Request;
            string          user_id      = 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);
            BuyManager      buyManager   = new BuyManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission);
            int             page         = 1;
            int             pageSize     = 30;
            int             sale_id      = 0;
            int             back_id      = 0;
            int             uid          = 0;
            long            stime        = 0;
            long            etime        = 0;
            int             storeHouseId = 0;

            if (!string.IsNullOrEmpty(request["sdate"]))
            {
                DateTime sdate = DateTime.MinValue;
                DateTime.TryParse(request["sdate"], out sdate);
                if (sdate != DateTime.MinValue)
                {
                    stime = DateTimeUtil.ConvertDateTimeToInt(sdate);
                }
            }
            if (!string.IsNullOrEmpty(request["edate"]))
            {
                DateTime edate = DateTime.MinValue;
                DateTime.TryParse(request["edate"], out edate);
                if (edate != DateTime.MinValue)
                {
                    etime = DateTimeUtil.ConvertDateTimeToInt(edate);
                }
            }
            int.TryParse(request["page"], out page);
            int.TryParse(request["pageSize"], out pageSize);
            int.TryParse(request["sale_id"], out sale_id);
            int.TryParse(request["back_id"], out back_id);
            int.TryParse(request["user_id"], out uid);
            int total = 0;

            int[] backids = null;
            if (back_id > 0)
            {
                backids = new int[] { back_id };
            }
            int[] userids = null;
            if (uid > 0)
            {
                userids = new int[] { uid };
            }
            string[] saleids = null;
            if (sale_id > 0)
            {
                saleids = new string[] { sale_id.ToString() };
            }
            data.data         = stockManager.SearchBackStockDetails(backids, saleids, userids, storeHouseId, stime, etime, page, pageSize, out total);
            data.curPage      = page;
            data.totalRecords = total;
            return(data);
        }