Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyERP.Model.CL_RECEIPT_MASTER model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CL_RECEIPT_MASTER(");
            strSql.Append("BillNo,COMPANY_CODE,COMPANY_NAME,CUSTOM_CODE,CUSTOM_NAME,BILLTYPE,BILL_STATUS,STOCK_CODE,STOCK_NAME,DEPARTMENT_CODE,DEPARTMENT_NAME,EMPLOYEE_CODE,EMPLOYEE_NAME,BILLDATE,CREATE_DATE,REMARK)");
            strSql.Append(" values (");
            strSql.Append("@BillNo,@COMPANY_CODE,@COMPANY_NAME,@CUSTOM_CODE,@CUSTOM_NAME,@BILLTYPE,@BILL_STATUS,@STOCK_CODE,@STOCK_NAME,@DEPARTMENT_CODE,@DEPARTMENT_NAME,@EMPLOYEE_CODE,@EMPLOYEE_NAME,@BILLDATE,@CREATE_DATE,@REMARK)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BillNo",          SqlDbType.NVarChar,  50),
                new SqlParameter("@COMPANY_CODE",    SqlDbType.NVarChar,  50),
                new SqlParameter("@COMPANY_NAME",    SqlDbType.NVarChar,  50),
                new SqlParameter("@CUSTOM_CODE",     SqlDbType.NChar,     10),
                new SqlParameter("@CUSTOM_NAME",     SqlDbType.NVarChar,  50),
                new SqlParameter("@BILLTYPE",        SqlDbType.NVarChar,  50),
                new SqlParameter("@BILL_STATUS",     SqlDbType.NVarChar,  10),
                new SqlParameter("@STOCK_CODE",      SqlDbType.NVarChar,  50),
                new SqlParameter("@STOCK_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@DEPARTMENT_CODE", SqlDbType.NVarChar,  50),
                new SqlParameter("@DEPARTMENT_NAME", SqlDbType.NVarChar,  50),
                new SqlParameter("@EMPLOYEE_CODE",   SqlDbType.NVarChar,  50),
                new SqlParameter("@EMPLOYEE_NAME",   SqlDbType.NVarChar,  50),
                new SqlParameter("@BILLDATE",        SqlDbType.DateTime),
                new SqlParameter("@CREATE_DATE",     SqlDbType.DateTime),
                new SqlParameter("@REMARK",          SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.BillNo;
            parameters[1].Value  = model.COMPANY_CODE;
            parameters[2].Value  = model.COMPANY_NAME;
            parameters[3].Value  = model.CUSTOM_CODE;
            parameters[4].Value  = model.CUSTOM_NAME;
            parameters[5].Value  = model.BILLTYPE;
            parameters[6].Value  = model.BILL_STATUS;
            parameters[7].Value  = model.STOCK_CODE;
            parameters[8].Value  = model.STOCK_NAME;
            parameters[9].Value  = model.DEPARTMENT_CODE;
            parameters[10].Value = model.DEPARTMENT_NAME;
            parameters[11].Value = model.EMPLOYEE_CODE;
            parameters[12].Value = model.EMPLOYEE_NAME;
            parameters[13].Value = model.BILLDATE;
            parameters[14].Value = model.CREATE_DATE;
            parameters[15].Value = model.REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 private void ShowInfo(string BillNo)
 {
     MyERP.BLL.CL_RECEIPT_MASTER   bll   = new MyERP.BLL.CL_RECEIPT_MASTER();
     MyERP.Model.CL_RECEIPT_MASTER model = bll.GetModel(BillNo);
     this.lblBillNo.Text          = model.BillNo;
     this.txtCOMPANY_CODE.Text    = model.COMPANY_CODE;
     this.txtCOMPANY_NAME.Text    = model.COMPANY_NAME;
     this.txtCUSTOM_CODE.Text     = model.CUSTOM_CODE;
     this.txtCUSTOM_NAME.Text     = model.CUSTOM_NAME;
     this.txtBILLTYPE.Text        = model.BILLTYPE;
     this.txtBILL_STATUS.Text     = model.BILL_STATUS;
     this.txtSTOCK_CODE.Text      = model.STOCK_CODE;
     this.txtSTOCK_NAME.Text      = model.STOCK_NAME;
     this.txtDEPARTMENT_CODE.Text = model.DEPARTMENT_CODE;
     this.txtDEPARTMENT_NAME.Text = model.DEPARTMENT_NAME;
     this.txtEMPLOYEE_CODE.Text   = model.EMPLOYEE_CODE;
     this.txtEMPLOYEE_NAME.Text   = model.EMPLOYEE_NAME;
     this.txtBILLDATE.Text        = model.BILLDATE.ToString();
     this.txtCREATE_DATE.Text     = model.CREATE_DATE.ToString();
     this.txtREMARK.Text          = model.REMARK;
 }
Example #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MyERP.Model.CL_RECEIPT_MASTER GetModel(string BillNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 BillNo,COMPANY_CODE,COMPANY_NAME,CUSTOM_CODE,CUSTOM_NAME,BILLTYPE,BILL_STATUS,STOCK_CODE,STOCK_NAME,DEPARTMENT_CODE,DEPARTMENT_NAME,EMPLOYEE_CODE,EMPLOYEE_NAME,BILLDATE,CREATE_DATE,REMARK from CL_RECEIPT_MASTER ");
            strSql.Append(" where BillNo=@BillNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BillNo", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = BillNo;

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

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

            if (this.txtBillNo.Text.Trim().Length == 0)
            {
                strErr += "BillNo不能为空!\\n";
            }
            if (this.txtCOMPANY_CODE.Text.Trim().Length == 0)
            {
                strErr += "COMPANY_CODE不能为空!\\n";
            }
            if (this.txtCOMPANY_NAME.Text.Trim().Length == 0)
            {
                strErr += "COMPANY_NAME不能为空!\\n";
            }
            if (this.txtCUSTOM_CODE.Text.Trim().Length == 0)
            {
                strErr += "CUSTOM_CODE不能为空!\\n";
            }
            if (this.txtCUSTOM_NAME.Text.Trim().Length == 0)
            {
                strErr += "CUSTOM_NAME不能为空!\\n";
            }
            if (this.txtBILLTYPE.Text.Trim().Length == 0)
            {
                strErr += "BILLTYPE不能为空!\\n";
            }
            if (this.txtBILL_STATUS.Text.Trim().Length == 0)
            {
                strErr += "BILL_STATUS不能为空!\\n";
            }
            if (this.txtSTOCK_CODE.Text.Trim().Length == 0)
            {
                strErr += "STOCK_CODE不能为空!\\n";
            }
            if (this.txtSTOCK_NAME.Text.Trim().Length == 0)
            {
                strErr += "STOCK_NAME不能为空!\\n";
            }
            if (this.txtDEPARTMENT_CODE.Text.Trim().Length == 0)
            {
                strErr += "DEPARTMENT_CODE不能为空!\\n";
            }
            if (this.txtDEPARTMENT_NAME.Text.Trim().Length == 0)
            {
                strErr += "DEPARTMENT_NAME不能为空!\\n";
            }
            if (this.txtEMPLOYEE_CODE.Text.Trim().Length == 0)
            {
                strErr += "EMPLOYEE_CODE不能为空!\\n";
            }
            if (this.txtEMPLOYEE_NAME.Text.Trim().Length == 0)
            {
                strErr += "EMPLOYEE_NAME不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtBILLDATE.Text))
            {
                strErr += "BILLDATE格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtCREATE_DATE.Text))
            {
                strErr += "CREATE_DATE格式错误!\\n";
            }
            if (this.txtREMARK.Text.Trim().Length == 0)
            {
                strErr += "REMARK不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   BillNo          = this.txtBillNo.Text;
            string   COMPANY_CODE    = this.txtCOMPANY_CODE.Text;
            string   COMPANY_NAME    = this.txtCOMPANY_NAME.Text;
            string   CUSTOM_CODE     = this.txtCUSTOM_CODE.Text;
            string   CUSTOM_NAME     = this.txtCUSTOM_NAME.Text;
            string   BILLTYPE        = this.txtBILLTYPE.Text;
            string   BILL_STATUS     = this.txtBILL_STATUS.Text;
            string   STOCK_CODE      = this.txtSTOCK_CODE.Text;
            string   STOCK_NAME      = this.txtSTOCK_NAME.Text;
            string   DEPARTMENT_CODE = this.txtDEPARTMENT_CODE.Text;
            string   DEPARTMENT_NAME = this.txtDEPARTMENT_NAME.Text;
            string   EMPLOYEE_CODE   = this.txtEMPLOYEE_CODE.Text;
            string   EMPLOYEE_NAME   = this.txtEMPLOYEE_NAME.Text;
            DateTime BILLDATE        = DateTime.Parse(this.txtBILLDATE.Text);
            DateTime CREATE_DATE     = DateTime.Parse(this.txtCREATE_DATE.Text);
            string   REMARK          = this.txtREMARK.Text;

            MyERP.Model.CL_RECEIPT_MASTER model = new MyERP.Model.CL_RECEIPT_MASTER();
            model.BillNo          = BillNo;
            model.COMPANY_CODE    = COMPANY_CODE;
            model.COMPANY_NAME    = COMPANY_NAME;
            model.CUSTOM_CODE     = CUSTOM_CODE;
            model.CUSTOM_NAME     = CUSTOM_NAME;
            model.BILLTYPE        = BILLTYPE;
            model.BILL_STATUS     = BILL_STATUS;
            model.STOCK_CODE      = STOCK_CODE;
            model.STOCK_NAME      = STOCK_NAME;
            model.DEPARTMENT_CODE = DEPARTMENT_CODE;
            model.DEPARTMENT_NAME = DEPARTMENT_NAME;
            model.EMPLOYEE_CODE   = EMPLOYEE_CODE;
            model.EMPLOYEE_NAME   = EMPLOYEE_NAME;
            model.BILLDATE        = BILLDATE;
            model.CREATE_DATE     = CREATE_DATE;
            model.REMARK          = REMARK;

            MyERP.BLL.CL_RECEIPT_MASTER bll = new MyERP.BLL.CL_RECEIPT_MASTER();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Example #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MyERP.Model.CL_RECEIPT_MASTER model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CL_RECEIPT_MASTER set ");
            strSql.Append("COMPANY_CODE=@COMPANY_CODE,");
            strSql.Append("COMPANY_NAME=@COMPANY_NAME,");
            strSql.Append("CUSTOM_CODE=@CUSTOM_CODE,");
            strSql.Append("CUSTOM_NAME=@CUSTOM_NAME,");
            strSql.Append("BILLTYPE=@BILLTYPE,");
            strSql.Append("BILL_STATUS=@BILL_STATUS,");
            strSql.Append("STOCK_CODE=@STOCK_CODE,");
            strSql.Append("STOCK_NAME=@STOCK_NAME,");
            strSql.Append("DEPARTMENT_CODE=@DEPARTMENT_CODE,");
            strSql.Append("DEPARTMENT_NAME=@DEPARTMENT_NAME,");
            strSql.Append("EMPLOYEE_CODE=@EMPLOYEE_CODE,");
            strSql.Append("EMPLOYEE_NAME=@EMPLOYEE_NAME,");
            strSql.Append("BILLDATE=@BILLDATE,");
            strSql.Append("CREATE_DATE=@CREATE_DATE,");
            strSql.Append("REMARK=@REMARK");
            strSql.Append(" where BillNo=@BillNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@COMPANY_CODE",    SqlDbType.NVarChar,  50),
                new SqlParameter("@COMPANY_NAME",    SqlDbType.NVarChar,  50),
                new SqlParameter("@CUSTOM_CODE",     SqlDbType.NChar,     10),
                new SqlParameter("@CUSTOM_NAME",     SqlDbType.NVarChar,  50),
                new SqlParameter("@BILLTYPE",        SqlDbType.NVarChar,  50),
                new SqlParameter("@BILL_STATUS",     SqlDbType.NVarChar,  10),
                new SqlParameter("@STOCK_CODE",      SqlDbType.NVarChar,  50),
                new SqlParameter("@STOCK_NAME",      SqlDbType.NVarChar,  50),
                new SqlParameter("@DEPARTMENT_CODE", SqlDbType.NVarChar,  50),
                new SqlParameter("@DEPARTMENT_NAME", SqlDbType.NVarChar,  50),
                new SqlParameter("@EMPLOYEE_CODE",   SqlDbType.NVarChar,  50),
                new SqlParameter("@EMPLOYEE_NAME",   SqlDbType.NVarChar,  50),
                new SqlParameter("@BILLDATE",        SqlDbType.DateTime),
                new SqlParameter("@CREATE_DATE",     SqlDbType.DateTime),
                new SqlParameter("@REMARK",          SqlDbType.NVarChar,  50),
                new SqlParameter("@BillNo",          SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.COMPANY_CODE;
            parameters[1].Value  = model.COMPANY_NAME;
            parameters[2].Value  = model.CUSTOM_CODE;
            parameters[3].Value  = model.CUSTOM_NAME;
            parameters[4].Value  = model.BILLTYPE;
            parameters[5].Value  = model.BILL_STATUS;
            parameters[6].Value  = model.STOCK_CODE;
            parameters[7].Value  = model.STOCK_NAME;
            parameters[8].Value  = model.DEPARTMENT_CODE;
            parameters[9].Value  = model.DEPARTMENT_NAME;
            parameters[10].Value = model.EMPLOYEE_CODE;
            parameters[11].Value = model.EMPLOYEE_NAME;
            parameters[12].Value = model.BILLDATE;
            parameters[13].Value = model.CREATE_DATE;
            parameters[14].Value = model.REMARK;
            parameters[15].Value = model.BillNo;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.CL_RECEIPT_MASTER DataRowToModel(DataRow row)
 {
     MyERP.Model.CL_RECEIPT_MASTER model = new MyERP.Model.CL_RECEIPT_MASTER();
     if (row != null)
     {
         if (row["BillNo"] != null)
         {
             model.BillNo = row["BillNo"].ToString();
         }
         if (row["COMPANY_CODE"] != null)
         {
             model.COMPANY_CODE = row["COMPANY_CODE"].ToString();
         }
         if (row["COMPANY_NAME"] != null)
         {
             model.COMPANY_NAME = row["COMPANY_NAME"].ToString();
         }
         if (row["CUSTOM_CODE"] != null)
         {
             model.CUSTOM_CODE = row["CUSTOM_CODE"].ToString();
         }
         if (row["CUSTOM_NAME"] != null)
         {
             model.CUSTOM_NAME = row["CUSTOM_NAME"].ToString();
         }
         if (row["BILLTYPE"] != null)
         {
             model.BILLTYPE = row["BILLTYPE"].ToString();
         }
         if (row["BILL_STATUS"] != null)
         {
             model.BILL_STATUS = row["BILL_STATUS"].ToString();
         }
         if (row["STOCK_CODE"] != null)
         {
             model.STOCK_CODE = row["STOCK_CODE"].ToString();
         }
         if (row["STOCK_NAME"] != null)
         {
             model.STOCK_NAME = row["STOCK_NAME"].ToString();
         }
         if (row["DEPARTMENT_CODE"] != null)
         {
             model.DEPARTMENT_CODE = row["DEPARTMENT_CODE"].ToString();
         }
         if (row["DEPARTMENT_NAME"] != null)
         {
             model.DEPARTMENT_NAME = row["DEPARTMENT_NAME"].ToString();
         }
         if (row["EMPLOYEE_CODE"] != null)
         {
             model.EMPLOYEE_CODE = row["EMPLOYEE_CODE"].ToString();
         }
         if (row["EMPLOYEE_NAME"] != null)
         {
             model.EMPLOYEE_NAME = row["EMPLOYEE_NAME"].ToString();
         }
         if (row["BILLDATE"] != null && row["BILLDATE"].ToString() != "")
         {
             model.BILLDATE = DateTime.Parse(row["BILLDATE"].ToString());
         }
         if (row["CREATE_DATE"] != null && row["CREATE_DATE"].ToString() != "")
         {
             model.CREATE_DATE = DateTime.Parse(row["CREATE_DATE"].ToString());
         }
         if (row["REMARK"] != null)
         {
             model.REMARK = row["REMARK"].ToString();
         }
     }
     return(model);
 }