public MainWindow() { InitializeComponent(); Settings = new SettingsWindow(); DatabaseStatements = new DatabaseStatements(); DatabaseStatements.CreateTable(); BarcodeEngineManager.SetBarcodeEngine(Settings.Settings.BarcodeEngine); }
private void LoadHistory() { HistoryStackpanel.Children.Clear(); foreach (Row r in DatabaseStatements.GetHistory()) { BarcodeHistoryUserControl temp = new BarcodeHistoryUserControl( new Barcode( r.GetValue <string>("value"), (BarcodeFormat)Enum.Parse(typeof(BarcodeFormat), r.GetValue <string>("type"))), DateTime.Parse(r.GetValue <string>("date"))); temp.Deleted += OnHistoryDeleted; temp.Clicked += OnHistoryClicked; HistoryStackpanel.Children.Add(temp); } }
private void HandleScan(Barcode barcode) { if (barcode is null) { return; } BarcodeHistoryUserControl temp = TryGetHistory(barcode, barcode.Text); if (temp is null) { temp = new BarcodeHistoryUserControl(barcode, DateTime.Now, barcode.Text); temp.Deleted += OnHistoryDeleted; temp.Clicked += OnHistoryClicked; HistoryStackpanel.Children.Insert(0, temp); DatabaseStatements.InsertBarcode(barcode.Text, barcode.Format); } ScrollToTarget(temp, barcode.Text); WriteText(barcode.Text); }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { switch (System.Windows.MessageBox.Show("Do you realy want to close this application?" + Environment.NewLine + "Yes: Close" + Environment.NewLine + "No: Minimize", "Close?", MessageBoxButton.YesNoCancel, MessageBoxImage.Question)) { case MessageBoxResult.Yes: ScanScreenshotHotkey.Unregister(); ScanTextboxHotkey.Unregister(); Settings.Close(false); DatabaseStatements?.Dispose(); break; case MessageBoxResult.No: MinimizeToIcon(); e.Cancel = true; break; default: e.Cancel = true; break; } }
{/// <summary> /// User grid display for the sales /// author written by Abdelrahman Ahmed /// </summary> public SalesEvent() { InitializeComponent(); salesgrid.ItemsSource = DatabaseStatements.displaysales("SELECT name as 'Name', email as 'Email', country as 'Country', type as 'Product', quantity as 'Quantity', weeks as 'Weekly Incrument' FROM Sales").Tables[0].DefaultView; }
{ /// <summary> /// In the Employee usercontrol below is the statement that connects /// Name, Email, Phone, Role in to the datagrid in the App from the database /// written by Author : Abdelrahman Ahmed /// </summary> public EmployeeEvent() { InitializeComponent(); employeelist.ItemsSource = DatabaseStatements.displayEmployees("SELECT firstname as 'First Name', lastname as 'Last Name', Email as 'E-Mail', phone as 'Phone Number', role as 'Role', status as 'Status' FROM Employees").Tables[0].DefaultView; }
/// <summary> /// after initialise component the statement below it /// displays the data grid for the Users from the database /// written by author : Abdelrahman Ahmed /// </summary> public UserEvent() { InitializeComponent(); UserlistGrid.ItemsSource = DatabaseStatements.GetUsers("SELECT username, phone, email, role FROM Users").Tables[0].DefaultView; }
public ScheduleEvent() { InitializeComponent(); schedulegrid.ItemsSource = DatabaseStatements.displaySchdeule("SELECT name as 'Name', type as 'Fertisiler Type', quantity as 'Quantity', area as 'Area', date as 'Date', priority as 'Priority' FROM schedule").Tables[0].DefaultView; }
private void DeleteHistory(BarcodeHistoryUserControl history) { DatabaseStatements.DeleteHistory(history.Barcode.Text, history.Barcode.Format); HistoryStackpanel.Children.Remove(history); }