//======================================================================================================= //This method is called when the user clicks the "Archive Entry" button, it then shows a message box to // make sure the user wants to archive the order, if they click yes, it calls the "Archiving" method in // the DatabaseFunctions.cs file. //======================================================================================================= private async void btnArchiveEntry_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are You Sure You Want To Archive This Entry?", "Archive Entry", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { SplashScreen _splash = new SplashScreen { StartPosition = FormStartPosition.CenterScreen, FormBorderStyle = FormBorderStyle.None, WindowState = FormWindowState.Normal, MaximumSize = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight), MinimumSize = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight) }; await Task.Delay(200); _splash.Show(); _splash.BringToFront(); _splash.Focus(); await Task.Delay(200); DatabaseFunctions.Archiving(true); bolArchiveView = false; pnlDefault.Visible = true; pnlUpdate.Visible = false; pnlArchiveView.Visible = false; btnViewArchive.Visible = true; _splash.Close(); } }
//======================================================================================================= //This method is called when the user clicks the "Submit" button when they are currently in "UpdateRow" // mode. It makes sure there is data entered in each text box, when this is true, it calls the // "UpdateWeight" method from DatabaseFunction.cs. If the user has not entered info for each text box, // it will prompt them to fill out all fields and try again //======================================================================================================= private async void btnSubmitUpdate_Click(object sender, EventArgs e) { if (txtDepartUpdate.Text != "" && txtPrinterName.Text != "") { SplashScreen _splash = new SplashScreen { StartPosition = FormStartPosition.CenterScreen, FormBorderStyle = FormBorderStyle.None, WindowState = FormWindowState.Normal, MaximumSize = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight), MinimumSize = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight) }; await Task.Delay(200); _splash.Show(); _splash.BringToFront(); _splash.Focus(); await Task.Delay(200); DatabaseFunctions.UpdatePrinter(txtDepartUpdate.Text, txtPrinterName.Text, intTUID); pnlUpdate.Visible = false; pnlDefault.Visible = true; pnlArchiveView.Visible = false; btnViewArchive.Visible = true; _splash.Close(); } else { MessageBox.Show("Please Enter Info For Each Field"); } }
//======================================================================================================= //This method is called when the user hits the "Update" button. Which then calls the method to narrow the // current list to one department. If there is nothing entered in the text box, it will assume the user // wants to view the entire list of the printer table. If the count of the printers list is 0, it will // then prompt the user an invalid department was entered and clears out the text box; if it is greater // than 0 it refreshes the dgv to show the current printers entered in the specified department //======================================================================================================= private async void btnUpdate_Click(object sender, EventArgs e) { this.Visible = false; SplashScreen _splash = new SplashScreen { StartPosition = FormStartPosition.CenterScreen, FormBorderStyle = FormBorderStyle.None, WindowState = FormWindowState.Normal, MaximumSize = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight), MinimumSize = new Size(Program.SplashScreenWidth, Program.SplashScreenHeight) }; await Task.Delay(200); _splash.Show(); _splash.BringToFront(); _splash.Focus(); await Task.Delay(200); Program.QADPrinters.Clear(); if (txtDept.Text != "") { DatabaseFunctions.NarrowToDept(txtDept.Text); if (Program.QADPrinters.Count > 0) { RefreshDGV(); } else { txtDept.Text = ""; DatabaseFunctions.ViewCurrent(); RefreshDGV(); MessageBox.Show("Invalid Department Entered"); } } else { DatabaseFunctions.ViewCurrent(); RefreshDGV(); } _splash.Close(); this.Visible = true; }