예제 #1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     this.btnCancle.Enabled = false;
     this.btnSave.Enabled = false;
     if (string.IsNullOrWhiteSpace(this.txtName.Text))
     {
         this.btnCancle.Enabled = true;
         this.btnSave.Enabled = true;
         MessageBox.ShowFailTip(this, "请输入等级名称!");
     }
     else if (Globals.SafeInt(this.txtName.Text, 0) > 20)
     {
         this.btnCancle.Enabled = true;
         this.btnSave.Enabled = true;
         MessageBox.ShowFailTip(this, "请输入0-20之间正确的等级名称!");
     }
     else if (string.IsNullOrWhiteSpace(this.txtMinRange.Text))
     {
         this.btnCancle.Enabled = true;
         this.btnSave.Enabled = true;
         MessageBox.ShowFailTip(this, "请输入等级积分下限!");
     }
     else if (string.IsNullOrWhiteSpace(this.txtMaxRange.Text))
     {
         this.btnCancle.Enabled = true;
         this.btnSave.Enabled = true;
         MessageBox.ShowFailTip(this, "请输入等级积分上限!");
     }
     else
     {
         string text = this.txtName.Text;
         int num = int.Parse(this.txtMinRange.Text);
         int num2 = int.Parse(this.txtMaxRange.Text);
         Maticsoft.Model.Members.UserRank model = new Maticsoft.Model.Members.UserRank {
             Name = text,
             PointMin = num,
             PointMax = num2,
             IsDefault = false,
             Description = this.txtDesc.Text,
             PriceOperations = "",
             PriceType = "",
             PriceValue = 0M,
             RankType = 0
         };
         Maticsoft.BLL.Members.UserRank rank2 = new Maticsoft.BLL.Members.UserRank();
         int num3 = rank2.Add(model);
         if (num3 > 0)
         {
             MessageBox.ShowSuccessTip(this, "保存成功!", "RankList.aspx");
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加用户等级(GradeID=" + num3 + ")成功", this);
         }
         else
         {
             this.btnCancle.Enabled = true;
             this.btnSave.Enabled = true;
             MessageBox.ShowFailTip(this, "系统忙,请稍后再试!");
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "添加用户等级失败", this);
         }
     }
 }
예제 #2
0
 public Maticsoft.Model.Members.UserRank DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Members.UserRank rank = new Maticsoft.Model.Members.UserRank();
     if (row != null)
     {
         if ((row["RankId"] != null) && (row["RankId"].ToString() != ""))
         {
             rank.RankId = int.Parse(row["RankId"].ToString());
         }
         if (row["Name"] != null)
         {
             rank.Name = row["Name"].ToString();
         }
         if (row["Description"] != null)
         {
             rank.Description = row["Description"].ToString();
         }
         if ((row["PointMax"] != null) && (row["PointMax"].ToString() != ""))
         {
             rank.PointMax = int.Parse(row["PointMax"].ToString());
         }
         if ((row["PointMin"] != null) && (row["PointMin"].ToString() != ""))
         {
             rank.PointMin = int.Parse(row["PointMin"].ToString());
         }
         if ((row["IsDefault"] != null) && (row["IsDefault"].ToString() != ""))
         {
             if ((row["IsDefault"].ToString() == "1") || (row["IsDefault"].ToString().ToLower() == "true"))
             {
                 rank.IsDefault = true;
             }
             else
             {
                 rank.IsDefault = false;
             }
         }
         if ((row["RankType"] != null) && (row["RankType"].ToString() != ""))
         {
             rank.RankType = int.Parse(row["RankType"].ToString());
         }
         if ((row["NumberOfMemberRanks"] != null) && (row["NumberOfMemberRanks"].ToString() != ""))
         {
             rank.NumberOfMemberRanks = new int?(int.Parse(row["NumberOfMemberRanks"].ToString()));
         }
         if ((row["IsMemberCreated"] != null) && (row["IsMemberCreated"].ToString() != ""))
         {
             if ((row["IsMemberCreated"].ToString() == "1") || (row["IsMemberCreated"].ToString().ToLower() == "true"))
             {
                 rank.IsMemberCreated = true;
             }
             else
             {
                 rank.IsMemberCreated = false;
             }
         }
         if ((row["CreatorUserId"] != null) && (row["CreatorUserId"].ToString() != ""))
         {
             rank.CreatorUserId = new int?(int.Parse(row["CreatorUserId"].ToString()));
         }
         if (row["PriceType"] != null)
         {
             rank.PriceType = row["PriceType"].ToString();
         }
         if (row["PriceOperations"] != null)
         {
             rank.PriceOperations = row["PriceOperations"].ToString();
         }
         if ((row["PriceValue"] != null) && (row["PriceValue"].ToString() != ""))
         {
             rank.PriceValue = decimal.Parse(row["PriceValue"].ToString());
         }
     }
     return rank;
 }