/// <summary> /// /// Click trigger function for the add button. /// This will create a new DashForm.cs instance /// so that the user can enter the details of a /// new applicant to add to the list. /// /// </summary> private void Button_Add_Click(object sender, EventArgs e) { Hide(); DashForm instance_DashForm = new DashForm(Mode.Applicant); instance_DashForm.Show(); }
/// <summary> /// Click trigger function for the login button. /// If the credentials exist in the database, the recruiter instance is created /// and the dashform is showed /// </summary>> private void Button_Login_Click(object sender, EventArgs e) { // create a string query to ask the database for string login = SqlQueries.SelectRecruiter(TextBox_Email.Text, TextBox_Password.Text); // open the connection with the DB and ask the query to the database DataSet recruiterDB = Connection.GetDbConn().GetDataSet(login); // checks whether the Database has a record of the information inserted if (recruiterDB.Tables[0].Rows.Count != 0) { // Points to the Row[0] of the table retrieved from the DB DataRow recruiterDBValue = recruiterDB.Tables[0].Rows[0]; // Call the method which creates the instance Recruiter.CreateInstance ( recruiterDBValue.ItemArray.GetValue(0).ToString(), // Retrieve the recruiter ID [DB: column 0] recruiterDBValue.ItemArray.GetValue(1).ToString(), // Retrieve the recruiter Name [DB: column 1] recruiterDBValue.ItemArray.GetValue(2).ToString(), // Retrieve the recruiter Surname [DB: column 2] recruiterDBValue.ItemArray.GetValue(3).ToString(), // Retrieve the recruiter Email [DB: column 3] recruiterDBValue.ItemArray.GetValue(4).ToString() // Retrieve the recruiter Password [DB: column 4] ); Hide(); DashForm instance_DashForm = new DashForm(Mode.Default); instance_DashForm.Show(); } else { // lable 'error' becomes visible and displays the error message Label_Error.Text = "Incorrect email or password"; Label_Error.Visible = true; } }
/// <summary> /// /// Click trigger function for dashboard button. /// This will create a new DashForm.cs instance /// and allows the program to loop around to the /// beginning. /// /// </summary> private void Button_Dashboard_Click(object sender, EventArgs e) { Hide(); DashForm instance_DashForm = new DashForm(Mode.Default); instance_DashForm.Show(); }
/// <summary> /// /// Click trigger function for the cancel button. /// This will double check if the user wants to /// cancel as they will be losing all the progress /// made. /// /// </summary> private void Button_Cancel_Click(object sender, EventArgs e) { if (cancel == Stage.NotClicked) { Button_Cancel.Text = "Are you sure?"; cancel = Stage.Clicked; } else if (cancel == Stage.Clicked) { Hide(); DashForm instance_DashForm = new DashForm(Mode.Default); instance_DashForm.Show(); } }