123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Comal.Classes;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- namespace comal.timesheets.CustomControls
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class StoreRequiItem : ContentView
- {
- public delegate void ZeroSelected(int _ID);
- public delegate void ParseError();
- public event ParseError OnParseError;
- public event ZeroSelected OnZeroSelected;
- public Guid ProductID { get; set; }
- public string ProductCode { get; set; }
- public string ProductName { get; set; }
- public string LocationName { get; set; }
- public double Quantity { get; set; }
- public int ID { get; set; }
- public Guid RequiItemID { get; set; }
- public Guid HoldingID { get; set; }
- public bool Packs { get; set; }
- public StoreRequiItem(ProductShell _product, double qty, string itemLocation, Guid _holdingID)
- {
- InitializeComponent();
- Quantity = qty;
- HoldingID = _holdingID;
- RequiItemID = Guid.Empty;
- LocationName = itemLocation;
- UpdateRow(_product);
- }
- private void UpdateRow(ProductShell _product)
- {
- ProductID = _product.ID;
- ProductCode = _product.Code;
- ProductName = _product.Name;
- locationLbl.Text = LocationName;
- productLbl.Text = ProductName + " (" + ProductCode + ")";
- qtyLbl.Text = Quantity.ToString();
- }
- public void UpdateShelf()
- {
-
- }
- #region Buttons
- private void ReduceQtyBtn_Clicked(object sender, EventArgs e)
- {
- if (Quantity <= 1)
- {
- OnZeroSelected?.Invoke(ID);
- return;
- }
- else
- {
- Quantity--;
- qtyLbl.Text = Quantity.ToString();
- }
- }
- private void IncreaseQtyBtn_Clicked(object sender, EventArgs e)
- {
- Quantity++;
- qtyLbl.Text = Quantity.ToString();
- }
- private void qtyEntry_Changed(object sender, EventArgs e)
- {
- try
- {
- double i = Convert.ToDouble(qtyLbl.Text);
- if (i > 0.0)
- {
- Quantity = i;
- }
- else
- {
- qtyLbl.Text = "1";
- Quantity = 1;
- }
- }
- catch
- {
- if (string.IsNullOrWhiteSpace(qtyLbl.Text))
- { }
- else
- OnParseError?.Invoke();
- }
- }
- #endregion
- private StoreRequiItem()
- {
-
- }
- }
- }
|