/// <summary> /// 创建店铺 /// </summary> /// <param name="storeInfo">店铺信息</param> /// <param name="storeKeeperInfo">店主信息</param> /// <returns>店铺id</returns> public static int CreateStore(StoreInfo storeInfo, StoreKeeperInfo storeKeeperInfo) { int storeId = BrnMall.Data.Stores.CreateStore(storeInfo); if (storeId > 0) { storeKeeperInfo.StoreId = storeId; CreateStoreKeeper(storeKeeperInfo); } return storeId; }
/// <summary> /// 从IDataReader创建StoreKeeperInfo /// </summary> public static StoreKeeperInfo BuildStoreKeeperFromReader(IDataReader reader) { StoreKeeperInfo storeKeeperInfo = new StoreKeeperInfo(); storeKeeperInfo.StoreId = TypeHelper.ObjectToInt(reader["storeid"]); storeKeeperInfo.Type = TypeHelper.ObjectToInt(reader["type"]); storeKeeperInfo.Name = reader["name"].ToString(); storeKeeperInfo.IdCard = reader["idcard"].ToString(); storeKeeperInfo.Address = reader["address"].ToString(); return storeKeeperInfo; }
/// <summary> /// 更新店长 /// </summary> /// <param name="storeKeeperInfo">店长信息</param> public static void UpdateStoreKeeper(StoreKeeperInfo storeKeeperInfo) { BrnMall.Core.BMAData.RDBS.UpdateStoreKeeper(storeKeeperInfo); if (_storenosql != null) _storenosql.UpdateStoreKeeper(storeKeeperInfo); }
/// <summary> /// 创建店长 /// </summary> /// <param name="storeKeeperInfo">店长信息</param> public static void CreateStoreKeeper(StoreKeeperInfo storeKeeperInfo) { BrnMall.Core.BMAData.RDBS.CreateStoreKeeper(storeKeeperInfo); }
/// <summary> /// 更新店长 /// </summary> /// <param name="storeKeeperInfo">店长信息</param> public static void UpdateStoreKeeper(StoreKeeperInfo storeKeeperInfo) { BrnMall.Data.Stores.UpdateStoreKeeper(storeKeeperInfo); }
/// <summary> /// 更新店长 /// </summary> /// <param name="storeKeeperInfo">店长信息</param> public void UpdateStoreKeeper(StoreKeeperInfo storeKeeperInfo) { DbParameter[] parms = { GenerateInParam("@storeid", SqlDbType.Int,4,storeKeeperInfo.StoreId), GenerateInParam("@type", SqlDbType.TinyInt,1,storeKeeperInfo.Type), GenerateInParam("@name", SqlDbType.NVarChar, 100, storeKeeperInfo.Name), GenerateInParam("@idcard", SqlDbType.NVarChar,50,storeKeeperInfo.IdCard), GenerateInParam("@address", SqlDbType.NVarChar,300,storeKeeperInfo.Address) }; string commandText = string.Format("UPDATE [{0}storekeepers] SET [type]=@type,[name]=@name,[idcard]=@idcard,[address]=@address WHERE [storeid]=@storeid", RDBSHelper.RDBSTablePre); RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 创建店长 /// </summary> /// <param name="storeKeeperInfo">店长信息</param> public void CreateStoreKeeper(StoreKeeperInfo storeKeeperInfo) { DbParameter[] parms = { GenerateInParam("@storeid", SqlDbType.Int,4,storeKeeperInfo.StoreId), GenerateInParam("@type", SqlDbType.TinyInt,1,storeKeeperInfo.Type), GenerateInParam("@name", SqlDbType.NVarChar, 100, storeKeeperInfo.Name), GenerateInParam("@idcard", SqlDbType.NVarChar,50,storeKeeperInfo.IdCard), GenerateInParam("@address", SqlDbType.NVarChar,300,storeKeeperInfo.Address) }; string commandText = string.Format("INSERT INTO [{0}storekeepers]([storeid],[type],[name],[idcard],[address]) VALUES(@storeid,@type,@name,@idcard,@address)", RDBSHelper.RDBSTablePre); RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
public ActionResult AddStore(AddStoreModel model) { if (AdminStores.GetStoreIdByName(model.StoreName) > 0) ModelState.AddModelError("StoreName", "名称已经存在"); if (ModelState.IsValid) { StoreInfo storeInfo = new StoreInfo() { State = (int)StoreState.Open, Name = model.StoreName, RegionId = 0, StoreRid = AdminStoreRanks.GetLowestStoreRank().StoreRid, StoreIid = 0, Logo = "", CreateTime = DateTime.Now, Mobile = "", Phone = "", QQ = "", WW = "", DePoint = 10.00m, SePoint = 10.00m, ShPoint = 10.00m, Honesties = 0, StateEndTime = model.StateEndTime, Theme = "Default", Banner = "", Announcement = "", Description = "" }; StoreKeeperInfo storeKeeperInfo = new StoreKeeperInfo() { Type = model.Type, Name = model.StoreKeeperName, IdCard = model.IdCard, Address = model.Address }; int storeId = AdminStores.CreateStore(storeInfo, storeKeeperInfo); if (storeId > 0) { AddMallAdminLog("添加店铺", "添加店铺,店铺id为:" + storeId); return PromptView("店铺添加成功"); } else { return PromptView("店铺添加失败"); } } ViewData["referer"] = MallUtils.GetMallAdminRefererCookie(); return View(model); }