/// <summary> /// 从IDataReader创建StoreShipTemplateInfo /// </summary> public static StoreShipTemplateInfo BuildStoreShipTemplateFromReader(IDataReader reader) { StoreShipTemplateInfo storeShipTemplateInfo = new StoreShipTemplateInfo(); storeShipTemplateInfo.StoreSTid = TypeHelper.ObjectToInt(reader["storestid"]); storeShipTemplateInfo.StoreId = TypeHelper.ObjectToInt(reader["storeid"]); storeShipTemplateInfo.Free = TypeHelper.ObjectToInt(reader["free"]); storeShipTemplateInfo.Type = TypeHelper.ObjectToInt(reader["type"]); storeShipTemplateInfo.Title = reader["title"].ToString(); return storeShipTemplateInfo; }
/// <summary> /// 创建店铺配送模板 /// </summary> /// <param name="storeShipTemplateInfo">店铺配送模板信息</param> public static int CreateStoreShipTemplate(StoreShipTemplateInfo storeShipTemplateInfo) { return BrnMall.Core.BMAData.RDBS.CreateStoreShipTemplate(storeShipTemplateInfo); }
/// <summary> /// 更新店铺配送模板 /// </summary> /// <param name="storeShipTemplateInfo">店铺配送模板信息</param> public static void UpdateStoreShipTemplate(StoreShipTemplateInfo storeShipTemplateInfo) { BrnMall.Core.BMAData.RDBS.UpdateStoreShipTemplate(storeShipTemplateInfo); }
/// <summary> /// 更新店铺配送模板 /// </summary> /// <param name="storeShipTemplateInfo">店铺配送模板信息</param> public static void UpdateStoreShipTemplate(StoreShipTemplateInfo storeShipTemplateInfo) { BrnMall.Data.Stores.UpdateStoreShipTemplate(storeShipTemplateInfo); BrnMall.Core.BMACache.Remove(CacheKeys.MALL_STORE_SHIPTEMPLATEINFO + storeShipTemplateInfo.StoreSTid); }
/// <summary> /// 创建店铺配送模板 /// </summary> /// <param name="storeShipTemplateInfo">店铺配送模板信息</param> public static int CreateStoreShipTemplate(StoreShipTemplateInfo storeShipTemplateInfo) { return BrnMall.Data.Stores.CreateStoreShipTemplate(storeShipTemplateInfo); }
/// <summary> /// 更新店铺配送模板 /// </summary> /// <param name="storeShipTemplateInfo">店铺配送模板信息</param> public void UpdateStoreShipTemplate(StoreShipTemplateInfo storeShipTemplateInfo) { DbParameter[] parms = { GenerateInParam("@storeid", SqlDbType.Int,4, storeShipTemplateInfo.StoreId), GenerateInParam("@free", SqlDbType.TinyInt,1, storeShipTemplateInfo.Free), GenerateInParam("@type", SqlDbType.TinyInt,1, storeShipTemplateInfo.Type), GenerateInParam("@title", SqlDbType.NVarChar, 100, storeShipTemplateInfo.Title), GenerateInParam("@storestid", SqlDbType.Int,4, storeShipTemplateInfo.StoreSTid) }; string commandText = string.Format("UPDATE [{0}storeshiptemplates] SET [storeid]=@storeid,[free]=@free,[type]=@type,[title]=@title WHERE [storestid]=@storestid", RDBSHelper.RDBSTablePre); RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 创建店铺配送模板 /// </summary> /// <param name="storeShipTemplateInfo">店铺配送模板信息</param> public int CreateStoreShipTemplate(StoreShipTemplateInfo storeShipTemplateInfo) { DbParameter[] parms = { GenerateInParam("@storeid", SqlDbType.Int,4, storeShipTemplateInfo.StoreId), GenerateInParam("@free", SqlDbType.TinyInt,1, storeShipTemplateInfo.Free), GenerateInParam("@type", SqlDbType.TinyInt,1, storeShipTemplateInfo.Type), GenerateInParam("@title", SqlDbType.NChar, 100, storeShipTemplateInfo.Title) }; string commandText = string.Format("INSERT INTO [{0}storeshiptemplates]([storeid],[free],[type],[title]) VALUES(@storeid,@free,@type,@title);SELECT SCOPE_IDENTITY();", RDBSHelper.RDBSTablePre); return TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText, parms)); }
public ActionResult AddStoreShipTemplate(AddStoreShipTemplateModel model) { if (ModelState.IsValid) { StoreShipTemplateInfo storeShipTemplateInfo = new StoreShipTemplateInfo() { StoreId = WorkContext.StoreId, Title = model.TemplateTitle, Free = model.Free, Type = model.Type }; int storeSTid = AdminStores.CreateStoreShipTemplate(storeShipTemplateInfo); if (storeSTid > 0) { StoreShipFeeInfo storeShipFeeInfo = new StoreShipFeeInfo() { StoreSTid = storeSTid, RegionId = -1, StartValue = model.StartValue, StartFee = model.StartFee, AddValue = model.AddValue, AddFee = model.AddFee }; AdminStores.CreateStoreShipFee(storeShipFeeInfo); AddStoreAdminLog("添加店铺配送模板", "添加店铺配送模板,店铺配送模板为:" + model.TemplateTitle); return PromptView("店铺配送模板添加成功"); } else { return PromptView("店铺配送模板添加失败"); } } ViewData["referer"] = MallUtils.GetStoreAdminRefererCookie(); return View(model); }