Exemplo n.º 1
0
        public int Save(Goods goods, int?supplierId)
        {
            int cnt = 0;

            if (null == goods)
            {
                return(0);
            }
            if (null != supplierId)
            {
                int rslt = 0;
                int?gId  = service.GenGoodsId();
                if (null == custService)
                {
                    custService = base.CreateService(typeof(CustomerService), ConnectorId) as CustomerService;
                }
                if (null == gId)
                {
                    gId = goods.__baseId;
                }
                goods.GID__PK = gId;
                rslt         += service.Save(goods);
                SupplyInfo spInfo = new SupplyInfo();
                spInfo.CustID = supplierId;
                spInfo.GID    = goods.GID__PK;
                spInfo.St     = ST.VALID;
                rslt         += custService.AddGoods(new List <SupplyInfo>()
                {
                    spInfo
                });
                if (rslt > 1)
                {
                    cnt = 1;
                }
            }
            else
            {
                cnt += service.Save(goods);
            }
            return(cnt);
        }