public ActionResult saveoutselltemp() { int detail = WebRequest.GetFormInt("detail", 0); string m = WebRequest.GetString("m", true); string mc = WebRequest.GetString("mc", true); int int_depot = WebRequest.GetFormInt("depot", 0); string depotname = WebRequest.GetString("depotname", true); string count = WebRequest.GetString("count", true); float price = WebRequest.GetFormFloat("price", 0); string no = WebRequest.GetString("no", true); int int_count = Convert.ToInt32(count); double dprice = Convert.ToDouble(price); string name = WebRequest.GetString("name", true); string model = WebRequest.GetString("model", true); string remark = WebRequest.GetString("remark", true); List<StockDetailModel> temp = (List<StockDetailModel>)SessionHelper.GetSession("WO1" + no + Masterpage.CurrUser.staffid); if (temp == null || temp.Count == 0) { temp = new List<StockDetailModel>(); temp.Add(new StockDetailModel { detailSn = 0, materialModel = model, materialUnit = "", materialName = name, materialNo = m, materialCategory = mc, amount = int_count, stockNo = no, depotId = int_depot, depotName = depotname, remark = remark, price = dprice, type = "add" }); } else { bool add = false; StockDetailModel ht = new StockDetailModel(); if (detail > 0) { ht = temp.FirstOrDefault(p => p.detailSn == detail); ht.type = "edit"; } else { ht = temp.FirstOrDefault(p => p.materialNo == m); if (ht == null) { ht = new StockDetailModel(); add = true; ht.type = "add"; } } ht.amount = int_count; ht.materialCategory = mc; ht.materialModel = model; ht.materialName = name; ht.materialNo = m; ht.depotId = int_depot; ht.depotName = depotname; ht.remark = remark; ht.price = dprice; if (add) temp.Add(ht); } SessionHelper.SetSession("WO1" + no + Masterpage.CurrUser.staffid, temp); return Json(temp.Count, JsonRequestBehavior.AllowGet); }
public ActionResult saveoutold2newtemp() { int detail = WebRequest.GetFormInt("detail", 0); int rad = WebRequest.GetFormInt("rad", 0); string m = WebRequest.GetString("m", true); string mc = WebRequest.GetString("mc", true); int int_depot = WebRequest.GetFormInt("depot", 0); string depotname = WebRequest.GetString("depotname", true); string count = WebRequest.GetString("count", true); string no = WebRequest.GetString("no", true); double int_count = Convert.ToDouble(count); string name = WebRequest.GetString("name", true); string model = WebRequest.GetString("model", true); string remark = WebRequest.GetString("remark", true); List<StockDetailModel> temp = (List<StockDetailModel>)SessionHelper.GetSession("ON1" + no + Masterpage.CurrUser.staffid); //var material = stockinService.GetOneMaterial(m); if (temp == null || temp.Count == 0) { temp = new List<StockDetailModel>(); temp.Add(new StockDetailModel { detailSn = 0, materialModel = model, materialUnit = "", materialName = name, materialNo = m, materialCategory = mc, amount = int_count, changeNo = no, depotId = int_depot, depotName = depotname,remark=remark, changeType = rad, type = "add" }); } else { bool add = false; StockDetailModel ht = new StockDetailModel(); if (detail > 0) { ht = temp.FirstOrDefault(p => p.detailSn == detail); ht.type = "edit"; } else { ht = temp.FirstOrDefault(p => p.materialNo == m && p.depotId == int_depot && p.changeType == rad); if (ht == null) { ht = new StockDetailModel(); add = true; ht.type = "add"; } } ht.changeType = rad; ht.amount = int_count; ht.materialCategory = mc; ht.materialModel = model; ht.materialName = name; ht.remark = remark; ht.materialNo = m; ht.depotId = int_depot; ht.depotName = depotname; ht.changeNo = no; if (add) temp.Add(ht); } SessionHelper.SetSession("ON1" + no + Masterpage.CurrUser.staffid, temp); return Json(temp.Count, JsonRequestBehavior.AllowGet); }