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

            strSql.Append("update ORDER_ZBWGDETAIL set ");
            strSql.Append("DetailID=@DetailID,");
            strSql.Append("BillNO=@BillNO,");
            strSql.Append("Sequence=@Sequence,");
            strSql.Append("ItemInternalCode=@ItemInternalCode,");
            strSql.Append("ZXBJNO=@ZXBJNO,");
            strSql.Append("ZXBJNAME=@ZXBJNAME,");
            strSql.Append("Quantity=@Quantity,");
            strSql.Append("FPqty=@FPqty,");
            strSql.Append("CREATE_DATE=@CREATE_DATE,");
            strSql.Append("CREATE_NAME=@CREATE_NAME,");
            strSql.Append("REMARK=@REMARK");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DetailID",         SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@BillNO",           SqlDbType.VarChar,          50),
                new SqlParameter("@Sequence",         SqlDbType.VarChar,          50),
                new SqlParameter("@ItemInternalCode", SqlDbType.VarChar,          50),
                new SqlParameter("@ZXBJNO",           SqlDbType.VarChar,          50),
                new SqlParameter("@ZXBJNAME",         SqlDbType.VarChar,          50),
                new SqlParameter("@Quantity",         SqlDbType.Int,               4),
                new SqlParameter("@FPqty",            SqlDbType.Int,               4),
                new SqlParameter("@CREATE_DATE",      SqlDbType.NVarChar,         10),
                new SqlParameter("@CREATE_NAME",      SqlDbType.NVarChar,         10),
                new SqlParameter("@REMARK",           SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = model.DetailID;
            parameters[1].Value  = model.BillNO;
            parameters[2].Value  = model.Sequence;
            parameters[3].Value  = model.ItemInternalCode;
            parameters[4].Value  = model.ZXBJNO;
            parameters[5].Value  = model.ZXBJNAME;
            parameters[6].Value  = model.Quantity;
            parameters[7].Value  = model.FPqty;
            parameters[8].Value  = model.CREATE_DATE;
            parameters[9].Value  = model.CREATE_NAME;
            parameters[10].Value = model.REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.ORDER_ZBWGDETAIL DataRowToModel(DataRow row)
 {
     MyERP.Model.ORDER_ZBWGDETAIL model = new MyERP.Model.ORDER_ZBWGDETAIL();
     if (row != null)
     {
         if (row["DetailID"] != null && row["DetailID"].ToString() != "")
         {
             model.DetailID = new Guid(row["DetailID"].ToString());
         }
         if (row["BillNO"] != null)
         {
             model.BillNO = row["BillNO"].ToString();
         }
         if (row["Sequence"] != null)
         {
             model.Sequence = row["Sequence"].ToString();
         }
         if (row["ItemInternalCode"] != null)
         {
             model.ItemInternalCode = row["ItemInternalCode"].ToString();
         }
         if (row["ZXBJNO"] != null)
         {
             model.ZXBJNO = row["ZXBJNO"].ToString();
         }
         if (row["ZXBJNAME"] != null)
         {
             model.ZXBJNAME = row["ZXBJNAME"].ToString();
         }
         if (row["Quantity"] != null && row["Quantity"].ToString() != "")
         {
             model.Quantity = int.Parse(row["Quantity"].ToString());
         }
         if (row["FPqty"] != null && row["FPqty"].ToString() != "")
         {
             model.FPqty = int.Parse(row["FPqty"].ToString());
         }
         if (row["CREATE_DATE"] != null)
         {
             model.CREATE_DATE = row["CREATE_DATE"].ToString();
         }
         if (row["CREATE_NAME"] != null)
         {
             model.CREATE_NAME = row["CREATE_NAME"].ToString();
         }
         if (row["REMARK"] != null)
         {
             model.REMARK = row["REMARK"].ToString();
         }
     }
     return(model);
 }
Example #3
0
 private void ShowInfo()
 {
     MyERP.BLL.ORDER_ZBWGDETAIL   bll   = new MyERP.BLL.ORDER_ZBWGDETAIL();
     MyERP.Model.ORDER_ZBWGDETAIL model = bll.GetModel();
     this.lblDetailID.Text         = model.DetailID.ToString();
     this.txtBillNO.Text           = model.BillNO;
     this.txtSequence.Text         = model.Sequence;
     this.txtItemInternalCode.Text = model.ItemInternalCode;
     this.txtZXBJNO.Text           = model.ZXBJNO;
     this.txtZXBJNAME.Text         = model.ZXBJNAME;
     this.txtQuantity.Text         = model.Quantity.ToString();
     this.txtFPqty.Text            = model.FPqty.ToString();
     this.txtCREATE_DATE.Text      = model.CREATE_DATE;
     this.txtCREATE_NAME.Text      = model.CREATE_NAME;
     this.txtREMARK.Text           = model.REMARK;
 }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyERP.Model.ORDER_ZBWGDETAIL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ORDER_ZBWGDETAIL(");
            strSql.Append("DetailID,BillNO,Sequence,ItemInternalCode,ZXBJNO,ZXBJNAME,Quantity,FPqty,CREATE_DATE,CREATE_NAME,REMARK)");
            strSql.Append(" values (");
            strSql.Append("@DetailID,@BillNO,@Sequence,@ItemInternalCode,@ZXBJNO,@ZXBJNAME,@Quantity,@FPqty,@CREATE_DATE,@CREATE_NAME,@REMARK)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DetailID",         SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@BillNO",           SqlDbType.VarChar,          50),
                new SqlParameter("@Sequence",         SqlDbType.VarChar,          50),
                new SqlParameter("@ItemInternalCode", SqlDbType.VarChar,          50),
                new SqlParameter("@ZXBJNO",           SqlDbType.VarChar,          50),
                new SqlParameter("@ZXBJNAME",         SqlDbType.VarChar,          50),
                new SqlParameter("@Quantity",         SqlDbType.Int,               4),
                new SqlParameter("@FPqty",            SqlDbType.Int,               4),
                new SqlParameter("@CREATE_DATE",      SqlDbType.NVarChar,         10),
                new SqlParameter("@CREATE_NAME",      SqlDbType.NVarChar,         10),
                new SqlParameter("@REMARK",           SqlDbType.NVarChar, 50)
            };
            parameters[0].Value  = Guid.NewGuid();
            parameters[1].Value  = model.BillNO;
            parameters[2].Value  = model.Sequence;
            parameters[3].Value  = model.ItemInternalCode;
            parameters[4].Value  = model.ZXBJNO;
            parameters[5].Value  = model.ZXBJNAME;
            parameters[6].Value  = model.Quantity;
            parameters[7].Value  = model.FPqty;
            parameters[8].Value  = model.CREATE_DATE;
            parameters[9].Value  = model.CREATE_NAME;
            parameters[10].Value = model.REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MyERP.Model.ORDER_ZBWGDETAIL GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 DetailID,BillNO,Sequence,ItemInternalCode,ZXBJNO,ZXBJNAME,Quantity,FPqty,CREATE_DATE,CREATE_NAME,REMARK from ORDER_ZBWGDETAIL ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            MyERP.Model.ORDER_ZBWGDETAIL model = new MyERP.Model.ORDER_ZBWGDETAIL();
            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 #6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtBillNO.Text.Trim().Length == 0)
            {
                strErr += "BillNO不能为空!\\n";
            }
            if (this.txtSequence.Text.Trim().Length == 0)
            {
                strErr += "Sequence不能为空!\\n";
            }
            if (this.txtItemInternalCode.Text.Trim().Length == 0)
            {
                strErr += "ItemInternalCode不能为空!\\n";
            }
            if (this.txtZXBJNO.Text.Trim().Length == 0)
            {
                strErr += "ZXBJNO不能为空!\\n";
            }
            if (this.txtZXBJNAME.Text.Trim().Length == 0)
            {
                strErr += "ZXBJNAME不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtQuantity.Text))
            {
                strErr += "Quantity格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtFPqty.Text))
            {
                strErr += "FPqty格式错误!\\n";
            }
            if (this.txtCREATE_DATE.Text.Trim().Length == 0)
            {
                strErr += "CREATE_DATE不能为空!\\n";
            }
            if (this.txtCREATE_NAME.Text.Trim().Length == 0)
            {
                strErr += "CREATE_NAME不能为空!\\n";
            }
            if (this.txtREMARK.Text.Trim().Length == 0)
            {
                strErr += "REMARK不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string BillNO           = this.txtBillNO.Text;
            string Sequence         = this.txtSequence.Text;
            string ItemInternalCode = this.txtItemInternalCode.Text;
            string ZXBJNO           = this.txtZXBJNO.Text;
            string ZXBJNAME         = this.txtZXBJNAME.Text;
            int    Quantity         = int.Parse(this.txtQuantity.Text);
            int    FPqty            = int.Parse(this.txtFPqty.Text);
            string CREATE_DATE      = this.txtCREATE_DATE.Text;
            string CREATE_NAME      = this.txtCREATE_NAME.Text;
            string REMARK           = this.txtREMARK.Text;

            MyERP.Model.ORDER_ZBWGDETAIL model = new MyERP.Model.ORDER_ZBWGDETAIL();
            model.BillNO           = BillNO;
            model.Sequence         = Sequence;
            model.ItemInternalCode = ItemInternalCode;
            model.ZXBJNO           = ZXBJNO;
            model.ZXBJNAME         = ZXBJNAME;
            model.Quantity         = Quantity;
            model.FPqty            = FPqty;
            model.CREATE_DATE      = CREATE_DATE;
            model.CREATE_NAME      = CREATE_NAME;
            model.REMARK           = REMARK;

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