Exemple #1
0
 //=========================================== APPLIES TO THE VACANCY
 private void button1_Click(object sender, EventArgs e)
 {
     if (numericUpDown1.Text == "")
     {
         MessageBox.Show("You haven't Entered id\nOr id that you entered is not valid", "Empty inputs", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         using (HrMatchingContext db = new HrMatchingContext())
         {
             //===================== CHECKS WHETHER VACANCY EXISTS OR NOT
             bool isExists = db.Vacancies.ToList().Exists(x => x.id == numericUpDown1.Value);
             if (isExists)
             {
                 var foundCv = db.CVs.FirstOrDefault(x => x.UserId == User.id);
                 if (foundCv != null)
                 {
                     var selectedVac = db.Vacancies.FirstOrDefault(x => x.id == numericUpDown1.Value);
                     selectedVac.CVs.Add(foundCv);
                     db.SaveChanges();
                     MessageBox.Show("You have applied to the vacancy successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     numericUpDown1.Value = 0;
                 }
                 else
                 {
                     MessageBox.Show("You haven't Added your CV\nPlease, add your CV from main Menu, then you can apply For the Job", "CV Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             else
             {
                 MessageBox.Show("You have Entered Invalid vacancy id", "Invalid inputs", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
     }
 }
Exemple #2
0
        private void Form5PostedVacancies_Load(object sender, EventArgs e)
        {
            using (HrMatchingContext db = new HrMatchingContext())
            {
                var postedVacSelf = db.Vacancies.Where(x => x.UserId == User.id).ToList();

                if (postedVacSelf != null)
                {
                    foreach (var item in postedVacSelf)
                    {
                        postedVacancies.Add(new PostedVacancy()
                        {
                            id              = item.id,
                            Vacancy_Name    = item.VacancyName,
                            Company_Name    = item.CompanyName,
                            Age             = item.Age,
                            Education       = item.Education,
                            Experience      = item.Experience,
                            Job             = item.Job,
                            Job_description = item.JobDescription,
                            City            = item.City,
                            Offered_Salary  = item.SalaryOffer,
                            Phone           = item.Phone
                        });
                    }
                }
                dataGridView1.DataSource = postedVacancies;
            }
        }
Exemple #3
0
 //======================================= FILLS THE DATAGRIDVIEW
 private void Form4AllVacancies_Load(object sender, EventArgs e)
 {
     label2.Visible         = true;
     button1.Visible        = true;
     numericUpDown1.Visible = true;
     using (HrMatchingContext db = new HrMatchingContext())
     {
         foreach (var item in db.Vacancies)
         {
             vacs.Add(new Vac()
             {
                 id             = item.id,
                 VacancyName    = item.VacancyName,
                 CompanyName    = item.CompanyName,
                 Age            = item.Age,
                 Education      = item.Education,
                 Experience     = item.Experience,
                 Job            = item.Job,
                 JobDescription = item.JobDescription,
                 City           = item.City,
                 SalaryOffer    = item.SalaryOffer,
                 Phone          = item.Phone
             });
         }
     }
     dataGridView1.DataSource = vacs;
 }
        private void Form4AppliedList_Load(object sender, EventArgs e)
        {
            using (HrMatchingContext db = new HrMatchingContext())
            {
                //================ FINDS THE ENTERED WORKERS CV AND INCLUDES VACANCIES TO REACH THEM
                var cv = db.CVs.Include("Vacancies").FirstOrDefault(x => x.UserId == User.id);

                //================ CHECKS WHETHER THIS USER HAS CV
                if (cv != null)
                {
                    foreach (var item in cv.Vacancies)
                    {
                        vacs.Add(new Vac()
                        {
                            id             = item.id,
                            VacancyName    = item.VacancyName,
                            CompanyName    = item.CompanyName,
                            Age            = item.Age,
                            Education      = item.Education,
                            Experience     = item.Experience,
                            Job            = item.Job,
                            JobDescription = item.JobDescription,
                            City           = item.City,
                            SalaryOffer    = item.SalaryOffer,
                            Phone          = item.Phone
                        });
                    }
                }
                dataGridView1.DataSource = vacs;
            }
        }
Exemple #5
0
        //===================================== SHOWS ALL INFORMATION WRITTEN IN THE CV
        private void showYourInfoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (HrMatchingContext db = new HrMatchingContext())
            {
                var foundCV = db.CVs.ToList().FirstOrDefault(x => x.UserId == User.id);

                //==================== CHECLS WHETHER SUCH USER HAVE CV OR NOT
                if (foundCV != null)
                {
                    panel1.Visible = true;

                    label2.Text  = foundCV.Name + " " + foundCV.Surname;
                    label8.Text  = foundCV.Gender;
                    label9.Text  = foundCV.Age.ToString();
                    label10.Text = foundCV.Education;
                    label11.Text = foundCV.Job;
                    label16.Text = foundCV.Experience;
                    label17.Text = foundCV.City;
                    label18.Text = foundCV.MinSalary.ToString();
                    label19.Text = foundCV.Phone;
                }
                else
                {
                    MessageBox.Show("You Haven't added your CV yet.\nYou can do it From 'Add Your CV' Section", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //======================== CHECKS WHETHER SEARCHING RELATIVE THIS CATEGORY IS SELECTED
            if (comboBox3.Text != "")
            {
                using (HrMatchingContext db = new HrMatchingContext())
                {
                    var foundCV = db.CVs.Where(x => x.Job == comboBox3.Text).ToList();
                    ListAdder(foundCV);
                }
            }
            //======================== CHECKS WHETHER SEARCHING RELATIVE THIS CATEGORY IS SELECTED
            if (comboBox2.Text != "")
            {
                using (HrMatchingContext db = new HrMatchingContext())
                {
                    var foundCV = db.CVs.Where(x => x.Education == comboBox2.Text).ToList();
                    ListAdder(foundCV);
                }
            }
            //======================== CHECKS WHETHER SEARCHING RELATIVE THIS CATEGORY IS SELECTED
            if (comboBox4.Text != "")
            {
                using (HrMatchingContext db = new HrMatchingContext())
                {
                    var foundCV = db.CVs.Where(x => x.City == comboBox4.Text).ToList();
                    ListAdder(foundCV);
                }
            }
            //======================== CHECKS WHETHER SEARCHING RELATIVE THIS CATEGORY IS SELECTED
            if (comboBox5.Text != "")
            {
                using (HrMatchingContext db = new HrMatchingContext())
                {
                    var foundCV = db.CVs.Where(x => x.Experience == comboBox5.Text).ToList();
                    ListAdder(foundCV);
                }
            }
            //======================== CHECKS WHETHER SEARCHING RELATIVE THIS CATEGORY IS SELECTED
            if (numericUpDown2.Value > 100)
            {
                using (HrMatchingContext db = new HrMatchingContext())
                {
                    var foundCV = db.CVs.Where(x => x.MinSalary >= numericUpDown2.Value).ToList();
                    if (foundCV != null)
                    {
                        ListAdder(foundCV);
                    }
                }
            }

            //======================= EMPITIES DATA GRID VIEW FOR THE NEXT SEARCHING
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = CVSearches;
            //======================= EMPITIES LIST FOR THE NEXT SEARCHING
            CVSearches = new List <CVSearch>();
        }
        private void Form4MostSuitable_Load(object sender, EventArgs e)
        {
            using (HrMatchingContext db = new HrMatchingContext())
            {
                //================================== FINDS WHETHER THIS USER HAS ADDED CV OR NOT
                var foundCV = db.CVs.FirstOrDefault(x => x.UserId == User.id);
                if (foundCV != null)
                {
                    //============================ FINDS VACANCIES WHICH HAS THE SAME "JOB","EDUCATION","CITY","EXPERIENCE","SALARY OFFER" with USER CV
                    var foundVacancies = db.Vacancies.Where(x => x.Job == foundCV.Job ||
                                                            x.Education == foundCV.Education ||
                                                            x.City == foundCV.City ||
                                                            x.Experience == foundCV.Experience ||
                                                            x.SalaryOffer >= foundCV.MinSalary).ToList();

                    if (foundVacancies.Count > 0)
                    {
                        foreach (var item in foundVacancies)
                        {
                            vacs.Add(new Vac()
                            {
                                id             = item.id,
                                VacancyName    = item.VacancyName,
                                CompanyName    = item.CompanyName,
                                Age            = item.Age,
                                Education      = item.Education,
                                Experience     = item.Experience,
                                City           = item.City,
                                Job            = item.Job,
                                JobDescription = item.JobDescription,
                                SalaryOffer    = item.SalaryOffer,
                                Phone          = item.Phone
                            });
                        }

                        dataGridView1.DataSource = vacs;
                    }
                    else
                    {
                        MessageBox.Show("Currently there are no Suitable Jobs for You\nPlease, try later when new offers will be added", "Cannot Find", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("You Haven't Added Your CV\nWe Cannot Show Suitable Jobs Without Knowing You", "CV Missing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            //============================== CHECKS WHETHER INPUT FIELDS ARE EMPTY
            if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text))
            {
                MessageBox.Show("Please, Complete the Form", "Empty Inputs", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                //============================== CONNECT TO DB AND TRYING TO ENTER
                using (HrMatchingContext db = new HrMatchingContext())
                {
                    //========================= FINDS CORRESPONDING USER
                    var User = db.Users.FirstOrDefault(x => x.Username == textBox1.Text && x.Password == textBox2.Text);

                    //===================== CHECKS WHETHER USER IS FOUND OR NOT
                    if (User != null)
                    {
                        //===================== CHECKS WHETHER USER IS BOSS OR WORKER
                        if (User.Status == 1)
                        {
                            Form4 form4 = new Form4();
                            //===================== SENDS FOUND USER TO THE OTHER FORM
                            form4.GetUser(User);

                            form4.Show();
                            this.Hide();
                        }
                        else if (User.Status == 2)
                        {
                            Form5 form5 = new Form5();
                            //===================== SENDS FOUND USER TO THE OTHER FORM
                            form5.GetUser(User);

                            form5.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MessageBox.Show("No Such User, Try Again!", "Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Exemple #9
0
        private void Form5AppliedWorkers_Load(object sender, EventArgs e)
        {
            using (HrMatchingContext db = new HrMatchingContext())
            {
                //=================== FINDS THIS USERS VACANCIES AND INCLUDES APPLIED CVS TO IT
                var userPostVac = db.Vacancies.Include("CVs").Where(x => x.UserId == User.id).ToList();
                int row         = 0;

                //======================== LOOPS THROUGH POSTED VACANCIES
                foreach (var vac in userPostVac)
                {
                    //======================== LOOPS THROUGH CVS THAT APPLIED TO ONE VACANY
                    foreach (var cv in vac.CVs)
                    {
                        appliedCVs.Add(new AppliedCV()
                        {
                            Row = row,

                            Vacancy_Name    = vac.VacancyName,
                            Company_Name    = vac.CompanyName,
                            Job_Description = vac.JobDescription,

                            CV_ID          = cv.id,
                            Name           = cv.Name,
                            Surname        = cv.Surname,
                            Gender         = cv.Gender,
                            Age            = cv.Age,
                            Education      = cv.Education,
                            Job            = cv.Job,
                            Experience     = cv.Experience,
                            City           = cv.City,
                            Minimum_Salary = cv.MinSalary,
                            Phone          = cv.Phone
                        });
                        row++;
                    }
                }

                dataGridView1.DataSource = appliedCVs;
            }
        }
Exemple #10
0
        //===================================== ADDS NEW CV
        private void aDDYourCVToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            panel1.Visible = false;
            bool isExists = false;

            using (HrMatchingContext db = new HrMatchingContext())
            {
                isExists = db.CVs.ToList().Exists(x => x.UserId == User.id);
            }

            //=========================== CHECKS WHETHER USER ALREAYD HAVE CV OR NOT
            if (isExists)
            {
                MessageBox.Show("You Have Already Uploaded CV, You can Check it from Info section", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                Form4CV form4CV = new Form4CV();
                form4CV.GetUser(User);
                form4CV.ShowDialog();
            }
        }
Exemple #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            //===================================== CHEKCS WHETHER INPUT FIELDS ARE EMPTY OR NOT
            if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(comboBox1.Text) ||
                numericUpDown1.Text == "" || string.IsNullOrEmpty(comboBox2.Text) || string.IsNullOrEmpty(comboBox3.Text) || string.IsNullOrEmpty(comboBox4.Text) ||
                numericUpDown2.Text == "" || string.IsNullOrEmpty(comboBox5.Text) || !maskedTextBox1.MaskCompleted)
            {
                MessageBox.Show("Please, Complete the Form", "Empty Inputs", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                CV cv = new CV()
                {
                    Name       = textBox1.Text,
                    Surname    = textBox2.Text,
                    Gender     = comboBox1.Text,
                    Age        = int.Parse(numericUpDown1.Value.ToString()),
                    Education  = comboBox2.Text,
                    Job        = comboBox3.Text,
                    City       = comboBox4.Text,
                    MinSalary  = int.Parse(numericUpDown2.Value.ToString()),
                    Experience = comboBox5.Text,
                    Phone      = maskedTextBox1.Text,
                    UserId     = User.id
                };

                //===================================== ADDS CV TO DB
                using (HrMatchingContext db = new HrMatchingContext())
                {
                    db.CVs.Add(cv);
                    db.SaveChanges();
                    MessageBox.Show("Your CV added successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Hide();
                }
            }
        }
Exemple #12
0
        //======================= RANDOM CODE GENERATOR

        private void button1_Click(object sender, EventArgs e)
        {
            var checkedButton = groupBox1.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);
            var emailPattern  = @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z";
            var passPattern   = @"^(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9])))(?=.{4,})";

            //====================== CHECKS WHETHER INPUTS ARE EMPTY OR NOT
            if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(textBox3.Text) || checkedButton == null)
            {
                MessageBox.Show("Please, Complete the Form", "Empty Inputs", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                //====================== CHECKS WHETHER EMAIL IS VALID
                if (Regex.IsMatch(textBox2.Text, emailPattern))
                {
                    //====================== CHECKS WHETHER PASSWORD IS VALID
                    if (Regex.IsMatch(textBox3.Text, passPattern))
                    {
                        //====================== CHECKS WHETHER PASSWORDS MATCH
                        if (textBox3.Text == textBox4.Text)
                        {
                            //====================== CHECKS WHETHER RANDOM GENERATED CODE IS CORRECT
                            if (label8.Text == textBox5.Text)
                            {
                                //====================== ADD NEW USER TO DB
                                using (HrMatchingContext db = new HrMatchingContext())
                                {
                                    //====================== CHECKS WHETHER SUCH USERNAME EXISTS OR NOT
                                    var flag = db.Users.ToList().Exists(x => x.Username == textBox1.Text);
                                    if (flag == false)
                                    {
                                        //====================== GETS STATUS RELATIVE TO RADIO BUTTON
                                        int status = checkedButton.Text == "Boss" ? 2 : 1;

                                        User user = new User()
                                        {
                                            Username = textBox1.Text,
                                            Email    = textBox2.Text,
                                            Status   = status,
                                            Password = textBox3.Text,
                                        };

                                        db.Users.Add(user);
                                        db.SaveChanges();

                                        MessageBox.Show("You Signed Up Successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);

                                        Form2 form2 = new Form2();
                                        form2.Show();
                                        this.Hide();
                                    }
                                    else
                                    {
                                        MessageBox.Show("Username Is Already Taken, Please change it.", "Reserved Username", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                    }
                                }
                            }
                            else
                            {
                                label8.Text = RandomString(4);
                                MessageBox.Show("Enter Random Generated Code Again", "Cannot Confirm", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                        else
                        {
                            MessageBox.Show("Passwords don't match", "Cannot Confirm", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please, Provide Valid Password\n\n(Characters at Least 4, 1 Capital letter, 1 small letter, 1 number, 1 special Character)\n\nExample: Farid_123", "Invalid Password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBox.Show("Please, Provide Valid Email Address", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
        }