コード例 #1
0
        public List <Chain.Model.GoodsNumber> DataTableToList(DataTable dt)
        {
            List <Chain.Model.GoodsNumber> modelList = new List <Chain.Model.GoodsNumber>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.GoodsNumber model = new Chain.Model.GoodsNumber();
                    if (dt.Rows[i]["ID"] != null && dt.Rows[i]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[i]["ID"].ToString());
                    }
                    if (dt.Rows[i]["GoodsID"] != null && dt.Rows[i]["GoodsID"].ToString() != "")
                    {
                        model.GoodsID = int.Parse(dt.Rows[i]["GoodsID"].ToString());
                    }
                    if (dt.Rows[i]["ShopID"] != null && dt.Rows[i]["ShopID"].ToString() != "")
                    {
                        model.ShopID = int.Parse(dt.Rows[i]["ShopID"].ToString());
                    }
                    if (dt.Rows[i]["Number"] != null && dt.Rows[i]["Number"].ToString() != "")
                    {
                        model.Number = decimal.Parse(dt.Rows[i]["Number"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
        protected void GetGoodsNumber(int goodsID, int shopID)
        {
            this.trGoodsNumber.Attributes.CssStyle.Add("display", "");
            Chain.Model.GoodsNumber ModelNumber = new Chain.Model.GoodsNumber();
            Chain.BLL.GoodsNumber   bllNumber   = new Chain.BLL.GoodsNumber();
            DataTable dt = new DataTable();

            if (shopID != 0)
            {
                dt = bllNumber.GetList(string.Concat(new object[]
                {
                    " GoodsID=",
                    goodsID,
                    " and ShopID=",
                    shopID
                })).Tables[0];
            }
            else
            {
                dt = bllNumber.GetList(string.Concat(new object[]
                {
                    " GoodsID=",
                    goodsID,
                    " and ShopID=",
                    this._UserShopID
                })).Tables[0];
            }
            this.txtGoodsNumber.Value = dt.Rows[0]["Number"].ToString();
            this.hdShopID.Value       = dt.Rows[0]["ShopID"].ToString();
        }
コード例 #3
0
 public bool Update(Chain.Model.GoodsNumber model)
 {
     return(this.dal.Update(model));
 }
コード例 #4
0
 public int Add(Chain.Model.GoodsNumber model)
 {
     return(this.dal.Add(model));
 }
コード例 #5
0
 public int UpdataGoodsNumber(Chain.Model.GoodsNumber model)
 {
     return(this.dal.UpdataGoodsNumber(model));
 }
コード例 #6
0
        protected void btnCopy_Click(object sender, EventArgs e)
        {
            Chain.BLL.SysShop             bllShop = new Chain.BLL.SysShop();
            Chain.BLL.GoodsClassAuthority bllGoodsClassAuthority = new Chain.BLL.GoodsClassAuthority();
            Chain.BLL.GoodsClass          bllGoodsClass          = new Chain.BLL.GoodsClass();
            DataTable dtShop       = bllShop.GetList("ShopID>0 and ShopType=3 and IsMain=0 ").Tables[0];
            DataTable dtGoodsClass = bllGoodsClass.GetList("CreateShopID=" + this._UserShopID).Tables[0];

            for (int i = 0; i < dtShop.Rows.Count; i++)
            {
                int ShopID = int.Parse(dtShop.Rows[i]["ShopID"].ToString());
                for (int j = 0; j < dtGoodsClass.Rows.Count; j++)
                {
                    int ClassID = int.Parse(dtGoodsClass.Rows[j]["ClassID"].ToString());
                    Chain.Model.GoodsClassAuthority modelGoodsClassAuthority = new Chain.Model.GoodsClassAuthority();
                    modelGoodsClassAuthority.ClassID = ClassID;
                    modelGoodsClassAuthority.ShopID  = ShopID;
                    int count = bllGoodsClassAuthority.GetRecordCount(string.Concat(new object[]
                    {
                        "ShopID=",
                        ShopID,
                        " and ClassID=",
                        ClassID
                    }));
                    if (count == 0)
                    {
                        bllGoodsClassAuthority.Add(modelGoodsClassAuthority);
                    }
                }
            }
            Chain.BLL.GoodsClassDiscount bllGoodsClassDiscount = new Chain.BLL.GoodsClassDiscount();
            DataTable dtClassDiscount = bllGoodsClassDiscount.GetList("DiscountShopID=" + this._UserShopID).Tables[0];

            for (int i = 0; i < dtShop.Rows.Count; i++)
            {
                int ShopID = int.Parse(dtShop.Rows[i]["ShopID"].ToString());
                for (int j = 0; j < dtClassDiscount.Rows.Count; j++)
                {
                    Chain.Model.GoodsClassDiscount modelGoodsClassDiscount = new Chain.Model.GoodsClassDiscount();
                    int ClassID    = int.Parse(dtClassDiscount.Rows[j]["GoodsClassID"].ToString());
                    int MemLevelID = int.Parse(dtClassDiscount.Rows[j]["MemLevelID"].ToString());
                    modelGoodsClassDiscount.GoodsClassID         = ClassID;
                    modelGoodsClassDiscount.MemLevelID           = MemLevelID;
                    modelGoodsClassDiscount.DiscountShopID       = ShopID;
                    modelGoodsClassDiscount.ClassDiscountPercent = int.Parse(dtClassDiscount.Rows[j]["ClassDiscountPercent"].ToString());
                    modelGoodsClassDiscount.ClassPointPercent    = int.Parse(dtClassDiscount.Rows[j]["ClassPointPercent"].ToString());
                    DataTable dtShopGoodsClassDiscount = bllGoodsClassDiscount.GetList(string.Concat(new object[]
                    {
                        "MemLevelID=",
                        MemLevelID,
                        " and DiscountShopID=",
                        ShopID,
                        " and GoodsClassID=",
                        ClassID
                    })).Tables[0];
                    if (dtShopGoodsClassDiscount.Rows.Count == 0)
                    {
                        bllGoodsClassDiscount.Add(modelGoodsClassDiscount);
                    }
                    else
                    {
                        modelGoodsClassDiscount.ClassDiscountID = int.Parse(dtShopGoodsClassDiscount.Rows[0]["ClassDiscountID"].ToString());
                        bllGoodsClassDiscount.Update(modelGoodsClassDiscount);
                    }
                }
            }
            Chain.BLL.Goods bllGoods = new Chain.BLL.Goods();
            DataTable       dtGoods  = bllGoods.GetGoodsList("CreateShopID=" + this._UserShopID).Tables[0];

            Chain.BLL.GoodsNumber bllGoodsNumber = new Chain.BLL.GoodsNumber();
            for (int i = 0; i < dtShop.Rows.Count; i++)
            {
                int ShopID = int.Parse(dtShop.Rows[i]["ShopID"].ToString());
                for (int j = 0; j < dtGoods.Rows.Count; j++)
                {
                    int GoodsID = int.Parse(dtGoods.Rows[j]["GoodsID"].ToString());
                    int count   = bllGoodsNumber.GetRecordCount(string.Concat(new object[]
                    {
                        "GoodsID=",
                        GoodsID,
                        " and ShopID=",
                        ShopID
                    }));
                    Chain.Model.GoodsNumber modelGoodsNumber = new Chain.Model.GoodsNumber();
                    modelGoodsNumber.GoodsID = GoodsID;
                    modelGoodsNumber.Number  = 0m;
                    modelGoodsNumber.ShopID  = ShopID;
                    if (count == 0)
                    {
                        bllGoodsNumber.Add(modelGoodsNumber);
                    }
                }
            }
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "message", "<Script Language='JavaScript' defer>art.dialog({title: '系统提示',time: 2,content:'同步成功',close: function () { location.href = 'GoodsList.aspx?PID=62';  }});</script>");
        }