Ejemplo n.º 1
0
        private void SearchCustNo(object ignored)
        {
            if (!string.IsNullOrEmpty(CustomerNoSearchCriteria.CustomerNo))
            {
                IsBusy = true;
                ServiceAgent.SearchCustomer(CustomerNoSearchCriteria, (s, e) =>
                {
                    if (e.Error == null)
                    {
                        Customers = e.Result;
                        if (Customers.Count > 0)
                        {
                            SelectedCustomer = Customers[0];
                        }
                        else
                        {
                            Message = ApplicationResources.GetString(ConstantResources.LTNORESULTSFOUND);
                        }
                    }
                    else
                    {
                        HandleError(e.Error);
                    }

                    IsBusy = false;
                });
            }
            else
            {
                Message = ApplicationResources.GetString(ConstantResources.LTENTERCUSTOMERNO);
            }
        }
Ejemplo n.º 2
0
        private void SortSearchResults()
        {
            if (SelectedSortItem != string.Empty)
            {
                if (SelectedSortItem == EnumReader.StringValueOf(CustomerSortParameters.CustomerNo))
                {
                    Customers = Customers.ToList().OrderBy(c => c.CustomerNo).ToObservableCollection();
                }
                else if (SelectedSortItem == EnumReader.StringValueOf(CustomerSortParameters.CustomerName))
                {
                    Customers = Customers.ToList().OrderBy(c => c.CustomerName).ToObservableCollection();
                }
                else if (SelectedSortItem == EnumReader.StringValueOf(CustomerSortParameters.SiteAddress))
                {
                    HandleError(new Exception(ApplicationResources.GetString(ConstantResources.LTSITESORTING)));
                }
                else if (SelectedSortItem == EnumReader.StringValueOf(CustomerSortParameters.PremiseAddress))
                {
                    HandleError(new Exception(ApplicationResources.GetString(ConstantResources.LTPREMISEADDRESSSORTING)));
                }

                if (Customers.Count > 0)
                {
                    SelectedCustomer = Customers[0];
                }
            }
        }
Ejemplo n.º 3
0
        private void Search(object SearchCustNo)
        {
            if (!string.IsNullOrEmpty(CustomerSearchCriteria.ClientName) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.Contact) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.CustomerNo) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.Phone) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.PropertyName) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.SalesCode) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.StreetName) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.StreetNo) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.MeterNo) ||
                !string.IsNullOrEmpty(CustomerSearchCriteria.Premise))
            {
                IsBusy = true;
                ServiceAgent.SearchCustomer(CustomerSearchCriteria, (s, e) =>
                {
                    if (e.Error == null)
                    {
                        Customers = e.Result;
                        FillSortDropdown();
                        if (Customers.Count > 0)
                        {
                            SelectedCustomer = Customers[0];
                        }
                        else
                        {
                            Dialogs.Alert(ApplicationResources.GetString(ConstantResources.LTSEARCH), ApplicationResources.GetString(ConstantResources.LTNOCLIENTS), null);
                        }
                    }
                    else
                    {
                        HandleError(e.Error);
                    }

                    IsBusy = false;
                });
            }
            else
            {
                Dialogs.Alert(ApplicationResources.GetString(ConstantResources.LTSEARCHCRITERIA), ApplicationResources.GetString(ConstantResources.LTFILLSEARCHCRITERIA), null);
            }
        }