Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyERP.Model.VEHICLE_ORD_MASTER model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into VEHICLE_ORD_MASTER(");
            strSql.Append("BillNo,MANUAL_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,@MANUAL_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("@MANUAL_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.MANUAL_BILLNO;
            parameters[2].Value  = model.COMPANY_CODE;
            parameters[3].Value  = model.COMPANY_NAME;
            parameters[4].Value  = model.CUSTOM_CODE;
            parameters[5].Value  = model.CUSTOM_NAME;
            parameters[6].Value  = model.BILLTYPE;
            parameters[7].Value  = model.BILL_STATUS;
            parameters[8].Value  = model.STOCK_CODE;
            parameters[9].Value  = model.STOCK_NAME;
            parameters[10].Value = model.DEPARTMENT_CODE;
            parameters[11].Value = model.DEPARTMENT_NAME;
            parameters[12].Value = model.EMPLOYEE_CODE;
            parameters[13].Value = model.EMPLOYEE_NAME;
            parameters[14].Value = model.BILLDATE;
            parameters[15].Value = model.CREATE_DATE;
            parameters[16].Value = model.REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 private void ShowInfo(string BillNo)
 {
     MyERP.BLL.VEHICLE_ORD_MASTER   bll   = new MyERP.BLL.VEHICLE_ORD_MASTER();
     MyERP.Model.VEHICLE_ORD_MASTER model = bll.GetModel(BillNo);
     this.lblBillNo.Text          = model.BillNo;
     this.lblMANUAL_BILLNO.Text   = model.MANUAL_BILLNO;
     this.lblCOMPANY_CODE.Text    = model.COMPANY_CODE;
     this.lblCOMPANY_NAME.Text    = model.COMPANY_NAME;
     this.lblCUSTOM_CODE.Text     = model.CUSTOM_CODE;
     this.lblCUSTOM_NAME.Text     = model.CUSTOM_NAME;
     this.lblBILLTYPE.Text        = model.BILLTYPE;
     this.lblBILL_STATUS.Text     = model.BILL_STATUS;
     this.lblSTOCK_CODE.Text      = model.STOCK_CODE;
     this.lblSTOCK_NAME.Text      = model.STOCK_NAME;
     this.lblDEPARTMENT_CODE.Text = model.DEPARTMENT_CODE;
     this.lblDEPARTMENT_NAME.Text = model.DEPARTMENT_NAME;
     this.lblEMPLOYEE_CODE.Text   = model.EMPLOYEE_CODE;
     this.lblEMPLOYEE_NAME.Text   = model.EMPLOYEE_NAME;
     this.lblBILLDATE.Text        = model.BILLDATE.ToString();
     this.lblCREATE_DATE.Text     = model.CREATE_DATE.ToString();
     this.lblREMARK.Text          = model.REMARK;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MyERP.Model.VEHICLE_ORD_MASTER GetModel(string BillNo)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 BillNo,MANUAL_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 VEHICLE_ORD_MASTER ");
            strSql.Append(" where BillNo=@BillNo ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BillNo", SqlDbType.NVarChar, 50)
            };
            parameters[0].Value = BillNo;

            MyERP.Model.VEHICLE_ORD_MASTER model = new MyERP.Model.VEHICLE_ORD_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);
            }
        }
Ejemplo n.º 4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtBillNo.Text.Trim().Length == 0)
            {
                strErr += "BillNo不能为空!\\n";
            }
            if (this.txtMANUAL_BILLNO.Text.Trim().Length == 0)
            {
                strErr += "MANUAL_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   MANUAL_BILLNO   = this.txtMANUAL_BILLNO.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.VEHICLE_ORD_MASTER model = new MyERP.Model.VEHICLE_ORD_MASTER();
            model.BillNo          = BillNo;
            model.MANUAL_BILLNO   = MANUAL_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.VEHICLE_ORD_MASTER bll = new MyERP.BLL.VEHICLE_ORD_MASTER();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.VEHICLE_ORD_MASTER DataRowToModel(DataRow row)
 {
     MyERP.Model.VEHICLE_ORD_MASTER model = new MyERP.Model.VEHICLE_ORD_MASTER();
     if (row != null)
     {
         if (row["BillNo"] != null)
         {
             model.BillNo = row["BillNo"].ToString();
         }
         if (row["MANUAL_BILLNO"] != null)
         {
             model.MANUAL_BILLNO = row["MANUAL_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);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MyERP.Model.VEHICLE_ORD_MASTER model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update VEHICLE_ORD_MASTER set ");
            strSql.Append("MANUAL_BILLNO=@MANUAL_BILLNO,");
            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("@MANUAL_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),
                new SqlParameter("@BillNo",          SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.MANUAL_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;
            parameters[16].Value = model.BillNo;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }