/// <summary> /// 获得店铺等级列表 /// </summary> /// <returns></returns> public static List<StoreRankInfo> GetStoreRankList() { List<StoreRankInfo> storeRankList = new List<StoreRankInfo>(); IDataReader reader = BrnMall.Core.BMAData.RDBS.GetStoreRankList(); while (reader.Read()) { StoreRankInfo storeRankInfo = new StoreRankInfo(); storeRankInfo.StoreRid = TypeHelper.ObjectToInt(reader["storerid"]); storeRankInfo.Title = reader["title"].ToString(); storeRankInfo.Avatar = reader["avatar"].ToString(); storeRankInfo.HonestiesLower = TypeHelper.ObjectToInt(reader["honestieslower"]); storeRankInfo.HonestiesUpper = TypeHelper.ObjectToInt(reader["honestiesupper"]); storeRankInfo.ProductCount = TypeHelper.ObjectToInt(reader["productcount"]); storeRankList.Add(storeRankInfo); } reader.Close(); return storeRankList; }
public ActionResult Add(StoreRankModel model) { if (AdminStoreRanks.GetStoreRidByTitle(model.RankTitle) > 0) ModelState.AddModelError("RankTitle", "名称已经存在"); if (ModelState.IsValid) { StoreRankInfo storeRankInfo = new StoreRankInfo() { Title = model.RankTitle, Avatar = model.Avatar, HonestiesLower = model.HonestiesLower, HonestiesUpper = model.HonestiesUpper, ProductCount = model.ProductCount }; AdminStoreRanks.CreateStoreRank(storeRankInfo); AddMallAdminLog("添加店铺等级", "添加店铺等级,店铺等级为:" + model.RankTitle); return PromptView("店铺等级添加成功"); } Load(); return View(model); }
/// <summary> /// 更新店铺等级 /// </summary> public static void UpdateStoreRank(StoreRankInfo storeRankInfo) { BrnMall.Core.BMAData.RDBS.UpdateStoreRank(storeRankInfo); }
/// <summary> /// 创建店铺等级 /// </summary> public void CreateStoreRank(StoreRankInfo storeRankInfo) { DbParameter[] parms = { GenerateInParam("@title", SqlDbType.NChar,50,storeRankInfo.Title), GenerateInParam("@avatar", SqlDbType.Char,50,storeRankInfo.Avatar), GenerateInParam("@honestieslower", SqlDbType.Int, 4, storeRankInfo.HonestiesLower), GenerateInParam("@honestiesupper", SqlDbType.Int,4,storeRankInfo.HonestiesUpper), GenerateInParam("@productcount", SqlDbType.Int,4,storeRankInfo.ProductCount) }; string commandText = string.Format("INSERT INTO [{0}storeranks]([title],[avatar],[honestieslower],[honestiesupper],[productcount]) VALUES(@title,@avatar,@honestieslower,@honestiesupper,@productcount)", RDBSHelper.RDBSTablePre); RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 更新店铺等级 /// </summary> public void UpdateStoreRank(StoreRankInfo storeRankInfo) { DbParameter[] parms = { GenerateInParam("@title", SqlDbType.NChar,50,storeRankInfo.Title), GenerateInParam("@avatar", SqlDbType.Char,50,storeRankInfo.Avatar), GenerateInParam("@honestieslower", SqlDbType.Int, 4, storeRankInfo.HonestiesLower), GenerateInParam("@honestiesupper", SqlDbType.Int,4,storeRankInfo.HonestiesUpper), GenerateInParam("@productcount", SqlDbType.Int,4,storeRankInfo.ProductCount), GenerateInParam("@storerid", SqlDbType.SmallInt,2,storeRankInfo.StoreRid) }; string commandText = string.Format("UPDATE [{0}storeranks] SET [title]=@title,[avatar]=@avatar,[honestieslower]=@honestieslower,[honestiesupper]=@honestiesupper,[productcount]=@productcount WHERE [storerid]=@storerid", RDBSHelper.RDBSTablePre); RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 更新店铺等级 /// </summary> public static void UpdateStoreRank(StoreRankInfo storeRankInfo) { BrnMall.Data.StoreRanks.UpdateStoreRank(storeRankInfo); BrnMall.Core.BMACache.Remove(CacheKeys.MALL_STORE_RANKLIST); }