コード例 #1
0
        public void EditWithExternalPerson()
        {
            var before = new SalesOrders(this.Session).Extent().ToArray();

            var expected = new SalesOrderBuilder(this.Session).WithPersonExternalDefaults(this.internalOrganisation).Build();

            this.Session.Derive();

            var expectedBillToCustomer             = expected.BillToCustomer?.DisplayName();
            var expectedBillToContactMechanism     = expected.BillToContactMechanism;
            var expectedShipToCustomer             = expected.ShipToCustomer?.DisplayName();
            var expectedShipToAddressDisplayName   = expected.ShipToAddress.DisplayName();
            var expectedShipFromAddressDisplayName = expected.ShipFromAddress?.DisplayName();
            var expectedCustomerReference          = expected.CustomerReference;
            var expectedDescription     = expected.Description;
            var expectedInternalComment = expected.InternalComment;

            var salesOrder = before.First();
            var id         = salesOrder.Id;

            this.salesOrderListPage.Table.DefaultAction(salesOrder);
            var salesOrderOverview       = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver);
            var salesOrderOverviewDetail = salesOrderOverview.SalesorderOverviewDetail.Click();

            salesOrderOverviewDetail.BillToCustomer.Select(expected.BillToCustomer?.DisplayName());

            this.Driver.WaitForAngular();

            salesOrderOverviewDetail.BillToContactMechanism.Select(expected.BillToContactMechanism);
            salesOrderOverviewDetail.ShipToCustomer.Select(expected.ShipToCustomer?.DisplayName());

            this.Driver.WaitForAngular();

            salesOrderOverviewDetail.ShipToAddress.Select(expected.ShipToAddress);
            salesOrderOverviewDetail.ShipFromAddress.Select(expected.ShipFromAddress);
            salesOrderOverviewDetail.CustomerReference.Set(expected.CustomerReference);
            salesOrderOverviewDetail.Description.Set(expected.Description);
            salesOrderOverviewDetail.InternalComment.Set(expected.InternalComment);

            this.Session.Rollback();
            salesOrderOverviewDetail.SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new SalesOrders(this.Session).Extent().ToArray();

            salesOrder = (SalesOrder)this.Session.Instantiate(id);

            Assert.Equal(after.Length, before.Length);

            Assert.Equal(expectedBillToCustomer, salesOrder.BillToCustomer?.DisplayName());
            Assert.Equal(expectedBillToContactMechanism, salesOrder.BillToContactMechanism);
            Assert.Equal(expectedShipToCustomer, salesOrder.ShipToCustomer?.DisplayName());
            Assert.Equal(expectedShipToAddressDisplayName, salesOrder.ShipToAddress.DisplayName());
            Assert.Equal(expectedShipFromAddressDisplayName, salesOrder.ShipFromAddress?.DisplayName());
            Assert.Equal(expectedCustomerReference, salesOrder.CustomerReference);
            Assert.Equal(expectedDescription, salesOrder.Description);
            Assert.Equal(expectedInternalComment, salesOrder.InternalComment);
        }
コード例 #2
0
        public int AddOrder(SalesOrders order)
        {
            _unitOfWork.OrderRepository.AddOrder(order);
            _unitOfWork.Save();

            return(order.SalesOrdersId);
        }
コード例 #3
0
        public IHttpActionResult PutSalesOrders(int id, SalesOrders salesOrders)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != salesOrders.SalesOrderId)
            {
                return(BadRequest());
            }

            db.Entry(salesOrders).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SalesOrdersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #4
0
 private void CloseOrder()
 {
     SelectedSalesOrder.IsClosed = true;
     SalesOrders.Update(SelectedSalesOrder);
     RefreshData();
     SelectedSalesOrder = null;
 }
