public JobDetailPage(Models.MyBookingModel bookingListTap = null) { InitializeComponent(); this.BindingContext = new JobDetailViewModel(Navigation, bookingListTap); startTimerBtn.CommandParameter = ButtonParameters.startTimer; endTimerBtn.CommandParameter = ButtonParameters.endTimer; completeBtn.CommandParameter = ButtonParameters.complete; }
public JobDetailPage(Models.MyBookingModel bookingListTap = null) { InitializeComponent(); jobdetailvm = new JobDetailViewModel(Navigation, bookingListTap); this.BindingContext = jobdetailvm; startTimerBtn.CommandParameter = ButtonParameters.startJob; completeBtn.CommandParameter = ButtonParameters.complete; acceptBtn.CommandParameter = ButtonParameters.accept; rejectBtn.CommandParameter = ButtonParameters.reject; sendQuoteBtn.CommandParameter = ButtonParameters.sendQuote; }
public JobDetailViewModel(INavigation navigation, Models.MyBookingModel bookingListTap) : base(navigation) { if (Xamarin.Forms.Application.Current.Properties.ContainsKey("AppLocale") && !string.IsNullOrEmpty(Xamarin.Forms.Application.Current.Properties["AppLocale"].ToString())) { languageculture = Xamarin.Forms.Application.Current.Properties["AppLocale"].ToString(); } else { languageculture = "en-US"; } //IsRatingPopup = false; MyBooking = bookingListTap; switch (languageculture) { case "en-US": MyBooking.Category.Name = MyBooking.Category.Name; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name; break; case "fr-FR": MyBooking.Category.Name = MyBooking.Category.Name_French; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name_French; break; case "he-IL": MyBooking.Category.Name = MyBooking.Category.Name_Hebrew; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name_Hebrew; break; case "ru-RU": MyBooking.Category.Name = MyBooking.Category.Name_Russian; MyBooking.SubCategory.Name = MyBooking.SubCategory.Name_Russian; break; } //MyBooking.ServiceProviderProfilePic = IsImagesValid(MyBooking.ServiceProviderProfilePic, ApiHelpers.ApiImageBaseUrl); if (MyBooking.SubSubCategories != null && MyBooking.SubSubCategories.Count > 0) { IsSubsubCategoryVisible = true; foreach (var item in MyBooking.SubSubCategories) { switch (languageculture) { case "en-US": item.Name = item.Name; break; case "fr-FR": item.Name = item.Name_French; break; case "he-IL": item.Name = item.Name_Hebrew; break; case "ru-RU": item.Name = item.Name_Russian; break; } SubSubCategoryList.Add(item); } SubSubCategoryHeight = SubSubCategoryList.Count * 70; } else { IsSubsubCategoryVisible = false; } if ((string.IsNullOrEmpty(MyBooking.Description) || string.IsNullOrWhiteSpace(MyBooking.Description)) && (MyBooking.ReferenceImages == null || MyBooking.ReferenceImages.Count == 0)) { IsRefDescriptionVisible = false; } else { IsRefDescriptionVisible = true; if (MyBooking.ReferenceImages != null && MyBooking.ReferenceImages.Count > 0) { IsRefImagesVisible = true; foreach (var item in MyBooking.ReferenceImages) { ReferenceImagesList.Add(new ReferenceImagesModel() { ReferenceImages = IsImagesValid(item, ApiHelpers.ReferenceImageBaseUrl) }); } } else { IsRefImagesVisible = false; } if (string.IsNullOrEmpty(MyBooking.Description) || string.IsNullOrWhiteSpace(MyBooking.Description)) { IsJobDescriptionVisible = false; } else { IsJobDescriptionVisible = true; } } if (MyBooking.JobStatus == Convert.ToInt32(RequestStatus.Completed)) { if (MyBooking.UserJobRating != null && MyBooking.UserRating != null && MyBooking.UserJobRating.Value != 0 && MyBooking.UserRating.Value != 0) { JobRatingIcon = string.Empty; } else { JobRatingIcon = "ic_customer_rating.png"; } //if(MyBooking.PaymentMethod == Convert.ToInt32(PaymentMethod.ByCreditCard)) //{ // IsPaymentBtnVisible = true; // if(MyBooking.IsPaymentDone != null && MyBooking.IsPaymentDone.Value) // { // PaymentBtnText = AppResource.PaymentBtn1; // PaymentBgColor = Color.FromHex(StaticHelpers.GrayColor); // IsPaymentBtnEnable = false; // } // else // { // PaymentBtnText = AppResource.PaymentBtn; // PaymentBgColor = Color.FromHex(StaticHelpers.BlueColor); // IsPaymentBtnEnable = true; // } //} //else //{ // IsPaymentBtnVisible = false; //} IsPaymentBtnVisible = true; if (MyBooking.IsPaymentDone != null && MyBooking.IsPaymentDone.Value) { PaymentBtnText = AppResource.PaymentBtn1; PaymentBgColor = Color.FromHex(StaticHelpers.GrayColor); IsPaymentBtnEnable = false; } else { PaymentBtnText = AppResource.PaymentBtn; PaymentBgColor = Color.FromHex(StaticHelpers.BlueColor); IsPaymentBtnEnable = true; } } else { JobRatingIcon = string.Empty; } if (MyBooking.CheckList != null && MyBooking.CheckList.Count > 0) { IsCheckList = true; foreach (var item in MyBooking.CheckList) { CheckList.Add(new CheckListModel() { CheckListValue = item.TaskDetail, CheckListCheck = item.IsDone.HasValue && item.IsDone.Value == true ? "ic_register_check.png" : "ic_uncheked.png", }); CheckListHeight = (50 * CheckList.Count) + 10; } } else { IsCheckList = false; } }