public ContentResult PrintGrf(string Id) { NSession.Clear(); object obj = NSession.CreateQuery("select Content from PrintTemplateType where Id=" + Id).UniqueResult(); return(Content(obj.ToString(), "text/xml", Encoding.Default)); }
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 PrintSave(string Id) { NSession.Clear(); PrintTemplateType obj = NSession.Get <PrintTemplateType>(Convert.ToInt32(Id)); byte[] FormData = Request.BinaryRead(Request.TotalBytes); obj.Content = System.Text.Encoding.Default.GetString(FormData); NSession.Update(obj); NSession.Flush(); return(Json(new { IsSuccess = 1 })); }
public ActionResult Edit(LanguageType obj) { try { NSession.Clear(); NSession.Update(obj); NSession.Flush(); Language.ReLoadLanguage(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public ActionResult Edit(DictionaryClassType obj) { try { DictionaryClassType c = GetById(obj.Id); NSession.CreateSQLQuery("update Dictionarys set DicCode='" + obj.Code + "' where DicCode='" + c.Code + "' ") .UniqueResult(); NSession.Clear(); NSession.Update(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public ActionResult Edit(PurchasePlanType obj) { try { string str = ""; PurchasePlanType obj2 = GetById(obj.Id); str += Utilities.GetObjEditString(obj2, obj) + "<br>"; NSession.Clear(); NSession.Update(obj); NSession.Flush(); LoggerUtil.GetPurchasePlanRecord(obj, "修改采购计划", str, CurrentUser, NSession); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public ActionResult Edit(SupplierType obj) { try { List <SuppliersProductType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <SuppliersProductType> >(obj.rows); NSession.Update(obj); NSession.Flush(); NSession.Delete("from SuppliersProductType where SId='" + obj.Id + "'"); NSession.Flush(); NSession.Clear(); foreach (SuppliersProductType product in list1) { product.SId = obj.Id; NSession.Save(product); NSession.Flush(); } } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public ActionResult Edit(DisputeType obj) { try { DisputeType obj2 = GetById(obj.Id); NSession.Clear(); obj.SolveBy = CurrentUser.Realname; obj.SolveOn = DateTime.Now; string str = Utilities.GetObjEditString(obj2, obj); NSession.Update(obj); NSession.Flush(); if (obj.Status == "已解决" && obj.RefundAmount != 0) { SaveAmount(obj); } LoggerUtil.GetDisputeRecord(obj, "处理纠纷", str, CurrentUser, NSession); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public ActionResult Edit(ProductType obj) { try { string str = ""; obj.Enabled = 1; ProductType obj2 = GetById(obj.Id); List <ProductComposeType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductComposeType> >(obj.rows); List <ProductComposeType> pis = NSession.CreateQuery("from ProductComposeType where SKU='" + obj.SKU + "'").List <ProductComposeType>().ToList <ProductComposeType>(); if (list1.Count != pis.Count) { str += "组合产品由<br>"; foreach (var item in pis) { str += Zu(item); } str += "修改为<br> "; foreach (var item in list1) { str += Zu(item); } str += "<br>"; } else { foreach (var item in pis) { int check = 0; foreach (var it in list1) { if (it.SrcSKU == item.SrcSKU && it.SrcQty == item.SrcQty) { check = 1; } } if (check != 1) { str += "组合产品由<br>"; foreach (var zu in pis) { str += Zu(zu); } str += "修改为<br> "; foreach (var zu in list1) { str += Zu(zu); } str += "<br>"; } } } NSession.Delete("from ProductComposeType where SKU='" + obj.SKU + "'"); NSession.Flush(); NSession.Clear(); foreach (ProductComposeType productCompose in list1) { productCompose.SKU = obj.SKU; productCompose.PId = obj.Id; NSession.Save(productCompose); NSession.Flush(); NSession.Clear(); obj.IsZu = 1; } str += Utilities.GetObjEditString(obj2, obj) + "<br>"; List <ProductIsInfractionType> list2 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductIsInfractionType> >(obj.rows2); foreach (ProductIsInfractionType item in list2) { IList <ProductIsInfractionType> qin = NSession.CreateQuery("from ProductIsInfractionType where SKU='" + obj.SKU + "' and Platform='" + item.Platform + "'").List <ProductIsInfractionType>(); if (qin.Count != 0) { foreach (var s in qin) { if (item.Isinfraction != s.Isinfraction) { str += item.Platform + "是否侵权由" + s.Isinfraction + "修改为" + item.Isinfraction + "<br>"; } } } } NSession.Delete("from ProductIsInfractionType where SKU='" + obj.SKU + "'"); NSession.Flush(); NSession.Clear(); foreach (ProductIsInfractionType item in list2) { item.OldSKU = obj.OldSKU; item.SKU = obj.SKU; NSession.Save(item); NSession.Flush(); NSession.Clear(); } NSession.Update(obj); NSession.Flush(); NSession.Clear(); //修改库存中的数据 IList <WarehouseStockType> list = NSession.CreateQuery(" from WarehouseStockType where PId=" + obj.Id).List <WarehouseStockType>(); // //在仓库中添加产品库存 // if (list.Count > 0) { foreach (var item in list) { item.Pic = obj.SPicUrl; item.SKU = obj.SKU; item.Title = obj.ProductName; item.UpdateOn = DateTime.Now; NSession.Update(item); NSession.Flush(); } } else { AddToWarehouse(obj); } LoggerUtil.GetProductRecord(obj, "商品修改", str, CurrentUser, NSession); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }