//display the views for all operations that were completed private void PopulateOperations() { Statistic.clearOperationsList(); SQLiteDataReader reader = StaticDBConnection.QueryDatabase("SELECT * FROM Operations ORDER BY Shift_Start"); while (reader.Read()) { operationCheck = true; CheckBox cb = new CheckBox(); cb.FontSize = 20; cb.FontWeight = FontWeights.Bold; cb.Foreground = Brushes.DarkSlateBlue; cb.Name = "operation" + reader["Operation_ID"]; cb.Checked += OperationChecked; cb.Unchecked += OperationUnchecked; DateTime startDate = Convert.ToDateTime(reader["Shift_Start"].ToString()); DateTime endDate = Convert.ToDateTime(reader["Shift_End"].ToString()); cb.Content = "Operation ID: " + reader["Operation_ID"] + " Operation Name: " + reader["Name"] + " Start: " + startDate.ToString("g") + " End: " + endDate.ToString("g"); previousOperation.Children.Add(cb); } StaticDBConnection.CloseConnection(); if (operationCheck == true) { Button submitButton = new Button(); submitButton.Content = "Submit"; submitButton.Width = 100; submitButton.Margin = new Thickness(0, 50, 0, 0); submitButton.Click += OperationSubmit; previousOperation.Children.Add(submitButton); } }
private void ComboBox_TeamMemberName3_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (ComboBox_TeamMemberName3.SelectedIndex == -1) { return; } if (ComboBox_TeamMemberName3.SelectedIndex == 0) { ComboBox_TeamMemberName3.Visibility = Visibility.Collapsed; teamMember3.Visibility = Visibility.Visible; //Button_OKTeamMember3.Visibility = Visibility.Visible; Button_CancelTeamMember3.Visibility = Visibility.Visible; } else { ComboBoxItem memberNameItem = new ComboBoxItem(); memberNameItem = (ComboBoxItem)ComboBox_TeamMemberName3.SelectedItem; using (SQLiteDataReader reader = StaticDBConnection.QueryDatabase("Select Training_Level FROM [Volunteers] WHERE Name='" + memberNameItem.Content.ToString() + "'")) { reader.Read(); lvlOfTraining3.SelectedIndex = Convert.ToInt32(reader["Training_Level"].ToString()); } StaticDBConnection.CloseConnection(); } }
//retrieve the total number of volunteers in operations public int getVolunteerCountFromDB() { int volunteerCount = 0; SQLiteDataReader reader = StaticDBConnection.QueryDatabase(dbQueryVolunteerCount); while (reader.Read()) { volunteerCount = int.Parse(reader["Num"].ToString()); } StaticDBConnection.CloseConnection(); return(volunteerCount); }
//retrieve the total number of teams in operations public int getTeamCountFromDB() { int teamCount = 0; SQLiteDataReader reader = StaticDBConnection.QueryDatabase(dbQueryTeamCount); while (reader.Read()) { teamCount = int.Parse(reader["Count"].ToString()); } StaticDBConnection.CloseConnection(); return(teamCount); }
//Children with Ambulance public void getInterventionChildrenWithAmublanceCount(String complaint) { String dBQueryInterventionChildrenACount = "SELECT count(*) as Count from Interventions WHERE Conclusion LIKE 'get_ComboBoxItem_Conclusion_911' AND Operation_ID IN " + Statistic.getOperationID() + " AND Chief_Complaint='" + complaint + "' AND Age < 18"; SQLiteDataReader childrenReader = StaticDBConnection.QueryDatabase(dBQueryInterventionChildrenACount); while (childrenReader.Read()) { int count = int.Parse(childrenReader["Count"].ToString()); interventionChildrenAList.Add(count); } StaticDBConnection.CloseConnection(); }
public InterventionStatisticMapper() { chiefComplaint.Clear(); SQLiteDataReader reader = StaticDBConnection.QueryDatabase(dBQueryComplaints); while (reader.Read()) { String complaint = reader["Chief_Complaint"].ToString(); chiefComplaint.Add(complaint); } StaticDBConnection.CloseConnection(); }
public VolunteerStatisticMapper() { SQLiteDataReader reader = StaticDBConnection.QueryDatabase(dbQuery); while (reader.Read()) { String volunteer = reader["Name"].ToString(); DateTime start = Convert.ToDateTime(reader["Joined"].ToString()); DateTime end = Convert.ToDateTime(reader["Departure"].ToString()); String operationID = reader["Operation_ID"].ToString(); //Creating volunteerStatistic VolunteerStatistic vs = new VolunteerStatistic(volunteer, start, end, operationID); volunteerStatisticList.Add(vs); } StaticDBConnection.CloseConnection(); }
public ABC(int id) { this.abcID = id; using (System.Data.SQLite.SQLiteDataReader results = StaticDBConnection.QueryDatabase("SELECT Intervention_ID, Consciousness, Disoriented, Airways, Breathing, Breathing_Frequency, Circulation, Circulation_Frequency FROM [ABCs] WHERE ABC_ID=" + id + ";")) { results.Read(); this.interventionID = (results.IsDBNull(0)) ? 0 : results.GetInt32(0); this.consciousness = (results.IsDBNull(1)) ? "" : results.GetString(1); this.disoriented = (results.IsDBNull(2)) ? false : Convert.ToBoolean(results.GetString(2)); this.airways = (results.IsDBNull(3)) ? "" : results.GetString(3); this.breathing = (results.IsDBNull(4)) ? "" : results.GetString(4); this.breathingFrequency = (results.IsDBNull(5)) ? 0 : results.GetInt32(5); this.circulation = (results.IsDBNull(6)) ? "" : results.GetString(6); this.circulationFrequency = (results.IsDBNull(7)) ? 0 : results.GetInt32(7); } StaticDBConnection.CloseConnection(); }
public TeamFormPage(TeamsSectionPage caller) { InitializeComponent(); this.caller = caller; ComboBoxItem createUserItem = new ComboBoxItem(); createUserItem.Content = "NEW USER"; createUserItem.FontStyle = FontStyles.Italic; createUserItem.FontWeight = FontWeights.Bold; ComboBoxItem createUserItem2 = new ComboBoxItem(); createUserItem2.Content = "NEW USER"; createUserItem2.FontStyle = FontStyles.Italic; createUserItem2.FontWeight = FontWeights.Bold; ComboBoxItem createUserItem3 = new ComboBoxItem(); createUserItem3.Content = "NEW USER"; createUserItem3.FontStyle = FontStyles.Italic; createUserItem3.FontWeight = FontWeights.Bold; ComboBox_TeamMemberName1.Items.Add(createUserItem); ComboBox_TeamMemberName2.Items.Add(createUserItem2); ComboBox_TeamMemberName3.Items.Add(createUserItem3); using (SQLiteDataReader reader = StaticDBConnection.QueryDatabase("SELECT Name FROM Volunteers")) { while (reader.Read()) { ComboBoxItem cbItem = new ComboBoxItem(); cbItem.Content = reader["Name"].ToString(); ComboBoxItem cbItem2 = new ComboBoxItem(); cbItem2.Content = reader["Name"].ToString(); ComboBoxItem cbItem3 = new ComboBoxItem(); cbItem3.Content = reader["Name"].ToString(); ComboBox_TeamMemberName1.Items.Add(cbItem); ComboBox_TeamMemberName2.Items.Add(cbItem2); ComboBox_TeamMemberName3.Items.Add(cbItem3); } } StaticDBConnection.CloseConnection(); }
private void GenerateComplainName() { ism = new InterventionStatisticMapper(); foreach (String complaint in ism.getListComplaint()) { RowDefinition rd = new RowDefinition(); rd.Height = new GridLength(40); ComplaintGrid.RowDefinitions.Add(rd); Border border = new Border(); border.BorderThickness = new Thickness(1, 0, 5, 1); border.BorderBrush = new SolidColorBrush(Colors.Black); TextBlock tb = new TextBlock(); tb.FontWeight = FontWeights.Bold; tb.Height = 40; tb.FontSize = 13; tb.Margin = new Thickness(5, 0, 0, 0); tb.VerticalAlignment = VerticalAlignment.Center; tb.HorizontalAlignment = HorizontalAlignment.Center; tb.TextWrapping = TextWrapping.Wrap; displayComplaint = StaticDBConnection.GetResource(complaint); tb.Name = complaint; tb.Text = displayComplaint; border.Child = tb; ComplaintGrid.Children.Add(border); Grid.SetColumn(border, 0); Grid.SetRow(border, count); GenerateInterventionWithoutAmbulance(count, complaint); GenerateInterventionWithAmbulance(count, complaint); GenerateTotalTableHorizontal(count); //resetting the total counters countWithoutAmbulance = 0; countWithAmbulance = 0; totalChildrenHoriCount = 0; totalAdultHoriCount = 0; count++; } StaticDBConnection.CloseConnection(); GenerateTotalTableVertical(count); totalChildrenVertical = 0; totalAdultVertical = 0; }
//Creates a new team member public TeamMember(String name, Trainings training, DateTime departure) { this.name = name; this.trainingLevel = training; this.departure = departure; try { using (SQLiteDataReader reader = StaticDBConnection.QueryDatabase("Select Volunteer_ID FROM [Volunteers] WHERE Name='" + name + "'")) { reader.Read(); this.volunteerID = Convert.ToInt32(reader["Volunteer_ID"].ToString()); } StaticDBConnection.CloseConnection(); StaticDBConnection.NonQueryDatabase("UPDATE [Volunteers] SET Training_Level=" + (int)this.trainingLevel + " WHERE Volunteer_ID=" + this.volunteerID + ";"); } catch { this.volunteerID = StaticDBConnection.NonQueryDatabaseWithID("INSERT INTO [Volunteers] (Name, Training_Level) VALUES ('" + name.Replace("'", "''") + "', " + (int)training + ")"); } }
public OperationStatisticMapper() { SQLiteDataReader reader = StaticDBConnection.QueryDatabase(dbQuery); while (reader.Read()) { DateTime startDate = Convert.ToDateTime(reader["Shift_Start"].ToString()); DateTime endDate = Convert.ToDateTime(reader["Shift_End"].ToString()); String volunteerFollowUpText = reader["VolunteerFollowUp"].ToString(); String financeText = reader["Finance"].ToString(); String vehicleText = reader["Vehicle"].ToString(); String particularSituationText = reader["ParticularSituation"].ToString(); String organizationFollowUpText = reader["OrganizationFollowUp"].ToString(); String supervisorFollowUpText = reader["SupervisorFollowUp"].ToString(); String eventName = reader["Name"].ToString(); String dispatcherName = reader["Dispatcher"].ToString(); OperationStatistic os = new OperationStatistic(startDate, endDate, volunteerFollowUpText, financeText, vehicleText, particularSituationText, organizationFollowUpText, supervisorFollowUpText, eventName, dispatcherName); operationStatisticList.Add(os); } StaticDBConnection.CloseConnection(); }
public InitialSetup() { InitializeComponent(); CultureResources.ChangeCulture(Properties.Settings.Default.DefaultCulture.NativeName); //Check and Attempt to recover Serializer serializer = Serializer.Instance; if (serializer.Recoverable()) { if (MessageBox.Show(Properties.Resources.MessageBox_Recovery_RecoveryFound, Properties.Resources.MessageBox_Recovery_RecoveryFound_Title, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { MainWindow mw = new MainWindow(); mw.Show(); switch (serializer.PerformRecovery()) { case RecoveryResults.Partial: MessageBox.Show(Properties.Resources.MessageBox_Recovery_PartialRecovery); goto case RecoveryResults.Success; case RecoveryResults.Success: serializer.StartBackUp(); this.Close(); break; case RecoveryResults.Failure: MessageBox.Show(Properties.Resources.MessageBox_Recovery_FailedRecovery); mw.ForceClose(); serializer.CleanUp(); break; } } else { serializer.CleanUp(); } } ComboBoxItem createUserItem = new ComboBoxItem(); createUserItem.Content = "NEW USER"; createUserItem.FontStyle = FontStyles.Italic; createUserItem.FontWeight = FontWeights.Bold; ComboBoxItem createUserItemSupervisor = new ComboBoxItem(); createUserItemSupervisor.Content = "NEW USER"; createUserItemSupervisor.FontStyle = FontStyles.Italic; createUserItemSupervisor.FontWeight = FontWeights.Bold; /*ComboBoxItem createUserItemOpManager = new ComboBoxItem(); * createUserItemOpManager.Content = "NEW USER"; * createUserItemOpManager.FontStyle = FontStyles.Italic; * createUserItemOpManager.FontWeight = FontWeights.Bold;*/ dispatcherName.Items.Add(createUserItem); supervisorName.Items.Add(createUserItemSupervisor); //opManagerName.Items.Add(createUserItemOpManager); ComboBoxItem supervisorItem = new ComboBoxItem(); supervisorItem.Content = "Supervisor"; ComboBoxItem opManagerItem = new ComboBoxItem(); opManagerItem.Content = "Operation Manager"; Combobox_SupervisorOperationManager.Items.Add(supervisorItem); Combobox_SupervisorOperationManager.Items.Add(opManagerItem); lastGridRow = InitialSetupGrid.RowDefinitions.Count; using (SQLiteDataReader reader = StaticDBConnection.QueryDatabase("SELECT Name FROM Volunteers")) { while (reader.Read()) { ComboBoxItem cbItem = new ComboBoxItem(); cbItem.Content = reader["Name"].ToString(); ComboBoxItem cbItemSupervisor = new ComboBoxItem(); cbItemSupervisor.Content = reader["Name"].ToString(); ComboBoxItem cbItemOpManager = new ComboBoxItem(); cbItemOpManager.Content = reader["Name"].ToString(); dispatcherName.Items.Add(cbItem); supervisorName.Items.Add(cbItemSupervisor); //opManagerName.Items.Add(cbItemOpManager); } } StaticDBConnection.CloseConnection(); }
private void Button_Add_Supervisor_Manager_Click(object sender, RoutedEventArgs e) { RowDefinition rowDef = new RowDefinition(); rowDef.Height = new GridLength(30); InitialSetupGrid.RowDefinitions.Add(rowDef); //supervisor or operation manager box ComboBox supervisorManagerCBox = new ComboBox(); supervisorManagerCBox.HorizontalContentAlignment = HorizontalAlignment.Center; supervisorManagerCBox.VerticalContentAlignment = VerticalAlignment.Center; ComboBoxItem supervisorItem = new ComboBoxItem(); supervisorItem.Content = "Supervisor"; supervisorManagerCBox.Items.Add(supervisorItem); ComboBoxItem operationManagerItem = new ComboBoxItem(); operationManagerItem.Content = "Operation Manager"; supervisorManagerCBox.Items.Add(operationManagerItem); InitialSetupGrid.Children.Add(supervisorManagerCBox); Grid.SetRow(supervisorManagerCBox, lastGridRow); Grid.SetColumn(supervisorManagerCBox, 0); StackPanel newVolunteerStackPanel = new StackPanel(); newVolunteerStackPanel.Orientation = Orientation.Horizontal; Grid.SetRow(newVolunteerStackPanel, lastGridRow); Grid.SetColumn(newVolunteerStackPanel, 1); InitialSetupGrid.Children.Add(newVolunteerStackPanel); TextBox newVolunteerBox = new TextBox(); newVolunteerBox.Name = ("Textbox_VolunteerName" + lastGridRow); newVolunteerBox.Width = 180; newVolunteerBox.Visibility = Visibility.Collapsed; newVolunteerStackPanel.Children.Add(newVolunteerBox); allVolunteerTextBoxes.Add(newVolunteerBox); Button newOKButton = new Button(); newOKButton.Content = "OK"; newOKButton.Width = 30; newOKButton.Click += new RoutedEventHandler(OKButtonClicked); newOKButton.Visibility = Visibility.Collapsed; newVolunteerStackPanel.Children.Add(newOKButton); allVolunteerOKButtons.Add(newOKButton); Button newCancelButton = new Button(); newCancelButton.Content = "Cancel"; newCancelButton.Width = 70; newCancelButton.Click += new RoutedEventHandler(CancelButtonClicked); newCancelButton.Visibility = Visibility.Collapsed; newVolunteerStackPanel.Children.Add(newCancelButton); allVolunteerCancelButtons.Add(newCancelButton); //Value box ComboBox supervisorManagerValueCBox = new ComboBox(); supervisorManagerValueCBox.Name = ("VolunteerName" + lastGridRow); supervisorManagerValueCBox.HorizontalAlignment = HorizontalAlignment.Left; supervisorManagerValueCBox.HorizontalContentAlignment = HorizontalAlignment.Center; supervisorManagerValueCBox.VerticalContentAlignment = VerticalAlignment.Center; supervisorManagerValueCBox.Width = 280; allVolunteerCBoxes.Add(supervisorManagerValueCBox); ComboBoxItem createUserItem = new ComboBoxItem(); createUserItem.Content = "NEW USER"; createUserItem.FontStyle = FontStyles.Italic; createUserItem.FontWeight = FontWeights.Bold; createUserItem.Selected += new RoutedEventHandler(NewUserSelected); supervisorManagerValueCBox.Items.Add(createUserItem); using (SQLiteDataReader reader = StaticDBConnection.QueryDatabase("SELECT Name FROM Volunteers")) { while (reader.Read()) { ComboBoxItem cbItem = new ComboBoxItem(); cbItem.Content = reader["Name"].ToString(); supervisorManagerValueCBox.Items.Add(cbItem); } } StaticDBConnection.CloseConnection(); InitialSetupGrid.Children.Add(supervisorManagerValueCBox); Grid.SetRow(supervisorManagerValueCBox, lastGridRow); Grid.SetColumn(supervisorManagerValueCBox, 1); lastGridRow++; InitialSetupForm.Height += 30; }