public static async Task <GenericResponse> GetList(string filtro = "", string ordenar_por = "", string orden = "", int Page = 1) { GenericResponse genericResponse = new GenericResponse(); try { List <CloureParam> cparams = new List <CloureParam>(); cparams.Add(new CloureParam("module", "bank_checks")); cparams.Add(new CloureParam("topic", "listar")); string res = await CloureManager.ExecuteAsync(cparams); JsonObject api_result = JsonObject.Parse(res); string error = api_result.GetNamedString("Error"); if (error == "") { JsonObject api_response = api_result.GetNamedObject("Response"); JsonArray registers = api_response.GetNamedArray("Registros"); foreach (JsonValue jsonValue in registers) { JsonObject register = jsonValue.GetObject(); BankCheck item = new BankCheck(); item.Id = (int)register.GetNamedNumber("Id"); item.Descripcion = register.GetNamedString("Descripcion"); item.Cliente = register.GetNamedString("Cliente"); JsonArray available_commands_arr = register.GetNamedArray("AvailableCommands"); item.availableCommands = new List <AvailableCommand>(); foreach (JsonValue available_cmd_obj in available_commands_arr) { JsonObject available_cmd_item = available_cmd_obj.GetObject(); int available_cmd_id = (int)available_cmd_item.GetNamedNumber("Id"); string available_cmd_name = available_cmd_item.GetNamedString("Name"); string available_cmd_title = available_cmd_item.GetNamedString("Title"); AvailableCommand availableCommand = new AvailableCommand(available_cmd_id, available_cmd_name, available_cmd_title); item.availableCommands.Add(availableCommand); } genericResponse.Items.Add(item); } genericResponse.PageString = api_response.GetNamedString("PageString"); } else { throw new Exception(error); } } catch (Exception ex) { var dialog = new MessageDialog(ex.Message); await dialog.ShowAsync(); } return(genericResponse); }
private void MenuFlyoutItem_Click(object sender, RoutedEventArgs e) { MenuFlyoutItem menuFlyoutItem = (MenuFlyoutItem)sender; BankCheck bank = (BankCheck)menuFlyoutItem.Tag; if (menuFlyoutItem.Name == "edit") { edit(bank); } if (menuFlyoutItem.Name == "delete") { DisplayDeleteDialog(bank); } }
private async void DisplayDeleteDialog(BankCheck bank) { ContentDialog deleteFileDialog = new ContentDialog { Title = "¿Está seguro que desea eliminar este registro?", Content = "El registro se borrará de forma permanente", PrimaryButtonText = "Borrar", CloseButtonText = "Cancelar" }; ContentDialogResult result = await deleteFileDialog.ShowAsync(); // Delete the file if the user clicked the primary button. /// Otherwise, do nothing. if (result == ContentDialogResult.Primary) { bool api_result = await BankChecks.Delete(bank.Id); if (api_result) { LoadData(); } } }
void edit(BankCheck bank) { //CloureManager.Navigate(typeof(BankAddPage), bank); }
private void lstItems_ItemClick(object sender, ItemClickEventArgs e) { BankCheck bank = (BankCheck)e.ClickedItem; edit(bank); }