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

            strSql.Append("insert into SAL_ITEM_STOCK_DETAIL(");
            strSql.Append("STOCK_CODE,STOCK_NAME,ITEM_INTERNAL_CODE,ITEM_CODE,ITEM_NAME,ACTUAL_QTY)");
            strSql.Append(" values (");
            strSql.Append("@STOCK_CODE,@STOCK_NAME,@ITEM_INTERNAL_CODE,@ITEM_CODE,@ITEM_NAME,@ACTUAL_QTY)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@STOCK_CODE",         SqlDbType.NVarChar, 50),
                new SqlParameter("@STOCK_NAME",         SqlDbType.NVarChar, 50),
                new SqlParameter("@ITEM_INTERNAL_CODE", SqlDbType.NVarChar, 50),
                new SqlParameter("@ITEM_CODE",          SqlDbType.NVarChar, 50),
                new SqlParameter("@ITEM_NAME",          SqlDbType.NVarChar, 50),
                new SqlParameter("@ACTUAL_QTY",         SqlDbType.Float, 8)
            };
            parameters[0].Value = model.STOCK_CODE;
            parameters[1].Value = model.STOCK_NAME;
            parameters[2].Value = model.ITEM_INTERNAL_CODE;
            parameters[3].Value = model.ITEM_CODE;
            parameters[4].Value = model.ITEM_NAME;
            parameters[5].Value = model.ACTUAL_QTY;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.SAL_ITEM_STOCK_DETAIL DataRowToModel(DataRow row)
 {
     MyERP.Model.SAL_ITEM_STOCK_DETAIL model = new MyERP.Model.SAL_ITEM_STOCK_DETAIL();
     if (row != null)
     {
         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["ITEM_INTERNAL_CODE"] != null)
         {
             model.ITEM_INTERNAL_CODE = row["ITEM_INTERNAL_CODE"].ToString();
         }
         if (row["ITEM_CODE"] != null)
         {
             model.ITEM_CODE = row["ITEM_CODE"].ToString();
         }
         if (row["ITEM_NAME"] != null)
         {
             model.ITEM_NAME = row["ITEM_NAME"].ToString();
         }
         if (row["ACTUAL_QTY"] != null && row["ACTUAL_QTY"].ToString() != "")
         {
             model.ACTUAL_QTY = decimal.Parse(row["ACTUAL_QTY"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 3
0
 private void ShowInfo()
 {
     MyERP.BLL.SAL_ITEM_STOCK_DETAIL   bll   = new MyERP.BLL.SAL_ITEM_STOCK_DETAIL();
     MyERP.Model.SAL_ITEM_STOCK_DETAIL model = bll.GetModel();
     this.lblSTOCK_CODE.Text         = model.STOCK_CODE;
     this.lblSTOCK_NAME.Text         = model.STOCK_NAME;
     this.lblITEM_INTERNAL_CODE.Text = model.ITEM_INTERNAL_CODE;
     this.lblITEM_CODE.Text          = model.ITEM_CODE;
     this.lblITEM_NAME.Text          = model.ITEM_NAME;
     this.lblACTUAL_QTY.Text         = model.ACTUAL_QTY.ToString();
 }
Exemplo n.º 4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            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.txtITEM_INTERNAL_CODE.Text.Trim().Length == 0)
            {
                strErr += "ITEM_INTERNAL_CODE不能为空!\\n";
            }
            if (this.txtITEM_CODE.Text.Trim().Length == 0)
            {
                strErr += "ITEM_CODE不能为空!\\n";
            }
            if (this.txtITEM_NAME.Text.Trim().Length == 0)
            {
                strErr += "ITEM_NAME不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtACTUAL_QTY.Text))
            {
                strErr += "ACTUAL_QTY格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string  STOCK_CODE         = this.txtSTOCK_CODE.Text;
            string  STOCK_NAME         = this.txtSTOCK_NAME.Text;
            string  ITEM_INTERNAL_CODE = this.txtITEM_INTERNAL_CODE.Text;
            string  ITEM_CODE          = this.txtITEM_CODE.Text;
            string  ITEM_NAME          = this.txtITEM_NAME.Text;
            decimal ACTUAL_QTY         = decimal.Parse(this.txtACTUAL_QTY.Text);


            MyERP.Model.SAL_ITEM_STOCK_DETAIL model = new MyERP.Model.SAL_ITEM_STOCK_DETAIL();
            model.STOCK_CODE         = STOCK_CODE;
            model.STOCK_NAME         = STOCK_NAME;
            model.ITEM_INTERNAL_CODE = ITEM_INTERNAL_CODE;
            model.ITEM_CODE          = ITEM_CODE;
            model.ITEM_NAME          = ITEM_NAME;
            model.ACTUAL_QTY         = ACTUAL_QTY;

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

            strSql.Append("update SAL_ITEM_STOCK_DETAIL set ");
            strSql.Append("STOCK_CODE=@STOCK_CODE,");
            strSql.Append("STOCK_NAME=@STOCK_NAME,");
            strSql.Append("ITEM_INTERNAL_CODE=@ITEM_INTERNAL_CODE,");
            strSql.Append("ITEM_CODE=@ITEM_CODE,");
            strSql.Append("ITEM_NAME=@ITEM_NAME,");
            strSql.Append("ACTUAL_QTY=@ACTUAL_QTY");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@STOCK_CODE",         SqlDbType.NVarChar, 50),
                new SqlParameter("@STOCK_NAME",         SqlDbType.NVarChar, 50),
                new SqlParameter("@ITEM_INTERNAL_CODE", SqlDbType.NVarChar, 50),
                new SqlParameter("@ITEM_CODE",          SqlDbType.NVarChar, 50),
                new SqlParameter("@ITEM_NAME",          SqlDbType.NVarChar, 50),
                new SqlParameter("@ACTUAL_QTY",         SqlDbType.Float, 8)
            };
            parameters[0].Value = model.STOCK_CODE;
            parameters[1].Value = model.STOCK_NAME;
            parameters[2].Value = model.ITEM_INTERNAL_CODE;
            parameters[3].Value = model.ITEM_CODE;
            parameters[4].Value = model.ITEM_NAME;
            parameters[5].Value = model.ACTUAL_QTY;

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

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

            strSql.Append("select  top 1 STOCK_CODE,STOCK_NAME,ITEM_INTERNAL_CODE,ITEM_CODE,ITEM_NAME,ACTUAL_QTY from SAL_ITEM_STOCK_DETAIL ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }