private void localMenu_OnItemClicked(string ActionType) { var selectedItem = dgGLTransExported.SelectedItem as GLTransExportedClient; switch (ActionType) { case "NewExport": var today = GetSystemDefaultDate(); var lst = (ICollection <GLTransExportedClient>)dgGLTransExported.ItemsSource; var maxDate = (lst != null && lst.Count > 0) ? (from rec in lst select rec._ToDate).Max() : today.AddYears(-1).AddDays(-today.Day); var start = maxDate.AddDays(1); var end = start.AddMonths(1).AddDays(-1); CWInterval winInterval = new CWInterval(start, end); winInterval.Closed += delegate { if (winInterval.DialogResult == true) { var glTransExported = new GLTransExportedClient(); glTransExported.SetMaster(api.CompanyEntity); glTransExported._FromDate = winInterval.FromDate; glTransExported._ToDate = winInterval.ToDate; AddDockItem(TabControls.GLTransPage, new object[] { glTransExported, "NewExport" }, Uniconta.ClientTools.Localization.lookup("AccountsTransaction")); } }; winInterval.Show(); break; case "DeleteExport": if (selectedItem != null) { DeleteRecord(selectedItem); } break; case "ShowExport": if (selectedItem != null) { AddDockItem(TabControls.GLTransPage, new object[] { selectedItem, "ShowExport" }, Uniconta.ClientTools.Localization.lookup("AccountsTransaction")); } break; case "ShowSupplement": if (selectedItem != null && selectedItem._SuppJournalPostedId != 0) { AddDockItem(TabControls.GLTransPage, new object[] { selectedItem, "ShowSupplement" }, Uniconta.ClientTools.Localization.lookup("SupplementaryTransactions")); } break; default: gridRibbon_BaseActions(ActionType); break; } }
async void DeleteRecord(GLTransExportedClient selectedItem) { if (UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("DeleteConfirmation"), Uniconta.ClientTools.Localization.lookup("Confirmation"), MessageBoxButton.OKCancel) == MessageBoxResult.OK) { busyIndicator.IsBusy = true; var err = await api.Delete(selectedItem); busyIndicator.IsBusy = false; if (err != ErrorCodes.Succes) { UtilDisplay.ShowErrorCode(err); } else { InitQuery(); } } }