//======================================================================================================= //This method is called when the user hits the "View" button on frmMain. It then calls the proper // DatabaseFunctions method that will load the list with all current modules entered in the table // and also opens a new instance of frmView. Since this is the first time ViewCurrent is called, it // needs to create the new instance of frmView //======================================================================================================= private async void btnView_Click(object sender, EventArgs e) { this.Hide(); _FrmMainMen.Hide(); 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.ViewCurrent(); _FrmView = new frmView(); await Task.Delay(200); _FrmView.Show(); _splash.Close(); }
//======================================================================================================= //This method is called when the user clicks on the "Submit" button on frmMain. It then checks if all // text boxes arent empty, if they are they will prompt the user to enter info for all text boxes, if // all text boxes are filled out, it will call the proper DatabaseFunctions method to insert new entry // in the module table //======================================================================================================= private async void btnSubmit_Click(object sender, EventArgs e) { string tempDept = txtDepart.Text; string tempModName = txtModName.Text; string tempIPAddress = txtIPAddress.Text; if (tempDept != "" && tempModName != "" && tempIPAddress != "") { 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.InsertNew(tempDept, tempModName, tempIPAddress); txtModName.Text = ""; txtIPAddress.Text = ""; _splash.Close(); } else { System.Windows.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 modules 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.ADAMMods.Clear(); if (txtDept.Text != "") { DatabaseFunctions.NarrowToDept(txtDept.Text); if (Program.ADAMMods.Count > 0) { RefreshDGV(); } else { txtDept.Text = ""; DatabaseFunctions.ViewCurrent(); RefreshDGV(); MessageBox.Show("Invalid Department Entered"); } } else { DatabaseFunctions.ViewCurrent(); RefreshDGV(); } _splash.Close(); this.Visible = true; }
//======================================================================================================== //This method is called when the user clicks on the "Delete Entry" button when currently viewing archived // entires. This allows the user to permanently delete the entry. It first checks if there are more than // 0 entries currently in the module list, if there isnt any, it will tell the user there are no // entries to delete. If there is, it shows a yes/no message box, if the user clicks "Yes" the entry is // wiped from the database, if not, it just shows them the current archived entries //======================================================================================================== private async void btnDelete_Click(object sender, EventArgs e) { if (Program.ADAMMods.Count > 0) { DialogResult result = MessageBox.Show("Are You Sure You Want To Delete This Entry?", "Delete 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); bolArchiveView = false; pnlDefault.Visible = true; pnlUpdate.Visible = false; pnlArchiveView.Visible = false; btnViewArchive.Visible = true; GetSelectedRow(); DatabaseFunctions.DeleteEntry(intTUID); _splash.Close(); } } else { MessageBox.Show("No Entries To Delete"); } }