Ejemplo n.º 1
0
 public List<Maticsoft.Model.SNS.GradeConfig> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.SNS.GradeConfig> list = new List<Maticsoft.Model.SNS.GradeConfig>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.SNS.GradeConfig item = new Maticsoft.Model.SNS.GradeConfig();
             if ((dt.Rows[i]["GradeID"] != null) && (dt.Rows[i]["GradeID"].ToString() != ""))
             {
                 item.GradeID = int.Parse(dt.Rows[i]["GradeID"].ToString());
             }
             if ((dt.Rows[i]["GradeName"] != null) && (dt.Rows[i]["GradeName"].ToString() != ""))
             {
                 item.GradeName = dt.Rows[i]["GradeName"].ToString();
             }
             if ((dt.Rows[i]["MinRange"] != null) && (dt.Rows[i]["MinRange"].ToString() != ""))
             {
                 item.MinRange = new int?(int.Parse(dt.Rows[i]["MinRange"].ToString()));
             }
             if ((dt.Rows[i]["MaxRange"] != null) && (dt.Rows[i]["MaxRange"].ToString() != ""))
             {
                 item.MaxRange = new int?(int.Parse(dt.Rows[i]["MaxRange"].ToString()));
             }
             if ((dt.Rows[i]["Remark"] != null) && (dt.Rows[i]["Remark"].ToString() != ""))
             {
                 item.Remark = dt.Rows[i]["Remark"].ToString();
             }
             list.Add(item);
         }
     }
     return list;
 }
Ejemplo n.º 2
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     this.btnCancle.Enabled = false;
     this.btnSave.Enabled = false;
     if (string.IsNullOrWhiteSpace(this.txtGradeName.Text))
     {
         this.btnCancle.Enabled = true;
         this.btnSave.Enabled = true;
         MessageBox.ShowFailTip(this, "请输入等级名称!");
     }
     else if (Globals.SafeInt(this.txtGradeName.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
     {
         int num = int.Parse(this.lblGradeID.Text);
         string text = this.txtGradeName.Text;
         int num2 = int.Parse(this.txtMinRange.Text);
         int num3 = int.Parse(this.txtMaxRange.Text);
         Maticsoft.Model.SNS.GradeConfig model = new Maticsoft.Model.SNS.GradeConfig {
             GradeID = num,
             GradeName = text,
             MinRange = new int?(num2),
             MaxRange = new int?(num3)
         };
         if (this.bll.Update(model))
         {
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "修改用户等级(GradeID=" + model.GradeID + ")成功", this);
             MessageBox.ShowSuccessTip(this, "保存成功!", "GradeList.aspx");
         }
         else
         {
             this.btnCancle.Enabled = true;
             this.btnSave.Enabled = true;
             MessageBox.ShowFailTip(this, "系统忙,请稍后再试!");
             LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "修改用户等级(GradeID=" + model.GradeID + ")失败", this);
         }
     }
 }
Ejemplo n.º 3
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     this.btnCancle.Enabled = false;
     this.btnSave.Enabled = false;
     if (string.IsNullOrWhiteSpace(this.txtGradeName.Text))
     {
         this.btnCancle.Enabled = true;
         this.btnSave.Enabled = true;
         MessageBox.ShowFailTip(this, "请输入等级名称!");
     }
     else if (Globals.SafeInt(this.txtGradeName.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.txtGradeName.Text))
     {
         this.btnCancle.Enabled = true;
         this.btnSave.Enabled = true;
         MessageBox.ShowFailTip(this, "请输入等级积分上限!");
     }
     else
     {
         string text = this.txtGradeName.Text;
         int num = int.Parse(this.txtMinRange.Text);
         int num2 = int.Parse(this.txtMaxRange.Text);
         Maticsoft.Model.SNS.GradeConfig model = new Maticsoft.Model.SNS.GradeConfig {
             GradeName = text,
             MinRange = new int?(num),
             MaxRange = new int?(num2)
         };
         Maticsoft.BLL.SNS.GradeConfig config2 = new Maticsoft.BLL.SNS.GradeConfig();
         int num3 = config2.Add(model);
         if (num3 > 0)
         {
             MessageBox.ShowSuccessTip(this, "保存成功!", "Gradelist.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);
         }
     }
 }