Esempio n. 1
0
        public void UpdateItem(SaleAdvertisementItem entity)
        {
            DataCommand dc = DataCommandManager.GetDataCommand("MaintainSaleAdvItem");

            dc.SetParameterValue(entity);

            dc.ExecuteNonQuery();
        }
Esempio n. 2
0
        public void UpdateItemStatus(SaleAdvertisementItem entity)
        {
            DataCommand dc = DataCommandManager.GetDataCommand("UpdataSaleAdvertisementItemStatusManagement");

            dc.SetParameterValue(entity);

            dc.ExecuteNonQuery();
        }
        public virtual void UpdateItemStatus(SaleAdvertisementItem entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            da.UpdateItemStatus(entity);
        }
Esempio n. 4
0
        public bool CheckSaleAdvItemDuplicate(SaleAdvertisementItem entity)
        {
            DataCommand command = DataCommandManager.GetDataCommand("GetSaleAdvItemCheckRepeate");

            command.SetParameterValue(entity);

            List <SaleAdvertisementItem> result = command.ExecuteEntityList <SaleAdvertisementItem>();

            return(result != null && result.Count > 0);
        }
Esempio n. 5
0
        public SaleAdvertisementItem CreateItem(SaleAdvertisementItem entity)
        {
            DataCommand dc = DataCommandManager.GetDataCommand("CreateSaleAdvItem");

            dc.SetParameterValue(entity);

            dc.ExecuteNonQuery();

            entity.SysNo = Convert.ToInt32(dc.GetParameterValue("@SysNo"));

            return(entity);
        }
Esempio n. 6
0
        public void CreateSaleAdvItemLog(SaleAdvertisementItem entity, string action)
        {
            DataCommand dc = DataCommandManager.GetDataCommand("CreateSaleAdvertisementItem_Log");

            dc.SetParameterValue("@ProductSysNo", entity.ProductSysNo);
            dc.SetParameterValue("@SaleAdvSysNo", entity.SaleAdvSysNo);
            dc.SetParameterValue("@OperationType", action);
            dc.SetParameterValue("@CompanyCode", "8601");      //[Mark][Alan.X.Luo 硬编码]
            dc.SetParameterValue("@StoreCompanyCode", "8601"); //[Mark][Alan.X.Luo 硬编码]

            dc.ExecuteNonQuery();
        }
        public virtual void UpdateItem(SaleAdvertisementItem entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }

            if (string.IsNullOrEmpty(entity.Introduction))
            {
                entity.Introduction = null;
            }

            //UI上可以不选择Group,如果GroupSysNo写入DB为null的话则查不出来
            if (entity.GroupSysNo == null)
            {
                entity.GroupName  = null;
                entity.GroupSysNo = 0;
            }

            da.UpdateItem(entity);
        }
Esempio n. 8
0
        public BatchResultRsp BatchCreateSaleAdvItem(SaleAdvertisementItem msg)
        {
            var BatchResultRsp = new BatchResultRsp
            {
                SuccessRecords = new List <string>(),
                FailureRecords = new List <string>()
            };

            var productIDList             = msg.Introduction.Split('\r').Distinct().ToList();
            SaleAdvertisementItem itemTmp = null;

            foreach (string pId in productIDList)
            {
                itemTmp               = new SaleAdvertisementItem();
                itemTmp.ProductID     = pId;
                itemTmp.SaleAdvSysNo  = msg.SaleAdvSysNo;
                itemTmp.RecommendType = msg.RecommendType;
                itemTmp.GroupPriority = msg.GroupPriority;
                itemTmp.Priority      = msg.Priority++;
                itemTmp.GroupSysNo    = msg.GroupSysNo;
                itemTmp.GroupName     = msg.GroupName;
                itemTmp.IconAddr      = msg.IconAddr;

                try
                {
                    ObjectFactory <SaleAdvAppService> .Instance.CreateItem(itemTmp);

                    BatchResultRsp.SuccessRecords.Add(pId);
                }
                catch (Exception ex)
                {
                    BatchResultRsp.FailureRecords.Add(pId + ex.Message);
                    continue;
                }
            }
            return(BatchResultRsp);
        }
        public virtual SaleAdvertisementItem CreateItem(SaleAdvertisementItem entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (string.IsNullOrEmpty(entity.Introduction))
            {
                entity.Introduction = null;
            }
            //UI上可以不选择Group,如果GroupSysNo写入DB为null的话则查不出来
            if (entity.GroupSysNo == null)
            {
                entity.GroupName  = null;
                entity.GroupSysNo = 0;
            }


            ProductInfo product = null;

            if (entity.ProductSysNo == null)
            {
                product = ExternalDomainBroker.GetProductInfo(entity.ProductID);
            }
            else
            {
                product = ExternalDomainBroker.GetProductInfo(entity.ProductSysNo.Value);
            }
            if (product == null)
            {
                //throw new BizException("商品无效!");
                throw new BizException(ResouceManager.GetMessageString("MKT.SaleAdvertisement", "SaleAdvertisement_InvalidProduct"));
            }
            else
            {
                entity.MarketPrice   = product.ProductPriceInfo.BasicPrice;
                entity.ProductSysNo  = product.SysNo;
                entity.ProductID     = product.ProductID;
                entity.ProductName   = product.ProductName;
                entity.ProductStatus = product.ProductStatus;
            }
            if (da.CheckSaleAdvItemDuplicate(entity))
            {
                //throw new BizException("你要创建或修改的记录已经存在了!");
                throw new BizException(ResouceManager.GetMessageString("MKT.SaleAdvertisement", "SaleAdvertisement_RecordAreadyExsist"));
            }
#warning To do 获取京东价
            var inventoryInfo = ExternalDomainBroker.GetProductInventoryInfo(entity.ProductSysNo.Value);
            entity.OnlineQty = inventoryInfo.Sum(p => p.OnlineQty);

            entity.Status = ADStatus.Active;
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = IsolationLevel.ReadCommitted;
            options.Timeout        = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope())
            {
                da.CreateItem(entity);

                da.CreateSaleAdvItemLog(entity, "A");

                scope.Complete();
            }

            return(entity);
        }
Esempio n. 10
0
 public virtual void UpdateItemStatus(SaleAdvertisementItem entity)
 {
     processor.UpdateItemStatus(entity);
 }
Esempio n. 11
0
 public virtual SaleAdvertisementItem CreateItem(SaleAdvertisementItem entity)
 {
     return(processor.CreateItem(entity));
 }
Esempio n. 12
0
 public SaleAdvertisementItem CreateSaleAdvItem(SaleAdvertisementItem msg)
 {
     return(ObjectFactory <SaleAdvAppService> .Instance.CreateItem(msg));
 }
Esempio n. 13
0
 public void UpdateSaleAdvItemStatus(SaleAdvertisementItem msg)
 {
     ObjectFactory <SaleAdvAppService> .Instance.UpdateItemStatus(msg);
 }