Пример #1
0
 protected void Clear_OnClick(object sender, EventArgs e)
 {
     MessageUserControl.TryRun(() =>
     {
         //Clear the web page of the current purchase order and reset the vendor list to the vendor prompt line
         VendorDropDownList.SelectedIndex = 0;
         Subtotal.Text   = "";
         GST.Text        = "";
         Total.Text      = "";
         VendorName.Text = "";
         Location.Text   = "";
         Phone.Text      = "";
         ActivePurchaseOrderDetailsGridView.DataBind();
         InventoryItemsGridView.DataBind();
     }, "Cleared", "Web Page has been cleared.");
 }
Пример #2
0
        protected void Update_OnClick(object sender, EventArgs e)
        {
            //Will do a bulk update processing of the currently displayed purchase order
            //Will update the Quantity and the PurchasePrice

            MessageUserControl.TryRun(() =>
            {
                PurchaseOrderInfo order = BuildPurchaseOrderInfo();
                int employeeID          = int.Parse(Employee.Text);
                var controller          = new PurchasingController();
                controller.UpdateOrder(order, employeeID);

                decimal subtotal  = order.PurchaseOrderDetails.Sum(x => x.Quantity * x.PurchasePrice);
                Subtotal.Text     = subtotal.ToString();
                decimal taxAmount = (0.05m * subtotal);
                GST.Text          = taxAmount.ToString();
                decimal total     = subtotal + taxAmount;
                Total.Text        = total.ToString();
            }, "Updated", "Purchase Order has been updated");
            ActivePurchaseOrderDetailsGridView.DataSource = PartsFromPurchaseOrderDetailsGridView();
            ActivePurchaseOrderDetailsGridView.DataBind();
            InventoryItemsGridView.DataSource = PartsFromInventoryItemsGridView(InventoryItemsGridView);
            InventoryItemsGridView.DataBind();
        }
Пример #3
0
        protected void Get_Create_PO_OnClick(object sender, EventArgs e)
        {
            int employeeID = int.Parse(Employee.Text);

            PurchasingController vendorController = new PurchasingController();
            var vendor   = vendorController.Vendor_Get(int.Parse(VendorDropDownList.SelectedValue));
            int vendorID = int.Parse(VendorDropDownList.SelectedValue);

            VendorName.Text = vendor.VendorName;
            Phone.Text      = vendor.Phone;
            Location.Text   = vendor.City;

            PurchasingController purchaseOrderController = new PurchasingController();
            var purchaseOrderInfo = purchaseOrderController.GetActivePurchaseOrder(vendorID);

            if (purchaseOrderInfo == null)
            {
                purchaseOrderController.CreateSuggestedPurchaseOrder(vendorID, employeeID);
                purchaseOrderInfo = purchaseOrderController.GetActivePurchaseOrder(vendorID);
            }
            ActivePurchaseOrderDetailsGridView.DataSource = purchaseOrderController.GetCurrentActivePurchaseOrderDetails(vendorID);
            ActivePurchaseOrderDetailsGridView.DataBind();

            //Subtotal.Text = purchaseOrderInfo.SubTotal.ToString("C");
            Subtotal.Text = purchaseOrderInfo.SubTotal.ToString();
            //GST.Text = purchaseOrderInfo.TaxAmount.ToString("C");
            GST.Text = purchaseOrderInfo.TaxAmount.ToString();
            //Total.Text = (purchaseOrderInfo.SubTotal + purchaseOrderInfo.TaxAmount).ToString("C");
            Total.Text = (purchaseOrderInfo.SubTotal + purchaseOrderInfo.TaxAmount).ToString();

            PurchasingController inventoryController = new PurchasingController();
            var unorderedInventory = inventoryController.GetVendorStockItemsNotOnOrder(vendorID, purchaseOrderInfo);

            InventoryItemsGridView.DataSource = unorderedInventory;
            InventoryItemsGridView.DataBind();
        }