Ejemplo n.º 1
0
        private global::Customer GetCustomerGetById(UInt32 customerId)
        {
            ABCPOS abcHardware        = new ABCPOS();
            var    registeredCustomer = abcHardware.FindCustomer(customerId);

            return(registeredCustomer);
        }
Ejemplo n.º 2
0
        private Boolean DeleteCustomer(global::Customer registeredCustomer)
        {
            ABCPOS abcHardware  = new ABCPOS();
            var    confirmation = abcHardware.DeleteCustomer(registeredCustomer);

            return(confirmation);
        }
Ejemplo n.º 3
0
        private Item GetItemByCode(String itemCode)
        {
            ABCPOS abcHardware   = new ABCPOS();
            var    inventoryItem = abcHardware.FindItem(itemCode);

            return(inventoryItem);
        }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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"));
            }
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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}";
            }
        }
Ejemplo n.º 14
0
 public SaleController(CustomerService customersService, ItemService itemsService, ABCPOS salesService)
 {
     _customersService = customersService;
     _itemsService     = itemsService;
     _salesService     = salesService;
 }