コード例 #5
0
ファイル: AppState.cs プロジェクト: barahonajm/FastPOS
        public void CompleteCurrentOrder()
        {
            CurrentSalesOrder.CompleteSalesOrder();
            SalesOrders.Add(CurrentSalesOrder);

            CurrentSalesOrder = new SalesOrder(new Location(Country.BOLIVIA, City.COCHABAMBA));
        }
コード例 #6
0
        public ActionResult CreateOrder(SalesOrders order)
        {
            // 產品選擇是否重複  true:有重複
            bool isProductDuplicate = order.Details.Select(x => x.ProductID).Distinct().Count() != order.Details.Count;

            if (!ModelState.IsValid || isProductDuplicate)
            {
                ViewBag.ErrorMessage = isProductDuplicate ? "商品重複!" : "驗證失敗!";
                // 準備 [客戶名稱] 下拉選單
                ViewBag.CustomerList = GetCustomerList();

                // 準備 [負責員工] 下拉選單資料
                ViewBag.EmployeeList = GetEmployeeList();

                // 準備 [出貨公司名稱] 下拉選單資料
                ViewBag.ShipperList = GetShipperList();

                return(View(order));
            }
            ModelState.Clear();

            SalesOrdersService orderService = new SalesOrdersService();

            orderService.InsOrder(order);

            return(RedirectToAction("Query", "Order"));
        }
コード例 #7
0
        public void CreateWithProductItemDefaults()
        {
            var salesOrder = new SalesOrders(this.Session).Extent().FirstOrDefault();

            var before = new SalesOrderItems(this.Session).Extent().ToArray();

            var expected = new SalesOrderItemBuilder(this.Session).WithSerialisedProductDefaults().Build();

            salesOrder.AddSalesOrderItem(expected);

            this.Session.Derive();

            Assert.True(expected.ExistDescription);
            Assert.True(expected.ExistComment);
            Assert.True(expected.ExistInternalComment);
            Assert.True(expected.ExistInvoiceItemType);
            Assert.True(expected.ExistProduct);
            Assert.True(expected.ExistSerialisedItem);
            Assert.True(expected.ExistQuantityOrdered);
            Assert.True(expected.ExistAssignedUnitPrice);

            var expectedDescription       = expected.Description;
            var expectedComment           = expected.Comment;
            var expectedInternalComment   = expected.InternalComment;
            var expectedInvoiceItemType   = expected.InvoiceItemType;
            var expectedProduct           = expected.Product;
            var expectedSerialisedItem    = expected.SerialisedItem;
            var expectedQuantityOrdered   = expected.QuantityOrdered;
            var expectedAssignedUnitPrice = expected.AssignedUnitPrice;

            this.salesOrderListPage.Table.DefaultAction(salesOrder);
            var salesOrderOverview          = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver);
            var salesOrderItemOverviewPanel = salesOrderOverview.SalesorderitemOverviewPanel.Click();

            var salesOrderItemCreate = salesOrderItemOverviewPanel
                                       .CreateSalesOrderItem()
                                       .BuildForProductItemDefaults(expected);

            this.Session.Rollback();
            salesOrderItemCreate.SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new SalesOrderItems(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length + 1);

            var actual = after.Except(before).First();

            Assert.Equal(expectedDescription, actual.Description);
            Assert.Equal(expectedComment, actual.Comment);
            Assert.Equal(expectedInternalComment, actual.InternalComment);
            Assert.Equal(expectedInvoiceItemType, actual.InvoiceItemType);
            Assert.Equal(expectedProduct, actual.Product);
            Assert.Equal(expectedSerialisedItem, actual.SerialisedItem);
            Assert.Equal(expectedQuantityOrdered, actual.QuantityOrdered);
            Assert.Equal(expectedAssignedUnitPrice, actual.AssignedUnitPrice);
        }
