Ejemplo n.º 1
0
        private void CustomerNoEntry_Completed(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(CustomerNoEntry.Text))
            {
                DataManager manager  = new DataManager();
                Customer    customer = new Customer();
                customer = manager.GetSQLite_CustomerbyCustNo(CustomerNoEntry.Text);
                if (customer != null)
                {
                    App.gCustomer          = new Customer();
                    App.gCustomer          = customer;
                    CustomerNoEntry.Text   = customer.CustomerNo;
                    CustomerNameLabel.Text = customer.Name;

                    multiPage = null;
                    if (customer.CustomerNo != prevCustomerNo)
                    {
                        prevRefDoc       = RefNoEntry.Text;
                        RefNoEntry.Text  = string.Empty;
                        AmountEntry.Text = string.Format("{0:0.00}", 0);
                    }
                }
                else
                {
                    UserDialogs.Instance.ShowError("Wrong customer no or customer does not existed!", 3000);

                    CustomerNoEntry.Text   = string.Empty;
                    CustomerNameLabel.Text = string.Empty;

                    CustomerNoEntry.Focus();
                }
            }
        }
Ejemplo n.º 2
0
        private void Listview_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (e.SelectedItem == null)
            {
                return;
            }
            var selectedItem = e.SelectedItem as Customer;

            App.gCustomer = new Customer();
            App.gCustomer = selectedItem;

            CustomerNoEntry.Text   = selectedItem.CustomerNo;
            CustomerNameLabel.Text = selectedItem.Name;
            multiPage = null;
            if (selectedItem.CustomerNo != prevCustomerNo)
            {
                prevRefDoc       = RefNoEntry.Text;
                RefNoEntry.Text  = string.Empty;
                AmountEntry.Text = string.Format("{0:0.00}", 0);
            }
            Navigation.PopAsync();
        }
Ejemplo n.º 3
0
        private void RefNolookUpButton_OnTouchesEnded(object sender, IEnumerable <NGraphics.Point> e)
        {
            try
            {
                if (!RefNolookUpButton.IsEnabled)
                {
                    return;
                }
                RefNolookUpButton.IsEnabled = false;

                //var obj = (ActionButton)sender;
                //if(!string.IsNullOrEmpty(CustomerNoEntry.Text))
                //{
                //    var page = new RefNoLookupPage(CustomerNoEntry.Text);
                //   // page.listview.ItemSelected += RefListview_ItemSelected;
                //    Navigation.PushAsync(page);
                //}
                //else
                //    UserDialogs.Instance.ShowError("Choose Customer first!", 3000);0
                if (!string.IsNullOrEmpty(CustomerNoEntry.Text))
                {
                    var items = new List <PaymentReference>();
                    App.gRefDocNo = RefNoEntry.Text;
                    // 22-03-2018 -> add new code block to show loading
                    Device.BeginInvokeOnMainThread(() => UserDialogs.Instance.ShowLoading("Loading", MaskType.Black));

                    Task.Run(async() =>
                    {
                        items = await GetReferenceData();
                    }).ContinueWith(result => Device.BeginInvokeOnMainThread(() =>
                    {
                        UserDialogs.Instance.HideLoading();
                        if (multiPage == null)
                        {
                            multiPage = new SelectMultipleBasePage <PaymentReference>(items)
                            {
                                Title = "Document List"
                            }
                        }
                        ;
                        Navigation.PushAsync(multiPage);
                    }));
                    // end block -> to show loading

                    //App.gRefDocNo = RefNoEntry.Text;
                    //UserDialogs.Instance.ShowLoading("Loading", MaskType.Black);
                    //    items = await GetReferenceData();


                    //UserDialogs.Instance.HideLoading(); //IsLoading = false;
                    //if (multiPage == null)
                    //    multiPage = new SelectMultipleBasePage<PaymentReference>(items) { Title = "Document List" };
                    //await Navigation.PushAsync(multiPage);
                }
                else
                {
                    UserDialogs.Instance.ShowError("Choose Customer first!", 3000);
                }
                RefNolookUpButton.IsEnabled = true;
                // UserDialogs.Instance.HideLoading(); //IsLoading = false;
            }
            catch (Exception ex)
            {
                UserDialogs.Instance.ShowError(ex.Message.ToString(), 3000);
                RefNolookUpButton.IsEnabled = true;
                UserDialogs.Instance.HideLoading(); //IsLoading = false;
            }
        }