Exemple #1
0
 public void BindClassTypeID()
 {
     DataSet allList = new Maticsoft.BLL.CMS.ClassType().GetAllList();
     if (!DataSetTools.DataSetIsNull(allList))
     {
         this.dropClassTypeID.DataSource = allList;
         this.dropClassTypeID.DataTextField = "ClassTypeName";
         this.dropClassTypeID.DataValueField = "ClassTypeID";
         this.dropClassTypeID.DataBind();
     }
 }
Exemple #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     this.btnCancle.Enabled = false;
     this.btnSave.Enabled = false;
     if (string.IsNullOrWhiteSpace(this.txtClassTypeName.Text.Trim()))
     {
         MessageBox.ShowFailTip(this, "请输入类型名称!");
     }
     else
     {
         Maticsoft.BLL.CMS.ClassType type = new Maticsoft.BLL.CMS.ClassType();
         Maticsoft.Model.CMS.ClassType model = null;
         if (!string.IsNullOrWhiteSpace(this.txtClassTypeName.Text.Trim()) && !string.IsNullOrWhiteSpace(this.HiddenField_ID.Value))
         {
             string s = this.HiddenField_ID.Value;
             model = new Maticsoft.Model.CMS.ClassType {
                 ClassTypeID = int.Parse(s),
                 ClassTypeName = this.txtClassTypeName.Text.Trim()
             };
             if (type.Update(model))
             {
                 MessageBox.ResponseScript(this, "parent.location.href='List.aspx'");
                 MessageBox.ShowSuccessTip(this, "保存成功!");
             }
             else
             {
                 MessageBox.ShowFailTip(this, "保存失败!");
             }
         }
         else if (!string.IsNullOrWhiteSpace(this.txtClassTypeName.Text.Trim()))
         {
             model = new Maticsoft.Model.CMS.ClassType {
                 ClassTypeName = this.txtClassTypeName.Text.Trim()
             };
             if (type.Add(model))
             {
                 MessageBox.ResponseScript(this, "parent.location.href='List.aspx'");
                 MessageBox.ShowSuccessTip(this, "保存成功!");
             }
             else
             {
                 MessageBox.ShowFailTip(this, "保存失败!");
             }
         }
     }
 }
 private void ContentTypeAdd(HttpRequest Request, HttpResponse Response)
 {
     Maticsoft.BLL.CMS.ClassType type = new Maticsoft.BLL.CMS.ClassType();
     Maticsoft.Model.CMS.ClassType model = null;
     if (!string.IsNullOrWhiteSpace(Request.Params["ClassTypeName"]) && !string.IsNullOrWhiteSpace(Request.Params["ClassTypeID"]))
     {
         string s = Request.Params["ClassTypeID"];
         model = new Maticsoft.Model.CMS.ClassType {
             ClassTypeID = int.Parse(s),
             ClassTypeName = Request.Params["ClassTypeName"]
         };
         if (type.Update(model))
         {
             Response.Write("SUCCESS");
         }
         else
         {
             Response.Write("ADDFAILED");
         }
     }
     else if (!string.IsNullOrWhiteSpace(Request.Params["ClassTypeName"]))
     {
         model = new Maticsoft.Model.CMS.ClassType {
             ClassTypeName = Request.Params["ClassTypeName"]
         };
         if (type.Add(model))
         {
             Response.Write("SUCCESS");
         }
         else
         {
             Response.Write("EDITFAILED");
         }
     }
     else
     {
         Response.Write("FAILED");
     }
 }