コード例 #8
0
        public ActionResult DeleteConfirmed(int id)
        {
            SalesOrders salesOrders = db.SalesOrders.Find(id);

            db.SalesOrders.Remove(salesOrders);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #9
0
ファイル: salesorderstest.cs プロジェクト: zhimaqiao51/docs
        public void ConnectTest()
        {
            IComponentConnector target = new SalesOrders(); // TODO: Initialize to an appropriate value
            int    connectionId        = 0;                 // TODO: Initialize to an appropriate value
            object target1             = null;              // TODO: Initialize to an appropriate value

            target.Connect(connectionId, target1);
        }
コード例 #10
0
        public void CreateWithInternalOrganisation()
        {
            var before = new SalesOrders(this.Session).Extent().ToArray();

            var expected = new SalesOrderBuilder(this.Session).WithOrganisationInternalDefaults(this.internalOrganisation).Build();

            Assert.True(expected.ExistShipToAddress);
            Assert.True(expected.ExistComment);
            Assert.True(expected.ExistBillToCustomer);
            Assert.True(expected.ExistBillToContactMechanism);
            Assert.True(expected.ExistBillToContactPerson);
            Assert.True(expected.ExistShipToCustomer);
            Assert.True(expected.ExistShipToAddress);
            Assert.True(expected.ExistShipToContactPerson);
            Assert.True(expected.ExistShipFromAddress);
            Assert.True(expected.ExistCustomerReference);

            this.Session.Derive();

            var expectedBillToCustomer             = expected.BillToCustomer.DisplayName();
            var expectedBillToContactMechanism     = expected.BillToContactMechanism;
            var expectedBillToContactPerson        = expected.BillToContactPerson;
            var expectedShipToCustomer             = expected.ShipToCustomer.DisplayName();
            var expectedShipToAddressDisplayName   = expected.ShipToAddress.DisplayName();
            var expectedShipToContactPerson        = expected.ShipToContactPerson;
            var expectedShipFromAddressDisplayName = expected.ShipFromAddress.DisplayName();
            var expectedCustomerReference          = expected.CustomerReference;

            var salesOrderCreate = this.salesOrderListPage
                                   .CreateSalesOrder()
                                   .BuildForOrganisationInternalDefaults(expected);


            this.Session.Rollback();
            salesOrderCreate.SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new SalesOrders(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length + 1);

            var actual = after.Except(before).First();

            Assert.Equal(expectedBillToCustomer, actual.BillToCustomer?.DisplayName());

            this.Driver.WaitForAngular();

            Assert.Equal(expectedBillToContactMechanism, actual.BillToContactMechanism);
            Assert.Equal(expectedBillToContactPerson, actual.BillToContactPerson);
            Assert.Equal(expectedShipToCustomer, actual.ShipToCustomer?.DisplayName());
            Assert.Equal(expectedShipToAddressDisplayName, actual.ShipToAddress?.DisplayName());
            Assert.Equal(expectedShipToContactPerson, actual.ShipToContactPerson);
            Assert.Equal(expectedShipFromAddressDisplayName, actual.ShipFromAddress?.DisplayName());
            Assert.Equal(expectedCustomerReference, actual.CustomerReference);
        }
コード例 #11
0
ファイル: SalesOrdersDao.cs プロジェクト: plolpss/test
        /// <summary>
        /// 用訂單編號取得訂單及明細
        /// </summary>
        /// <param name="orderId"></param>
        /// <returns></returns>
        public SalesOrders GetOrderById(int orderId)
        {
            using (SqlConnection conn = GetSqlConnection())
            {
                string     sql = "select * from Sales.Orders where OrderID = @Id";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.Add(new SqlParameter("@Id", orderId));

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);

                DataSet ds = new DataSet();
                adapter.Fill(ds);

                DataRow     row   = ds.Tables[0].Rows[0];
                SalesOrders order =
                    new SalesOrders
                {
                    OrderID    = int.Parse(row["OrderID"].ToString()),
                    CustomerID = int.Parse(row["CustomerID"].ToString()),
                    EmployeeID = int.Parse(row["EmployeeID"].ToString()),

                    OrderDate      = DateTime.Parse(row["OrderDate"].ToString()),
                    RequiredDate   = DateTime.Parse(row["RequiredDate"].ToString()),
                    ShippedDate    = (!string.IsNullOrWhiteSpace(row["ShippedDate"].ToString())) ? new DateTime?(DateTime.Parse(row["ShippedDate"].ToString())) : null,
                    ShipperID      = (!string.IsNullOrWhiteSpace(row["ShipperID"].ToString())) ? new int?(int.Parse(row["ShipperID"].ToString())) : null,
                    Freight        = (!string.IsNullOrWhiteSpace(row["Freight"].ToString())) ? new decimal?(decimal.Parse(row["Freight"].ToString())) : null,
                    ShipCountry    = row["ShipCountry"].ToString(),
                    ShipCity       = row["ShipCity"].ToString(),
                    ShipRegion     = row["ShipRegion"].ToString(),
                    ShipPostalCode = row["ShipPostalCode"].ToString(),
                    ShipAddress    = row["ShipAddress"].ToString()
                };

                string     sqlDetail = "select * from Sales.OrderDetails where OrderID = @Id";
                SqlCommand cmdDetail = new SqlCommand(sqlDetail, conn);
                cmdDetail.Parameters.Add(new SqlParameter("@Id", orderId));

                SqlDataAdapter adapterDetail = new SqlDataAdapter(cmdDetail);

                DataSet dsDetail = new DataSet();
                adapterDetail.Fill(dsDetail);
                order.Details = new List <OrderDetail>();
                foreach (DataRow detailRow in dsDetail.Tables[0].Rows)
                {
                    order.Details.Add(new OrderDetail
                    {
                        OrderID   = int.Parse(detailRow["OrderID"].ToString()),
                        ProductID = int.Parse(detailRow["ProductID"].ToString()),
                        UnitPrice = decimal.Parse(detailRow["UnitPrice"].ToString()),
                        Qty       = int.Parse(detailRow["Qty"].ToString()),
                    });
                }

                return(order);
            }
        }
