Exemplo n.º 1
0
        public async Task <bool> Create(DirectSalesOrderPromotion DirectSalesOrderPromotion)
        {
            DirectSalesOrderPromotionDAO DirectSalesOrderPromotionDAO = new DirectSalesOrderPromotionDAO();

            DirectSalesOrderPromotionDAO.Id = DirectSalesOrderPromotion.Id;
            DirectSalesOrderPromotionDAO.DirectSalesOrderId     = DirectSalesOrderPromotion.DirectSalesOrderId;
            DirectSalesOrderPromotionDAO.ItemId                 = DirectSalesOrderPromotion.ItemId;
            DirectSalesOrderPromotionDAO.UnitOfMeasureId        = DirectSalesOrderPromotion.UnitOfMeasureId;
            DirectSalesOrderPromotionDAO.Quantity               = DirectSalesOrderPromotion.Quantity;
            DirectSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = DirectSalesOrderPromotion.PrimaryUnitOfMeasureId;
            DirectSalesOrderPromotionDAO.RequestedQuantity      = DirectSalesOrderPromotion.RequestedQuantity;
            DirectSalesOrderPromotionDAO.Note   = DirectSalesOrderPromotion.Note;
            DirectSalesOrderPromotionDAO.Factor = DirectSalesOrderPromotion.Factor;
            DataContext.DirectSalesOrderPromotion.Add(DirectSalesOrderPromotionDAO);
            await DataContext.SaveChangesAsync();

            DirectSalesOrderPromotion.Id = DirectSalesOrderPromotionDAO.Id;
            await SaveReference(DirectSalesOrderPromotion);

            return(true);
        }
Exemplo n.º 2
0
        public async Task <bool> BulkMerge(List <DirectSalesOrderPromotion> DirectSalesOrderPromotions)
        {
            List <DirectSalesOrderPromotionDAO> DirectSalesOrderPromotionDAOs = new List <DirectSalesOrderPromotionDAO>();

            foreach (DirectSalesOrderPromotion DirectSalesOrderPromotion in DirectSalesOrderPromotions)
            {
                DirectSalesOrderPromotionDAO DirectSalesOrderPromotionDAO = new DirectSalesOrderPromotionDAO();
                DirectSalesOrderPromotionDAO.Id = DirectSalesOrderPromotion.Id;
                DirectSalesOrderPromotionDAO.DirectSalesOrderId     = DirectSalesOrderPromotion.DirectSalesOrderId;
                DirectSalesOrderPromotionDAO.ItemId                 = DirectSalesOrderPromotion.ItemId;
                DirectSalesOrderPromotionDAO.UnitOfMeasureId        = DirectSalesOrderPromotion.UnitOfMeasureId;
                DirectSalesOrderPromotionDAO.Quantity               = DirectSalesOrderPromotion.Quantity;
                DirectSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = DirectSalesOrderPromotion.PrimaryUnitOfMeasureId;
                DirectSalesOrderPromotionDAO.RequestedQuantity      = DirectSalesOrderPromotion.RequestedQuantity;
                DirectSalesOrderPromotionDAO.Note   = DirectSalesOrderPromotion.Note;
                DirectSalesOrderPromotionDAO.Factor = DirectSalesOrderPromotion.Factor;
                DirectSalesOrderPromotionDAOs.Add(DirectSalesOrderPromotionDAO);
            }
            await DataContext.BulkMergeAsync(DirectSalesOrderPromotionDAOs);

            return(true);
        }
Exemplo n.º 3
0
        public async Task <bool> Update(DirectSalesOrderPromotion DirectSalesOrderPromotion)
        {
            DirectSalesOrderPromotionDAO DirectSalesOrderPromotionDAO = DataContext.DirectSalesOrderPromotion.Where(x => x.Id == DirectSalesOrderPromotion.Id).FirstOrDefault();

            if (DirectSalesOrderPromotionDAO == null)
            {
                return(false);
            }
            DirectSalesOrderPromotionDAO.Id = DirectSalesOrderPromotion.Id;
            DirectSalesOrderPromotionDAO.DirectSalesOrderId     = DirectSalesOrderPromotion.DirectSalesOrderId;
            DirectSalesOrderPromotionDAO.ItemId                 = DirectSalesOrderPromotion.ItemId;
            DirectSalesOrderPromotionDAO.UnitOfMeasureId        = DirectSalesOrderPromotion.UnitOfMeasureId;
            DirectSalesOrderPromotionDAO.Quantity               = DirectSalesOrderPromotion.Quantity;
            DirectSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = DirectSalesOrderPromotion.PrimaryUnitOfMeasureId;
            DirectSalesOrderPromotionDAO.RequestedQuantity      = DirectSalesOrderPromotion.RequestedQuantity;
            DirectSalesOrderPromotionDAO.Note   = DirectSalesOrderPromotion.Note;
            DirectSalesOrderPromotionDAO.Factor = DirectSalesOrderPromotion.Factor;
            await DataContext.SaveChangesAsync();

            await SaveReference(DirectSalesOrderPromotion);

            return(true);
        }