コード例 #1
0
        private global::Customer GetCustomerGetById(UInt32 customerId)
        {
            ABCPOS abcHardware        = new ABCPOS();
            var    registeredCustomer = abcHardware.FindCustomer(customerId);

            return(registeredCustomer);
        }
コード例 #2
0
        private Boolean DeleteCustomer(global::Customer registeredCustomer)
        {
            ABCPOS abcHardware  = new ABCPOS();
            var    confirmation = abcHardware.DeleteCustomer(registeredCustomer);

            return(confirmation);
        }
コード例 #3
0
        private Item GetItemByCode(String itemCode)
        {
            ABCPOS abcHardware   = new ABCPOS();
            var    inventoryItem = abcHardware.FindItem(itemCode);

            return(inventoryItem);
        }
コード例 #4
0
    protected void FindButton_Click(object sender, EventArgs e)
    {
        ABCPOS ABCHardware   = new ABCPOS();
        String itemCode      = this.ItemCodeTextBox.Text;
        Item   inventoryItem = ABCHardware.FindItem(itemCode);

        OnFindComplete(inventoryItem);
    }
コード例 #5
0
    protected void FindButton_Click(object sender, EventArgs e)
    {
        ABCPOS   ABCHardware        = new ABCPOS();
        String   customerID         = this.CustomerIdTextBox.Text;
        Customer registeredcustomer = ABCHardware.FindCustomer(uint.Parse(customerID));

        OnFindComplete(registeredcustomer);
    }
コード例 #6
0
        private Boolean SaveItem(Item inventoryItem)
        {
            ABCPOS abcHardware = new ABCPOS();

            inventoryItem.Description = DescriptionTextBox.Text;
            inventoryItem.UnitPrice   = Decimal.Parse(UnitPriceTextBox.Text);
            inventoryItem.Stock       = Int32.Parse(StockTextBox.Text);
            var confirmation = abcHardware.DeleteItem(inventoryItem);

            return(confirmation);
        }
コード例 #7
0
        private Boolean SaveItem()
        {
            ABCPOS abcHardware = new ABCPOS();

            var confirmation = abcHardware.AddItem(
                itemCode: ItemCodeTextBox.Text,
                description: DescriptionTextBox.Text,
                unitPrice: Decimal.Parse(UnitPriceTextBox.Text),
                stock: Int32.Parse(StockTextBox.Text));

            return(confirmation);
        }
コード例 #8
0
        private UInt32 SaveCustomer()
        {
            ABCPOS abcHardware = new ABCPOS();

            var customerId = abcHardware.AddCustomer(
                customerName: CustomerNameTextBox.Text,
                address: AddressTextBox.Text,
                city: CityTextBox.Text,
                province: ProvinceTextBox.Text,
                postal: PostalTextBox.Text);

            return(customerId);
        }
コード例 #9
0
        protected void ProcessButton_Click(object sender, EventArgs e)
        {
            // Create Sale header object
            Sale ABCSale = new Sale(
                saleDate: DateTime.Now,
                salesPerson: HttpContext.Current.User.Identity.Name,
                customerId: int.Parse(CustomerDropdown.SelectedValue),
                gstRate: GetCurrentGSTPercentage());

            // Add Sale Items objects from session to Sale header
            var items          = GetItems();
            var purchasedItems = GetPurchasedItems(items);

            foreach (PurchaseItem purchase in purchasedItems)
            {
                ABCSale.AddItem(purchase.ItemCode, purchase.Quantity);
            }

            ABCPOS ABCHardware = new ABCPOS();
            Int32  saleNumber  = 0;

            try
            {
                // Commit Sale to persistence
                saleNumber = ABCHardware.ProcessSale(ABCSale);

                // Reset session objects
                Session.Remove("subtotal");
                Session.Remove("gst");
                Session.Remove("saletotal");

                // Reset UI values
                CustomerDropdown.SelectedIndex = 0;
                AddressTextBox.Text            = String.Empty;
                CityTextBox.Text     = String.Empty;
                ProvinceTextBox.Text = String.Empty;
                PostalTextBox.Text   = String.Empty;
                items.ToList().ForEach(item => { item.Quantity = 0; item.ItemTotal = 0; });
                Repeater1.DataSource = items;
                Page.DataBind();

                // Show success message
                var message = String.Format("Sale has been processed. <b>Sale&nbsp;Number:&nbsp;</b>{0}", saleNumber);
                ShowResult(ActionResult.Success, message);
            }
            catch (Exception ex)
            {
                ShowResult(ActionResult.Error, ex.Message);
            }
        }
