Esempio n. 1
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     int num = Globals.SafeInt(this.txtAreaId.Value, 0);
     Maticsoft.Model.Ms.RegionAreas model = new Maticsoft.Model.Ms.RegionAreas {
         Name = Globals.HtmlEncode(this.tName.Text.Trim())
     };
     if (num > 0)
     {
         model.AreaId = num;
         if (this.bll.Update(model))
         {
             this.tName.Text = "";
             this.txtAreaId.Value = "";
             this.gridView.OnBind();
         }
         else
         {
             MessageBox.ShowFailTip(this, "编辑失败!请重试。");
         }
     }
     else if (this.bll.Add(model) > 0)
     {
         this.gridView.OnBind();
     }
     else
     {
         MessageBox.ShowFailTip(this, "添加失败!请重试。");
     }
 }
Esempio n. 2
0
 public Maticsoft.Model.Ms.RegionAreas DataRowToModel(DataRow row)
 {
     Maticsoft.Model.Ms.RegionAreas areas = new Maticsoft.Model.Ms.RegionAreas();
     if (row != null)
     {
         if ((row["AreaId"] != null) && (row["AreaId"].ToString() != ""))
         {
             areas.AreaId = int.Parse(row["AreaId"].ToString());
         }
         if (row["Name"] != null)
         {
             areas.Name = row["Name"].ToString();
         }
     }
     return areas;
 }