public SalesOrderPresenter() { var repository = new SalesOrderRepository(); ItemsCollection = new ObservableCollection<SalesOrder>(repository.Data); GridView.DataContext = this; ItemView.DataContext = this; var collectionView = CollectionViewSource.GetDefaultView(ItemsCollection); Controllers.AddRange( new IDisposable[] { new BrowseController(collectionView, ChangeCurrentItem, () => !EditableState), new CrudController<SalesOrder>( repository, collectionView, () => CurrentItem, SetCurrent, EditableStateChanged), new TemplaterController( "Templates\\SalesOrderGrid.xlsx", "Templates\\SalesOrderItem.xlsx", "Templates\\SalesOrderItem.docx", "Templates\\SalesOrder.txt", ItemsCollection, () => GridView.dataGrid.SelectedItems), new LayoutController(ChangeView, GridView, ItemView, GridView.dataGrid) }); ChangeView(GridView); PropertyChanged.Notify(() => CurrentItem); }
public QuoteBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; quoteRepository = new QuoteRepository(unitOfWork); salesOrderRepository = new SalesOrderRepository(unitOfWork); productQuoteAssociationRepository = new ProductQuoteAssociationRepository(unitOfWork); }
public SalesOrderPresenter() { var repository = new SalesOrderRepository(); ItemsCollection = new ObservableCollection <SalesOrder>(repository.Data); GridView.DataContext = this; ItemView.DataContext = this; var collectionView = CollectionViewSource.GetDefaultView(ItemsCollection); Controllers.AddRange( new IDisposable[] { new BrowseController(collectionView, ChangeCurrentItem, () => !EditableState), new CrudController <SalesOrder>( repository, collectionView, () => CurrentItem, SetCurrent, EditableStateChanged), new TemplaterController( "Templates\\SalesOrderGrid.xlsx", "Templates\\SalesOrderItem.xlsx", "Templates\\SalesOrderItem.docx", "Templates\\SalesOrder.txt", ItemsCollection, () => GridView.dataGrid.SelectedItems), new LayoutController(ChangeView, GridView, ItemView, GridView.dataGrid) }); ChangeView(GridView); PropertyChanged.Notify(() => CurrentItem); }
public void TestSalesOrderRepository() { var repo = new SalesOrderRepository(); var orders = repo.GetSalesOrdersAsync("00000", 25).Result; Assert.IsNotNull(orders.Count > 2); }
public virtual Task <IAppSalesOrder> Create() { var crmService = StartupHelper.CreateCrmService(); ISalesOrderRepository salesorderrepository = new SalesOrderRepository(); ISalesOrderService salesorderservice = new SalesOrderService(crmService, salesorderrepository); IAppSalesOrder app = new AppSalesOrder(salesorderservice); return(Task.FromResult(app));; }
public static Customer GetLargestCustomer() { var soRep = new SalesOrderRepository(); //return soRep.All().OrderByDescending(so => so.TotalSales).FirstOrDefault().CustomerId; var coRep = new CustomerRepository(); var Cs = coRep.All().ToList(); var selected = Cs.OrderByDescending(c => c.TotalSales); return(selected.FirstOrDefault()); }
public async Task GetByIdAsycAsync(string Id, string expected) { //arrange var salesOrderRepository = new SalesOrderRepository(SetUpContext()); //act var value = await salesOrderRepository.GetByIdAsync(new Guid(Id)); //assert Assert.AreEqual(expected, value.CustomerFirstName); }
public IQueryable<SalesOrder> GetSalesOrder() { List<SalesOrder> salesOrder = new List<SalesOrder>(); using (_uowProcess = new UnitOfWorkInventorySystemProcessEntities()) { SalesOrderRepository repo = new SalesOrderRepository(_uowProcess); salesOrder = repo.FindAll.ToList(); } return salesOrder.AsQueryable(); }
public async Task GetById_SaleOrderItemsCountAsync(string Id, int expected) { //arrange var salesOrderRepository = new SalesOrderRepository(SetUpContext()); //act var value = await salesOrderRepository.GetByIdAsync(new Guid(Id)); //assert Assert.AreEqual(expected, value.SaleOrderItems.Count()); }
public SalesOrder GetSalesOrderById(int id) { SalesOrder salesOrder = new SalesOrder(); using (_uowProcess = new UnitOfWorkInventorySystemProcessEntities()) { SalesOrderRepository repo = new SalesOrderRepository(_uowProcess); salesOrder = repo.Find(id); } return salesOrder; }
public async Task <IHttpActionResult> GetTopTenSalesOrders() { var repository = new SalesOrderRepository(); var results = await repository.GetTopTenSalesOrdersAsync(); if (results == null) { return(NotFound()); } return(Ok(results)); }
public AccountBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; accountRepository = new AccountRespository(unitOfWork); accountTypeRepository = new AccountTypeRespository(unitOfWork); tagRepository = new TagRepository(unitOfWork); accountTagRepository = new AccountTagRepository(unitOfWork); taskItemRepository = new TaskItemRepository(unitOfWork); contactRepository = new ContactRepository(unitOfWork); fileAttachmentRepository = new FileAttachmentRepository(unitOfWork); salesOrderRepository = new SalesOrderRepository(unitOfWork); accountCaseRepository = new AccountCaseRepository(unitOfWork); }
public SalesOrderModel GetSalesOrderDetail(int salesOrderId) { salesOrderRepository = new SalesOrderRepository(unitOfWork); SalesOrderModel salesOrderModel = new SalesOrderModel(); SalesOrder salesOrder = salesOrderRepository.SingleOrDefault(x => x.SalesOrderId == salesOrderId && x.RecordDeleted == false); AutoMapper.Mapper.Map(salesOrder.Address, salesOrderModel.AddressModel); AutoMapper.Mapper.Map(salesOrder.Account, salesOrderModel.AccountModel); //AutoMapper.Mapper.Map(salesOrder.Address1, salesOrderModel.AddressModel1); AutoMapper.Mapper.Map(salesOrder.ProductSalesOrderAssociations, salesOrderModel.ProductSalesOrderAssociationModels); AutoMapper.Mapper.Map(salesOrder, salesOrderModel); return(salesOrderModel); }
static async Task Main(string[] args) { var options = new Microsoft.EntityFrameworkCore.DbContextOptions <SalesOrderContext>(); var salesOrderContext = new SalesOrderContext(options); var serviceBusHelper = new StorageQueueHelper(); var testFileHelper = new TextFileHelper(); var productRepository = new ProductRepository(testFileHelper); var productService = new ProductService(productRepository); var salesOrderRepository = new SalesOrderRepository(salesOrderContext); var salesOrderService = new SalesOrderService(salesOrderRepository); var salesOrderProcessor = new SalesOrderProcessor( serviceBusHelper, productService, salesOrderService); await salesOrderProcessor.Run(); }
public Receipt GenerateFromSalesOrder(int salesOrderId) { var salesOrderEntity = SalesOrderRepository.Get(salesOrderId); var items = salesOrderEntity.Items.Select(e => new ReceiptItem(e)).ToList(); var itemsIds = items.Select(x => x.ItemId); return (new Receipt() { PriceCalculator = new LoggingPriceCalculator( new PriceOnlyForNewElementCalculator( new PriceCalculator(PriceService, DiscountsService), itemsIds), Logger), Items = items, Value = salesOrderEntity.Value }); }
public SalesOrdersAppService(SalesOrderRepository salesOrderRepository, SalesInvoiceRepository salesInvoiceRepository, SalesOrderLineRepository salesOrderLineRepository, IRepository <Customer, int> lookup_customerRepository, IRepository <Machine, int> lookup_machineRepository, IRepository <Material, int> lookup_materialRepository, IRepository <ProductionStatus, int> lookup_productionStatusRepository, IRepository <PaymentMethod, int> lookup_paymentMethodRepository ) { _salesOrderRepository = salesOrderRepository; _salesInvoiceRepository = salesInvoiceRepository; _salesOrderLineRepository = salesOrderLineRepository; _lookup_customerRepository = lookup_customerRepository; _lookup_machineRepository = lookup_machineRepository; _lookup_materialRepository = lookup_materialRepository; _lookup_productionStatusRepository = lookup_productionStatusRepository; _lookup_paymentMethodRepository = lookup_paymentMethodRepository; }
public LeadBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; leadRepository = new LeadRepository(unitOfWork); taskItemRepository = new TaskItemRepository(unitOfWork); stageRepository = new StageRepository(unitOfWork); leadAuditBusiness = new LeadAuditBusiness(unitOfWork); accountRepository = new AccountRespository(_unitOfWork); contactRepository = new ContactRepository(_unitOfWork); moduleRepository = new ModuleRepository(_unitOfWork); leadStatusRepository = new LeadStatusRepository(_unitOfWork); fileAttachmentrepository = new FileAttachmentRepository(_unitOfWork); stageBusiness = new StageBusiness(_unitOfWork); ratingBusiness = new RatingBusiness(_unitOfWork); leadContactRepository = new LeadContactRepository(_unitOfWork); accountcontactRepository = new AccountContactRepository(_unitOfWork); salesOrderRepository = new SalesOrderRepository(_unitOfWork); tagRepository = new TagRepository(_unitOfWork); leadTagRepository = new LeadTagRepository(_unitOfWork); }
/// <summary> /// Process Order /// </summary> /// <param name="customerId"></param> /// <param name="salesOrderId"></param> public void ProcessOrder(Guid customerId, Guid salesOrderId) { var customerRepository = new CustomerRepository(); var salesOrderRepository = new SalesOrderRepository(); // Get the Sales Order logger.WriteLine("Get SalesOrder ID={0}", salesOrderId); var salesOrder = salesOrderRepository.GetById(salesOrderId); // Get the Current Customer logger.WriteLine("Get Customer ID={0}", customerId); var currentCustomer = customerRepository.GetById(customerId); // Business Rules if(currentCustomer.CreditScore < 500) { logger.WriteLine("RequestApprovalForLowCreditScore"); salesOrder.Status = SalesOrderStatus.Pending; emailServer.Send(currentCustomer.ApprovalManagerEmail, "Request Approval for low credit score"); } else if( salesOrder.Total >= 1000D ) { logger.WriteLine("RequestApprovalForLargeOrder"); salesOrder.Status = SalesOrderStatus.LargeOrder; emailServer.Send(currentCustomer.ApprovalManagerEmail, "Request Approval for large order"); } else { logger.WriteLine("CompleteOrder"); salesOrder.Status = SalesOrderStatus.Completed; emailServer.Send(currentCustomer.EmailAddress, "Your order has been shipped"); } // Save the sales order and customer customerRepository.Save(currentCustomer); salesOrderRepository.Save(salesOrder); }
static async Task Main(string[] args) { // How manu to create? int salesOrderCount = int.Parse(args[0]); // Set-up Helpers and Dependencies var serviceBusHelper = new StorageQueueHelper(); var textFileHelper = new TextFileHelper(); // Set-up data access var options = new Microsoft.EntityFrameworkCore.DbContextOptions <SalesOrderContext>(); var salesOrderContext = new SalesOrderContext(options); var productRepository = new ProductRepository(textFileHelper); var productService = new ProductService(productRepository); var salesOrderRepository = new SalesOrderRepository(salesOrderContext); var consoleLogger = new ConsoleLogger(); // Process sales orders - will run forever var generateSalesOrders = new GenerateSalesOrders( serviceBusHelper, productService, consoleLogger); await generateSalesOrders.Run(salesOrderCount); }
public SalesorderController(SalesOrderRepository salesOrderRepository) { this.salesOrderRepository = salesOrderRepository; }
public SalesOrderFacade(DataContext dataContext) : base(dataContext) { salesorderRepository = new SalesOrderRepository(dataContext); }
public SalesOrderBusiness(IUnitOfWork _unitOfWork) { unitOfWork = _unitOfWork; salesOrderRepository = new SalesOrderRepository(unitOfWork); }
public MainPageViewModel(SalesOrderRepository repository) { _repository = repository; this.ActiveSalesOrderNumbers = new ObservableCollection <SalesOrder>(); }
public RepositoryFactory() { Repository bankRepository = new Repository(new Bank()); CurrencyRepository ccyRepository = new CurrencyRepository(); Repository divRepository = new Repository(new Division()); Repository empRepository = new EmployeeRepository(new Employee()); Repository topRepository = new Repository(new TermOfPayment()); Repository unitRepository = new Repository(new Unit()); Repository cuscatRepository = new Repository(new CustomerCategory()); Repository supcatRepository = new Repository(new SupplierCategory()); Repository pricecatRepository = new Repository(new PriceCategory()); Repository taxRepository = new Repository(new Tax()); Repository prtGroupRepository = new Repository(new PartGroup()); Repository warehouseRepository = new Repository(new Warehouse()); Repository prtCategoryRepository = new Repository(new PartCategory()); Repository docTypeRepository = new Repository(new DocumentType()); Repository excRateRepository = new Repository(new ExchangeRate()); CustomerRepository customerRepository = new CustomerRepository(); SupplierRepository supplierRepository = new SupplierRepository(); Repository yearRepository = new YearRepository(); Repository partRepository = new PartRepository(new Part()); StockTakingRepository stocktakingRepository = new StockTakingRepository(); UserRepository userRepository = new UserRepository(new User()); GeneralSetupRepository generalsetupRepository = new GeneralSetupRepository(); PurchaseOrderRepository poRepository = new PurchaseOrderRepository(); PeriodRepository periodRepository = new PeriodRepository(); UserSettingsRepository usRepository = new UserSettingsRepository(); GoodReceiveNoteRepository grnRepository = new GoodReceiveNoteRepository(); PurchaseReturnRepository prRepository = new PurchaseReturnRepository(); SupplierInvoiceRepository siRepository = new SupplierInvoiceRepository(); SupplierOutStandingInvoiceRepository soiRepository = new SupplierOutStandingInvoiceRepository(); SupplierInvoiceJournalRepository sijRepository = new SupplierInvoiceJournalRepository(); PaymentRepository payRepository = new PaymentRepository(); APDebitNoteRepository apdnRepository = new APDebitNoteRepository(); ProcessTransactionRepository prtrRepository = new ProcessTransactionRepository(); SalesOrderRepository slsorderRepository = new SalesOrderRepository(); DeliveryOrderRepository doRepository = new DeliveryOrderRepository(); SalesReturnRepository srRepository = new SalesReturnRepository(); CustomerOutStandingInvoiceRepository coirRepository = new CustomerOutStandingInvoiceRepository(); CustomerInvoiceRepository cirRepository = new CustomerInvoiceRepository(); ReceiptRepository rcptRepository = new ReceiptRepository(); ARCreditNoteRepository arcrRepository = new ARCreditNoteRepository(); CustomerInvoiceJournalRepository cijRepository = new CustomerInvoiceJournalRepository(); OpeningStockRepository opstRepository = new OpeningStockRepository(); POSRepository posRepository = new POSRepository(); m_listService.Add(BANK_REPOSITORY, bankRepository); m_listService.Add(CURRENCY_REPOSITORY, ccyRepository); m_listService.Add(DIVISION_REPOSITORY, divRepository); m_listService.Add(EMPLOYEE_REPOSITORY, empRepository); m_listService.Add(TOP_REPOSITORY, topRepository); m_listService.Add(UNIT_REPOSITORY, unitRepository); m_listService.Add(CUSTOMER_CATEGORY_REPOSITORY, cuscatRepository); m_listService.Add(SUPPLIER_CATEGORY_REPOSITORY, supcatRepository); m_listService.Add(PRICE_CATEGORY_REPOSITORY, pricecatRepository); m_listService.Add(TAX_REPOSITORY, taxRepository); m_listService.Add(PART_GROUP_REPOSITORY, prtGroupRepository); m_listService.Add(WAREHOUSE_REPOSITORY, warehouseRepository); m_listService.Add(PART_CATEGORY_REPOSITORY, prtCategoryRepository); m_listService.Add(DOC_TYPE_REPOSITORY, docTypeRepository); m_listService.Add(EXCHANGE_RATE_REPOSITORY, excRateRepository); m_listService.Add(CUSTOMER_REPOSITORY, customerRepository); m_listService.Add(SUPPLIER_REPOSITORY, supplierRepository); m_listService.Add(YEAR_REPOSITORY, yearRepository); m_listService.Add(PART_REPOSITORY, partRepository); m_listService.Add(STOCKTAKING_REPOSITORY, stocktakingRepository); m_listService.Add(USER_REPOSITORY, userRepository); m_listService.Add(GENERAL_SETUP_REPOSITORY, generalsetupRepository); m_listService.Add(PURCHASEORDER_REPOSITORY, poRepository); m_listService.Add(PERIOD_REPOSITORY, periodRepository); m_listService.Add(USER_SETTING_REPOSITORY, usRepository); m_listService.Add(GOODRECEIVENOTE_REPOSITORY, grnRepository); m_listService.Add(PURCHASE_RETURN_REPOSITORY, prRepository); m_listService.Add(SUPPLIERINVOICE_REPOSITORY, siRepository); m_listService.Add(SUPPLIERINVOICE_JOURNAL_REPOSITORY, sijRepository); m_listService.Add(SUPPLIER_OUTSTANDING_INVOICE_REPOSITORY, soiRepository); m_listService.Add(PAYMENT_REPOSITORY, payRepository); m_listService.Add(APDEBITNOTE_REPOSITORY, apdnRepository); m_listService.Add(PROCESS_TRANSACTION_REPOSITORY, prtrRepository); m_listService.Add(SALES_ORDER_REPOSITORY, slsorderRepository); m_listService.Add(DELIVERY_ORDER_REPOSITORY, doRepository); m_listService.Add(SALES_RETURN_REPOSITORY, srRepository); m_listService.Add(CUSTOMER_OUTSTANDING_INVOICE_REPOSITORY, coirRepository); m_listService.Add(CUSTOMERINVOICE_REPOSITORY, cirRepository); m_listService.Add(RECEIPT_REPOSITORY, rcptRepository); m_listService.Add(ARCREDITNOTE_REPOSITORY, arcrRepository); m_listService.Add(CUSTOMERINVOICE_JOURNAL_REPOSITORY, cijRepository); m_listService.Add(OPENING_STOCK_REPOSITORY, opstRepository); m_listService.Add(POS_REPOSITORY, posRepository); }
public void Init() { soRepo = new SalesOrderRepository(); productRepo = new ProductRepository(); }