Exemplo n.º 1
0
        public int SyncGoodsClass(int ClassID, int ShopID)
        {
            GoodsClass bllGC = new GoodsClass();

            Chain.Model.GoodsClass model = bllGC.GetModel(ClassID);
            int result;

            if (model != null)
            {
                if (model.ParentID != 0)
                {
                    this.dal.SyncGoodsClass(model.ParentID, ShopID);
                }
                result = this.dal.SyncGoodsClass(ClassID, ShopID);
            }
            else
            {
                result = 0;
            }
            return(result);
        }
Exemplo n.º 2
0
        public int SyncGoodsClass(int ClassID, List <int> ShopList)
        {
            GoodsClass bllGC = new GoodsClass();

            Chain.Model.GoodsClass model = bllGC.GetModel(ClassID);
            int result;

            if (model != null && ShopList.Count > 0)
            {
                if (model.ParentID != 0)
                {
                    this.dal.SyncGoodsClass(model.ParentID, ShopList);
                }
                result = this.dal.SyncGoodsClass(ClassID, ShopList);
            }
            else
            {
                result = -1;
            }
            return(result);
        }
Exemplo n.º 3
0
        public int DeleteClassByShop(int ClassID, int ShopID)
        {
            GoodsNumber         bllGN  = new GoodsNumber();
            GoodsClassAuthority bllGCA = new GoodsClassAuthority();
            GoodsClassDiscount  bllGCD = new GoodsClassDiscount();
            GoodsClass          bllGC  = new GoodsClass();
            Goods bllG = new Goods();

            Chain.Model.GoodsClass modelGC = bllGC.GetModel(ClassID);
            int result;

            if (modelGC == null)
            {
                result = -100;
            }
            else
            {
                if (modelGC.ParentID == 0)
                {
                    int childClassCount = bllGCA.GetClassCountByParentID(modelGC.ClassID);
                    if (childClassCount > 0)
                    {
                        int childClassCountInShop = bllGCA.GetClassCountByParentID(modelGC.ClassID, ShopID);
                        if (childClassCountInShop > 0)
                        {
                            result = -2;
                            return(result);
                        }
                        if (bllGN.GetGoodsCount(ClassID, ShopID) == 0)
                        {
                            bllGCA.DeleteAuthority(ClassID, ShopID);
                            result = 1;
                            return(result);
                        }
                        result = -1;
                        return(result);
                    }
                }
                int goodsCount = bllGN.GetGoodsCount(ClassID, ShopID);
                if (goodsCount == 0)
                {
                    bllGCA.DeleteAuthority(ClassID, ShopID);
                    bllGCD.DeleteDiscount(ClassID, ShopID);
                    DataTable dt           = bllGCA.GetShopIDListByClass(ClassID).Tables[0];
                    bool      isClassShare = false;
                    foreach (DataRow item in dt.Rows)
                    {
                        if (Convert.ToInt32(item["ShopID"]) != ShopID)
                        {
                            isClassShare = true;
                            break;
                        }
                    }
                    if (!isClassShare)
                    {
                        bllGC.Delete(ClassID);
                    }
                    result = 1;
                }
                else
                {
                    result = -1;
                }
            }
            return(result);
        }