示例#1
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, "保存失败!");
             }
         }
     }
 }
示例#2
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.txtClassTypeName.Text))
     {
         MessageBox.ShowFailTip(this, CMS.ClassErrorNameNotNull);
     }
     else
     {
         Maticsoft.Model.CMS.ClassType model = new Maticsoft.Model.CMS.ClassType {
             ClassTypeID = Globals.SafeInt(this.lblClassTypeID.Text, 0),
             ClassTypeName = this.txtClassTypeName.Text
         };
         if (this.bll.Update(model))
         {
             MessageBox.ShowSuccessTip(this, Site.TooltipUpdateOK, "List.aspx");
         }
         else
         {
             MessageBox.ShowFailTip(this, Site.TooltipUpdateError, "List.aspx");
         }
     }
 }
示例#3
0
 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");
     }
 }
示例#4
0
 public List<Maticsoft.Model.CMS.ClassType> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Model.CMS.ClassType> list = new List<Maticsoft.Model.CMS.ClassType>();
     if (DataTableTools.DataTableIsNull(dt))
     {
         return null;
     }
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Model.CMS.ClassType item = new Maticsoft.Model.CMS.ClassType();
             if (dt.Rows[i]["ClassTypeID"].ToString() != "")
             {
                 item.ClassTypeID = int.Parse(dt.Rows[i]["ClassTypeID"].ToString());
             }
             item.ClassTypeName = dt.Rows[i]["ClassTypeName"].ToString();
             list.Add(item);
         }
     }
     return list;
 }
示例#5
0
 public Maticsoft.Model.CMS.ClassType GetModel(int ClassTypeID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select  top 1 ClassTypeID,ClassTypeName from CMS_ClassType ");
     builder.Append(" where ClassTypeID=@ClassTypeID ");
     SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ClassTypeID", SqlDbType.Int, 4) };
     cmdParms[0].Value = ClassTypeID;
     Maticsoft.Model.CMS.ClassType type = new Maticsoft.Model.CMS.ClassType();
     DataSet ds = DbHelperSQL.Query(builder.ToString(), cmdParms);
     if (DataSetTools.DataSetIsNull(ds))
     {
         return null;
     }
     if (ds.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (ds.Tables[0].Rows[0]["ClassTypeID"].ToString() != "")
     {
         type.ClassTypeID = int.Parse(ds.Tables[0].Rows[0]["ClassTypeID"].ToString());
     }
     if (ds.Tables[0].Rows[0]["ClassTypeName"] != null)
     {
         type.ClassTypeName = ds.Tables[0].Rows[0]["ClassTypeName"].ToString();
     }
     return type;
 }