Beispiel #1
0
 private void ShowInfo(string DICT_CODE)
 {
     MyERP.BLL.PUB_DICT   bll   = new MyERP.BLL.PUB_DICT();
     MyERP.Model.PUB_DICT model = bll.GetModel(DICT_CODE);
     this.lblDICT_CODE.Text        = model.DICT_CODE;
     this.txtDICT_NAME.Text        = model.DICT_NAME;
     this.txtPARENT_DICT_CODE.Text = model.PARENT_DICT_CODE;
     this.txtCREATE_NAME.Text      = model.CREATE_NAME;
     this.txtCREATE_DATE.Text      = model.CREATE_DATE.ToString();
     this.txtUPDATE_NAME.Text      = model.UPDATE_NAME;
     this.txtUPDATE_DATE.Text      = model.UPDATE_DATE.ToString();
     this.txtREMARK.Text           = model.REMARK;
 }
Beispiel #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MyERP.Model.PUB_DICT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update PUB_DICT set ");
            strSql.Append("DICT_NAME=@DICT_NAME,");
            strSql.Append("PARENT_DICT_CODE=@PARENT_DICT_CODE,");
            strSql.Append("CREATE_NAME=@CREATE_NAME,");
            strSql.Append("CREATE_DATE=@CREATE_DATE,");
            strSql.Append("UPDATE_NAME=@UPDATE_NAME,");
            strSql.Append("UPDATE_DATE=@UPDATE_DATE,");
            strSql.Append("REMARK=@REMARK");
            strSql.Append(" where DICT_CODE=@DICT_CODE ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DICT_NAME",        SqlDbType.NVarChar,  50),
                new SqlParameter("@PARENT_DICT_CODE", SqlDbType.NVarChar,  50),
                new SqlParameter("@CREATE_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@CREATE_DATE",      SqlDbType.DateTime),
                new SqlParameter("@UPDATE_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@UPDATE_DATE",      SqlDbType.DateTime),
                new SqlParameter("@REMARK",           SqlDbType.NChar,     10),
                new SqlParameter("@DICT_CODE",        SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = model.DICT_NAME;
            parameters[1].Value = model.PARENT_DICT_CODE;
            parameters[2].Value = model.CREATE_NAME;
            parameters[3].Value = model.CREATE_DATE;
            parameters[4].Value = model.UPDATE_NAME;
            parameters[5].Value = model.UPDATE_DATE;
            parameters[6].Value = model.REMARK;
            parameters[7].Value = model.DICT_CODE;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.PUB_DICT DataRowToModel(DataRow row)
 {
     MyERP.Model.PUB_DICT model = new MyERP.Model.PUB_DICT();
     if (row != null)
     {
         if (row["DICT_CODE"] != null)
         {
             model.DICT_CODE = row["DICT_CODE"].ToString();
         }
         if (row["DICT_NAME"] != null)
         {
             model.DICT_NAME = row["DICT_NAME"].ToString();
         }
         if (row["PARENT_DICT_CODE"] != null)
         {
             model.PARENT_DICT_CODE = row["PARENT_DICT_CODE"].ToString();
         }
         if (row["CREATE_NAME"] != null)
         {
             model.CREATE_NAME = row["CREATE_NAME"].ToString();
         }
         if (row["CREATE_DATE"] != null && row["CREATE_DATE"].ToString() != "")
         {
             model.CREATE_DATE = DateTime.Parse(row["CREATE_DATE"].ToString());
         }
         if (row["UPDATE_NAME"] != null)
         {
             model.UPDATE_NAME = row["UPDATE_NAME"].ToString();
         }
         if (row["UPDATE_DATE"] != null && row["UPDATE_DATE"].ToString() != "")
         {
             model.UPDATE_DATE = DateTime.Parse(row["UPDATE_DATE"].ToString());
         }
         if (row["REMARK"] != null)
         {
             model.REMARK = row["REMARK"].ToString();
         }
     }
     return(model);
 }
Beispiel #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyERP.Model.PUB_DICT model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into PUB_DICT(");
            strSql.Append("DICT_CODE,DICT_NAME,PARENT_DICT_CODE,CREATE_NAME,CREATE_DATE,UPDATE_NAME,UPDATE_DATE,REMARK)");
            strSql.Append(" values (");
            strSql.Append("@DICT_CODE,@DICT_NAME,@PARENT_DICT_CODE,@CREATE_NAME,@CREATE_DATE,@UPDATE_NAME,@UPDATE_DATE,@REMARK)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DICT_CODE",        SqlDbType.NVarChar,  50),
                new SqlParameter("@DICT_NAME",        SqlDbType.NVarChar,  50),
                new SqlParameter("@PARENT_DICT_CODE", SqlDbType.NVarChar,  50),
                new SqlParameter("@CREATE_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@CREATE_DATE",      SqlDbType.DateTime),
                new SqlParameter("@UPDATE_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@UPDATE_DATE",      SqlDbType.DateTime),
                new SqlParameter("@REMARK",           SqlDbType.NChar, 10)
            };
            parameters[0].Value = model.DICT_CODE;
            parameters[1].Value = model.DICT_NAME;
            parameters[2].Value = model.PARENT_DICT_CODE;
            parameters[3].Value = model.CREATE_NAME;
            parameters[4].Value = model.CREATE_DATE;
            parameters[5].Value = model.UPDATE_NAME;
            parameters[6].Value = model.UPDATE_DATE;
            parameters[7].Value = model.REMARK;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MyERP.Model.PUB_DICT GetModel(string DICT_CODE)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 DICT_CODE,DICT_NAME,PARENT_DICT_CODE,CREATE_NAME,CREATE_DATE,UPDATE_NAME,UPDATE_DATE,REMARK from PUB_DICT ");
            strSql.Append(" where DICT_CODE=@DICT_CODE ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DICT_CODE", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = DICT_CODE;

            MyERP.Model.PUB_DICT model = new MyERP.Model.PUB_DICT();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtDICT_CODE.Text.Trim().Length == 0)
            {
                strErr += "DICT_CODE不能为空!\\n";
            }
            if (this.txtDICT_NAME.Text.Trim().Length == 0)
            {
                strErr += "DICT_NAME不能为空!\\n";
            }
            if (this.txtPARENT_DICT_CODE.Text.Trim().Length == 0)
            {
                strErr += "PARENT_DICT_CODE不能为空!\\n";
            }
            if (this.txtCREATE_NAME.Text.Trim().Length == 0)
            {
                strErr += "CREATE_NAME不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtCREATE_DATE.Text))
            {
                strErr += "CREATE_DATE格式错误!\\n";
            }
            if (this.txtUPDATE_NAME.Text.Trim().Length == 0)
            {
                strErr += "UPDATE_NAME不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtUPDATE_DATE.Text))
            {
                strErr += "UPDATE_DATE格式错误!\\n";
            }
            if (this.txtREMARK.Text.Trim().Length == 0)
            {
                strErr += "REMARK不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   DICT_CODE        = this.txtDICT_CODE.Text;
            string   DICT_NAME        = this.txtDICT_NAME.Text;
            string   PARENT_DICT_CODE = this.txtPARENT_DICT_CODE.Text;
            string   CREATE_NAME      = this.txtCREATE_NAME.Text;
            DateTime CREATE_DATE      = DateTime.Parse(this.txtCREATE_DATE.Text);
            string   UPDATE_NAME      = this.txtUPDATE_NAME.Text;
            DateTime UPDATE_DATE      = DateTime.Parse(this.txtUPDATE_DATE.Text);
            string   REMARK           = this.txtREMARK.Text;

            MyERP.Model.PUB_DICT model = new MyERP.Model.PUB_DICT();
            model.DICT_CODE        = DICT_CODE;
            model.DICT_NAME        = DICT_NAME;
            model.PARENT_DICT_CODE = PARENT_DICT_CODE;
            model.CREATE_NAME      = CREATE_NAME;
            model.CREATE_DATE      = CREATE_DATE;
            model.UPDATE_NAME      = UPDATE_NAME;
            model.UPDATE_DATE      = UPDATE_DATE;
            model.REMARK           = REMARK;

            MyERP.BLL.PUB_DICT bll = new MyERP.BLL.PUB_DICT();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }