public ActionResult Edit(int id) { NoStockType obj = GetById(id); ViewData["id"] = id; return(View(obj)); }
public ActionResult Edit(NoStockType obj) { try { NSession.Update(obj); NSession.Flush(); List <NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <NoStockLinkType> >(obj.rowse); NSession.Delete("from NoStockLinkType where PId='" + obj.Id + "'"); NSession.Flush(); NSession.Clear(); foreach (NoStockLinkType link in list1) { link.OldSKU = obj.OldSKU; link.SKU = obj.SKU; link.PId = obj.Id; link.CreateBy = CurrentUser.Realname; link.CreateOn = DateTime.Now; NSession.Save(link); NSession.Flush(); } } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
public JsonResult Create(NoStockType obj) { try { obj.Enabled = 1; obj.CreateBy = CurrentUser.Realname; obj.CreateOn = DateTime.Now; NSession.SaveOrUpdate(obj); NSession.Flush(); List <NoStockLinkType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <NoStockLinkType> >(obj.rows); foreach (NoStockLinkType link in list1) { link.OldSKU = obj.OldSKU; link.SKU = obj.SKU; link.PId = obj.Id; link.CreateBy = CurrentUser.Realname; link.CreateOn = DateTime.Now; NSession.Save(link); NSession.Flush(); } } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
public JsonResult IsReceived(int id) { NoStockType obj = GetById(id); obj.Enabled = 0; NSession.Update(obj); NSession.Flush(); return(Json("")); }
public ViewResult Received(int id) { NoStockType obj = GetById(id); ProductType product = new ProductType(); product.OldSKU = obj.OldSKU; product.SKU = obj.SKU; product.ProductName = obj.Name; product.Standard = obj.Standard; ViewData["nid"] = id; return(View(product)); }
/// <summary> /// 根据Id获取 /// </summary> /// <param name="Id"></param> /// <returns></returns> public NoStockType GetById(int Id) { NoStockType obj = NSession.Get <NoStockType>(Id); if (obj == null) { throw new Exception("返回实体为空"); } else { return(obj); } }
public JsonResult DeleteConfirmed(int id) { try { NoStockType obj = GetById(id); obj.Enabled = 0; NSession.Update(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }