Exemplo n.º 1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (
                !(JobTitleBox.Text == "Job Title") && !string.IsNullOrEmpty(JobTitleBox.Text) &&
                !(YearsOfExperience.Text == "Years of Experience") && !string.IsNullOrEmpty(YearsOfExperience.Text) &&
                !(TypeBox.Text == "Job Type") && !string.IsNullOrEmpty(TypeBox.Text) &&
                !(JobRoleBox.Text == "Job Role") && !string.IsNullOrEmpty(JobRoleBox.Text) &&
                !(CareerLevelBox.Text == "Career Level") && !string.IsNullOrEmpty(CareerLevelBox.Text) &&
                !(VacanciesBox.Text == "Vacancies") && !string.IsNullOrEmpty(VacanciesBox.Text) &&
                !string.IsNullOrEmpty(DescBox.Text) && !string.IsNullOrEmpty(ReqBox.Text)
                )
            {
                SqlConnection con = new SqlConnection(@"Data Source=OLA\SQLSERVER;Initial Catalog=ApplicantTrackingSystem;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False");
                con.Open();

                SqlCommand cmd = new SqlCommand("INSERT INTO [Job](CompanyName,ExperienceYears,PostDate,CareerLevel,Type,Vacancies,Description,Requirements,Role,JobTitle) VALUES (@CompanyName,@ExperienceYears,@PostDate,@CareerLevel,@Type,@Vacancies,@Description,@Requirements,@Role,@JobTitle)", con);
                //CompanyName,ExperienceYears,PostDate,CareerLevel,Type,Vacancies,Description,Requirements,Role,JobTitle
                cmd.Parameters.AddWithValue("@CompanyName", HRLogin.LocalCompanyName);
                cmd.Parameters.AddWithValue("@ExperienceYears", YearsOfExperience.Text);
                cmd.Parameters.AddWithValue("@PostDate", DateTime.Now.ToString("yyyyMMdd"));
                cmd.Parameters.AddWithValue("@CareerLevel", CareerLevelBox.Text);
                cmd.Parameters.AddWithValue("@Type", TypeBox.Text);
                cmd.Parameters.AddWithValue("@Vacancies", VacanciesBox.Text);
                cmd.Parameters.AddWithValue("@Description", DescBox.Text);
                cmd.Parameters.AddWithValue("@Requirements", ReqBox.Text);

                cmd.Parameters.AddWithValue("@Role", JobRoleBox.Text);
                cmd.Parameters.AddWithValue("@JobTitle", JobTitleBox.Text);



                cmd.ExecuteNonQuery();
                con.Close();
                MessageBox.Show("Job has been added successfully");
                ViewJobsPanel.Show();
                AddJobPanel.Hide();
            }
            else
            {
                MessageBox.Show("Please Fill the Empty Boxes");
            }
        }
Exemplo n.º 2
0
 private void ViewJobs_Click(object sender, EventArgs e)
 {
     ViewJobsPanel.Show();
     AddJobPanel.Hide();
 }