Example #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.CommodityFather model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CommodityFather set ");
            if (model.CommodityFatherName != null)
            {
                strSql.Append("CommodityFatherName='" + model.CommodityFatherName + "',");
            }
            else
            {
                strSql.Append("CommodityFatherName= null ,");
            }
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where CommodityFatherID='" + model.CommodityFatherID + "' ");
            int rowsAffected = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 private void ShowInfo(string CommodityFatherID)
 {
     Maticsoft.BLL.CommodityFather   bll   = new Maticsoft.BLL.CommodityFather();
     Maticsoft.Model.CommodityFather model = bll.GetModel(CommodityFatherID);
     this.lblCommodityFatherID.Text   = model.CommodityFatherID;
     this.lblCommodityFatherName.Text = model.CommodityFatherName;
 }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.CommodityFather model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.CommodityFatherID != null)
            {
                strSql1.Append("CommodityFatherID,");
                strSql2.Append("'" + model.CommodityFatherID + "',");
            }
            if (model.CommodityFatherName != null)
            {
                strSql1.Append("CommodityFatherName,");
                strSql2.Append("'" + model.CommodityFatherName + "',");
            }
            strSql.Append("insert into CommodityFather(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtCommodityFatherName.Text.Trim().Length == 0)
            {
                strErr += "CommodityFatherName不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string CommodityFatherID   = this.lblCommodityFatherID.Text;
            string CommodityFatherName = this.txtCommodityFatherName.Text;


            Maticsoft.Model.CommodityFather model = new Maticsoft.Model.CommodityFather();
            model.CommodityFatherID   = CommodityFatherID;
            model.CommodityFatherName = CommodityFatherName;

            Maticsoft.BLL.CommodityFather bll = new Maticsoft.BLL.CommodityFather();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #5
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Maticsoft.Model.CommodityFather modelnew = CommodityFather_BLL.GetModel(Request.QueryString["ID"].ToString());//引用id所在行的数据
     if ((CommodityFather_BLL.GetList("CommodityFatherName ='" + RadTextBox1.Text + "'").Tables[0].Rows.Count) != 0 && RadTextBox1.Text != modelnew.CommodityFatherName)
     {
         RadAjaxManager1.Alert("请输入不同名称!");
     }
     else
     {
         CommodityFather_Model = CommodityFather_BLL.GetModel(Request.QueryString["ID"].ToString());
         CommodityFather_Model.CommodityFatherName = RadTextBox1.Text;
         CommodityFather_BLL.Update(CommodityFather_Model);
         ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>");
     }
 }
Example #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.CommodityFather DataRowToModel(DataRow row)
 {
     Maticsoft.Model.CommodityFather model = new Maticsoft.Model.CommodityFather();
     if (row != null)
     {
         if (row["CommodityFatherID"] != null)
         {
             model.CommodityFatherID = row["CommodityFatherID"].ToString();
         }
         if (row["CommodityFatherName"] != null)
         {
             model.CommodityFatherName = row["CommodityFatherName"].ToString();
         }
     }
     return(model);
 }
Example #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (UsersInfo.UserID == "")
     {
         Response.Write("<script> alert('请先登录!'); window.location.href='/BackLogin.aspx' </script>");
         return;
     }
     if (!IsPostBack)
     {
         if (Request.QueryString["ID"] != null)
         {
             Maticsoft.Model.CommodityFather modelnew = CommodityFather_BLL.GetModel(Request.QueryString["ID"].ToString()); //引用id所在行的数据
             RadTextBox1.Text = modelnew.CommodityFatherName;                                                               //添加数据
         }
     }
 }
Example #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.CommodityFather GetModel(string CommodityFatherID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" CommodityFatherID,CommodityFatherName ");
            strSql.Append(" from CommodityFather ");
            strSql.Append(" where CommodityFatherID='" + CommodityFatherID + "' ");
            Maticsoft.Model.CommodityFather model = new Maticsoft.Model.CommodityFather();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }