public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <TravelerSpecs>(); lstItemsShow = new ObservableCollection <TravelerSpecs>(); LstItems = await _apiService.GetTravelsAsync(email, vmstatus); foreach (TravelerSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); LstItemsShow.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstItemsShow = new ObservableCollection <RequestSpecs>(); LstItems = await _apiService.GetRequestsAsync(email, Status, "", ""); foreach (RequestSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); LstItemsShow.Add(item); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public OfferDetailsViewModel() { IList <cCountry> countries = ProvideCountries.InfoListByDemand("America"); lstCountries = new ObservableCollection <cCountry>(countries.AsEnumerable <cCountry>()); IList <cCountry> countriesdes = ProvideCountries.InfoListByDemand("America"); lstCountriesDes = new ObservableCollection <cCountry>(countriesdes.AsEnumerable <cCountry>()); }
public StepOneViewModel(string calledfrom) { Calledfrom = calledfrom; criptografia = new Criptografia(); lstitemcategories = new ObservableCollection <Countries>(); ObservableCollection <Countries> lstc = new ObservableCollection <Countries>(); //Get Profile profile = DatabaseHelper.GetProfile(App.Os_Folder); password = profile.Password; email = profile.Email; firstName = profile.FirstName; lastName = profile.LastName; if (profile.PhoneNumber != null && !string.IsNullOrEmpty(profile.PhoneNumber)) { phone = criptografia.desencriptar(profile.PhoneNumber, Constants.AppCode); } passport = profile.PassportNumber; code = profile.VerificationCode; registeredwith = profile.registeredwith; DateTime result; passdate = (DateTime.TryParse(profile.PassportDate, out result))? DateTime.Parse(profile.PassportDate): DateTime.Today; lstitemcategories = DatabaseHelper.getCountries(App.Os_Folder); if (lstitemcategories.Count > 0 && profile.CountryCode != null) { SelectedCountry = (from c in lstitemcategories where c.CountryCode == profile.CountryCode select c).First(); phonepattern = SelectedCountry.NumberPattern; countrycode = ProvideCountries.GetCountryPhoneCode(profile.CountryCode); flagimage = profile.CountryCode + ".png"; int cindx = 0; foreach (var item in lstitemcategories) { if (item.CountryCode == SelectedCountry.CountryCode) { index = cindx; } cindx++; } } SubmitCommand = new Command(OnSubmit); }
public async Task onsomecomandAsync() { App.WaitScreenStart(Translator.getText("Loading")); { lstrequestsAccepted = new ObservableCollection <Traveler_Request>(); ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); ObservableCollection <RequestSpecs> LstItemstemp = new ObservableCollection <RequestSpecs>(); lstitemsshow = new ObservableCollection <RequestSpecs>(); lstrequestsAccepted = await _apiService.getRequestesAcceptedbyTravelerAsync(IdInfo); LstItems = await _apiService.GetRequestToTravelAsync(1, from.Split(' ')[0].Trim(), to.Split(' ')[0].Trim(), email); LstItemstemp = await _apiService.GetRequestToTravelAsync(9, from.Split(' ')[0].Trim(), to.Split(' ')[0].Trim(), email); foreach (RequestSpecs item in LstItemstemp) { LstItems.Add(item); } CapacityNumber = 0; foreach (RequestSpecs item in LstItems) { int intis = (from t in lstrequestsAccepted where t.IdRequestSpecs == item.Id select t).Count(); if (intis > 0) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); item.canDelete = (IdInfo.status == 0)? true : false; lstitemsshow.Add(item); } } decimal result = 0; capacityNumber = (decimal.TryParse(IdInfo.Capacity, out result)) ? decimal.Parse(IdInfo.Capacity) : 0; TotalCapacityAccepted = 0; foreach (Traveler_Request item in lstrequestsAccepted.ToList()) { //TotalCapacityAccepted += (from t in LstItems.ToList() where t.Id == item.IdRequestSpecs select t.Weight).FirstOrDefault<decimal>(); TotalCapacityAccepted += LstItems.ToList().Where(x => x.Id == item.IdRequestSpecs).Select(x => x.Weight).FirstOrDefault <decimal>(); } CapacityNumber = TotalCapacityAccepted; } App.WaitScreenStop(); }
public async Task onsomecomandAsync() { if (IsBusy) { return; } IsBusy = true; try { lstrequestsAccepted = new ObservableCollection <Traveler_Request>(); ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstitemsshow = new ObservableCollection <RequestSpecs>(); lstrequestsAccepted = await _apiService.getRequestesAcceptedbyTravelerAsync(IdInfo); LstItems = await _apiService.GetRequestToTravelAsync(9, from.Split('-')[0].Trim(), to.Split('-')[0].Trim(), email); CapacityNumber = 0; foreach (RequestSpecs item in LstItems) { int intis = (from t in lstrequestsAccepted where t.IdRequestSpecs == item.Id select t).Count(); if (intis > 0) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); lstitemsshow.Add(item); } } decimal result = 0; capacityNumber = (decimal.TryParse(IdInfo.Capacity, out result)) ? decimal.Parse(IdInfo.Capacity) : 0; CapacityNumber = (from list in lstitemsshow select list.Weight).Sum(); } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public async Task ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { App.WaitScreenStart(Translator.getText("Loading")); ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstItemsShow = new ObservableCollection <ShowRequestSpecs>(); LstItems = await _apiService.GetRequestsAsync(email, Status, "", ""); foreach (RequestSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); ShowImage = (item.DeliveredAt == "1") ? true : false; sts = new ShowRequestSpecs(); sts.requestSpecs = new RequestSpecs(); sts.requestSpecs = item; sts.imageShow = ShowImage; LstItemsShow.Add(sts); } IsBusy = false; } catch (Exception ex) { Debug.WriteLine(ex); } finally { App.WaitScreenStop(); IsBusy = false; } }
public async void ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { App.WaitScreenStart(Translator.getText("Loading")); ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <TravelerSpecs>(); LstItemsShow = new ObservableCollection <ShowTravelSpecs>(); LstItems = await _apiService.GetTravelsAsync(email, vmstatus); foreach (TravelerSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); sts = new ShowTravelSpecs(); sts.travelerSpecs = new TravelerSpecs(); sts.travelerSpecs = item; sts.imageShow = ShowImage; LstItemsShow.Add(sts); } IsBusy = false; } catch (Exception ex) { Debug.WriteLine(ex); } finally { App.WaitScreenStop(); IsBusy = false; } }
void Handle_SelectedIndexChanged(object sender, System.EventArgs e) { if (PickerCountry.SelectedIndex != viewmodel.Index) { E_Phone.Text = ""; } Countries customPicker = viewmodel.SelectedCountry; viewmodel.FlagImage = customPicker.CountryCode + ".png"; viewmodel.CountryCode = "( +" + ProvideCountries.GetCountryPhoneCode(customPicker.CountryCode) + " )"; WSViews.MaskedBehavior mn = new WSViews.MaskedBehavior(); mn.Mask = customPicker.NumberPattern; E_Phone.Behaviors.Clear(); E_Phone.Behaviors.Add(mn); }
public async Task InitializeAsync() { //using (UserDialogs.Instance.Loading(Translator.getText("Loading"), null, null, true, MaskType.Black)) { ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <TravelerSpecs>(); LstItemsShow = new ObservableCollection <TravelerSpecs>(); LstItems = await _apiService.GetTravelsAsync(email, vmstatus); foreach (TravelerSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); LstItemsShow.Add(item); } } }
public UniListPageRewViewModel(TravelerSpecs idInfo) { IdInfo = idInfo; requestsacepted = 0; from = idInfo.CountryCodeFrom + "-" + ProvideCountries.GetCountryName(idInfo.CountryCodeFrom); to = idInfo.CountryCodeTo + "-" + ProvideCountries.GetCountryName(idInfo.CountryCodeTo); datefrom = idInfo.FromDate; dateto = idInfo.ToDate; capacity = Translator.getText("Capacity"); Profile profile = DatabaseHelper.GetProfile(App.Os_Folder); email = profile.Email; LoadItemsCommand = new Command(async() => await onsomecomandAsync()); LoadItemsCommand.Execute(true); }
private async Task InitializeAsync(string sEmail) { //using (UserDialogs.Instance.Loading(Translator.getText("Loading"), null, null, true, MaskType.Black)) { ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstItemsShow = new ObservableCollection <RequestSpecs>(); LstItems = await _apiService.GetRequestsAsync(email, Status, "", ""); foreach (RequestSpecs item in LstItems) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); LstItemsShow.Add(item); } } }
public async void ExecuteLoadItemsCommand() { if (IsBusy) { return; } IsBusy = true; try { App.WaitScreenStart(Translator.getText("Loading")); ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <TravelerSpecs>(); LstItemsShow = new ObservableCollection <ShowTravelSpecs>(); LstItems = await _apiService.GetTravelsAsync(email, vmstatus); foreach (TravelerSpecs item in LstItems) { ShowImage = (item.DeliveredAt == "1") ? true : false; try { if (Application.Current.Properties["notifiedItemRoute"] != null) { string NotifiedBoxlist = (string)Application.Current.Properties["notifiedItemRoute"]; string travelinf = item.CountryCodeFrom + ">" + item.CountryCodeTo; if (NotifiedBoxlist.Contains(travelinf)) { ShowImage = true; } } } catch (Exception ex) { Application.Current.Properties["notified"] = "False"; Application.Current.Properties["Goto"] = ""; } item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); sts = new ShowTravelSpecs(); sts.travelerSpecs = new TravelerSpecs(); sts.travelerSpecs = item; sts.imageShow = ShowImage; LstItemsShow.Add(sts); } Application.Current.Properties["notifiedItemRoute"] = ""; await Application.Current.SavePropertiesAsync(); IsBusy = false; } catch (Exception ex) { Debug.WriteLine(ex); } finally { App.WaitScreenStop(); IsBusy = false; } }
public async Task onsomecomandAsync() { if (IsBusy) { return; } IsBusy = true; try { App.WaitScreenStart(Translator.getText("Loading")); ApiService _apiService = new ApiService(); LstItems = new ObservableCollection <RequestSpecs>(); lstitemsshow = new ObservableCollection <RequestSpecs>(); lstitemsshow2 = new ObservableCollection <RequestSpecs>(); LstItems.Clear(); lstitemsshow.Clear(); lstitemsshow2.Clear(); travelInfo = new TravelInfoClass(); travelInfo = await _apiService.GetInfoTravelLists(IdInfo.Id, 0, from.Split(' ')[0].Trim(), to.Split(' ')[0].Trim(), email); TotalCapacityAccepted = 0; if (travelInfo != null) { foreach (RequestSpecs item in travelInfo.lstRequestSpecsNew) { if (item.status == 0) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); item.imageSource = ImageManager.BytesToImage(item.ProductImage); if (item.OpenDays == "Yes") { item.Tolerance = Translator.getText("OpenDate"); } if (item.OpenDelivery == "Yes") { item.Tolerance = Translator.getText("rangedays"); } lstitemsshow.Add(item); } } decimal result; CapacityNumber = (decimal.TryParse(IdInfo.Capacity, out result)) ? decimal.Parse(IdInfo.Capacity) : 0; TotalCapacityAccepted = travelInfo.lstRequestSpecsAccepted.Select(x => x.Weight).Sum(); } CapacityTaken = TotalCapacityAccepted.ToString(); CapacityNumber = CapacityNumber - TotalCapacityAccepted; TextRequestsAcepted = Translator.getText("RequestsAcepted"); //+ "(" + lstrequestsAccepted.Count + ")"; foreach (RequestSpecs item in travelInfo.lstRequestSpecsAccepted) { item.CountryCodeFrom = item.CountryCodeFrom + " - " + ProvideCountries.GetCountryName(item.CountryCodeFrom); item.CountryCodeTo = item.CountryCodeTo + " - " + ProvideCountries.GetCountryName(item.CountryCodeTo); ImageSource imasource = ImageManager.BytesToImage(item.ProductImage); item.imageSource = imasource; item.canDelete = (IdInfo.status == 0 && item.status != 22 && item.status != 9) ? true : false; lstitemsshow2.Add(item); } IsBusy = false; } catch (Exception ex) { Debug.WriteLine(ex); } finally { App.WaitScreenStop(); IsBusy = false; } }