コード例 #1
0
        public async Task <bool> Create(CustomerSalesOrderPromotion CustomerSalesOrderPromotion)
        {
            CustomerSalesOrderPromotionDAO CustomerSalesOrderPromotionDAO = new CustomerSalesOrderPromotionDAO();

            CustomerSalesOrderPromotionDAO.Id = CustomerSalesOrderPromotion.Id;
            CustomerSalesOrderPromotionDAO.CustomerSalesOrderId = CustomerSalesOrderPromotion.CustomerSalesOrderId;
            CustomerSalesOrderPromotionDAO.ItemId                 = CustomerSalesOrderPromotion.ItemId;
            CustomerSalesOrderPromotionDAO.UnitOfMeasureId        = CustomerSalesOrderPromotion.UnitOfMeasureId;
            CustomerSalesOrderPromotionDAO.Quantity               = CustomerSalesOrderPromotion.Quantity;
            CustomerSalesOrderPromotionDAO.RequestedQuantity      = CustomerSalesOrderPromotion.RequestedQuantity;
            CustomerSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = CustomerSalesOrderPromotion.PrimaryUnitOfMeasureId;
            CustomerSalesOrderPromotionDAO.Factor                 = CustomerSalesOrderPromotion.Factor;
            CustomerSalesOrderPromotionDAO.Note = CustomerSalesOrderPromotion.Note;
            DataContext.CustomerSalesOrderPromotion.Add(CustomerSalesOrderPromotionDAO);
            await DataContext.SaveChangesAsync();

            CustomerSalesOrderPromotion.Id = CustomerSalesOrderPromotionDAO.Id;
            await SaveReference(CustomerSalesOrderPromotion);

            return(true);
        }
コード例 #2
0
        public async Task <bool> BulkMerge(List <CustomerSalesOrderPromotion> CustomerSalesOrderPromotions)
        {
            List <CustomerSalesOrderPromotionDAO> CustomerSalesOrderPromotionDAOs = new List <CustomerSalesOrderPromotionDAO>();

            foreach (CustomerSalesOrderPromotion CustomerSalesOrderPromotion in CustomerSalesOrderPromotions)
            {
                CustomerSalesOrderPromotionDAO CustomerSalesOrderPromotionDAO = new CustomerSalesOrderPromotionDAO();
                CustomerSalesOrderPromotionDAO.Id = CustomerSalesOrderPromotion.Id;
                CustomerSalesOrderPromotionDAO.CustomerSalesOrderId = CustomerSalesOrderPromotion.CustomerSalesOrderId;
                CustomerSalesOrderPromotionDAO.ItemId                 = CustomerSalesOrderPromotion.ItemId;
                CustomerSalesOrderPromotionDAO.UnitOfMeasureId        = CustomerSalesOrderPromotion.UnitOfMeasureId;
                CustomerSalesOrderPromotionDAO.Quantity               = CustomerSalesOrderPromotion.Quantity;
                CustomerSalesOrderPromotionDAO.RequestedQuantity      = CustomerSalesOrderPromotion.RequestedQuantity;
                CustomerSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = CustomerSalesOrderPromotion.PrimaryUnitOfMeasureId;
                CustomerSalesOrderPromotionDAO.Factor                 = CustomerSalesOrderPromotion.Factor;
                CustomerSalesOrderPromotionDAO.Note = CustomerSalesOrderPromotion.Note;
                CustomerSalesOrderPromotionDAOs.Add(CustomerSalesOrderPromotionDAO);
            }
            await DataContext.BulkMergeAsync(CustomerSalesOrderPromotionDAOs);

            return(true);
        }
コード例 #3
0
        public async Task <bool> Update(CustomerSalesOrderPromotion CustomerSalesOrderPromotion)
        {
            CustomerSalesOrderPromotionDAO CustomerSalesOrderPromotionDAO = DataContext.CustomerSalesOrderPromotion.Where(x => x.Id == CustomerSalesOrderPromotion.Id).FirstOrDefault();

            if (CustomerSalesOrderPromotionDAO == null)
            {
                return(false);
            }
            CustomerSalesOrderPromotionDAO.Id = CustomerSalesOrderPromotion.Id;
            CustomerSalesOrderPromotionDAO.CustomerSalesOrderId = CustomerSalesOrderPromotion.CustomerSalesOrderId;
            CustomerSalesOrderPromotionDAO.ItemId                 = CustomerSalesOrderPromotion.ItemId;
            CustomerSalesOrderPromotionDAO.UnitOfMeasureId        = CustomerSalesOrderPromotion.UnitOfMeasureId;
            CustomerSalesOrderPromotionDAO.Quantity               = CustomerSalesOrderPromotion.Quantity;
            CustomerSalesOrderPromotionDAO.RequestedQuantity      = CustomerSalesOrderPromotion.RequestedQuantity;
            CustomerSalesOrderPromotionDAO.PrimaryUnitOfMeasureId = CustomerSalesOrderPromotion.PrimaryUnitOfMeasureId;
            CustomerSalesOrderPromotionDAO.Factor                 = CustomerSalesOrderPromotion.Factor;
            CustomerSalesOrderPromotionDAO.Note = CustomerSalesOrderPromotion.Note;
            await DataContext.SaveChangesAsync();

            await SaveReference(CustomerSalesOrderPromotion);

            return(true);
        }