public ProductListPage(ApplicationActivity pageType) { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); productListPageVM = new ProductListPageViewModel(Navigation, pageType); BindingContext = productListPageVM; }
public ApplicationActivity AppActivity(ApplicationActivity AMV, DataRow _ActivityRow) { AMV.count = _ActivityRow.Field <int?>("count"); AMV.DT_created = _ActivityRow.Field <DateTime>("DT_created"); return(AMV); }
public CheckApprovedServiceStatusListPageViewModel(INavigation navigation, ApplicationActivity pageType) : base(navigation) { _navigation = navigation; PageHeaderText = "Complaint List"; PageSubHeaderText = pageType == ApplicationActivity.CheckApprovedServiceStatusListPage ? "Approved" : "InProgress"; IsMenuVisible = false; IsBackButtonVisible = true; ServiceComplaintList = new ObservableCollection <ApproveServiceModel>(); LoadListData(pageType); }
public ProductListPageViewModel(INavigation navigation, ApplicationActivity pageType) : base(navigation) { LoadProductListData(pageType); _navigation = navigation; ProductList = new ObservableCollection <ProductModel>(); ProductData = new ReadOnlyObservableCollection <ProductModel>(ProductList); PageHeaderText = "Services"; IsMenuVisible = false; IsBackButtonVisible = true; }
public CheckApprovedServiceStatusListPage(ApplicationActivity pageType) { try { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); checkApprovedServiceStatusPageVM = new CheckApprovedServiceStatusListPageViewModel(Navigation, pageType); BindingContext = checkApprovedServiceStatusPageVM; } catch (Exception ex) { UserDialogs.Instance.HideLoading(); } }
public ApproveServiceComplaintDetailPageViewModel(INavigation navigation, ApproveServiceModel data, ApplicationActivity pageType) : base(navigation) { _approveServiceData = data; _navigation = navigation; _pageType = pageType; PageHeaderText = "Complaint Detail"; IsMenuVisible = false; IsBackButtonVisible = true; LoadListData(); IsComplaintDateEntryVisible = true; IsComplaintDatePickerVisible = false; UpdateCommand = new DelegateCommand(ExecuteOnUpdate); ComplaintDate = DateTime.Today; }
public ApproveServiceComplaintDetailPage(ApproveServiceModel data, ApplicationActivity pageType) { try { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); approveServiceDetailPageVM = new ApproveServiceComplaintDetailPageViewModel(Navigation, data, pageType); BindingContext = approveServiceDetailPageVM; } catch (Exception ex) { UserDialogs.Instance.HideLoading(); } }
protected async Task PageNavigation(ApplicationActivity page, ApplicationActivity pageType) { Device.BeginInvokeOnMainThread(() => UserDialogs.Instance.ShowLoading("Loading...")); try { if (CrossConnectivity.Current.IsConnected) { switch (page) { case ApplicationActivity.ProductListPage: await _navigation.PushAsync(new ProductListPage(pageType)); // UserDialogs.Instance.HideLoading(); break; case ApplicationActivity.CheckApprovedServiceStatusListPage: ApproveBackgroundColor = Color.FromHex("#981C1C"); InProgressBackgroundColor = Color.FromHex("#000000"); await _navigation.PushAsync(new CheckApprovedServiceStatusListPage(pageType)); // UserDialogs.Instance.HideLoading(); break; case ApplicationActivity.CheckInprogressServiceStatusListPage: ApproveBackgroundColor = Color.FromHex("#981C1C"); InProgressBackgroundColor = Color.FromHex("#000000"); await _navigation.PushAsync(new CheckInprogressServiceStatusListPage(pageType)); // UserDialogs.Instance.HideLoading(); break; } } else { Device.BeginInvokeOnMainThread(() => UserDialogs.Instance.HideLoading()); Device.BeginInvokeOnMainThread(() => UserDialogs.Instance.AlertAsync("Network", AppConstant.NETWORK_FAILURE, "OK")); return; } } catch (Exception ex) { Device.BeginInvokeOnMainThread(() => UserDialogs.Instance.HideLoading()); } }
private async void LoadListData(ApplicationActivity pageType) { if (CrossConnectivity.Current.IsConnected) { bool isCallFirstTime = false; ReqProductModel productType = new ReqProductModel(); ApproveServiceModel approveModel = new ApproveServiceModel(); HttpClientHelper apicall = new HttpClientHelper(ApiUrls.Url_GetApprovedInProgressServiceList, Settings.AccessTokenSettings); productType.productType = pageType; var regjson = JsonConvert.SerializeObject(productType); var response = await apicall.Post <List <ApproveServiceModel> >(regjson); switch (pageType) { case ApplicationActivity.CheckApprovedServiceStatusListPage: ApproveBackgroundColor = Color.FromHex("#981C1C"); InProgressBackgroundColor = Color.FromHex("#000000"); if (response != null) { if (response.Count > 0) { IsStatusVisible = false; ServiceComplaintList = new ObservableCollection <ApproveServiceModel>(response); } else { IsStatusVisible = true; UserDialogs.Instance.HideLoading(); } } break; case ApplicationActivity.CheckInprogressServiceStatusListPage: ApproveBackgroundColor = Color.FromHex("#000000"); InProgressBackgroundColor = Color.FromHex("#981C1C"); if (response != null) { if (response.Count > 0) { IsStatusVisible = false; ServiceComplaintList = new ObservableCollection <ApproveServiceModel>(response); } else { IsStatusVisible = true; UserDialogs.Instance.HideLoading(); } } break; default: break; } } else { UserDialogs.Instance.HideLoading(); await Application.Current.MainPage.DisplayAlert("Network", AppConstant.NETWORK_FAILURE, "OK"); return; } UserDialogs.Instance.HideLoading(); }
private async void LoadProductListData(ApplicationActivity pageType) { try { if (CrossConnectivity.Current.IsConnected) { bool isCallFirstTime = false; ReqProductModel productType = new ReqProductModel(); HttpClientHelper apicall = new HttpClientHelper(ApiUrls.Url_GetProductListData, Settings.AccessTokenSettings); productType.productType = pageType; var regjson = JsonConvert.SerializeObject(productType); var response = await apicall.Post <ProductListResponseModel>(regjson); if (response != null) { switch (pageType) { case ApplicationActivity.Electrical: if (response.electrical != null) { Cache.globalCatagory = "Electrical"; PageSubHeaderText = "Electrical"; foreach (var item in response.electrical) { string filepath = AppSetting.Root_Url + item.serviceImage; //byte[] imageByte = null; //imageByte = Convert.FromBase64String(item.serviceImage); ProductModel productModel = new ProductModel(); productModel.ProductName = item.serviceName; productModel.ProductImage = filepath; //ImageSource.FromUri(new Uri(filepath)); //ImageSource.FromStream(() => new MemoryStream(imageByte)); ProductList.Add(productModel); } } break; case ApplicationActivity.Electronic: if (response.electronic != null) { Cache.globalCatagory = "Electronics"; PageSubHeaderText = "Electronics"; foreach (var item in response.electronic) { string filepath = AppSetting.Root_Url + item.serviceImage; //byte[] imageByte = null; //imageByte = Convert.FromBase64String(item.serviceImage); ProductModel productModel = new ProductModel(); productModel.ProductName = item.serviceName; productModel.ProductImage = filepath; //ImageSource.FromUri(new Uri(filepath)); //ImageSource.FromStream(() => new MemoryStream(imageByte)); ProductList.Add(productModel); } } break; case ApplicationActivity.IT: if (response.it != null) { Cache.globalCatagory = "IT"; PageSubHeaderText = "IT"; foreach (var item in response.it) { string filepath = AppSetting.Root_Url + item.serviceImage; //byte[] imageByte = null; //imageByte = Convert.FromBase64String(item.serviceImage); ProductModel productModel = new ProductModel(); productModel.ProductName = item.serviceName; productModel.ProductImage = filepath; //ImageSource.FromUri(new Uri(filepath)); //ImageSource.FromStream(() => new MemoryStream(imageByte)); ProductList.Add(productModel); } } break; case ApplicationActivity.DailyNeeds: if (response.dailyNeeds != null) { Cache.globalCatagory = "Daily Services"; PageSubHeaderText = "Daily Services"; foreach (var item in response.dailyNeeds) { string filepath = AppSetting.Root_Url + item.serviceImage; //byte[] imageByte = null; //imageByte = Convert.FromBase64String(item.serviceImage); ProductModel productModel = new ProductModel(); productModel.ProductName = item.serviceName; productModel.ProductImage = filepath; //ImageSource.FromUri(new Uri(filepath)); //ImageSource.FromStream(() => new MemoryStream(imageByte)); ProductList.Add(productModel); } } break; default: break; } } ProductData = new ReadOnlyObservableCollection <ProductModel>(ProductList); if (Cache.globalCatagory == "Electronics") { Device.StartTimer(TimeSpan.FromSeconds(10), () => { if (isCallFirstTime == false) { isCallFirstTime = true; UserDialogs.Instance.HideLoading(); return(true); } else { return(false); } }); } else { Device.StartTimer(TimeSpan.FromSeconds(4), () => { if (isCallFirstTime == false) { isCallFirstTime = true; UserDialogs.Instance.HideLoading(); return(true); } else { return(false); } }); } } else { UserDialogs.Instance.HideLoading(); await Application.Current.MainPage.DisplayAlert("Network", AppConstant.NETWORK_FAILURE, "OK"); return; } } catch (Exception) { UserDialogs.Instance.HideLoading(); } }