コード例 #12
0
        public IHttpActionResult GetSalesOrders(int id)
        {
            SalesOrders salesOrders = db.SalesOrders.Find(id);

            if (salesOrders == null)
            {
                return(NotFound());
            }

            return(Ok(salesOrders));
        }
コード例 #13
0
 private void updateSalesOrder(SalesOrders salesOrder, bool sendResult)
 {
     if (sendResult)
     {
         salesOrder.WmsUpdate = DateTime.Now;
         db.SalesOrders.Attach(salesOrder);
         db.Entry(salesOrder).Property(x => x.WmsUpdate).IsModified = true;
         db.SaveChanges();
         System.Console.WriteLine("salesOrder:" + salesOrder.SalesOrderId + "\nSend to Wms");
     }
 }
コード例 #14
0
        public void UpdateSalesOrder(SalesOrders model)
        {
            var vm = unitOfWork.SalesOrderPaymentRepo.Fetch(x => x.SalesOrderId == model.Id).Sum(x => x.Amount);

            if (model.TotalAmount >= vm)
            {
                model.Status = "Tendered Transaction";
            }
            unitOfWork.SalesOrderRepo.Update(model);
            unitOfWork.SalesOrderRepo.SaveChanges();
        }
コード例 #15
0
        public ActionResult UpdateOrder(int orderID)
        {
            SalesOrdersService orderService = new SalesOrdersService();

            SalesOrders order = orderService.GetOrder(orderID);

            // 準備下拉選單
            PrepareDDLSource();

            return(View(order));
        }
