public Customer_DirectSalesOrderContentDTO(DirectSalesOrderContent DirectSalesOrderContent) { this.Id = DirectSalesOrderContent.Id; this.DirectSalesOrderId = DirectSalesOrderContent.DirectSalesOrderId; this.ItemId = DirectSalesOrderContent.ItemId; this.UnitOfMeasureId = DirectSalesOrderContent.UnitOfMeasureId; this.Quantity = DirectSalesOrderContent.Quantity; this.PrimaryUnitOfMeasureId = DirectSalesOrderContent.PrimaryUnitOfMeasureId; this.RequestedQuantity = DirectSalesOrderContent.RequestedQuantity; this.PrimaryPrice = DirectSalesOrderContent.PrimaryPrice; this.SalePrice = DirectSalesOrderContent.SalePrice; this.EditedPriceStatusId = DirectSalesOrderContent.EditedPriceStatusId; this.DiscountPercentage = DirectSalesOrderContent.DiscountPercentage; this.DiscountAmount = DirectSalesOrderContent.DiscountAmount; this.GeneralDiscountPercentage = DirectSalesOrderContent.GeneralDiscountPercentage; this.GeneralDiscountAmount = DirectSalesOrderContent.GeneralDiscountAmount; this.Amount = DirectSalesOrderContent.Amount; this.TaxPercentage = DirectSalesOrderContent.TaxPercentage; this.TaxAmount = DirectSalesOrderContent.TaxAmount; this.Factor = DirectSalesOrderContent.Factor; this.EditedPriceStatus = DirectSalesOrderContent.EditedPriceStatus == null ? null : new Customer_EditedPriceStatusDTO(DirectSalesOrderContent.EditedPriceStatus); this.Item = DirectSalesOrderContent.Item == null ? null : new Customer_ItemDTO(DirectSalesOrderContent.Item); this.PrimaryUnitOfMeasure = DirectSalesOrderContent.PrimaryUnitOfMeasure == null ? null : new Customer_UnitOfMeasureDTO(DirectSalesOrderContent.PrimaryUnitOfMeasure); this.UnitOfMeasure = DirectSalesOrderContent.UnitOfMeasure == null ? null : new Customer_UnitOfMeasureDTO(DirectSalesOrderContent.UnitOfMeasure); this.Errors = DirectSalesOrderContent.Errors; }
public async Task <bool> Update(DirectSalesOrderContent DirectSalesOrderContent) { DirectSalesOrderContentDAO DirectSalesOrderContentDAO = DataContext.DirectSalesOrderContent.Where(x => x.Id == DirectSalesOrderContent.Id).FirstOrDefault(); if (DirectSalesOrderContentDAO == null) { return(false); } DirectSalesOrderContentDAO.Id = DirectSalesOrderContent.Id; DirectSalesOrderContentDAO.DirectSalesOrderId = DirectSalesOrderContent.DirectSalesOrderId; DirectSalesOrderContentDAO.ItemId = DirectSalesOrderContent.ItemId; DirectSalesOrderContentDAO.UnitOfMeasureId = DirectSalesOrderContent.UnitOfMeasureId; DirectSalesOrderContentDAO.Quantity = DirectSalesOrderContent.Quantity; DirectSalesOrderContentDAO.PrimaryUnitOfMeasureId = DirectSalesOrderContent.PrimaryUnitOfMeasureId; DirectSalesOrderContentDAO.RequestedQuantity = DirectSalesOrderContent.RequestedQuantity; DirectSalesOrderContentDAO.PrimaryPrice = DirectSalesOrderContent.PrimaryPrice; DirectSalesOrderContentDAO.SalePrice = DirectSalesOrderContent.SalePrice; DirectSalesOrderContentDAO.EditedPriceStatusId = DirectSalesOrderContent.EditedPriceStatusId; DirectSalesOrderContentDAO.DiscountPercentage = DirectSalesOrderContent.DiscountPercentage; DirectSalesOrderContentDAO.DiscountAmount = DirectSalesOrderContent.DiscountAmount; DirectSalesOrderContentDAO.GeneralDiscountPercentage = DirectSalesOrderContent.GeneralDiscountPercentage; DirectSalesOrderContentDAO.GeneralDiscountAmount = DirectSalesOrderContent.GeneralDiscountAmount; DirectSalesOrderContentDAO.TaxPercentage = DirectSalesOrderContent.TaxPercentage; DirectSalesOrderContentDAO.TaxAmount = DirectSalesOrderContent.TaxAmount; DirectSalesOrderContentDAO.Amount = DirectSalesOrderContent.Amount; DirectSalesOrderContentDAO.Factor = DirectSalesOrderContent.Factor; await DataContext.SaveChangesAsync(); await SaveReference(DirectSalesOrderContent); return(true); }
public async Task <bool> Create(DirectSalesOrderContent DirectSalesOrderContent) { DirectSalesOrderContentDAO DirectSalesOrderContentDAO = new DirectSalesOrderContentDAO(); DirectSalesOrderContentDAO.Id = DirectSalesOrderContent.Id; DirectSalesOrderContentDAO.DirectSalesOrderId = DirectSalesOrderContent.DirectSalesOrderId; DirectSalesOrderContentDAO.ItemId = DirectSalesOrderContent.ItemId; DirectSalesOrderContentDAO.UnitOfMeasureId = DirectSalesOrderContent.UnitOfMeasureId; DirectSalesOrderContentDAO.Quantity = DirectSalesOrderContent.Quantity; DirectSalesOrderContentDAO.PrimaryUnitOfMeasureId = DirectSalesOrderContent.PrimaryUnitOfMeasureId; DirectSalesOrderContentDAO.RequestedQuantity = DirectSalesOrderContent.RequestedQuantity; DirectSalesOrderContentDAO.PrimaryPrice = DirectSalesOrderContent.PrimaryPrice; DirectSalesOrderContentDAO.SalePrice = DirectSalesOrderContent.SalePrice; DirectSalesOrderContentDAO.EditedPriceStatusId = DirectSalesOrderContent.EditedPriceStatusId; DirectSalesOrderContentDAO.DiscountPercentage = DirectSalesOrderContent.DiscountPercentage; DirectSalesOrderContentDAO.DiscountAmount = DirectSalesOrderContent.DiscountAmount; DirectSalesOrderContentDAO.GeneralDiscountPercentage = DirectSalesOrderContent.GeneralDiscountPercentage; DirectSalesOrderContentDAO.GeneralDiscountAmount = DirectSalesOrderContent.GeneralDiscountAmount; DirectSalesOrderContentDAO.TaxPercentage = DirectSalesOrderContent.TaxPercentage; DirectSalesOrderContentDAO.TaxAmount = DirectSalesOrderContent.TaxAmount; DirectSalesOrderContentDAO.Amount = DirectSalesOrderContent.Amount; DirectSalesOrderContentDAO.Factor = DirectSalesOrderContent.Factor; DataContext.DirectSalesOrderContent.Add(DirectSalesOrderContentDAO); await DataContext.SaveChangesAsync(); DirectSalesOrderContent.Id = DirectSalesOrderContentDAO.Id; await SaveReference(DirectSalesOrderContent); return(true); }
private async Task SaveReference(DirectSalesOrderContent DirectSalesOrderContent) { }
public async Task <bool> Delete(DirectSalesOrderContent DirectSalesOrderContent) { await DataContext.DirectSalesOrderContent.Where(x => x.Id == DirectSalesOrderContent.Id).DeleteFromQueryAsync(); return(true); }
public async Task <DirectSalesOrderContent> Get(long Id) { DirectSalesOrderContent DirectSalesOrderContent = await DataContext.DirectSalesOrderContent.AsNoTracking() .Where(x => x.Id == Id) .Select(x => new DirectSalesOrderContent() { Id = x.Id, DirectSalesOrderId = x.DirectSalesOrderId, ItemId = x.ItemId, UnitOfMeasureId = x.UnitOfMeasureId, Quantity = x.Quantity, PrimaryUnitOfMeasureId = x.PrimaryUnitOfMeasureId, RequestedQuantity = x.RequestedQuantity, PrimaryPrice = x.PrimaryPrice, SalePrice = x.SalePrice, EditedPriceStatusId = x.EditedPriceStatusId, DiscountPercentage = x.DiscountPercentage, DiscountAmount = x.DiscountAmount, GeneralDiscountPercentage = x.GeneralDiscountPercentage, GeneralDiscountAmount = x.GeneralDiscountAmount, TaxPercentage = x.TaxPercentage, TaxAmount = x.TaxAmount, Amount = x.Amount, Factor = x.Factor, DirectSalesOrder = x.DirectSalesOrder == null ? null : new DirectSalesOrder { Id = x.DirectSalesOrder.Id, Code = x.DirectSalesOrder.Code, OrganizationId = x.DirectSalesOrder.OrganizationId, BuyerStoreId = x.DirectSalesOrder.BuyerStoreId, PhoneNumber = x.DirectSalesOrder.PhoneNumber, StoreAddress = x.DirectSalesOrder.StoreAddress, DeliveryAddress = x.DirectSalesOrder.DeliveryAddress, SaleEmployeeId = x.DirectSalesOrder.SaleEmployeeId, CreatorId = x.DirectSalesOrder.CreatorId, OrderDate = x.DirectSalesOrder.OrderDate, DeliveryDate = x.DirectSalesOrder.DeliveryDate, RequestStateId = x.DirectSalesOrder.RequestStateId, EditedPriceStatusId = x.DirectSalesOrder.EditedPriceStatusId, Note = x.DirectSalesOrder.Note, SubTotal = x.DirectSalesOrder.SubTotal, GeneralDiscountPercentage = x.DirectSalesOrder.GeneralDiscountPercentage, GeneralDiscountAmount = x.DirectSalesOrder.GeneralDiscountAmount, TotalTaxAmount = x.DirectSalesOrder.TotalTaxAmount, TotalAfterTax = x.DirectSalesOrder.TotalAfterTax, PromotionCode = x.DirectSalesOrder.PromotionCode, PromotionValue = x.DirectSalesOrder.PromotionValue, Total = x.DirectSalesOrder.Total, RowId = x.DirectSalesOrder.RowId, }, EditedPriceStatus = x.EditedPriceStatus == null ? null : new EditedPriceStatus { Id = x.EditedPriceStatus.Id, Code = x.EditedPriceStatus.Code, Name = x.EditedPriceStatus.Name, }, Item = x.Item == null ? null : new Item { Id = x.Item.Id, ProductId = x.Item.ProductId, Code = x.Item.Code, Name = x.Item.Name, ScanCode = x.Item.ScanCode, SalePrice = x.Item.SalePrice, RetailPrice = x.Item.RetailPrice, StatusId = x.Item.StatusId, Used = x.Item.Used, RowId = x.Item.RowId, }, PrimaryUnitOfMeasure = x.PrimaryUnitOfMeasure == null ? null : new UnitOfMeasure { Id = x.PrimaryUnitOfMeasure.Id, Code = x.PrimaryUnitOfMeasure.Code, Name = x.PrimaryUnitOfMeasure.Name, Description = x.PrimaryUnitOfMeasure.Description, StatusId = x.PrimaryUnitOfMeasure.StatusId, Used = x.PrimaryUnitOfMeasure.Used, RowId = x.PrimaryUnitOfMeasure.RowId, }, UnitOfMeasure = x.UnitOfMeasure == null ? null : new UnitOfMeasure { Id = x.UnitOfMeasure.Id, Code = x.UnitOfMeasure.Code, Name = x.UnitOfMeasure.Name, Description = x.UnitOfMeasure.Description, StatusId = x.UnitOfMeasure.StatusId, Used = x.UnitOfMeasure.Used, RowId = x.UnitOfMeasure.RowId, }, }).FirstOrDefaultAsync(); if (DirectSalesOrderContent == null) { return(null); } return(DirectSalesOrderContent); }