// Close the NewWorkOrder form, and move back to the WorkOrderForm private void cancelButton_Click(object sender, EventArgs e) { this.Close(); WorkOrderForm workOrder = new WorkOrderForm(); workOrder.Show(); }
private void btnSubmit_Click(object sender, EventArgs e) { nullOrEmptyCheck(); if (nullOrEmptyCheck()) { string occstat = " "; string animal = " "; string pte = " "; if (rbtnOccupied.Checked) { occstat = rbtnOccupied.Text; animal = newInvoiceAnimalsInHomeComboBox.SelectedItem.ToString().ToLower(); pte = newInvoicePermissionToEnterComboBox.SelectedItem.ToString().ToLower(); } else if (rbtnUnoccupied.Checked) { occstat = rbtnUnoccupied.Text; animal = " "; pte = " "; } Engine.OfficeWorker.SubmitWorkOrder(cmbxContractingCompany.Text, occstat, newInvoiceCommunityComboBox.SelectedItem.ToString(), txtStreetAddress.Text, dateTimePicker.Value, cmbxWorkOrderType.SelectedItem.ToString().ToLower(), rtxtDescriptionOfRequest.Text, animal, pte); MessageBox.Show(Engine.OfficeWorker.message); this.Close(); WorkOrderForm workorders = new WorkOrderForm(); workorders.Show(); } }
// Save values into the project DB private void saveInvoiceButton_Click(object sender, EventArgs e) { nullOrEmptyCheck(); if (nullOrEmptyCheck()) { string altnum = newInvoiceAlternatePhoneNumberTextBox.Text; string altphonetype; string altextension = newInvoiceAlternatePhoneExtensionTextBox.ToString(); if (newInvoiceAlternatePhoneTypeComboBox.SelectedIndex != -1) { altphonetype = newInvoiceAlternatePhoneTypeComboBox.SelectedItem.ToString(); } else { altphonetype = null; } Engine.WorkOrders.saveInvoice(altnum, altphonetype, altphonetype, newInvoiceCommunityComboBox.SelectedItem.ToString().ToLower(), newInvoiceStreetAddressTextBox.Text.ToLower(), newInvoiceEmailTextBox.Text.ToLower(), newInvoicePrimaryPhoneNumberTextBox.Text.ToLower(), newInvoicePrimaryPhoneTypeComboBox.SelectedItem.ToString().ToLower(), newInvoicePrimaryPhoneExtensionTextBox.Text.ToLower(), newInvoiceRequestTimeOfServiceComboBox.SelectedItem.ToString().ToLower(), newInvoiceWorkOrderTypeComboBox.SelectedItem.ToString().ToLower(), newInvoiceDescriptionOfRequestRichTextBox.Text.ToString().ToLower(), newInvoicePermissionToEnterComboBox.SelectedItem.ToString().ToLower(), newInvoiceAnimalsInHomeComboBox.SelectedItem.ToString().ToLower()); MessageBox.Show(Engine.WorkOrders.message); WorkOrderForm workorder = new WorkOrderForm(); workorder.Show(); this.Close(); } }
private void btnCancel_Click(object sender, EventArgs e) { DialogResult cancelResult = MessageBox.Show("Are you sure you want to cancel this Work Order?", "Cancel Work Order", MessageBoxButtons.YesNo); if (cancelResult == DialogResult.Yes) { this.Close(); WorkOrderForm workorders = new WorkOrderForm(); workorders.Show(); } }
// Close the NewWorkOrder form, and move back to the WorkOrderForm private void cancelButton_Click(object sender, EventArgs e) { // Message to be displayed in MessageBox const string prompt = "Are you sure you would like to cancel? You will lose any unsaved information."; const string caption = "Cancel New Work Order"; // MessageBox pop up to confirm var result = MessageBox.Show(prompt, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); // Close form if yes was pressed if (result == DialogResult.Yes) { this.Close(); WorkOrderForm workOrder = new WorkOrderForm(); workOrder.Show(); } }
/** * Checks Login creditials to determine if you can login */ private void loginButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(passwordEntryTextBox.Text) && !string.IsNullOrEmpty(emailEntryTextBox.Text)) { tooltip(); } else { Engine.Login.logincomplete(emailEntryTextBox.Text, passwordEntryTextBox.Text); if (Engine.Login.success == true) { MessageBox.Show("Login Successful"); this.Hide(); if (Engine.ActiveUser.usertype == "occupant" || Engine.ActiveUser.usertype == "office worker") { WorkOrderForm invoice = new WorkOrderForm(); invoice.Show(); } else if (Engine.ActiveUser.usertype == "administrator") { AdminForm admin = new AdminForm(); admin.Show(); } else if (Engine.ActiveUser.usertype == "contractor") { ContractorWorkOrderForm contractor = new ContractorWorkOrderForm(); contractor.Show(); } } else { MessageBox.Show(Engine.Login.message); } } }
/** * Checks Login creditials to determine if you can login */ private void loginButton_Click(object sender, EventArgs e) { string confirmed; // will be used to store the result when we check whether the user's account has been confirmed by the admin or not string usertype; // will be used to hold the user's account type /** * If the email field is empty then a tooltip informs you that you need to enter an email address. */ if (string.IsNullOrEmpty(emailEntryTextBox.Text)) { ToolTip tip = new ToolTip(); tip.Show("Please Enter An Email Address", emailEntryTextBox, 10000); } /** * If the password field is empty then a tooltip informs you that you need to enter a password. */ if (string.IsNullOrEmpty(passwordEntryTextBox.Text)) { ToolTip tip2 = new ToolTip(); tip2.Show("Please Enter A Passwords", passwordEntryTextBox, 10000); } /** * If both fields are filled then a connection to the invoicelogin will be established. */ else if (!string.IsNullOrEmpty(passwordEntryTextBox.Text) && !string.IsNullOrEmpty(emailEntryTextBox.Text)) { OleDbConnection connection = new OleDbConnection("Provider = Microsoft.ACE.OLEDB.12.0; Data Source = ProjectDB.accdb; Persist Security Info = True"); connection.Open(); /** * MySQLCommand that will be used to query the database using the entered email and password */ OleDbCommand command = new OleDbCommand("Select Email, Password, UserType, Confirmed from UserAccounts where Email='" + emailEntryTextBox.Text.ToLower() + "'and Password='******'", connection); /** * Fill the DataTable with results from the query. * If the table has at least one row then that means the login information entered was that of a registered user and login was successful. * In the future logging successfully will result in you being taken to another form. For now you are only informed of your successful login. * If the table has no rows, then either your email-password combination could not be found in our records and the login was unsuccessful. * */ OleDbDataAdapter data = new OleDbDataAdapter(command); DataTable table = new DataTable(); data.Fill(table); if (table.Rows.Count > 0) { usertype = table.Rows[0]["usertype"].ToString(); // Store the usertype item from your dataTable into the usertype variable confirmed = table.Rows[0]["confirmed"].ToString(); // store the confirmed item from your dataTable /** * Checks to see if the administrator has confirmed the account and if not then inform the user that it has yet to be confirmed/activated */ if (confirmed == "False") { MessageBox.Show("Your account has not been confirmed by the adminstrator yet"); } /** * If the adminstrator has confirmed the user's account then next the usertype is checked to determine which form the user should see. * For now the occupant, contractor and office worker all see the same form but eventually all three will have different level's of access. */ else if (confirmed == "True") { if (usertype == "Occupant" || usertype == "Office Worker") { MessageBox.Show("Login Successful!"); WorkOrderForm invoice = new WorkOrderForm(); invoice.Show(); } else if (usertype == "Administrator") { MessageBox.Show("Login Successful!"); AdminForm invoice = new AdminForm(); invoice.Show(); } else if (usertype == "Contractor") { MessageBox.Show("Login Successful!"); ContractorWorkOrderForm workOrder = new ContractorWorkOrderForm(); workOrder.Show(); } } } else { MessageBox.Show("Invalid username or password"); } } }