コード例 #16
0
        public void EditWithSerialisedProductItemDefaults()
        {
            var salesOrder = new SalesOrders(this.Session).Extent().FirstOrDefault();

            var before = new SalesOrderItems(this.Session).Extent().ToArray();

            var disposableSalesOrder = new SalesOrderBuilder(this.Session).WithOrganisationInternalDefaults(this.internalOrganisation).Build();
            var expected             = disposableSalesOrder.SalesOrderItems.First(v => v.InvoiceItemType.IsProductItem);

            var salesOrderItem = salesOrder.SalesOrderItems.First(v => v.InvoiceItemType.IsProductItem);
            var id             = salesOrderItem.Id;

            this.Session.Derive();

            var expectedDescription       = expected.Description;
            var expectedComment           = expected.Comment;
            var expectedInternalComment   = expected.InternalComment;
            var expectedInvoiceItemType   = expected.InvoiceItemType;
            var expectedProduct           = expected.Product;
            var expectedSerialisedItem    = expected.SerialisedItem;
            var expectedQuantityOrdered   = expected.QuantityOrdered;
            var expectedAssignedUnitPrice = expected.AssignedUnitPrice;

            this.salesOrderListPage.Table.DefaultAction(salesOrder);
            var salesOrderOverview          = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver);
            var salesOrderItemOverviewPanel = salesOrderOverview.SalesorderitemOverviewPanel.Click();

            salesOrderItemOverviewPanel.Table.DefaultAction(salesOrderItem);

            var salesOrderItemEdit = new SalesOrderItemEditComponent(this.Driver);

            salesOrderItemEdit.Description.Set(expected.Description);
            salesOrderItemEdit.Comment.Set(expected.Comment);
            salesOrderItemEdit.InternalComment.Set(expected.InternalComment);
            salesOrderItemEdit.PriceableAssignedUnitPrice_2.Set(expected.AssignedUnitPrice.ToString());

            this.Session.Rollback();
            salesOrderItemEdit.SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new SalesOrderItems(this.Session).Extent().ToArray();

            var actual = (SalesOrderItem)this.Session.Instantiate(id);

            Assert.Equal(after.Length, before.Length);

            Assert.Equal(expectedDescription, actual.Description);
            Assert.Equal(expectedComment, actual.Comment);
            Assert.Equal(expectedInternalComment, actual.InternalComment);
            Assert.Equal(expectedInvoiceItemType, actual.InvoiceItemType);
            Assert.Equal(expectedAssignedUnitPrice, actual.AssignedUnitPrice);
        }
コード例 #17
0
        public IHttpActionResult PostSalesOrders(SalesOrders salesOrders)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SalesOrders.Add(salesOrders);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = salesOrders.SalesOrderId }, salesOrders));
        }
コード例 #18
0
        public virtual void Initialize()
        {
            var tariff = new Tariff(100.0m,
                                    new Dictionary <ShippingType, decimal>
            {
                [ShippingType.Standard] = 10,
                [ShippingType.Express]  = 50,
                [ShippingType.Teleport] = 500
            });

            SalesOrders.Insert(new SalesOrder("SO123", DateTime.Today, new Customer("Bob", tariff)));
            SalesOrders.Insert(new SalesOrder("SO456", null, new Customer("Mary", null)));
        }
コード例 #19
0
        public SalesOrders Insert(SalesOrders salesOrders)
        {
            try
            {
                db.SalesOrders.Add(salesOrders);
                db.SaveChanges();
            }
            catch (Exception e)
            {
            }

            return(salesOrders);
        }
コード例 #20
0
 public void TenderTransaction(SalesOrders salesOrders)
 {
     try
     {
         var sales = db.SalesOrders.Find(salesOrders.Id);
         sales.CustomerName = salesOrders.CustomerName;
         sales.AmountPaid   = salesOrders.AmountPaid;
         sales.Status       = "Tendered Transaction";
         db.SaveChanges();
     }
     catch (Exception e)
     {
     }
 }
