public JsonResult UpdateRate() { try { cn.com.webxml.webservice.ForexRmbRateWebService server = new cn.com.webxml.webservice.ForexRmbRateWebService(); DataSet ds = server.getForexRmbRate(); foreach (DataRow dr in ds.Tables[0].Rows) { CurrencyType c = new CurrencyType(); c.CurrencyCode = dr["Symbol"].ToString(); c.CurrencyName = dr["Name"].ToString(); NSession.Delete(" from CurrencyType where CurrencyCode='" + c.CurrencyCode + "'"); NSession.Flush(); c.CurrencySign = ""; string str = dr["fBuyPrice"].ToString(); if (string.IsNullOrEmpty(str)) { str = "0"; } c.CurrencyValue = Math.Round(Convert.ToDecimal(str) / 100, 5); c.CreateOn = DateTime.Now;; NSession.Save(c); } } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
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 void DelDictionary(int id) { DictionaryType log = GetById(id); NSession.Delete(log); NSession.Flush(); }
public JsonResult DeleteConfirmed(int id) { try { PlanDaoType obj = GetById(id); PurchasePlanType plan = NSession.Get <PurchasePlanType>(obj.PlanId); if (plan != null) { plan.Status = "已发货"; plan.DaoQty = plan.DaoQty - obj.RealQty; NSession.Update(plan); NSession.Flush(); } NSession.Delete("from SKUCodeType where PlanNo='" + obj.PlanNo + "' and Code >=" + obj.SKUCode + " and Code < " + (obj.SKUCode + obj.RealQty)); NSession.Flush(); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public void DelFreight(int id) { LogisticsFreightType log = GetById(id); NSession.Delete(log); NSession.Flush(); }
public void AddAreaCountry(string id, int tid) { NSession.Delete("from LogisticsAreaCountryType where CountryCode=" + id + " and AreaCode in (select Id from LogisticsAreaType where LId =(select LId from LogisticsAreaType where Id=" + tid + "))"); NSession.Flush(); LogisticsAreaCountryType logcountry = new LogisticsAreaCountryType { CountryCode = id, AreaCode = tid }; NSession.Save(logcountry); }
public JsonResult DeleteConfirmed2(int id) { try { SKUCodeType obj = NSession.Get <SKUCodeType>(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public JsonResult DeleteConfirmed(int id) { try { SerialNumberType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public JsonResult DeleteConfirmed(int id) { try { PlacardType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错" + ee.Message })); } return(Json(new { IsSuccess = true })); }
public JsonResult DeleteConfirmed(int id) { try { EbayType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { ErrorMsg = "出错了", IsSuccess = false })); } return(Json(new { IsSuccess = "true" })); }
public JsonResult DeleteConfirmed(int id) { try { OrderReturnRecordType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { errorMsg = "出错了" })); } return(Json(new { IsSuccess = "true" })); }
public JsonResult Delete(int id) { try { LanguageType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); Language.ReLoadLanguage(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public JsonResult DeleteConfirmed(int id) { try { SupplierType obj = GetById(id); NSession.Delete(obj); NSession.Delete("from SuppliersProductType where SId='" + obj.Id + "'"); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public void DelAreaCountry(string id, int tid) { LogisticsAreaCountryType logc = new LogisticsAreaCountryType { CountryCode = id.ToString(), AreaCode = tid }; IList <LogisticsAreaCountryType> list = NSession.CreateCriteria(typeof(LogisticsAreaCountryType)) .Add(Example.Create(logc)) .List <LogisticsAreaCountryType>(); foreach (LogisticsAreaCountryType item in list) { NSession.Delete(item); NSession.Flush(); } }
public JsonResult DeleteConfirmed(int id) { try { StockInType obj = GetById(id); NSession.Delete("from SKUCodeType where PlanNo='" + obj.Id + "'"); NSession.Flush(); Utilities.StockOut(1, obj.SKU, obj.Qty, "入库删除", CurrentUser.Realname, "", "", NSession); NSession.Delete(obj); NSession.Flush(); } catch (Exception ee) { return(Json(new { IsSuccess = false, ErrorMsg = "出错了" })); } return(Json(new { IsSuccess = true })); }
public JsonResult DeleteConfirmed(int id) { try { ProductType obj = GetById(id); NSession.Delete(obj); NSession.Flush(); NSession.Delete("from WarehouseStockType where SKU='" + obj.SKU + "'"); NSession.Flush(); LoggerUtil.GetProductRecord(obj, "删除商品", "商品被删除", 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(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 })); }