public EditUserAdminConfirm(User user) { InitializeComponent(); this.password = user.Password; dbTools = new DatabaseTools(); this.user = user; check = false; }
public EditUserInfo(User user) { InitializeComponent(); dgTools = new DataGridTools(); dbTools = new DatabaseTools(); this.user = user; ReportGen = new ReportGenerator(); }
// Constructor public ProductManagerForm() { InitializeComponent(); // Instantiating class level objects dgTools = new DataGridTools(); dbTools = new DatabaseTools(); newProducts = new List <Product>(); matsQuantityToRemove = new List <RawMaterial>(); filterTools = new FilterTools(); //toolStripStatusLabel1.BackColor = }
// Constructor public RawMaterialsForm(string title = "", string desc = "") { InitializeComponent(); dbTools = new DatabaseTools(); Title = title; // If the title for the screen is passed into the parameters, it will change the text on the form before showing it if (title != "" && desc != "") { lblRawMat.Text = title; lblDesc.Text = desc; } }
private void addItemBtn_Click(object sender, EventArgs e) { firstname = txtFirstName.Text; lastname = txtLastName.Text; job = boxOccupation.Text; dbTools = new DatabaseTools(); try { string message = "Are you sure you want to change the job of " + txtFirstName.Text + " " + txtLastName.Text + " to " + job + "?"; string title = "Warning!"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { try { confirmForm = new EditUserAdminConfirm(this.user); confirmForm.ShowDialog(); if (confirmForm.check == true) { dbTools.EditUserJob(firstname, lastname, job); } this.Show(); refreshToolStripMenuItem_Click(sender, e); editUserStatus.Text = "Successfully edited user!"; } catch (Exception err) { MessageBox.Show(err.Message, "Issue editing user. Please try again."); } } else { return; } } catch (Exception err) { MessageBox.Show(err.Message, "Warning!"); } }
// Event handler for Register button click private void registerBtn_Click(object sender, EventArgs e) { dbTools = new DatabaseTools(); userManager = new UserManager(); if (passwordTxt.Text.Equals(confirmpasswordtxt.Text)) { try { string message = "Are you sure you want to create a new user with job title " + boxOccupation.Text + "?"; string title = "Warning!"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { User newUser = new User(firstnametxt.Text, lastnametxt.Text, emailtxt.Text, usernameTxt.Text, passwordTxt.Text, boxOccupation.Text); userManager.RegisterUser(newUser); // Register the user in the database } else { return; } } catch (Exception err) { MessageBox.Show(err.Message, "Warning!"); } // Clear values for other users usernameTxt.Clear(); passwordTxt.Clear(); confirmpasswordtxt.Clear(); firstnametxt.Clear(); lastnametxt.Clear(); emailtxt.Clear(); boxOccupation.Text = string.Empty; this.Hide(); } else { MessageBox.Show("Passwords Do Not Match!", "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void changeqnt_Click(object sender, EventArgs e) { try { String MatName = itembox.Text; int Quant = int.Parse(qtnBox.Text); dbTools = new DatabaseTools(); if (dbTools.CheckMat(MatName).Equals(true)) { try { string message = "Are you sure you want to change the quantity of " + MatName + " to " + Quant + "?"; string title = "Warning!"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { dbTools.EditQuant(MatName, Quant); dgTools.SqlCommand = "SELECT RawMaterialName, Quantity FROM RawMaterials"; // Viewing all data from RawMaterials database except the ID dgTools.RefreshDataGrid(stockDataGridView); itembox.Clear(); qtnBox.Clear(); } else { return; } } catch (Exception err) { MessageBox.Show(err.Message, "Warning!"); } } else { MessageBox.Show("This item can not be found."); } } catch (Exception err) { MessageBox.Show("Please input a value and quantity", "Warning!"); } }
private void addItemBtn_Click(object sender, EventArgs e) { String ProductName = txtItemName.Text; String Location = locationMenu.Text; dbTools = new DatabaseTools(); dbTools.CheckProduct(ProductName); if (dbTools.CheckProduct(ProductName).Equals(true)) { try { string message = "Are you sure you want to change the location of " + ProductName + " to " + Location + "?"; string title = "Warning!"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { dbTools.EditLocation(ProductName, Location); txtItemName.Clear(); locationMenu.Text = String.Empty; btnRefresh_Click(sender, e); } else { return; } } catch (Exception err) { MessageBox.Show(err.Message, "Warning!"); } } else { MessageBox.Show("This item can not be found."); } }
private void addItemBtn_Click_1(object sender, EventArgs e) { String ProductName = ItemName.Text; String Quality = qualityMenu.Text; dbTools = new DatabaseTools(); dbTools.CheckProduct(ProductName); if (dbTools.CheckProduct(ProductName).Equals(true)) { try { string message = "Are you sure you want to change the quality of " + ProductName + " to " + Quality + "?"; string title = "Warning!"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, title, buttons); if (result == DialogResult.Yes) { dbTools.EditQuality(ProductName, Quality); Refresh_Click(sender, e); } else { return; } } catch (Exception err) { MessageBox.Show(err.Message, "Warning!"); } } else { MessageBox.Show("This item can not be found."); } }
// Constructor public RawMaterial(string rawMaterialName, int quantity) { dbTools = new DatabaseTools(); this.rawMaterialName = rawMaterialName; this.quantity = quantity; }
public FilterTools() { dbTools = new DatabaseTools(); dgTools = new DataGridTools(); }
// Variables // Constructor public ReportGenerator() { dbTools = new DatabaseTools(); }