Example #1
0
        public bool LoadCities(int?countryID)
        {
            //custom authentication
            CountryCityProvinceServiceClient client = null;
            bool result = false;

            try
            {
                client = new CountryCityProvinceServiceClient();
                City [] cities = client.GetCities(countryID);

                CommonLibrary.Utilty.Sort.GenericList <City> genericList = new CommonLibrary.Utilty.Sort.GenericList <City>();
                genericList.AddRange(cities);
                genericList.Sort("Name", CommonLibrary.Utilty.Sort.CollectionSortDirection.Ascending);

                if (genericList != null && genericList.Count > 0)
                {
                    _view.Cities = genericList;
                    result       = true;
                }
            }
            catch (TimeoutException te)
            {
                _log.Fatal(te);
            }
            catch (FaultException fe)
            {
                _log.Fatal(fe);
            }
            catch (CommunicationException ce)
            {
                _log.Fatal(ce);
            }

            catch (Exception ex)
            {
                _log.Fatal(ex);
            }

            finally
            {
                if (client != null)
                {
                    client.CloseProxy();
                }
            }

            return(result);
        }
        public bool LoadProfileTypes()
        {
            ProfileServiceClient client = null;
            bool result = false;

            try
            {
                client = new ProfileServiceClient();
                ProfileType [] profileTypes = client.RetrieveProfileTypes();
                CommonLibrary.Utilty.Sort.GenericList <ProfileType> genericList = new CommonLibrary.Utilty.Sort.GenericList <ProfileType>();
                genericList.AddRange(profileTypes);
                genericList.Sort("ProfileName", CommonLibrary.Utilty.Sort.CollectionSortDirection.Ascending);

                if (genericList != null && genericList.Count > 0)
                {
                    _view.ProfileTypes = genericList;
                    result             = true;
                }
            }
            catch (TimeoutException te)
            {
                _log.Fatal(te);
            }
            catch (FaultException fe)
            {
                _log.Fatal(fe);
            }
            catch (CommunicationException ce)
            {
                _log.Fatal(ce);
            }

            catch (Exception ex)
            {
                _log.Fatal(ex);
            }

            finally
            {
                if (client != null)
                {
                    client.CloseProxy();
                }
            }

            return(result);
        }