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

            strSql.Append("update SAL_ITEM_NOW_PRICE set ");
            strSql.Append("CompanyCode=@CompanyCode,");
            strSql.Append("ItemNo=@ItemNo,");
            strSql.Append("Color=@Color,");
            strSql.Append("ItemInternalCode=@ItemInternalCode,");
            strSql.Append("InternalCodeMean=@InternalCodeMean,");
            strSql.Append("AllPrice=@AllPrice,");
            strSql.Append("WholeSalePrice=@WholeSalePrice,");
            strSql.Append("OncePrice=@OncePrice,");
            strSql.Append("MeasureUnit=@MeasureUnit,");
            strSql.Append("LastEdit=@LastEdit");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyCode",      SqlDbType.NVarChar,   10),
                new SqlParameter("@ItemNo",           SqlDbType.NVarChar,   20),
                new SqlParameter("@Color",            SqlDbType.NVarChar,   10),
                new SqlParameter("@ItemInternalCode", SqlDbType.NVarChar,  200),
                new SqlParameter("@InternalCodeMean", SqlDbType.NVarChar,  200),
                new SqlParameter("@AllPrice",         SqlDbType.Decimal,     9),
                new SqlParameter("@WholeSalePrice",   SqlDbType.Decimal,     9),
                new SqlParameter("@OncePrice",        SqlDbType.Decimal,     9),
                new SqlParameter("@MeasureUnit",      SqlDbType.NVarChar,    6),
                new SqlParameter("@LastEdit",         SqlDbType.VarBinary, 8)
            };
            parameters[0].Value = model.CompanyCode;
            parameters[1].Value = model.ItemNo;
            parameters[2].Value = model.Color;
            parameters[3].Value = model.ItemInternalCode;
            parameters[4].Value = model.InternalCodeMean;
            parameters[5].Value = model.AllPrice;
            parameters[6].Value = model.WholeSalePrice;
            parameters[7].Value = model.OncePrice;
            parameters[8].Value = model.MeasureUnit;
            parameters[9].Value = model.LastEdit;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
 private void ShowInfo()
 {
     MyERP.BLL.SAL_ITEM_NOW_PRICE   bll   = new MyERP.BLL.SAL_ITEM_NOW_PRICE();
     MyERP.Model.SAL_ITEM_NOW_PRICE model = bll.GetModel();
     this.txtCompanyCode.Text      = model.CompanyCode;
     this.txtItemNo.Text           = model.ItemNo;
     this.txtColor.Text            = model.Color;
     this.txtItemInternalCode.Text = model.ItemInternalCode;
     this.txtInternalCodeMean.Text = model.InternalCodeMean;
     this.txtAllPrice.Text         = model.AllPrice.ToString();
     this.txtWholeSalePrice.Text   = model.WholeSalePrice.ToString();
     this.txtOncePrice.Text        = model.OncePrice.ToString();
     this.txtMeasureUnit.Text      = model.MeasureUnit;
     this.txtLastEdit.Text         = model.LastEdit.ToString();
 }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MyERP.Model.SAL_ITEM_NOW_PRICE DataRowToModel(DataRow row)
 {
     MyERP.Model.SAL_ITEM_NOW_PRICE model = new MyERP.Model.SAL_ITEM_NOW_PRICE();
     if (row != null)
     {
         if (row["CompanyCode"] != null)
         {
             model.CompanyCode = row["CompanyCode"].ToString();
         }
         if (row["ItemNo"] != null)
         {
             model.ItemNo = row["ItemNo"].ToString();
         }
         if (row["Color"] != null)
         {
             model.Color = row["Color"].ToString();
         }
         if (row["ItemInternalCode"] != null)
         {
             model.ItemInternalCode = row["ItemInternalCode"].ToString();
         }
         if (row["InternalCodeMean"] != null)
         {
             model.InternalCodeMean = row["InternalCodeMean"].ToString();
         }
         if (row["AllPrice"] != null && row["AllPrice"].ToString() != "")
         {
             model.AllPrice = decimal.Parse(row["AllPrice"].ToString());
         }
         if (row["WholeSalePrice"] != null && row["WholeSalePrice"].ToString() != "")
         {
             model.WholeSalePrice = decimal.Parse(row["WholeSalePrice"].ToString());
         }
         if (row["OncePrice"] != null && row["OncePrice"].ToString() != "")
         {
             model.OncePrice = decimal.Parse(row["OncePrice"].ToString());
         }
         if (row["MeasureUnit"] != null)
         {
             model.MeasureUnit = row["MeasureUnit"].ToString();
         }
         if (row["LastEdit"] != null && row["LastEdit"].ToString() != "")
         {
             model.LastEdit = (byte[])row["LastEdit"];
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MyERP.Model.SAL_ITEM_NOW_PRICE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SAL_ITEM_NOW_PRICE(");
            strSql.Append("CompanyCode,ItemNo,Color,ItemInternalCode,InternalCodeMean,AllPrice,WholeSalePrice,OncePrice,MeasureUnit,LastEdit)");
            strSql.Append(" values (");
            strSql.Append("@CompanyCode,@ItemNo,@Color,@ItemInternalCode,@InternalCodeMean,@AllPrice,@WholeSalePrice,@OncePrice,@MeasureUnit,@LastEdit)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CompanyCode",      SqlDbType.NVarChar,   10),
                new SqlParameter("@ItemNo",           SqlDbType.NVarChar,   20),
                new SqlParameter("@Color",            SqlDbType.NVarChar,   10),
                new SqlParameter("@ItemInternalCode", SqlDbType.NVarChar,  200),
                new SqlParameter("@InternalCodeMean", SqlDbType.NVarChar,  200),
                new SqlParameter("@AllPrice",         SqlDbType.Decimal,     9),
                new SqlParameter("@WholeSalePrice",   SqlDbType.Decimal,     9),
                new SqlParameter("@OncePrice",        SqlDbType.Decimal,     9),
                new SqlParameter("@MeasureUnit",      SqlDbType.NVarChar,    6),
                new SqlParameter("@LastEdit",         SqlDbType.VarBinary, 8)
            };
            parameters[0].Value = model.CompanyCode;
            parameters[1].Value = model.ItemNo;
            parameters[2].Value = model.Color;
            parameters[3].Value = model.ItemInternalCode;
            parameters[4].Value = model.InternalCodeMean;
            parameters[5].Value = model.AllPrice;
            parameters[6].Value = model.WholeSalePrice;
            parameters[7].Value = model.OncePrice;
            parameters[8].Value = model.MeasureUnit;
            parameters[9].Value = model.LastEdit;

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

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

            strSql.Append("select  top 1 CompanyCode,ItemNo,Color,ItemInternalCode,InternalCodeMean,AllPrice,WholeSalePrice,OncePrice,MeasureUnit,LastEdit from SAL_ITEM_NOW_PRICE ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtCompanyCode.Text.Trim().Length == 0)
            {
                strErr += "CompanyCode不能为空!\\n";
            }
            if (this.txtItemNo.Text.Trim().Length == 0)
            {
                strErr += "ItemNo不能为空!\\n";
            }
            if (this.txtColor.Text.Trim().Length == 0)
            {
                strErr += "Color不能为空!\\n";
            }
            if (this.txtItemInternalCode.Text.Trim().Length == 0)
            {
                strErr += "ItemInternalCode不能为空!\\n";
            }
            if (this.txtInternalCodeMean.Text.Trim().Length == 0)
            {
                strErr += "InternalCodeMean不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtAllPrice.Text))
            {
                strErr += "AllPrice格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtWholeSalePrice.Text))
            {
                strErr += "WholeSalePrice格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtOncePrice.Text))
            {
                strErr += "OncePrice格式错误!\\n";
            }
            if (this.txtMeasureUnit.Text.Trim().Length == 0)
            {
                strErr += "MeasureUnit不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string  CompanyCode      = this.txtCompanyCode.Text;
            string  ItemNo           = this.txtItemNo.Text;
            string  Color            = this.txtColor.Text;
            string  ItemInternalCode = this.txtItemInternalCode.Text;
            string  InternalCodeMean = this.txtInternalCodeMean.Text;
            decimal AllPrice         = decimal.Parse(this.txtAllPrice.Text);
            decimal WholeSalePrice   = decimal.Parse(this.txtWholeSalePrice.Text);
            decimal OncePrice        = decimal.Parse(this.txtOncePrice.Text);
            string  MeasureUnit      = this.txtMeasureUnit.Text;

            byte[] LastEdit = new UnicodeEncoding().GetBytes(this.txtLastEdit.Text);


            MyERP.Model.SAL_ITEM_NOW_PRICE model = new MyERP.Model.SAL_ITEM_NOW_PRICE();
            model.CompanyCode      = CompanyCode;
            model.ItemNo           = ItemNo;
            model.Color            = Color;
            model.ItemInternalCode = ItemInternalCode;
            model.InternalCodeMean = InternalCodeMean;
            model.AllPrice         = AllPrice;
            model.WholeSalePrice   = WholeSalePrice;
            model.OncePrice        = OncePrice;
            model.MeasureUnit      = MeasureUnit;
            model.LastEdit         = LastEdit;

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