/// <summary> /// 从服务器端获取经销店库存上报分页列表 /// </summary> /// <param name="context"></param> public void GetDealerStockPagerList(HttpContext context) { string username = context.User.Identity.Name; Common.SysUserEntity model = new BLL.sysUser().GetSysUserByLoginName(username); int DealerId = model.DealerId; int totalCount = 0; // 总记录数 int pageIndex = Convert.ToInt32(context.Request["page"]); // 当前页 int pageSize = Convert.ToInt32(context.Request["rows"]); // 页码大小 Common.Entity.DealerStock search = new Common.Entity.DealerStock(); if (!string.IsNullOrEmpty(context.Request.Form["filterContext"])) { search = JsonConvert.DeserializeObject <Common.Entity.DealerStock>(context.Request.Form["filterContext"]); } var list = new BLL.DealerStock().GetDealerStockPagerList(pageIndex, pageSize, DealerId, search, out totalCount); int totalPages = CommonFunction.CalculateTotalPage(pageSize, totalCount); var ResultData = new CommonFunction.DataResult <Common.Entity.DealerStock>() { totalCount = totalCount, totalpages = totalPages, currPage = pageIndex, dataList = list, }; context.Response.Write(JsonConvert.SerializeObject(ResultData)); }
public void SaveData(HttpContext context) { string name = context.Request["CustomerName"]; string cboCarname = context.Request["cboCarname"]; DateTime StockDate = Convert.ToDateTime(context.Request["StockDate"]); int StockNumber = Convert.ToInt32(context.Request["StockNumber"]); int hidCustomerID = Convert.ToInt32(context.Request["hidCustomerID"]); string username = context.User.Identity.Name; Common.SysUserEntity model = new BLL.sysUser().GetSysUserByLoginName(username); int DealerId = model.DealerId; string code = context.Request["hidCode"]; Common.Entity.DealerStock stock = new Common.Entity.DealerStock(); stock.DealerID = DealerId; stock.CustomerID = hidCustomerID; stock.CarName = cboCarname; stock.StockMonth = StockDate; stock.StockCount = StockNumber; string opType = context.Request["opType"]; if (opType == "add") { if (new BLL.DealerStock().Exists(stock)) { context.Response.Write("{\"msg\":\"已经存在该客户的月份库存,请修改。\",\"state\":1}"); } else if (new BLL.DealerStock().Add(stock)) { context.Response.Write("{\"msg\":\"添加成功。\",\"success\":true}"); } else { context.Response.Write("{\"msg\":\"添加失败。\",\"success\":false}"); } } else { int HidID = Convert.ToInt32(context.Request["HidID"]); Common.Entity.DealerStock entity = new Common.Entity.DealerStock(); entity.CustomerID = hidCustomerID; entity.CarName = cboCarname; entity.StockMonth = StockDate; entity.StockCount = StockNumber; entity.PKID = HidID; int r = new BLL.DealerStock().Update(entity); if (r > 0) { context.Response.Write("{\"msg\":\"修改成功。\",\"success\":true}"); } else { context.Response.Write("{\"msg\":\"修改失败。\",\"success\":false}"); } } }
public void DeleteDealerStockByPKID(HttpContext context) { int StockId = Convert.ToInt32(context.Request["StockId"]); if (StockId > 0) { int result = new BLL.DealerStock().Delete(StockId); if (result > 0) { context.Response.Write("{\"msg\":\"删除成功。\",\"success\":true}"); } else { context.Response.Write("{\"msg\":\"删除失败。\",\"success\":false}"); } } }