public ActionResult Add(UserRankModel model)
        {
            if (AdminUserRanks.GetUserRidByTitle(model.UserRankTitle) > 0)
                ModelState.AddModelError("UserRankTitle", "名称已经存在");

            if (ModelState.IsValid)
            {
                UserRankInfo userRankInfo = new UserRankInfo()
                {
                    System = 0,
                    Title = model.UserRankTitle,
                    Avatar = model.Avatar,
                    CreditsLower = model.CreditsLower,
                    CreditsUpper = model.CreditsUpper,
                    LimitDays = 0
                };

                AdminUserRanks.CreateUserRank(userRankInfo);
                AddAdminOperateLog("添加会员等级", "添加会员等级,会员等级为:" + model.UserRankTitle);
                return PromptView("会员等级添加成功");
            }
            Load();
            return View(model);
        }
Exemple #2
0
 /// <summary>
 /// 创建用户等级
 /// </summary>
 public void CreateUserRank(UserRankInfo userRankInfo)
 {
     DbParameter[] parms = {
                                 GenerateInParam("@system", SqlDbType.Int, 4, userRankInfo.System),
                                 GenerateInParam("@title", SqlDbType.NChar,50,userRankInfo.Title),
                                 GenerateInParam("@avatar", SqlDbType.Char,50,userRankInfo.Avatar),
                                 GenerateInParam("@creditslower", SqlDbType.Int, 4, userRankInfo.CreditsLower),
                                 GenerateInParam("@creditsupper", SqlDbType.Int,4,userRankInfo.CreditsUpper),
                                 GenerateInParam("@limitdays", SqlDbType.Int,4,userRankInfo.LimitDays)
                             };
     string commandText = string.Format("INSERT INTO [{0}userranks]([system],[title],[avatar],[creditslower],[creditsupper],[limitdays]) VALUES(@system,@title,@avatar,@creditslower,@creditsupper,@limitdays)",
                                         RdbsHelper.RdbsTablePre);
     RdbsHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
 }
Exemple #3
0
 /// <summary>
 /// 更新用户解禁时间
 /// </summary>
 /// <param name="uid">用户id</param>
 /// <param name="userRankInfo">用户等级</param>
 public static void UpdateUserLiftBanTimeByUid(int uid, UserRankInfo userRankInfo)
 {
     UpdateUserLiftBanTimeByUid(uid, DateTime.Now.AddDays(userRankInfo.LimitDays));
 }
Exemple #4
0
        /// <summary>
        /// 更新用户等级
        /// </summary>
        public void UpdateUserRank(UserRankInfo userRankInfo)
        {
            DbParameter[] parms = {
                                        GenerateInParam("@system", SqlDbType.Int, 4, userRankInfo.System),
                                        GenerateInParam("@title", SqlDbType.NChar,50,userRankInfo.Title),
                                        GenerateInParam("@avatar", SqlDbType.Char,50,userRankInfo.Avatar),
                                        GenerateInParam("@creditslower", SqlDbType.Int, 4, userRankInfo.CreditsLower),
                                        GenerateInParam("@creditsupper", SqlDbType.Int,4,userRankInfo.CreditsUpper),
                                        GenerateInParam("@limitdays", SqlDbType.Int,4,userRankInfo.LimitDays),
                                        GenerateInParam("@userrid", SqlDbType.SmallInt, 2, userRankInfo.UserRid)
                                    };

            string commandText = string.Format("UPDATE [{0}userranks] SET [system]=@system,[title]=@title,[avatar]=@avatar,[creditslower]=@creditslower,[creditsupper]=@creditsupper,[limitdays]=@limitdays WHERE [userrid]=@userrid",
                                                RdbsHelper.RdbsTablePre);
            RdbsHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
        }