private async void deleteRowFromInvoiceItems(object sender, RoutedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_ucInvoice); } for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual) { if (vis is DataGridRow) { #region Window.GetWindow(this).Opacity = 0.2; wd_acceptCancelPopup w = new wd_acceptCancelPopup(); w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxDelete"); w.ShowDialog(); Window.GetWindow(this).Opacity = 1; #endregion if (w.isOk) { Invoice row = (Invoice)dg_Invoice.SelectedItems[0]; int res = 0; if (row.invType == "or") { res = await invoice.deleteOrder(row.invoiceId); } else { res = await invoice.deleteInvoice(row.invoiceId); } if (res > 0) { Toaster.ShowSuccess(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopDelete"), animation: ToasterAnimation.FadeIn); await refreshInvoices(); Txb_search_TextChanged(null, null); } else { Toaster.ShowError(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trPopError"), animation: ToasterAnimation.FadeIn); } } } } if (sender != null) { SectionData.EndAwait(grid_ucInvoice); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_ucInvoice); } SectionData.ExceptionMessage(ex, this); } }
private async void Tgl_isClose_Checked(object sender, RoutedEventArgs e) { if (flag) { return; } flag = true; ToggleButton cb = sender as ToggleButton; if (cb.IsFocused == true) { #region Accept this.Opacity = 0; wd_acceptCancelPopup w = new wd_acceptCancelPopup(); w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxConfirm"); w.ShowDialog(); #endregion if (w.isOk) { status = "o"; await openCloseBox(status); await fillPosInfo(); } else { tgl_isClose.IsChecked = false; } this.Opacity = 1; } flag = false; }
async void confirmRowinDatagrid(object sender, RoutedEventArgs e) { try { if (sender != null) { SectionData.StartAwait(grid_main); } for (var vis = sender as Visual; vis != null; vis = VisualTreeHelper.GetParent(vis) as Visual) { if (vis is DataGridRow) { #region Window.GetWindow(this).Opacity = 0.2; wd_acceptCancelPopup w = new wd_acceptCancelPopup(); w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxConfirm"); w.ShowDialog(); Window.GetWindow(this).Opacity = 1; #endregion if (w.isOk) { // Pos posModel = new Pos(); Invoice row = (Invoice)dg_invoice.SelectedItems[0]; await saveOrderStatus(row.invoiceId, "tr"); await fillDataGrid(); } } } if (sender != null) { SectionData.EndAwait(grid_main); } } catch (Exception ex) { if (sender != null) { SectionData.EndAwait(grid_main); } SectionData.ExceptionMessage(ex, this); } }
private async void Tgl_isClose_Unchecked(object sender, RoutedEventArgs e) { if (flag) { return; } flag = true; ToggleButton cb = sender as ToggleButton; if (cb.IsFocused == true) { if (cashesQuery.Count() > 0) { Toaster.ShowWarning(Window.GetWindow(this), message: MainWindow.resourcemanager.GetString("trCantDoProcess"), animation: ToasterAnimation.FadeIn); tgl_isClose.IsChecked = true; } else { #region Accept //this.Visibility = Visibility.Collapsed; this.Opacity = 0; wd_acceptCancelPopup w = new wd_acceptCancelPopup(); w.contentText = MainWindow.resourcemanager.GetString("trMessageBoxConfirm"); w.ShowDialog(); #endregion if (w.isOk) { status = "c"; await openCloseBox(status); await fillPosInfo(); } else { tgl_isClose.IsChecked = true; } this.Opacity = 1; //this.Visibility = Visibility.Visible; } } flag = false; }