public async void GetVehicleBrands()
        {
            try
            {
                var result = Dbcontext.GetCompanyVehicleBrands(Application.Current.Properties["UN"].ToString(),
                                                               Application.Current.Properties["PW"].ToString(), Application.Current.Properties["Ucid"].ToString(),
                                                               Convert.ToInt32(Application.Current.Properties["CompanyId"].ToString()));
                AllVehicleBrands = new ObservableCollection <VehicleBrand>();
                VehicleBrand brand;


                if (result != null)
                {
                    if (result.Length > 0)
                    {
                        foreach (var data in result)
                        {
                            brand      = new VehicleBrand();
                            brand.Id   = data.Id;
                            brand.Name = data.Name;

                            AllVehicleBrands.Add(brand);
                        }
                    }
                }
                GetErrorCodes();
            }
            catch (Exception e)
            {
                IsBusy = false;
                await Application.Current.MainPage.DisplayAlert("Fel", e.Message, "Stäng");
            }
        }
예제 #2
0
        public async void GetVehicleBrands()
        {
            try
            {
                //await Dbcontext.OpenAsync();
                var result = Dbcontext.GetCompanyVehicleBrands(Application.Current.Properties["UN"].ToString(),
                                                               Application.Current.Properties["PW"].ToString(), Application.Current.Properties["Ucid"].ToString(),
                                                               Convert.ToInt32(Application.Current.Properties["CompanyId"].ToString()));
                AllVehicleBrands = new ObservableCollection <VehicleBrand>();
                VehicleBrand brand;


                if (result != null)
                {
                    if (result.Length > 0)
                    {
                        foreach (var data in result)
                        {
                            brand      = new VehicleBrand();
                            brand.Id   = data.Id;
                            brand.Name = data.Name;

                            AllVehicleBrands.Add(brand);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                //await Dbcontext.CloseAsync();
                await Application.Current.MainPage.DisplayAlert("Fel", e.Message, "Stäng");
            }
            //  Dbcontext = new ServiceReference1.Service1Client(ServiceReference1.Service1Client.EndpointConfiguration.BasicHttpBinding_IService1);


            GetErrorCodes();

            //   AllRows = new ObservableCollection<InternalControlPerformRow>(temp);
        }