private void SearchBox_PreviewKeyDown_1(object sender, KeyEventArgs e) { try { if (e.Key == Key.Delete) { DeleteTransactionEntry(); } if (SearchListCtl.Items.Count == 1) { SearchListCtl.SelectedIndex = 0; } if (e.Key == Key.Enter) { LocalProcesItem(SearchListCtl.SelectedItem); MoveToNextControl(sender); } pkey = e.Key; } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void FilterControl_Direction_1(object sender, DirectionEventArgs e) { try { if (e.Direction == DirectionEnum.Down) { if (SearchListCtl != null) { SearchListCtl.SelectedIndex += 1; } } if (e.Direction == DirectionEnum.Up && SearchListCtl.SelectedIndex > -1) { SearchListCtl.SelectedIndex -= 1; } if (e.Direction == DirectionEnum.Right) { MoveToNextControl(sender); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void PreviousPharmacySaleSteps() { try { SalesLst.SelectedIndex = 0; if (SalesPadState == SalesPadTransState.Receipt ) //SalesPad.TotalsCol.Width == new GridLength(0) && SalesPad.PaymentCol.Width == new GridLength(0) { HideReceipt(); ShowTransaction(); return; } if (SalesPadState == SalesPadTransState.Transaction) { SalesVM.Instance.GoToPreviousTransaction(); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void DeleteTransactionEntry() { try { if (SalesVM.Instance.TransactionData == null) { MessageBox.Show("Current Transaction Line not selected!"); return; } if (SalesVM.Instance.TransactionData.CurrentTransactionEntry == null) { MessageBox.Show("Current Transaction Line not selected!"); var t = SalesVM.Instance.TransactionData.TransactionEntries.FirstOrDefault() as PrescriptionEntry; if (t != null) { SalesVM.Instance.TransactionData.CurrentTransactionEntry = t; } return; } if (SalesVM.Instance.TransactionData != null && SalesVM.Instance.TransactionData.CurrentTransactionEntry != null) { SalesVM.Instance.DeleteTransactionEntry <TransactionEntryBase>( SalesVM.Instance.TransactionData.CurrentTransactionEntry); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private async Task Print() { try { if (SalesVM.Instance != null && (SalesVM.Instance.TransactionData is QuickPrescription || SalesVM.Instance.TransactionData is Prescription)) { ListView plist = Common.FindChild <ListView>(ReceiptGrd, "PrescriptionEntriesRptLst"); // (ListView)this.FindName("PrescriptionEntriesRptLst"); if (plist != null) { PrintListItems(plist); } } //else //{ // if (SalesVM.Instance != null) SalesVM.Instance.Print(ref ReceiptGrd); //} } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
void SalesLst_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (SalesVM.Instance.TransactionData == null) { return; } if (SalesLst.SelectedItem == null) { return; } SalesVM.Instance.TransactionData.CurrentTransactionEntry = (PrescriptionEntry)SalesLst.SelectedItem; if (padPos != PadPosition.Middle) { return; } SalesPad_LayoutUpdated(null, null); } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
void SalesView_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { try { if (e != null && e.Action == NotifyCollectionChangedAction.Add) { if (e.NewItems != null && e.NewItems.Count > 0) { if (SalesLst != null) { SalesLst.ScrollIntoView(e.NewItems[0]); SalesLst.SelectedItem = e.NewItems[0]; } } SalesVM.Instance.TransactionData.CurrentTransactionEntry = (PrescriptionEntry)SalesLst.SelectedItem; } else if (e.Action == NotifyCollectionChangedAction.Reset) { SetUpSalesPad(); // SalesLst_SelectionChanged(null, null); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void Continue_Click_1(object sender, RoutedEventArgs e) { try { if (batch == null) { MessageBox.Show("Please Create Batch before continuing!"); return; } SalesRegion.SalesVM.Instance.Batch = batch; //SalesRegion.SalesVM.Instance.CurrentLogin = cashier; SalesRegion.SalesVM.Instance.Station = station; if (station != null) { SalesRegion.SalesVM.Instance.Store = station.Store; } Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; Application.Current.MainWindow = null; this.Close(); Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose; var shell = new Shell(); shell.Show(); } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void SearchBox_PreviewKeyDown_1(object sender, KeyEventArgs e) { try { if (e.Key == Key.Delete) { // DeleteTransactionEntry(); } if (e.Key == Key.Enter) { // if (SalesVM.Instance != null) if (SearchBox != null) SalesVM.Instance.GetSearchResults(SearchBox.Text); //if (SearchListCtl.Items.Count == 3) //{ // SearchListCtl.SelectedIndex = 2; // LocalProcesItem(SearchListCtl.SelectedItem); // MoveToNextControl(sender); // HideSearchList(); //} } pkey = e.Key; } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
public static int test_0_get_current_method_generic() { var c = new GetCurrentMethodClass <string> (); var m = c.get_current(); var m2 = typeof(GetCurrentMethodClass <>).GetMethod("get_current"); return(m == m2 ? 0 : 1); }
public void ppcan_PreviewKeyDown_1(object sender, KeyEventArgs e) { try { var uie = e.OriginalSource as Control; if (uie == null) { uie = SalesPad.SearchBox as Control; } if (uie.Name == "PART_FilterBox" && ((uie as TextBox).Text != "") && (e.Key == Key.Up || e.Key == Key.Down)) { return; } if (uie.Name == "PrintBtn" && e.Key == Key.Enter) { if (pkey == Key.Enter) { GotoNextSalesStep(e.Key); } e.Handled = true; pkey = e.Key; return; } //if (e.KeyboardDevice != null && (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.P)) //{ // if (SalesPadState != SalesPadTransState.Receipt) // { // HideCurrentSalesPadState(); // // unhide the colums to print // ShowReceipt(); // SalesVM.Instance.Print(ref SalesPad.ReceiptGrd); // e.Handled = true; // //hide it back // } // else // { // SalesVM.Instance.Print(ref SalesPad.ReceiptGrd); // e.Handled = true; // } //} pkey = e.Key; } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
public void MoveSalesPadDown() { try { SalesLst.UpdateLayout(); SalesPad.Margin = SalesPadMargin; if (padPos == PadPosition.Above && SalesLst.SelectedIndex != -1) { Canvas.SetTop(SalesLst, 0); SetSalesPadtoSelectedItem(); padPos = PadPosition.Middle; } if (padPos == PadPosition.Middle) { if (SalesLst.SelectedIndex == -1) { Canvas.SetTop(SalesLst, 0); // SalesPad.Margin = SalesPadMargin; Canvas.SetTop(SalesPad, SalesLst.ActualHeight + 8); SetSalesPadtoSelectedItem(); if (SalesLst.SelectedIndex == -1) { padPos = PadPosition.Below; } } else { Canvas.SetTop(SalesLst, 0); SetSalesPadtoSelectedItem(); } } if (SalesLst.SelectedIndex != -1 && padPos == PadPosition.Below) { Canvas.SetTop(SalesLst, 0); Canvas.SetTop(SalesPad, 0); SalesPad.Margin = SalesPadMargin; SetSalesPadtoSelectedItem(); if (SalesLst.SelectedIndex == 0) { padPos = PadPosition.Middle; } // padPos = PadPosition.Below; } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void NextPhamacySalesSteps(Key e) { try { if (SalesPadState == SalesPadTransState.Receipt && (e == Key.Right || e == Key.Enter)) { HideReceipt(); SalesVM.Instance.CloseTransaction(); ShowTransaction(); return; } if (SalesPadState == SalesPadTransState.Transaction) { if (SalesVM.Instance.TransactionData != null && SalesVM.Instance.TransactionData.GetType() == typeof(Prescription)) { var p = SalesVM.Instance.TransactionData as Prescription; if (p.Doctor == null) { MessageBox.Show("Please Select a doctor"); return; } if (p.Patient == null) { MessageBox.Show("Please Select a Patient"); return; } } HideTransaction(); if (SalesVM.Instance.TransactionData != null && SalesVM.Instance.TransactionData.Status == null) { if (!SalesVM.Instance.SaveTransaction()) { MessageBox.Show("Saving Transaction Failed Try again!"); //return; } ; //ShowReceipt(); } ShowReceipt(); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
public void MoveToNextControl(object sender) { try { UIElement uie = sender as UIElement; uie.MoveFocus( new TraversalRequest( FocusNavigationDirection.Next)); } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void SalesPad_PreviewKeyDown_1(object sender, KeyEventArgs e) { try { if (e == null) { return; } var uie = e.OriginalSource as Control; if (uie == null) { uie = SearchBox as Control; } if (uie.Name == "PART_FilterBox") { if (e.Key == Key.Enter) //pkey == Key.Enter && { // SearchBox.RaiseFilterEvent(); if (SearchListCtl.Items.Count == 1) { SearchListCtl.SelectedIndex = 0; } var textBox = uie as TextBox; if (textBox != null) { textBox.Text = ""; } //e.Handled = true; MoveToNextControl(uie); } return; } if (e.Key == Key.Enter) { // e.Handled = true; MoveToNextControl(uie); } pkey = e.Key; } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private async void PrintBtn_RightClick(object sender, MouseButtonEventArgs e) { try { ListView plist = Common.FindChild <ListView>(ReceiptGrd, "PrescriptionEntriesRptLst"); // (ListView)this.FindName("PrescriptionEntriesRptLst"); if (plist != null) { plist.SelectAll(); PrintBtn_Click_1(sender, e); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void PharmacistCbo_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (e != null && e.AddedItems.Count > 0) { Cashier c = (e.AddedItems[0] as Cashier); if (c != null && SalesVM.Instance.TransactionData != null) { SalesVM.Instance.TransactionData.PharmacistId = c.Id; } } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void ReBindItemEditor() { try { ReBindTranStatusTxt(); Binding myBinding = new Binding("SelectedItem"); myBinding.Source = SalesView.SalesLst; myBinding.Mode = BindingMode.OneWay; if (ContentProperty != null) { ((FrameworkElement)SalesPad.FindName("ItemEditor")).SetBinding(ContentProperty, myBinding); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void PrintListItems(ListView plist) { try { if (plist == null) { return; } dynamic lst; if (plist.SelectedItems.Count == 0) { lst = plist.Items; } else { lst = plist.SelectedItems; } foreach (var itm in lst) { if (plist.ItemContainerGenerator != null) { var fi = (FrameworkElement)plist.ItemContainerGenerator.ContainerFromItem(itm); if (fi != null) { PrintEntry(fi, itm); } else { MessageBox.Show("Print error! Please check prints and reprint and also tell joseph you saw this error in TaskPad."); } } } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void SetSalesPadtoSelectedItem() { try { SalesLst.UpdateLayout(); f = (FrameworkElement)SalesLst.ItemContainerGenerator.ContainerFromItem(SalesLst.SelectedItem); if (f != null)//&& f.Parent != null { var transformToAncestor = ((FrameworkElement)f).TransformToAncestor(ppcan); if (transformToAncestor != null) { Rect r = transformToAncestor.TransformBounds(new Rect(0, 0, 0, 0)); SalesPad.Margin = new Thickness(r.Left, r.Top, r.Right, r.Bottom); } } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
public void GoToNextTransactionEntry() { try { if (SalesVM.Instance.TransactionData == null) { return; } if (!SalesVM.Instance.SaveTransaction()) { return; } if (SalesLst.SelectedIndex == SalesLst.Items.Count - 1) { padPos = PadPosition.Below; SalesVM.Instance.TransactionData.CurrentTransactionEntry = null; SalesLst.SelectedItem = null; Canvas.SetTop(SalesLst, 0); SalesLst.UpdateLayout(); Canvas.SetTop(SalesPad, 0); SalesPad.Margin = SalesPadMargin; Canvas.SetTop(SalesPad, SalesLst.ActualHeight + 8); SetSalesPadtoSelectedItem(); } else { SalesLst.SelectedIndex += 1; // selected index don't change when more than list } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void SearchBox_OnTextChanged(object sender, TextChangedEventArgs e) { try { if (e != null && e.Changes != null) { //if (SalesVM.Instance != null) if (SearchBox != null) SalesVM.Instance.GetSearchResults(SearchBox.Text); //ShowSearchList(); RestartQueryTimer(); } else { HideSearchList(); RevokeQueryTimer(); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { try { // return Visibility.Visible; Cashier currentLogin = SalesVM.Instance.CurrentLogin; Cashier transactionCashier = (values[0] as Cashier); Cashier pharmacist = (values[1] as Cashier); //if (c == null || c.Role == "Pharmacist") if (pharmacist == null) { return(Visibility.Hidden); } return(Visibility.Visible); //if (parameter.ToString() == "Button") //{ // if (currentLogin != null) // { // if (currentLogin.Role == "Pharmacist") // { // if (pharmacist != null && pharmacist.Id == currentLogin.Id) // { // return Visibility.Visible; // } // else // { // return Visibility.Hidden; // } // } // else // { // if (transactionCashier != null && currentLogin.Id == transactionCashier.Id && SalesVM.Instance.Pharmacists != null && SalesVM.Instance.Pharmacists.Any() == true) // { // return Visibility.Visible; // } // } // } // if (currentLogin != null && (transactionCashier != null && currentLogin.Id == transactionCashier.Id && pharmacist != null && pharmacist.Role == "Pharmacist")) // { // return Visibility.Visible; // } // return Visibility.Hidden; //} //else //{ // if (currentLogin != null && (currentLogin != null && currentLogin.Role == "Pharmacist" || transactionCashier != null && currentLogin.Id != transactionCashier.Id) ) // { // // if(p != null && p.Id == c.Id) // return Visibility.Hidden; // } // //if (SalesVM._pharmacists == null || SalesVM._pharmacists.Count == 0) // //{ // // return Visibility.Hidden; // //} // return Visibility.Visible; //} } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
private void LocalProcesItem(object itm) { try { if (ItemEditor == null) { return; } if (itm == null) { return; } if (edititem == true) { ItemEditor.Content = itm; edititem = false; return; } if (itm.GetType() == typeof(RMSDataAccessLayer.SearchItem)) { switch (((ISearchItem)itm).DisplayName) { case "Add Patient": Patient p = SalesVM.Instance.CreateNewPatient(SearchBox.Text); p.StartTracking(); ItemEditor.Content = p; break; case "Add Doctor": Doctor d = SalesVM.Instance.CreateNewDoctor(); d.StartTracking(); ItemEditor.Content = d; break; default: ItemEditor.Content = ((RMSDataAccessLayer.SearchItem)itm).SearchObject; break; } } else { if (showPatientTransactions == true) { if (itm.GetType() == typeof(RMSDataAccessLayer.Patient)) { var lst = SalesVM.Instance.GetPatientTransactionList(itm as Patient); ItemEditor.Content = lst; showPatientTransactions = false; } if (itm.GetType() == typeof(RMSDataAccessLayer.Doctor)) { var lst = SalesVM.Instance.GetDoctorTransactionList(itm as Doctor); ItemEditor.Content = lst; showPatientTransactions = false; } } else { if (SalesVM.Instance != null) { SalesVM.Instance.ProcessSearchListItem(itm); } MoveToNextControl(ItemEditor); } } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { try { return(Visibility.Visible); Cashier c = SalesVM.Instance.CashierEx; Cashier tc = (values[0] as Cashier); Cashier p = (values[1] as Cashier); //if (c == null || c.Role == "Pharmacist") if (parameter.ToString() == "Button") { if (c != null) { if (c.Role == "Pharmacist") { if (p != null && p.Id == c.Id) { return(Visibility.Visible); } else { return(Visibility.Hidden); } } else { if (tc != null && c.Id == tc.Id && SalesVM.Instance.Pharmacists != null && SalesVM.Instance.Pharmacists.Any() == true) { return(Visibility.Visible); } } } if (c != null && (tc != null && c.Id == tc.Id && p != null && p.Role == "Pharmacist")) { return(Visibility.Visible); } return(Visibility.Hidden); } else { if (c != null && (c != null && c.Role == "Pharmacist" || tc != null && c.Id != tc.Id)) { // if(p != null && p.Id == c.Id) return(Visibility.Hidden); } //if (SalesVM._pharmacists == null || SalesVM._pharmacists.Count == 0) //{ // return Visibility.Hidden; //} return(Visibility.Visible); } } catch (Exception ex) { Logger.Log(LoggingLevel.Error, GetCurrentMethodClass.GetCurrentMethod() + ": --- :" + ex.Message + ex.StackTrace); throw ex; } }