Exemplo n.º 1
0
        public int Add(Chain.Model.Goods model)
        {
            int result;

            if (this.Exists(model.GoodsCode, model.CreateShopID))
            {
                result = -1;
            }
            else
            {
                result = this.dal.Add(model);
            }
            return(result);
        }
Exemplo n.º 2
0
        protected void GetGoodsInfo(int goodsID)
        {
            Chain.BLL.Goods   bllGoods   = new Chain.BLL.Goods();
            Chain.Model.Goods modelGoods = bllGoods.GetModel(goodsID);
            DataTable         dtGoods    = bllGoods.GetItemAll(goodsID).Tables[0];

            this.txtGoodsID.Value   = modelGoods.GoodsID.ToString();
            this.txtGoodsCode.Value = modelGoods.GoodsCode;
            this.txtCode.Value      = modelGoods.GoodsCode;
            if (modelGoods.GoodsType == 1)
            {
                this.chkService.Checked = true;
            }
            this.txtGoodsName.Value     = modelGoods.Name;
            this.txtGoodsNameCode.Value = modelGoods.NameCode;
            PubFunction.BindGoodsClass(this.sltGoodsClass, modelGoods.CreateShopID);
            this.sltGoodsClass.Value       = modelGoods.GoodsClassID.ToString();
            this.sltjldw.Value             = modelGoods.Unit;
            this.sltCommissionType.Value   = modelGoods.CommissionType.ToString();
            this.txtCommissionNumber.Value = modelGoods.CommissionNumber.ToString();
            this.txtGoodsPrice.Value       = Math.Round(modelGoods.Price, 2).ToString();
            if (modelGoods.Point != -1)
            {
                this.txtGoodsPoint.Value = modelGoods.Point.ToString();
            }
            else
            {
                this.txtGoodsPoint.Value = "";
            }
            this.txtGoodsBidPrice.Value    = Math.Round(modelGoods.GoodsBidPrice, 2).ToString();
            this.txtGoodsMinPercent.Value  = modelGoods.MinPercent.ToString();
            this.txtGoodsRemark.Value      = modelGoods.GoodsRemark;
            this.txtGoodsSalePercent.Value = modelGoods.SalePercet.ToString();
            PubFunction.BindEditCustomFields(this.tbCustomField, "goods", dtGoods.Rows[0]);
            PubFunction.BindShopSelect(this._UserShopID, this.sltShopList, modelGoods.CreateShopID, this._UserShopID != 1);
            this.txtShopID.Value = modelGoods.CreateShopID.ToString();
            this.txtShopID.Value = modelGoods.CreateShopID.ToString();
        }
