public async Task UpdateAsyncShouldUpdateOrder() { var db = DbInfrastructure.GetDatabase(); var customer = await DbInfrastructure.SeedCustomer(db); var serviceProviderMock = new Mock <IServiceProvider>(); var orderService = new PurchaseOrderService(db, new SortStrategyParser(serviceProviderMock.Object)); var order = await SeedOrderByCustomer(db, customer); const string UpdatedDescription = "Updated Description!"; const decimal UpdatedPrice = 999.999M; const int UpdatedQuantity = 5; await orderService.UpdateAsync(order.Id, UpdatedDescription, UpdatedPrice, UpdatedQuantity, Status.Inactive); var actualOrder = await db.Purchases.FirstOrDefaultAsync(); actualOrder .Should() .Match <PurchaseOrder>(po => po.Description == UpdatedDescription) .And .Match <PurchaseOrder>(po => po.Price == UpdatedPrice) .And .Match <PurchaseOrder>(po => po.Quantity == UpdatedQuantity) .And .Match <PurchaseOrder>(po => po.Status == Status.Inactive); }
public async Task AllAsyncShouldReturnCorrectCustomersSortedByDescription() { var db = DbInfrastructure.GetDatabase(); var serviceProviderMock = new Mock <IServiceProvider>(); var customer = await DbInfrastructure.SeedCustomer(db); await DbInfrastructure.SeedCustomers(100, 10, db); var orderService = new PurchaseOrderService(db, new SortStrategyParser(serviceProviderMock.Object)); await DbInfrastructure.SeedOrdersByCustomer(db, customer); const string Description = "description"; for (var i = 1; i <= 8; i++) { var orders = await orderService.AllAsync <OrderViewModel>(i, customer.Id, Description); orders .Should() .HaveCount(WebConstants.OrdersPerPage); orders .Should() .BeInAscendingOrder(c => c.Description); orders .Should() .NotContain(c => c.Status == Status.Deleted); } }
public async Task GetByIdAsyncShouldReturnCorrectOrder() { var db = DbInfrastructure.GetDatabase(); var customer = await DbInfrastructure.SeedCustomer(db); var serviceProviderMock = new Mock <IServiceProvider>(); var orderService = new PurchaseOrderService(db, new SortStrategyParser(serviceProviderMock.Object)); var order = await SeedOrderByCustomer(db, customer); var actualOrder = await orderService.GetByIdAsync(order.Id); actualOrder .Should() .Match <PurchaseOrder>(po => po.CustomerId == customer.Id) .And .Match <PurchaseOrder>(po => po.Status == Status.Active) .And .Match <PurchaseOrder>(po => po.Description == Constants.Description) .And .Match <PurchaseOrder>(po => po.Price == Constants.Price) .And .Match <PurchaseOrder>(po => po.Quantity == Constants.Quantity) .And .Match <PurchaseOrder>(po => po.TotalAmount == Constants.Price * Constants.Quantity); }
public async Task DeleteAsyncShouldMarkOrderAsDeleted() { var db = DbInfrastructure.GetDatabase(); var customer = await DbInfrastructure.SeedCustomer(db); await DbInfrastructure.SeedOrdersByCustomer(db, customer); var serviceProviderMock = new Mock <IServiceProvider>(); var orderService = new PurchaseOrderService(db, new SortStrategyParser(serviceProviderMock.Object)); IEnumerable <OrderViewModel> orders; for (var i = 1; i <= 10; i++) { orders = await orderService.AllAsync <OrderViewModel>(i, customer.Id, string.Empty); await orderService.DeleteAsync(orders.First().Id); } for (var i = 1; i <= 9; i++) { orders = await orderService.AllAsync <OrderViewModel>(i, customer.Id, string.Empty); orders .Should() .HaveCount(WebConstants.OrdersPerPage); } }
public PurchaseOrderController(SCMSContext _context) { var optionBuilder = new DbContextOptions <SCMSContext>(); _purchaseOrderRepository = new PurchaseOrderRepository(_context); _purchaseOrderItemRepository = new PurchaseOrderItemRepository(_context); _purchaseOrderService = new PurchaseOrderService(_purchaseOrderRepository, _purchaseOrderItemRepository); }
/// <summary> /// 到货的采购单据 /// </summary> public void PerformedTabPageInit() { int status = Convert.ToInt32(OrderStatus.Performed); List <PurchaseOrder> purOrderList = PurchaseOrderService.GetStatusPurchaseOrder(status); dt.Rows.Clear(); PerformedControl.DataSource = GetPurchaseOrderList(purOrderList); }
public ActionResult ViewClosedPO(string orderNumber, string sessionId) { PurchaseOrder order = PurchaseOrderService.GetOrderDetails(orderNumber); ViewData["order"] = order; ViewData["sessionId"] = sessionId; return(View("Closed")); }
public ActionResult Update(int id, int status) { PurchaseOrder purchase = new PurchaseOrderService().GetById(id); purchase.SetStatus(status); new PurchaseOrderService().Update(purchase); return(View()); }
public InventoryApiController() { context = new ApplicationDbContext(); itemService = new ItemService(context); stkMovementService = new StockMovementService(context); itemPriceService = new ItemPriceService(context); requisitionService = new RequisitionService(context); purchaseOrderService = new PurchaseOrderService(context); }
static void Main(string[] args) { ITerminal terminal = new VT100(); IPurchaseOrderService purchaseOrderService = new PurchaseOrderService(); PurchaseOrderScreen screen = new PurchaseOrderScreen(purchaseOrderService, terminal); screen.Display(); }
public ActionResult All(string sessionId) { Employee user = EmployeeService.GetUserBySessionId(sessionId); List <PurchaseOrder> orders = PurchaseOrderService.GetAllOrders(user.EmpId); ViewData["sessionId"] = sessionId; ViewData["orders"] = orders; return(View()); }
public PurchaseOrderController() { context = new ApplicationDbContext(); purchaseOrderService = new PurchaseOrderService(context); statusService = new StatusService(context); itemService = new ItemService(context); itemPriceService = new ItemPriceService(context); userService = new UserService(context); }
public void Put() { // Arrange PurchaseOrderService controller = _container.Resolve <PurchaseOrderService>(); // Act controller.Put(5, "value"); // Assert }
public ActionResult ConfirmOrder(bool confirm, string orderNumber, string sessionId) { if (confirm) { PurchaseOrderService.ConfirmOrder(orderNumber); return(RedirectToAction("All", new { sessionid = sessionId })); } return(null); }
public void Delete() { // Arrange PurchaseOrderService controller = _container.Resolve <PurchaseOrderService>(); // Act controller.Delete(5); // Assert }
public DeliveryOrderController() { context = new ApplicationDbContext(); deliveryOrderService = new DeliveryOrderService(context); purchaseOrderService = new PurchaseOrderService(context); purchaseOrderDetailService = new PurchaseOrderService(context); userService = new UserService(context); statusService = new StatusService(context); supplierService = new SupplierService(context); itemService = new ItemService(context); }
static void Main(string[] args) { Assembly.Load("AcmeCorpEF"); ITerminal terminal = new VT100(); IPurchaseOrderService purchaseOrderService = new PurchaseOrderService(); PurchaseOrderScreen screen = new PurchaseOrderScreen(purchaseOrderService, terminal); screen.Display(); }
public PODOController(DeliveryOrderService doService, PurchaseDeliveryProductService pdpService, PurchaseOrderService poService, ProductService pService, SupplierProductService spService, SupplierService supService, DeliveryOrderSupplierProductService dospService) { this.doService = doService; this.poService = poService; this.pdpService = pdpService; this.pService = pService; this.spService = spService; this.supService = supService; this.dospService = dospService; }
static void Main(string[] args) { IUnitOfWorkFactory uwf = new EFUnitOfWorkFactory(); ITerminal terminal = new VT100(); IPurchaseOrderService purchaseOrderService = new PurchaseOrderService(uwf); PurchaseOrderScreen screen = new PurchaseOrderScreen(purchaseOrderService, terminal); screen.Display(); }
public void GetById() { // Arrange PurchaseOrderService controller = _container.Resolve <PurchaseOrderService>(); // Act string result = controller.Get(5); // Assert Assert.AreEqual("value", result); }
private void LoadData() { var poHeader = PurchaseOrderService.GetPurchaseOrder(RowID); Detail = PurchaseOrderService.GetPurchaseOrderDetail(RowID).ToList(); txtDocumentNo.Text = poHeader.DocumentNo; lblBranch.Text = poHeader.Branch.Name; ViewState["BranchID"] = poHeader.BranchID; ddlTerms.SelectedValue = poHeader.Terms; cboSupplier.SelectedValue = poHeader.SupplierID.ToString(); dtpDate.SelectedDate = poHeader.DocumentDate; dtpExpectedDate.SelectedDate = poHeader.ExpectedDate; txtNotes.Text = poHeader.Notes; SupplierInformation.LoadSupplierInformation(poHeader.SupplierID); lblPONo.Text = String.Format("{0} - {1}", poHeader.DocumentNo, PurchaseOrderService.TranslateStatus(Convert.ToString(poHeader.Status))); btnVoid.Enabled = true; btnPrint.Enabled = true; RefreshDetail(); if (poHeader.VoidWhen.HasValue || poHeader.Status == 'N' || poHeader.Status == 'A') { btnSave.Enabled = false; btnVoid.Enabled = false; } if (poHeader.Status != 'A') { btnPrint.Enabled = false; } switch (poHeader.Status) { case 'A': lblPOStatus.Text = "Approved"; break; case 'N': lblPOStatus.Text = "Not Approved"; break; case 'V': lblPOStatus.Text = "Void"; break; default: lblPOStatus.Text = "Open"; break; } //btnPrint.Attributes.Add("onclick", // String.Format("showSimplePopUp('ReportPreview.aspx?ReportName={0}&DocumentNo={1}'); return false;", // "SlipPurchaseOrder", // poHeader.DocumentNo)); }
public async Task GetPurchaseOrderAsync_Returns_Null() { //Arrange var id = 10001; var service = new PurchaseOrderService(_myRestaurantContext); //Act var result = await service.GetPurchaseOrderAsync(d => d.Id == id); //Assert result.Should().BeNull(); }
private void definePOToolStripMenuItem_Click(object sender, EventArgs e) { IPurchaseOrderService purchaseOrderService = new PurchaseOrderService(); IProductService productService = new ProductService(); FrmPurchaseOrder childForm = new FrmPurchaseOrder(purchaseOrderService, productService); childForm.MdiParent = this; // childForm.Text = "FrmUser " + childFormNumber++; childForm.Dock = DockStyle.Fill; childForm.Show(); }
public async Task GetPurchaseOrdersAsync_Returns_PurchaseOrders() { //Arrange var service = new PurchaseOrderService(_myRestaurantContext); //Act var result = await service.GetPurchaseOrdersAsync(); //Assert result.Should().BeAssignableTo <IEnumerable <PurchaseOrder> >(); result.Should().HaveCount(6); }
public void TestMethod1() { List <PurchaseOrder> result = new List <PurchaseOrder>(); using (var context = new PurchaseSQLDBContext()) { PurchaseOrderService service = new PurchaseOrderService(); result = service.GetAll(); } Assert.IsTrue(result.Count > 200); }
public void UpdateAsyncShouldThrowInvalidOperationExceptionIfOrderIsNotFound() { var db = DbInfrastructure.GetDatabase(); var serviceProviderMock = new Mock <IServiceProvider>(); var orderService = new PurchaseOrderService(db, new SortStrategyParser(serviceProviderMock.Object)); Func <Task> func = async() => await orderService.DeleteAsync(Guid.NewGuid().ToString()); func .Should() .Throw <InvalidOperationException>() .WithMessage(ExceptionMessages.OrderNotFound); }
public void TestInitialize() { context = new ApplicationDbContext(); purchaseOrderService = new PurchaseOrderService(context); purchaseOrderRepository = new PurchaseOrderRepository(context); purchaseOrderDetailRepository = new PurchaseOrderDetailRepository(context); statusRepository = new StatusRepository(context); itemRepository = new ItemRepository(context); itemPriceRepository = new ItemPriceRepository(context); supplierRepository = new SupplierRepository(context); deliveryOrderRepository = new DeliveryOrderRepository(context); deliveryOrderDetailRepository = new DeliveryOrderDetailRepository(context); }
/// <summary> /// 三个月内新增的订单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ThreeMonthOrderItem_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e) { DateTime dTime = System.DateTime.Now; string weekNow = DateTime.Now.ToString(); //MessageBox.Show(weekNow.ToString()); int intervalDays = 90; // 计算两个之间相隔的天数 string weekStart = DateTime.Now.AddDays(-intervalDays + 1).ToString("yyyy-MM-dd 00:00:00"); //MessageBox.Show(weekStart.ToString()); List <PurchaseOrder> monthOrderList = PurchaseOrderService.GetPurchaseOrder(Convert.ToDateTime(weekStart), Convert.ToDateTime(weekNow)); dt.Rows.Clear(); gridControl1.DataSource = GetPurchaseOrderList(monthOrderList); }
public void Get() { // Arrange PurchaseOrderService controller = _container.Resolve <PurchaseOrderService>(); // Act IEnumerable <string> result = controller.Get(); // Assert Assert.IsNotNull(result); Assert.AreEqual(2, result.Count()); Assert.AreEqual("value1", result.ElementAt(0)); Assert.AreEqual("value2", result.ElementAt(1)); }
protected void btnProcessApprove_Click(object sender, EventArgs e) { try { PurchaseOrderService.ApprovedPurchaseOrder(txtDocumentNo.Text, EmployeeService.GetEmployee(UserSessionHelper.GetCurrentUserName()).ID, txtApproveReason.Text); LoadData(); WebFormHelper.SetLabelTextWithCssClass(lblStatusAddEdit, String.Format("Purchase Order {0} has been marked as APPROVED", txtDocumentNo.Text), LabelStyleNames.AlternateMessage); } catch (Exception ex) { WebFormHelper.SetLabelTextWithCssClass(lblStatusAddEdit, ex.Message, LabelStyleNames.ErrorMessage); } }