Exemple #1
0
        /// <summary>
        /// 获得店长
        /// </summary>
        /// <param name="storeId">店铺id</param>
        /// <returns></returns>
        public static StoreKeeperInfo GetStoreKeeperById(int storeId)
        {
            StoreKeeperInfo storeKeeperInfo = null;

            if (_storenosql != null)
            {
                storeKeeperInfo = _storenosql.GetStoreKeeperById(storeId);
                if (storeKeeperInfo == null)
                {
                    IDataReader reader = BrnMall.Core.BMAData.RDBS.GetStoreKeeperById(storeId);
                    if (reader.Read())
                    {
                        storeKeeperInfo = BuildStoreKeeperFromReader(reader);
                    }
                    reader.Close();
                    if (storeKeeperInfo != null)
                    {
                        _storenosql.CreateStoreKeeper(storeKeeperInfo);
                    }
                }
            }
            else
            {
                IDataReader reader = BrnMall.Core.BMAData.RDBS.GetStoreKeeperById(storeId);
                if (reader.Read())
                {
                    storeKeeperInfo = BuildStoreKeeperFromReader(reader);
                }
                reader.Close();
            }

            return(storeKeeperInfo);
        }
Exemple #2
0
 /// <summary>
 /// 更新店长
 /// </summary>
 /// <param name="storeKeeperInfo">店长信息</param>
 public static void UpdateStoreKeeper(StoreKeeperInfo storeKeeperInfo)
 {
     BrnMall.Core.BMAData.RDBS.UpdateStoreKeeper(storeKeeperInfo);
     if (_storenosql != null)
     {
         _storenosql.UpdateStoreKeeper(storeKeeperInfo);
     }
 }
Exemple #3
0
        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));
        }
Exemple #4
0
        /// <summary>
        /// 创建店铺
        /// </summary>
        /// <param name="storeInfo">店铺信息</param>
        /// <param name="storeKeeperInfo">店主信息</param>
        /// <returns>店铺id</returns>
        public static int CreateStore(StoreInfo storeInfo, StoreKeeperInfo storeKeeperInfo)
        {
            int storeId = NStore.Data.Stores.CreateStore(storeInfo);

            if (storeId > 0)
            {
                storeKeeperInfo.StoreId = storeId;
                CreateStoreKeeper(storeKeeperInfo);
            }
            return(storeId);
        }
Exemple #5
0
        /// <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);
        }
Exemple #6
0
        /// <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);
        }
Exemple #7
0
        /// <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);
        }
Exemple #8
0
        public ActionResult EditStoreKeeper(int storeId = -1)
        {
            StoreKeeperInfo storeKeeperInfo = AdminStores.GetStoreKeeperById(storeId);

            if (storeKeeperInfo == null)
            {
                return(PromptView("店长不存在"));
            }

            StoreKeeperModel model = new StoreKeeperModel();

            model.Type            = storeKeeperInfo.Type;
            model.StoreKeeperName = storeKeeperInfo.Name;
            model.IdCard          = storeKeeperInfo.IdCard;
            model.Address         = storeKeeperInfo.Address;

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
Exemple #9
0
        public ActionResult EditStoreKeeper(StoreKeeperModel model, int storeId = -1)
        {
            StoreKeeperInfo storeKeeperInfo = AdminStores.GetStoreKeeperById(storeId);

            if (storeKeeperInfo == null)
            {
                return(PromptView("店长不存在"));
            }

            if (ModelState.IsValid)
            {
                storeKeeperInfo.Type    = model.Type;
                storeKeeperInfo.Name    = model.StoreKeeperName;
                storeKeeperInfo.IdCard  = model.IdCard;
                storeKeeperInfo.Address = model.Address;

                AdminStores.UpdateStoreKeeper(storeKeeperInfo);
                AddMallAdminLog("修改店长", "修改店长,店铺ID为:" + storeId);
                return(PromptView("店长修改成功"));
            }

            ViewData["referer"] = MallUtils.GetMallAdminRefererCookie();
            return(View(model));
        }
Exemple #10
0
 /// <summary>
 /// 更新店长
 /// </summary>
 /// <param name="storeKeeperInfo">店长信息</param>
 public static void UpdateStoreKeeper(StoreKeeperInfo storeKeeperInfo)
 {
     NStore.Data.Stores.UpdateStoreKeeper(storeKeeperInfo);
 }
Exemple #11
0
 /// <summary>
 /// 创建店长
 /// </summary>
 /// <param name="storeKeeperInfo">店长信息</param>
 public static void CreateStoreKeeper(StoreKeeperInfo storeKeeperInfo)
 {
     NStore.Data.Stores.CreateStoreKeeper(storeKeeperInfo);
 }
Exemple #12
0
 /// <summary>
 /// 创建店长
 /// </summary>
 /// <param name="storeKeeperInfo">店长信息</param>
 public static void CreateStoreKeeper(StoreKeeperInfo storeKeeperInfo)
 {
     BrnMall.Core.BMAData.RDBS.CreateStoreKeeper(storeKeeperInfo);
 }