コード例 #21
0
        public IHttpActionResult DeleteSalesOrders(int id)
        {
            SalesOrders salesOrders = db.SalesOrders.Find(id);

            if (salesOrders == null)
            {
                return(NotFound());
            }

            db.SalesOrders.Remove(salesOrders);
            db.SaveChanges();

            return(Ok(salesOrders));
        }
コード例 #22
0
        // GET: SalesOrders/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SalesOrders salesOrders = db.SalesOrders.Find(id);

            if (salesOrders == null)
            {
                return(HttpNotFound());
            }
            return(View(salesOrders));
        }
コード例 #23
0
 public async System.Threading.Tasks.Task <ActionResult> Create2([Bind(Include = "SalesOrderId,SalesOrderStatusId,CustomerId,ExpectedDate,CurrencyId,CurrencyRate,EntryAuthor,EntryDate,LastAuthor,LastUpdate")] SalesOrders salesOrders)
 {
     try
     {
         new ObjectLib().InitObjec(salesOrders, Request.RequestContext.HttpContext.User.Identity.Name);
         // TODO: Add insert logic here
         await new HttpClientLib().PostAsync <SalesOrders>("API", "/api/SalesOrders/", salesOrders);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
コード例 #24
0
        public void EditForSalesOrder()
        {
            this.salesOrderListPage = this.Sidenav.NavigateToSalesOrders();

            var salesOrder = new SalesOrders(this.Session).Extent().First;

            salesOrder.AddOrderAdjustment(new SurchargeAdjustmentBuilder(this.Session).WithAmountDefaults().Build());

            this.Session.Derive();
            this.Session.Commit();

            var before = new OrderAdjustments(this.Session).Extent().ToArray();

            var expected = new SurchargeAdjustmentBuilder(this.Session).WithAmountDefaults().Build();

            var surchargeAdjustment = salesOrder.OrderAdjustments.First();
            var id = surchargeAdjustment.Id;

            this.Session.Derive();

            var expectedAmount      = expected.Amount;
            var expectedDescription = expected.Description;

            this.salesOrderListPage.Table.DefaultAction(salesOrder);
            var salesOrderOverview      = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver);
            var adjustmentOverviewPanel = salesOrderOverview.OrderadjustmentOverviewPanel.Click();

            adjustmentOverviewPanel.Table.DefaultAction(surchargeAdjustment);

            var adjustmentEdit = new OrderAdjustmentEditComponent(this.Driver);

            adjustmentEdit.Amount.Set(expected.Amount.ToString());
            adjustmentEdit.Description.Set(expected.Description);

            this.Session.Rollback();
            adjustmentEdit.SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new OrderAdjustments(this.Session).Extent().ToArray();

            var actual = (SurchargeAdjustment)this.Session.Instantiate(id);

            Assert.Equal(after.Length, before.Length);

            Assert.Equal(expectedAmount, actual.Amount);
            Assert.Equal(expectedDescription, actual.Description);
        }
コード例 #25
0
        public SalesOrders Update(SalesOrders salesOrders)
        {
            try
            {
                var item = db.SalesOrders.Find(salesOrders);
                item.CustomerName = salesOrders.CustomerName;
                item.AmountPaid   = salesOrders.AmountPaid;

                db.SaveChanges();
            }
            catch (Exception e)
            {
            }

            return(salesOrders);
        }
コード例 #26
0
        public void CreatePercentageForSalesOrder()
        {
            this.salesOrderListPage = this.Sidenav.NavigateToSalesOrders();

            var salesOrder = new SalesOrders(this.Session).Extent().First;

            var before = new MiscellaneousCharges(this.Session).Extent().ToArray();

            var expected = new MiscellaneousChargeBuilder(this.Session).WithPercentageDefaults().Build();

            salesOrder.AddOrderAdjustment(expected);

            this.Session.Derive();

            Assert.True(expected.ExistPercentage);
            Assert.True(expected.ExistDescription);

            var expectedPercentage  = expected.Percentage;
            var expectedDescription = expected.Description;

            this.salesOrderListPage.Table.DefaultAction(salesOrder);
            var miscellaneousChargeCreate = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver).OrderadjustmentOverviewPanel.Click().CreateMiscellaneousCharge();

            miscellaneousChargeCreate
            .Percentage.Set(expectedPercentage.ToString())
            .Description.Set(expectedDescription);

            this.Session.Rollback();
            miscellaneousChargeCreate.SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new MiscellaneousCharges(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length + 1);

            var actual = after.Except(before).First();

            Assert.Equal(expectedPercentage, actual.Percentage);
            Assert.Equal(expectedDescription, actual.Description);
        }
