Ejemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.WL_RECEIPT_MASTER DataRowToModel(DataRow row)
 {
     MyERP.Model.WL_RECEIPT_MASTER model = new MyERP.Model.WL_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["PARENT_COMPANY_CODE"] != null)
         {
             model.PARENT_COMPANY_CODE = row["PARENT_COMPANY_CODE"].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["STOCK_CODE"] != null)
         {
             model.STOCK_CODE = row["STOCK_CODE"].ToString();
         }
         if (row["STOCK_NAME"] != null)
         {
             model.STOCK_NAME = row["STOCK_NAME"].ToString();
         }
         if (row["INSTOCK_CODE"] != null)
         {
             model.INSTOCK_CODE = row["INSTOCK_CODE"].ToString();
         }
         if (row["INSTOCK_NAME"] != null)
         {
             model.INSTOCK_NAME = row["INSTOCK_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["BILL_STATUS"] != null)
         {
             model.BILL_STATUS = row["BILL_STATUS"].ToString();
         }
         if (row["PayAcount"] != null && row["PayAcount"].ToString() != "")
         {
             model.PayAcount = decimal.Parse(row["PayAcount"].ToString());
         }
         if (row["REMARK"] != null)
         {
             model.REMARK = row["REMARK"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            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.txtPARENT_COMPANY_CODE.Text.Trim().Length == 0)
            {
                strErr += "PARENT_COMPANY_CODE不能为空!\\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.txtSTOCK_CODE.Text.Trim().Length == 0)
            {
                strErr += "STOCK_CODE不能为空!\\n";
            }
            if (this.txtSTOCK_NAME.Text.Trim().Length == 0)
            {
                strErr += "STOCK_NAME不能为空!\\n";
            }
            if (this.txtINSTOCK_CODE.Text.Trim().Length == 0)
            {
                strErr += "INSTOCK_CODE不能为空!\\n";
            }
            if (this.txtINSTOCK_NAME.Text.Trim().Length == 0)
            {
                strErr += "INSTOCK_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 (this.txtBILL_STATUS.Text.Trim().Length == 0)
            {
                strErr += "BILL_STATUS不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtPayAcount.Text))
            {
                strErr += "PayAcount格式错误!\\n";
            }
            if (this.txtREMARK.Text.Trim().Length == 0)
            {
                strErr += "REMARK不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   BillNO              = this.lblBillNO.Text;
            string   COMPANY_CODE        = this.txtCOMPANY_CODE.Text;
            string   COMPANY_NAME        = this.txtCOMPANY_NAME.Text;
            string   PARENT_COMPANY_CODE = this.txtPARENT_COMPANY_CODE.Text;
            string   CUSTOM_CODE         = this.txtCUSTOM_CODE.Text;
            string   CUSTOM_NAME         = this.txtCUSTOM_NAME.Text;
            string   BillTYPE            = this.txtBillTYPE.Text;
            string   STOCK_CODE          = this.txtSTOCK_CODE.Text;
            string   STOCK_NAME          = this.txtSTOCK_NAME.Text;
            string   INSTOCK_CODE        = this.txtINSTOCK_CODE.Text;
            string   INSTOCK_NAME        = this.txtINSTOCK_NAME.Text;
            string   EMPLOYEE_CODE       = this.txtEMPLOYEE_CODE.Text;
            string   EMPLOYEE_NAME       = this.txtEMPLOYEE_NAME.Text;
            DateTime BillDate            = DateTime.Parse(this.txtBillDate.Text);
            string   BILL_STATUS         = this.txtBILL_STATUS.Text;
            decimal  PayAcount           = decimal.Parse(this.txtPayAcount.Text);
            string   REMARK              = this.txtREMARK.Text;


            MyERP.Model.WL_RECEIPT_MASTER model = new MyERP.Model.WL_RECEIPT_MASTER();
            model.BillNO              = BillNO;
            model.COMPANY_CODE        = COMPANY_CODE;
            model.COMPANY_NAME        = COMPANY_NAME;
            model.PARENT_COMPANY_CODE = PARENT_COMPANY_CODE;
            model.CUSTOM_CODE         = CUSTOM_CODE;
            model.CUSTOM_NAME         = CUSTOM_NAME;
            model.BillTYPE            = BillTYPE;
            model.STOCK_CODE          = STOCK_CODE;
            model.STOCK_NAME          = STOCK_NAME;
            model.INSTOCK_CODE        = INSTOCK_CODE;
            model.INSTOCK_NAME        = INSTOCK_NAME;
            model.EMPLOYEE_CODE       = EMPLOYEE_CODE;
            model.EMPLOYEE_NAME       = EMPLOYEE_NAME;
            model.BillDate            = BillDate;
            model.BILL_STATUS         = BILL_STATUS;
            model.PayAcount           = PayAcount;
            model.REMARK              = REMARK;

            MyERP.BLL.WL_RECEIPT_MASTER bll = new MyERP.BLL.WL_RECEIPT_MASTER();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MyERP.Model.WL_RECEIPT_MASTER model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update WL_RECEIPT_MASTER set ");
            strSql.Append("COMPANY_CODE=@COMPANY_CODE,");
            strSql.Append("COMPANY_NAME=@COMPANY_NAME,");
            strSql.Append("PARENT_COMPANY_CODE=@PARENT_COMPANY_CODE,");
            strSql.Append("CUSTOM_CODE=@CUSTOM_CODE,");
            strSql.Append("CUSTOM_NAME=@CUSTOM_NAME,");
            strSql.Append("BillTYPE=@BillTYPE,");
            strSql.Append("STOCK_CODE=@STOCK_CODE,");
            strSql.Append("STOCK_NAME=@STOCK_NAME,");
            strSql.Append("INSTOCK_CODE=@INSTOCK_CODE,");
            strSql.Append("INSTOCK_NAME=@INSTOCK_NAME,");
            strSql.Append("EMPLOYEE_CODE=@EMPLOYEE_CODE,");
            strSql.Append("EMPLOYEE_NAME=@EMPLOYEE_NAME,");
            strSql.Append("BillDate=@BillDate,");
            strSql.Append("BILL_STATUS=@BILL_STATUS,");
            strSql.Append("PayAcount=@PayAcount,");
            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("@PARENT_COMPANY_CODE", SqlDbType.NVarChar,  50),
                new SqlParameter("@CUSTOM_CODE",         SqlDbType.NVarChar,  50),
                new SqlParameter("@CUSTOM_NAME",         SqlDbType.NVarChar,  50),
                new SqlParameter("@BillTYPE",            SqlDbType.NVarChar,  50),
                new SqlParameter("@STOCK_CODE",          SqlDbType.NVarChar,  50),
                new SqlParameter("@STOCK_NAME",          SqlDbType.NVarChar,  50),
                new SqlParameter("@INSTOCK_CODE",        SqlDbType.NVarChar,  50),
                new SqlParameter("@INSTOCK_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("@BILL_STATUS",         SqlDbType.NVarChar,  10),
                new SqlParameter("@PayAcount",           SqlDbType.Float,      8),
                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.PARENT_COMPANY_CODE;
            parameters[3].Value  = model.CUSTOM_CODE;
            parameters[4].Value  = model.CUSTOM_NAME;
            parameters[5].Value  = model.BillTYPE;
            parameters[6].Value  = model.STOCK_CODE;
            parameters[7].Value  = model.STOCK_NAME;
            parameters[8].Value  = model.INSTOCK_CODE;
            parameters[9].Value  = model.INSTOCK_NAME;
            parameters[10].Value = model.EMPLOYEE_CODE;
            parameters[11].Value = model.EMPLOYEE_NAME;
            parameters[12].Value = model.BillDate;
            parameters[13].Value = model.BILL_STATUS;
            parameters[14].Value = model.PayAcount;
            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);
            }
        }