コード例 #10
0
        private Boolean SaveCustomer(global::Customer registeredCustomer)
        {
            ABCPOS abcHardware = new ABCPOS();

            registeredCustomer.Name      = CustomerNameTextBox.Text;
            registeredCustomer.Address   = AddressTextBox.Text;
            registeredCustomer.City      = CityTextBox.Text;
            registeredCustomer.Province  = ProvinceTextBox.Text;
            registeredCustomer.Postal    = PostalTextBox.Text;
            registeredCustomer.IsDeleted = IsDeletedCheckbox.Checked;
            var confirmation = abcHardware.UpdateCustomer(registeredCustomer);

            return(confirmation);
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "HideFlashMessages", "$(document).ready(function () { $('.alert').hide(); });", true);

            IList <PurchaseItem> purchases;

            if (!IsPostBack)
            {
                Session.Remove("purchase");
                Session.Remove("subtotal");
                Session.Remove("gst");
                Session.Remove("saletotal");

                ABCPOS abcHardware = new ABCPOS();
                CustomerDropdown.DataSource = abcHardware.GetActiveCustomers();

                SaleDateLabel.Text = DateTime.Now.ToShortDateString();
                purchases          = abcHardware.GetActiveItems().Select(i => new PurchaseItem
                {
                    ItemCode    = i.ItemCode,
                    Description = i.Description,
                    UnitPrice   = i.UnitPrice,
                    Stock       = i.Stock,
                    Quantity    = 0,
                    ItemTotal   = 0.00M
                }).ToList();
                Session["purchase"] = purchases;
            }
            else
            {
                purchases = HttpContext.Current.Session["purchase"] as IList <PurchaseItem>;
            }

            if (purchases != null)
            {
                Repeater1.DataSource = purchases;
                DataBind();
            }
            if (CustomerDropdown.Items.FindByValue("0") == null)
            {
                CustomerDropdown.Items.Insert(0, new ListItem("[Select Customer]", "0"));
            }
        }
コード例 #12
0
        protected void CustomerDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList dropdown = (DropDownList)sender;

            if (uint.Parse(dropdown.SelectedValue) > 0)
            {
                ABCPOS   abcHardware        = new ABCPOS();
                Customer registeredCustomer = abcHardware.FindCustomer(uint.Parse(dropdown.SelectedValue));
                AddressTextBox.Text  = registeredCustomer.Address;
                CityTextBox.Text     = registeredCustomer.City;
                ProvinceTextBox.Text = registeredCustomer.Province;
                PostalTextBox.Text   = registeredCustomer.Postal;
            }
            else
            {
                AddressTextBox.Text  = String.Empty;
                CityTextBox.Text     = String.Empty;
                ProvinceTextBox.Text = String.Empty;
                PostalTextBox.Text   = String.Empty;
            }
        }
コード例 #13
0
        public void OnPost()
        {
            int    saleNum = 0;
            ABCPOS abcpos  = new ABCPOS();
            Sale   sale    = new Sale()
            {
                SalesDate     = DateTime.Now,
                CustomerID    = 123,
                SalesPersonID = SalePersonIDField,
                SalesItems    = saleitems
            };

            try
            {
                saleNum = abcpos.ProcessSale(sale);
            }
            catch (Exception e)
            {
                Message = $"Error : {e}";
            }
        }
コード例 #14
0
ファイル: SaleController.cs プロジェクト: Hanley666/BAIS3150
 public SaleController(CustomerService customersService, ItemService itemsService, ABCPOS salesService)
 {
     _customersService = customersService;
     _itemsService     = itemsService;
     _salesService     = salesService;
 }