Esempio n. 1
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtBillNO.Text.Trim().Length == 0)
            {
                strErr += "BillNO不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtSequence.Text))
            {
                strErr += "Sequence格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtquantity.Text))
            {
                strErr += "quantity格式错误!\\n";
            }
            if (this.txtCREATE_NAME.Text.Trim().Length == 0)
            {
                strErr += "CREATE_NAME不能为空!\\n";
            }
            if (this.txtCREATE_DATE.Text.Trim().Length == 0)
            {
                strErr += "CREATE_DATE不能为空!\\n";
            }
            if (this.txtREMARK.Text.Trim().Length == 0)
            {
                strErr += "REMARK不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            Guid    DetailID    = new Guid(this.lblDetailID.Text);
            string  BillNO      = this.txtBillNO.Text;
            int     Sequence    = int.Parse(this.txtSequence.Text);
            decimal quantity    = decimal.Parse(this.txtquantity.Text);
            string  CREATE_NAME = this.txtCREATE_NAME.Text;
            string  CREATE_DATE = this.txtCREATE_DATE.Text;
            string  REMARK      = this.txtREMARK.Text;


            MyERP.Model.ORDER_ZBCKDETAIL model = new MyERP.Model.ORDER_ZBCKDETAIL();
            model.DetailID    = DetailID;
            model.BillNO      = BillNO;
            model.Sequence    = Sequence;
            model.quantity    = quantity;
            model.CREATE_NAME = CREATE_NAME;
            model.CREATE_DATE = CREATE_DATE;
            model.REMARK      = REMARK;

            MyERP.BLL.ORDER_ZBCKDETAIL bll = new MyERP.BLL.ORDER_ZBCKDETAIL();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Esempio n. 2
0
 private void ShowInfo()
 {
     MyERP.BLL.ORDER_ZBCKDETAIL   bll   = new MyERP.BLL.ORDER_ZBCKDETAIL();
     MyERP.Model.ORDER_ZBCKDETAIL model = bll.GetModel();
     this.lblDetailID.Text    = model.DetailID.ToString();
     this.lblBillNO.Text      = model.BillNO;
     this.lblSequence.Text    = model.Sequence.ToString();
     this.lblquantity.Text    = model.quantity.ToString();
     this.lblCREATE_NAME.Text = model.CREATE_NAME;
     this.lblCREATE_DATE.Text = model.CREATE_DATE;
     this.lblREMARK.Text      = model.REMARK;
 }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MyERP.Model.ORDER_ZBCKDETAIL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ORDER_ZBCKDETAIL set ");
            strSql.Append("DetailID=@DetailID,");
            strSql.Append("BillNO=@BillNO,");
            strSql.Append("Sequence=@Sequence,");
            strSql.Append("quantity=@quantity,");
            strSql.Append("CREATE_NAME=@CREATE_NAME,");
            strSql.Append("CREATE_DATE=@CREATE_DATE,");
            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.Int,               4),
                new SqlParameter("@quantity",    SqlDbType.Float,             8),
                new SqlParameter("@CREATE_NAME", SqlDbType.NVarChar,         10),
                new SqlParameter("@CREATE_DATE", SqlDbType.NVarChar,         10),
                new SqlParameter("@REMARK",      SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = model.DetailID;
            parameters[1].Value = model.BillNO;
            parameters[2].Value = model.Sequence;
            parameters[3].Value = model.quantity;
            parameters[4].Value = model.CREATE_NAME;
            parameters[5].Value = model.CREATE_DATE;
            parameters[6].Value = model.REMARK;

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

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

            strSql.Append("select  top 1 DetailID,BillNO,Sequence,quantity,CREATE_NAME,CREATE_DATE,REMARK from ORDER_ZBCKDETAIL ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyERP.Model.ORDER_ZBCKDETAIL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ORDER_ZBCKDETAIL(");
            strSql.Append("DetailID,BillNO,Sequence,quantity,CREATE_NAME,CREATE_DATE,REMARK)");
            strSql.Append(" values (");
            strSql.Append("@DetailID,@BillNO,@Sequence,@quantity,@CREATE_NAME,@CREATE_DATE,@REMARK)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@DetailID",    SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@BillNO",      SqlDbType.VarChar,          50),
                new SqlParameter("@Sequence",    SqlDbType.Int,               4),
                new SqlParameter("@quantity",    SqlDbType.Float,             8),
                new SqlParameter("@CREATE_NAME", SqlDbType.NVarChar,         10),
                new SqlParameter("@CREATE_DATE", SqlDbType.NVarChar,         10),
                new SqlParameter("@REMARK",      SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = Guid.NewGuid();
            parameters[1].Value = model.BillNO;
            parameters[2].Value = model.Sequence;
            parameters[3].Value = model.quantity;
            parameters[4].Value = model.CREATE_NAME;
            parameters[5].Value = model.CREATE_DATE;
            parameters[6].Value = model.REMARK;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.ORDER_ZBCKDETAIL DataRowToModel(DataRow row)
 {
     MyERP.Model.ORDER_ZBCKDETAIL model = new MyERP.Model.ORDER_ZBCKDETAIL();
     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 && row["Sequence"].ToString() != "")
         {
             model.Sequence = int.Parse(row["Sequence"].ToString());
         }
         if (row["quantity"] != null && row["quantity"].ToString() != "")
         {
             model.quantity = decimal.Parse(row["quantity"].ToString());
         }
         if (row["CREATE_NAME"] != null)
         {
             model.CREATE_NAME = row["CREATE_NAME"].ToString();
         }
         if (row["CREATE_DATE"] != null)
         {
             model.CREATE_DATE = row["CREATE_DATE"].ToString();
         }
         if (row["REMARK"] != null)
         {
             model.REMARK = row["REMARK"].ToString();
         }
     }
     return(model);
 }