public ActionResult EnterDetail(string id) { if (string.IsNullOrEmpty(id)) { return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("请输入正确的入库单编号")); } int eId = 0; int.TryParse(id,out eId); if (eId <= 0) { return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("请输入正确的入库单编号")); } string uid = HttpContext.User.Identity.Name; BEnterStock stock = null; UserManager userMgr = new UserManager(int.Parse(uid), null); BUser user = userMgr.CurrentUser; try { StockManager stockManager = new StockManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission); stock = stockManager.GetEnterStockFullInfo(eId); } catch (KMJXCException kex) { return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode(kex.Message)); } catch { return Redirect("/Home/Error?message=" + HttpUtility.UrlEncode("未知错误")); } return View(stock); }
public ApiMessage CreateStoreHouse() { ApiMessage message = new ApiMessage(); 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); try { BStoreHouse house = new BStoreHouse(); house.Name=request["name"]; house.Address=request["address"]; house.Phone=request["phone"]; house.IsDefault = false; if (!string.IsNullOrEmpty(request["isdefault"])) { if (request["isdefault"] == "1") { house.IsDefault = true; } } stockManager.CreateStoreHouse(house); message.Status = "ok"; message.Message = "创建成功"; } catch (KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误"; } return message; }
public ApiMessage CreateLeaveStockForMallTrade() { ApiMessage message = new ApiMessage() { Status = "ok", Message = "更新成功" }; 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); string mall_product=request["mall_item_id"]; string mall_sku=request["mall_sku_id"]; int product = 0; int parent_product = 0; string trade_id=request["trade_id"]; string order_id = request["order_id"]; int.TryParse(request["product"], out parent_product); int.TryParse(request["product_prop"], out product); bool map = false; try { if (!string.IsNullOrEmpty(request["connect"]) && request["connect"].Trim() == "1") { map = true; } else { map = false; } stockManager.CreateLeaveStockForMallTrade(trade_id, order_id, mall_product, mall_sku, parent_product, product, map); } catch (KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch { } return message; }
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; }
public ApiMessage UpdateProductsWastage() { ApiMessage message = new ApiMessage() { Status = "ok" }; 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); try { string ws=request["wastages"]; if (string.IsNullOrEmpty(ws)) { message.Status = "failed"; message.Message = "输入错误"; return message; } ws = HttpUtility.UrlDecode(ws); JArray ps = (JArray)JArray.Parse(ws); if (ps != null && ps.Count > 0) { List<BProduct> products = new List<BProduct>(); for (int i = 0; i < ps.Count; i++) { BProduct product = new BProduct(); JObject json = (JObject)ps[i]; if (json["product_id"] != null) { product.ID = (int)json["product_id"]; } if (json["quantity"] != null) { product.Quantity = (int)json["quantity"]; } if (json["parent_id"] != null) { product.ParentID = (int)json["parent_id"]; } products.Add(product); } stockManager.UpdateProductsWastage(products); } } catch (KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误"; } return message; }
public ApiMessage UpdateProductsStocks() { ApiMessage message = new ApiMessage() { Status="ok"}; 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); string jsonStocks=request["stocks"]; try { List<BStock> bStocks = new List<BStock>(); if (string.IsNullOrEmpty(jsonStocks)) { message.Status = "failed"; message.Message = "没有任何库存修改的信息"; return message; } jsonStocks = HttpUtility.UrlDecode(jsonStocks); JArray jStocks = JArray.Parse(jsonStocks); if (jStocks != null) { for (int i = 0; i < jStocks.Count(); i++) { JObject stock = (JObject)jStocks[i]; int product_id = (int)stock["product_id"]; int quantity = (int)stock["quantity"]; int storeHouse_id = (int)stock["store_house"]; int batch_id = (int)stock["batch_id"]; BStock bStock = new BStock() { Quantity = quantity, Product = new BProduct { ID = product_id }, StoreHouse = new BStoreHouse() { ID = storeHouse_id }, Batch = new BStockBatch() { ID = batch_id } }; bStocks.Add(bStock); } } List<string> messages = new List<string>(); stockManager.UpdateProductsStocks(bStocks, out messages); message.Item = messages; } catch (KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { } return message; }
public ApiMessage UpdateEnterStockToProductStock() { ApiMessage message = new ApiMessage() { Status="ok",Message="更新成功"}; 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 enter_id = 0; int.TryParse(request["enter_id"],out enter_id); try { bool result = stockManager.UpdateProductStockByEnterStock(enter_id); if (!result) { message.Status = "failed"; message.Message = "更新库存失败"; } else { message.Status = "ok"; message.Message = "成功更新库存"; } } catch (JXC.Common.KMException.KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误:"+ex.Message; } return message; }
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; }
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; }
// // 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); }
public SalesManager(BUser user, Shop shop, Permission permission) : base(user, shop, permission) { stockManager = new StockManager(user, shop, permission); tradeManager = new TaobaoTradeManager(this.AccessToken, this.Shop.Mall_Type_ID); }
public ProductManager(BUser user, int shop_id, Permission permission) : base(user,shop_id,permission) { stockManager = new StockManager(user,shop_id,permission); }
public PQGridData GetStoreHouses() { 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); List<BStoreHouse> houses = stockManager.GetStoreHouses(); data.totalRecords = houses.Count; data.data = houses; data.curPage = 1; return data; }
public ApiMessage GetProductsWastageDetail() { ApiMessage data = new ApiMessage() { Status="ok"}; 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); try { int[] products = base.ConvertToIntArrar(request["product_ids"]); data.Item = stockManager.GetProductsWastageDetail(products); } catch (KMJXCException kex) { data.Status = "failed"; data.Message = kex.Message; } catch (Exception ex) { data.Status = "failed"; data.Message = "未知错误"; } return data; }
public List<BProduct> GetProductStockDetails() { 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 product_id = 0; int.TryParse(request["product_id"],out product_id); List<BProduct> stores = stockManager.GetProductStockDetails(product_id); return stores; }
public ApiMessage EnterStockFromBuy() { 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); ApiMessage message = new ApiMessage(); int[] buy_ids =null; int updateStock = 0; int shouseId = 0; buy_ids = base.ConvertToIntArrar(request["buy_ids"]); int.TryParse(request["update_stock"], out updateStock); int.TryParse(request["house_id"], out shouseId); try { if (buy_ids != null) { foreach (int buy_id in buy_ids) { BEnterStock stock = new BEnterStock(); stock.BuyID = buy_id; stock.Created = DateTimeUtil.ConvertDateTimeToInt(DateTime.Now); stock.StoreHouse = new BStoreHouse() { ID = shouseId, Shop = new BShop() { ID = stockManager.Shop.Shop_ID } }; if (updateStock == 1) { stock.UpdateStock = true; } stockManager.CreateEnterStock(stock); } } message.Status = "ok"; message.Message = ""; } catch (JXC.Common.KMException.KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误"; } finally { } return message; }
public ApiMessage HandleBackSaleDetail() { ApiMessage message = new ApiMessage(); 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); string backSales = request["back_sales"]; int status=0; int.TryParse(request["status"],out status); if (string.IsNullOrEmpty(backSales)) { message.Status = "failed"; message.Message = "没有任何退货信息"; return message; } backSales = HttpUtility.UrlDecode(backSales); try { JArray jsons = JArray.Parse(backSales); if (jsons != null && jsons.Count > 0) { for (int i = 0; i < jsons.Count; i++) { JObject json = (JObject)jsons[i]; int back_Sale_ID = (int)json["back_sale_id"]; JArray orders=(JArray)json["orders"]; List<BOrder> bOrders = new List<BOrder>(); for(int j = 0; j < orders.Count; j++) { JObject o=(JObject)orders[j]; string order_id=(string)o["order_id"]; int quantity = (int)o["quantity"]; bOrders.Add(new BOrder() { Order_ID=order_id,Quantity=quantity}); } switch (status) { case 1: saleManager.HandleBackSaleDetail_BackStock(back_Sale_ID, bOrders, status); break; case 2: saleManager.HandleBackSaleDetail_PartialWaste(back_Sale_ID, bOrders, status); break; case 3: saleManager.HandleWastageBackSale_TotalWaste(back_Sale_ID, bOrders, status); break; default: break; } } } message.Status = "ok"; } catch (KM.JXC.Common.KMException.KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = ex.Message; } finally { } return message; }
public ApiMessage SyncMallTrades() { ApiMessage message = new ApiMessage(); 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 start = 0; int end = 0; int syncType = 0; int shop = 0; string status = request["status"]; int.TryParse(request["start"],out start); int.TryParse(request["end"], out end); int.TryParse(request["syncType"],out syncType); int.TryParse(request["shop"], out shop); try { saleManager.SyncMallTrades(start, end, status, syncType, shop); message.Status = "ok"; } catch (KMJXCMallException mex) { message.Status = "failed"; message.Message = mex.Message; } catch (KMJXCException kex) { message.Status = "failed"; message.Message = kex.Message; } catch (Exception ex) { message.Status = "failed"; message.Message = "未知错误"; } return message; }
public ProductManager(BUser user, Shop shop, Permission permission) : base(user, shop, permission) { stockManager = new StockManager(user, shop, permission); }
public PQGridData SearchLeaveStock() { 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; string sale_id = request["sale_id"]; int leave_id=0; int uid = 0; 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.TryParse(request["leave_id"], out leave_id); int.TryParse(request["user_id"], out uid); int total = 0; int[] leave_ids = null; int[] user_ids = null; string[] sale_ids = null; if (leave_id > 0) { leave_ids = new int[] { leave_id }; } if (uid > 0) { user_ids = new int[] { uid }; } if (!string.IsNullOrEmpty(sale_id)) { sale_ids = new string[] { sale_id }; } data.data = stockManager.SearchLeaveStocks(leave_ids, sale_ids, user_ids, stime, etime, page, pageSize, out total); data.curPage = page; data.totalRecords = total; return data; }
public List<BStoreHouse> GetStoreHouses() { string user_id = User.Identity.Name; UserManager userMgr = new UserManager(int.Parse(user_id), null); BUser user = userMgr.CurrentUser; StockManager shopManager = new StockManager(userMgr.CurrentUser, userMgr.Shop, userMgr.CurrentUserPermission); return shopManager.GetStoreHouses(); }
public PQGridData SearchProductsStore() { 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.SearchProductsStocks(null, category, storeHouse, keyword, page, pageSize, out total); data.curPage = page; data.totalRecords = total; return data; }
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; }
public PQGridData SearchBackSaleDetails() { 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; int sale_id = 0; int back_id = 0; int uid = 0; long stime = 0; long etime = 0; int? status = null; int status1 = 0; string state=request["status"]; if (!string.IsNullOrEmpty(state)) { int.TryParse(state, out status1); status = status1; } 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 = saleManager.SearchBackSaleDetails(saleids, userids,status, stime, etime, page, pageSize, out total); data.curPage = page; data.totalRecords = total; return data; }