Exemplo n.º 3
0
        public List <Chain.Model.Goods> DataTableToList(DataTable dt)
        {
            List <Chain.Model.Goods> modelList = new List <Chain.Model.Goods>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.Goods model = new Chain.Model.Goods();
                    if (dt.Rows[i]["GoodsID"] != null && dt.Rows[i]["GoodsID"].ToString() != "")
                    {
                        model.GoodsID = int.Parse(dt.Rows[i]["GoodsID"].ToString());
                    }
                    if (dt.Rows[i]["GoodsCode"] != null && dt.Rows[i]["GoodsCode"].ToString() != "")
                    {
                        model.GoodsCode = dt.Rows[i]["GoodsCode"].ToString();
                    }
                    if (dt.Rows[i]["GoodsClassID"] != null && dt.Rows[i]["GoodsClassID"].ToString() != "")
                    {
                        model.GoodsClassID = int.Parse(dt.Rows[i]["GoodsClassID"].ToString());
                    }
                    if (dt.Rows[i]["Name"] != null && dt.Rows[i]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[i]["Name"].ToString();
                    }
                    if (dt.Rows[i]["NameCode"] != null && dt.Rows[i]["NameCode"].ToString() != "")
                    {
                        model.NameCode = dt.Rows[i]["NameCode"].ToString();
                    }
                    if (dt.Rows[i]["Unit"] != null && dt.Rows[i]["Unit"].ToString() != "")
                    {
                        model.Unit = dt.Rows[i]["Unit"].ToString();
                    }
                    if (dt.Rows[i]["GoodsNumber"] != null && dt.Rows[i]["GoodsNumber"].ToString() != "")
                    {
                        model.GoodsNumber = int.Parse(dt.Rows[i]["GoodsNumber"].ToString());
                    }
                    if (dt.Rows[i]["SalePercet"] != null && dt.Rows[i]["SalePercet"].ToString() != "")
                    {
                        model.SalePercet = decimal.Parse(dt.Rows[i]["SalePercet"].ToString());
                    }
                    if (dt.Rows[i]["GoodsSaleNumber"] != null && dt.Rows[i]["GoodsSaleNumber"].ToString() != "")
                    {
                        model.GoodsSaleNumber = int.Parse(dt.Rows[i]["GoodsSaleNumber"].ToString());
                    }
                    if (dt.Rows[i]["Price"] != null && dt.Rows[i]["Price"].ToString() != "")
                    {
                        model.Price = decimal.Parse(dt.Rows[i]["Price"].ToString());
                    }
                    if (dt.Rows[i]["CommissionType"] != null && dt.Rows[i]["CommissionType"].ToString() != "")
                    {
                        model.CommissionType = int.Parse(dt.Rows[i]["CommissionType"].ToString());
                    }
                    if (dt.Rows[i]["CommissionNumber"] != null && dt.Rows[i]["CommissionNumber"].ToString() != "")
                    {
                        model.CommissionNumber = decimal.Parse(dt.Rows[i]["CommissionNumber"].ToString());
                    }
                    if (dt.Rows[i]["Point"] != null && dt.Rows[i]["Point"].ToString() != "")
                    {
                        model.Point = int.Parse(dt.Rows[i]["Point"].ToString());
                    }
                    if (dt.Rows[i]["MinPercent"] != null && dt.Rows[i]["MinPercent"].ToString() != "")
                    {
                        model.MinPercent = decimal.Parse(dt.Rows[i]["MinPercent"].ToString());
                    }
                    if (dt.Rows[i]["GoodsType"] != null && dt.Rows[i]["GoodsType"].ToString() != "")
                    {
                        model.GoodsType = int.Parse(dt.Rows[i]["GoodsType"].ToString());
                    }
                    if (dt.Rows[i]["GoodsBidPrice"] != null && dt.Rows[i]["GoodsBidPrice"].ToString() != "")
                    {
                        model.GoodsBidPrice = decimal.Parse(dt.Rows[i]["GoodsBidPrice"].ToString());
                    }
                    if (dt.Rows[i]["GoodsRemark"] != null && dt.Rows[i]["GoodsRemark"].ToString() != "")
                    {
                        model.GoodsRemark = dt.Rows[i]["GoodsRemark"].ToString();
                    }
                    if (dt.Rows[i]["GoodsPicture"] != null && dt.Rows[i]["GoodsPicture"].ToString() != "")
                    {
                        model.GoodsPicture = dt.Rows[i]["GoodsPicture"].ToString();
                    }
                    if (dt.Rows[i]["GoodsCreateTime"] != null && dt.Rows[i]["GoodsCreateTime"].ToString() != "")
                    {
                        model.GoodsCreateTime = DateTime.Parse(dt.Rows[i]["GoodsCreateTime"].ToString());
                    }
                    if (dt.Rows[i]["CreateShopID"] != null && dt.Rows[i]["CreateShopID"].ToString() != "")
                    {
                        model.CreateShopID = int.Parse(dt.Rows[i]["CreateShopID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 4
0
 public int Update(Chain.Model.Goods model)
 {
     return(this.dal.Update(model) ? 1 : -3);
 }