public DetailTruckPageViewModel(PengajuanItem item) { this.Model = item; DriverData = GetLicense(item.Truck.DriverLicense, item.Truck.DriverName, item.Truck.DriverIDCard, item.Truck.DriverPhoto); AssDriverData = GetLicense(item.Truck.AssdriverLicense, item.Truck.AssdriverName, item.Truck.AssdriverIDCard, item.Truck.AssdriverPhoto); VehicleRegistrationData = GetLicense(item.Truck.VehicleRegistration, null, null, null); KeurDLLAJRData = GetLicense(item.Truck.KeurDLLAJR, null, null, null); Title = "DATA TRUCK"; NextCommand = new Command(nextAction); }
public CheckPageViewModel(PengajuanItem item) { this.Model = item; Title = "Home"; Items = new ObservableCollection <GroupPemeriksaan>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); ItemTapped = new Command <GroupPemeriksaan>(OnItemSelected); ApproveCommand = new Command <PengajuanItem>(ApproveAction); RejectCommand = new Command <PengajuanItem>(RejectAction); LoadItemsCommand.Execute(null); }
private async void RejectAction(PengajuanItem obj) { if (IsBusy) { return; } try { object result = null; if (await Account.UserInRole(UserType.Gate)) { result = await GateService.Reject(Model.Id, Items.SelectMany(x => x.Items).ToList()); } else { result = await ApprovalService.Reject(Model.Id, Items.SelectMany(x => x.Items).ToList()); } if (result != null) { MessagingCenter.Send(new MessagingCenterAlert { Title = "Info", Message = "Berhasil !", Cancel = "OK" }, "message"); IsBusy = false; MessagingCenter.Send(Model, "approve"); await Shell.Current.GoToAsync($"//Home"); } else { throw new SystemException("Gagal... !, Periksa Kembali Data Anda"); } } catch (Exception ex) { MessagingCenter.Send(new MessagingCenterAlert { Title = "Error", Message = ex.Message, Cancel = "OK" }, "message"); IsBusy = false; } }