コード例 #27
0
        public void CreateAmountForSalesOrder()
        {
            this.salesOrderListPage = this.Sidenav.NavigateToSalesOrders();

            var salesOrder = new SalesOrders(this.Session).Extent().First;

            var before = new SurchargeAdjustments(this.Session).Extent().ToArray();

            var expected = new SurchargeAdjustmentBuilder(this.Session).WithAmountDefaults().Build();

            salesOrder.AddOrderAdjustment(expected);

            this.Session.Derive();

            Assert.True(expected.ExistAmount);
            Assert.True(expected.ExistDescription);

            var expectedAmount      = expected.Amount;
            var expectedDescription = expected.Description;

            this.salesOrderListPage.Table.DefaultAction(salesOrder);
            var surchargeAdjustmentCreate = new SalesOrderOverviewComponent(this.salesOrderListPage.Driver).OrderadjustmentOverviewPanel.Click().CreateSurchargeAdjustment();

            surchargeAdjustmentCreate
            .Amount.Set(expectedAmount.ToString())
            .Description.Set(expectedDescription);

            this.Session.Rollback();
            surchargeAdjustmentCreate.SAVE.Click();

            this.Driver.WaitForAngular();
            this.Session.Rollback();

            var after = new SurchargeAdjustments(this.Session).Extent().ToArray();

            Assert.Equal(after.Length, before.Length + 1);

            var actual = after.Except(before).First();

            Assert.Equal(expectedAmount, actual.Amount);
            Assert.Equal(expectedDescription, actual.Description);
        }
コード例 #28
0
        public ActionResult UpdateOrder(SalesOrders order)
        {
            // 產品選擇是否重複  true:有重複
            bool isProductDuplicate = order.Details.Select(x => x.ProductID).Distinct().Count() != order.Details.Count;

            if (!ModelState.IsValid || isProductDuplicate)
            {
                // 準備下拉選單
                PrepareDDLSource();
                ViewBag.ErrorMessage = isProductDuplicate ? "商品重複!" : "驗證失敗!";
                return(View(order));
            }
            ModelState.Clear();

            SalesOrdersService orderService = new SalesOrdersService();

            orderService.UpdOrder(order);

            return(RedirectToAction("Query", "Order"));
        }
コード例 #29
0
        public async Task <ActionResult> OnPostSearch(DataTable dt)
        {
            try
            {
                int pageSize  = dt.pageSize ?? 10;
                int pageIndex = dt.pageIndex;

                //query data by page
                Page <SalesOrder> page = await _salesOrderService
                                         .LoadByPageAsync(pageIndex, pageSize, false, new object[] { CustomerID ?? 0, StartOrderDate, EndOrderDate });

                SalesOrders        = page.Items;
                dt.recordsTotal    = page.TotalItems;
                dt.recordsFiltered = page.TotalItems;
                dt.data            = SalesOrders.ToList();

                return(new JsonResult(JsonConvert.SerializeObject(dt)));
            }
            catch (Exception e)
            {
                return(GenJsonResult(-1, e.Message, 0));
            }
        }
コード例 #30
0
 private void RefreshData()
 {
     FilteredSalesOrders = SalesOrderList = SalesOrders.GetOpenedSalesOrders().ToSvenTechCollection();
     CheckOrdersStatus();
 }