private void JobseekerApplied_Load(object sender, EventArgs e)
 {
     using (HrMatchContext db = new HrMatchContext())
     {
         var requested = db.CVs.Include("Vacancies").FirstOrDefault(x => x.UserId == user.ID);
         foreach (var item in requested.Vacancies)
         {
             allAppliedvac.Add(new AllAppliedvac()
             {
                 ID         = item.ID,
                 JobTitle   = item.JobTitle,
                 Company    = item.Company,
                 Category   = item.Category,
                 City       = item.City,
                 Salary     = item.Salary,
                 Age        = item.Age,
                 Education  = item.Education,
                 Experience = item.Experience,
                 Phone      = item.Phone,
                 About      = item.About
             });
         }
     }
     AppliedVacancy.DataSource          = allAppliedvac;
     AppliedVacancy.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
 }
 private void AllVacancyPage_Load(object sender, EventArgs e)
 {
     using (HrMatchContext db = new HrMatchContext())
     {
         foreach (var item in db.Vacancies)
         {
             allVac.Add(new Allvac()
             {
                 ID         = item.ID,
                 JobTitle   = item.JobTitle,
                 Company    = item.Company,
                 Category   = item.Category,
                 City       = item.City,
                 Salary     = item.Salary,
                 Age        = item.Age,
                 Education  = item.Education,
                 Experience = item.Experience,
                 Phone      = item.Phone,
                 About      = item.About
             });
         }
     }
     ActiveVacancy.DataSource          = allVac;
     ActiveVacancy.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
 }
Exemplo n.º 3
0
        private void myVacancies_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row    = this.myVacancies.Rows[e.RowIndex];
            int             ID     = int.Parse(row.Cells["ID"].Value.ToString());
            DialogResult    result = MessageBox.Show($"Delete vacancy with id - {ID}", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                using (HrMatchContext db = new HrMatchContext())
                {
                    var delete = db.Database.ExecuteSqlCommand($"DELETE FROM Vacancies WHERE ID = {ID}");
                    try
                    {
                        if (delete > 0)
                        {
                            MessageBox.Show("Vacancy Deleted");
                            this.Dispose();
                        }
                        else
                        {
                            MessageBox.Show("Vacancy not Deleted");
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Can't find any Vacancy");
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void suitableAnnouncements_Click(object sender, EventArgs e)
        {
            CV activeCV;
            IQueryable <Announcement> query;

            using (HrMatchContext db = new HrMatchContext())
            {
                activeCV = db.CVs.FirstOrDefault(c => c.UserID == activeWorker.ID);

                if (activeCV != null)
                {
                    query = db.Announcements
                            .Where(a => (a.CategoryID == activeCV.CategoryID) && (a.Education == activeCV.Education || a.Experience == activeCV.Experience || a.Age == activeCV.Age || a.City == activeCV.City || a.Salary > activeCV.Salary));

                    if (query.Any(a => a.CategoryID == activeCV.CategoryID || a.Education == activeCV.Education || a.Experience == activeCV.Experience || a.Age >= activeCV.Age || a.City == activeCV.City || a.Salary >= activeCV.Salary))
                    {
                        SuitableAnnouncementsForm suitableAnnouncementsForm = new SuitableAnnouncementsForm(activeWorker);
                        suitableAnnouncementsForm.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("There is no Suitable Announcement for You.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("You must add Your CV for showing Suitable Announcements", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void EmployerPendingPage_Load(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                var myActiveVacancy = db.Vacancies.Include("CVs").Where(x => x.UserId == user.ID).ToList();


                foreach (var vacancy in myActiveVacancy)
                {
                    foreach (var cv in vacancy.CVs)
                    {
                        allPendingRequests.Add(new AllPendingRequests()
                        {
                            JobTitle = vacancy.JobTitle,

                            ID         = cv.ID,
                            Name       = cv.Name,
                            Surname    = cv.Surname,
                            Gender     = cv.Gender,
                            City       = cv.City,
                            Category   = cv.Category,
                            Salary     = cv.Salary,
                            Age        = cv.Age,
                            Education  = cv.Education,
                            Experience = cv.Experience,
                            Phone      = cv.Phone,
                        });
                    }
                }
                PendingRequests.DataSource          = allPendingRequests;
                PendingRequests.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            }
        }
Exemplo n.º 6
0
        private void Form14_Load(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                IQueryable <Announcement> query = db.Announcements;

                CV cv = db.CVs.FirstOrDefault(c => c.UserID == activeWorker.ID);

                foreach (var dbAnnouncement in query)
                {
                    string categoryName = db.Categories.FirstOrDefault(c => c.ID.Equals(dbAnnouncement.CategoryID)).Name;
                    string cityName     = db.Cities.FirstOrDefault(c => c.ID.Equals(dbAnnouncement.CityID)).Name;

                    ListViewItem listViewItem;


                    if (cv != null && cv.CategoryID == dbAnnouncement.CategoryID)
                    {
                        string[] item = { "APPLY HERE", dbAnnouncement.Name, dbAnnouncement.CompanyName, categoryName, dbAnnouncement.Information, dbAnnouncement.Education, dbAnnouncement.Experience, dbAnnouncement.Age.ToString(), cityName, dbAnnouncement.Salary.ToString(), dbAnnouncement.PhoneNumber };
                        listViewItem = new ListViewItem(item);
                    }
                    else
                    {
                        string[] item = { "NOT SUITABLE FOR YOUR CV", dbAnnouncement.Name, dbAnnouncement.CompanyName, categoryName, dbAnnouncement.Information, dbAnnouncement.Education, dbAnnouncement.Experience, dbAnnouncement.Age.ToString(), cityName, dbAnnouncement.Salary.ToString(), dbAnnouncement.PhoneNumber };
                        listViewItem = new ListViewItem(item);
                    }

                    listView.Items.Add(listViewItem);
                }
            }
        }
        public void AddtoListView()
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                foreach (var dbAnnouncement in query)
                {
                    string categoryName = db.Categories.FirstOrDefault(c => c.ID.Equals(dbAnnouncement.CategoryID)).Name;
                    string cityName     = db.Cities.FirstOrDefault(c => c.ID.Equals(dbAnnouncement.CityID)).Name;

                    ListViewItem listViewItem;

                    if (HasCV() && cv.CategoryID == dbAnnouncement.CategoryID)
                    {
                        string[] item = { "APPLY HERE", dbAnnouncement.Name, dbAnnouncement.CompanyName, categoryName, dbAnnouncement.Information, dbAnnouncement.Education, dbAnnouncement.Experience, dbAnnouncement.Age.ToString(), cityName, dbAnnouncement.Salary.ToString(), dbAnnouncement.PhoneNumber };

                        listViewItem = new ListViewItem(item);
                    }
                    else
                    {
                        string[] item = { "NOT SUITABLE FOR YOUR CV", dbAnnouncement.Name, dbAnnouncement.CompanyName, categoryName, dbAnnouncement.Information, dbAnnouncement.Education, dbAnnouncement.Experience, dbAnnouncement.Age.ToString(), cityName, dbAnnouncement.Salary.ToString(), dbAnnouncement.PhoneNumber };

                        listViewItem = new ListViewItem(item);
                    }

                    listView.Items.Add(listViewItem);
                }
            }
        }
Exemplo n.º 8
0
        private void Form13_Load(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                query = db.workersAnnouncements
                        .Where(x => x.WorkerID == activeWorker.ID);

                List <Announcement> announcements = new List <Announcement>();

                foreach (var dbworkerAnnouncement in query)
                {
                    announcements.AddRange(db.Announcements.Where(a => a.ID == dbworkerAnnouncement.AnnouncementID));
                }

                foreach (var dbAnnouncement in announcements)
                {
                    string categoryName = db.Categories.FirstOrDefault(c => c.ID.Equals(dbAnnouncement.CategoryID)).Name;
                    string cityName     = db.Cities.FirstOrDefault(c => c.ID.Equals(dbAnnouncement.CityID)).Name;

                    string[] item = { dbAnnouncement.Name, dbAnnouncement.CompanyName, categoryName, dbAnnouncement.Information, dbAnnouncement.Education, dbAnnouncement.Experience, dbAnnouncement.Age.ToString(), cityName, dbAnnouncement.Salary.ToString(), dbAnnouncement.PhoneNumber };

                    ListViewItem listViewItem = new ListViewItem(item);

                    listView.Items.Add(listViewItem);
                }
            }
        }
Exemplo n.º 9
0
 private void EmployerVacanciesPage_Load(object sender, EventArgs e)
 {
     using (HrMatchContext db = new HrMatchContext())
     {
         var myVacancies = db.Vacancies.Where(x => x.UserId == user.ID).ToList();
         foreach (var item in myVacancies)
         {
             myVac.Add(new MyVac()
             {
                 ID         = item.ID,
                 JobTitle   = item.JobTitle,
                 Company    = item.Company,
                 Category   = item.Category,
                 City       = item.City,
                 Salary     = item.Salary,
                 Age        = item.Age,
                 Education  = item.Education,
                 Experience = item.Experience,
                 Phone      = item.Phone,
                 About      = item.About
             });
         }
     }
     myVacancies.DataSource          = myVac;
     myVacancies.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
 }
Exemplo n.º 10
0
        private void CvInfoDelete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure?", "Delete CV", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                using (HrMatchContext db = new HrMatchContext())
                {
                    var delete = db.Database.ExecuteSqlCommand($"DELETE FROM CVs WHERE UserID = {user.ID}");
                    try
                    {
                        if (delete > 0)
                        {
                            MessageBox.Show("Cv Deleted");
                            this.Dispose();
                        }
                        else
                        {
                            MessageBox.Show("CV not Deleted");
                        }
                    }
                    catch
                    {
                        MessageBox.Show("Can't find any CV");
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (CheckFields())
            {
                using (HrMatchContext db = new HrMatchContext())
                {
                    int categoryID = db.Categories.FirstOrDefault(c => c.Name.Equals(category.Text)).ID;
                    int cityID = db.Cities.FirstOrDefault(c => c.Name.Equals(city.Text)).ID;
                   
                    Byte.TryParse(age.Text, out byte Age);
                    Decimal.TryParse(salary.Text, out decimal Salary);

                    Announcement announcement = new Announcement(activeEmployer.ID, name.Text, company.Text, categoryID, information.Text, cityID, Age, education.Text, experience.Text, Salary, phoneNumber.Text);
                    db.Announcements.Add(announcement);

                    db.SaveChanges();


                    MessageBox.Show("Your Announcement is Successfully Added!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    name.Text = string.Empty;
                    company.Text = string.Empty;
                    category.Text = string.Empty;
                    information.Text = string.Empty;
                    city.Text = string.Empty;
                    age.Text = string.Empty;
                    education.Text = string.Empty;
                    experience.Text = string.Empty;
                    salary.Text = string.Empty;
                    phoneNumber.Text = string.Empty;
                }              
            }
        }
Exemplo n.º 12
0
        public bool CheckFields()
        {
            if (name.Text == string.Empty ||
                company.Text == string.Empty ||
                category.Text == string.Empty ||
                information.Text == string.Empty ||
                city.Text == string.Empty ||
                age.Text == string.Empty ||
                education.Text == string.Empty ||
                experience.Text == string.Empty ||
                salary.Text == string.Empty ||
                phoneNumber.Text == string.Empty)
            {
                MessageBox.Show("All field must be filled!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            using (HrMatchContext db = new HrMatchContext())
            {
                if (!db.Categories.Any(c => c.Name == category.Text))
                {
                    MessageBox.Show("'Category' field has not chosen correctly!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else if (!db.Cities.Any(c => c.Name == city.Text))
                {
                    MessageBox.Show("'City' field has not chosen correctly!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else if (!Byte.TryParse(age.Text, out byte Age))
                {
                    MessageBox.Show("'Age' field is not valid format! It must be a number!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else if (!education.Items.Contains(education.Text))
                {
                    MessageBox.Show("'Education' field has not chosen correctly!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else if (!experience.Items.Contains(experience.Text))
                {
                    MessageBox.Show("'Experience' field has not chosen correctly!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else if (!Decimal.TryParse(salary.Text, out decimal Salary))
                {
                    MessageBox.Show("Salary field is not valid format! It must be a number!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                else if (!isValidPhoneNumber(phoneNumber.Text))
                {
                    MessageBox.Show("'Phone Number' field has not written correctly! Example: +994-55-555-55-55", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                return(true);
            }
        }
        private void Form12_Load(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                CV activeCV = db.CVs.FirstOrDefault(c => c.UserID == activeWorker.ID);

                query = db.Announcements
                        .Where(a => (a.CategoryID == activeCV.CategoryID) && (a.Education == activeCV.Education || a.Experience == activeCV.Experience || a.Age == activeCV.Age || a.City == activeCV.City || a.Salary > activeCV.Salary));

                AddtoListView();
            }
        }
Exemplo n.º 14
0
        public static bool CheckAlreadyApply(User activeWorker, Announcement activeAnnouncement)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                if (db.workersAnnouncements.Any(x => x.WorkerID == activeWorker.ID && x.AnnouncementID == activeAnnouncement.ID))
                {
                    return(true);
                }

                return(false);
            }
        }
        private void Form3_Load(object sender, EventArgs e)
        {
            users = new List <User>();

            using (db = new HrMatchContext())
            {
                foreach (var user in db.Users)
                {
                    User dbUser = new User(user.ID, user.Username, user.Email, user.Status, user.Password);
                    users.Add(dbUser);
                }
            }
        }
        public bool HasCV()
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                cv = db.CVs.FirstOrDefault(c => c.UserID == activeWorker.ID);

                if (cv != null)
                {
                    return(true);
                }

                return(false);
            }
        }
        private void listView_MouseClick(object sender, MouseEventArgs e)
        {
            if (cv != null)
            {
                for (int itemIndex = 0; itemIndex < listView.Items.Count; itemIndex++)
                {
                    var rectangle = listView.GetItemRect(itemIndex);

                    ListViewItem item = listView.Items[itemIndex];

                    var subItems = item.SubItems;

                    if (rectangle.Contains(e.Location) && subItems[0].Text == "APPLY HERE")
                    {
                        DialogResult dialogResult = MessageBox.Show("Do You Want to Pass Apply Form?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                        if (dialogResult.Equals(DialogResult.Yes))
                        {
                            string  name         = subItems[1].Text;
                            string  companyName  = subItems[2].Text;
                            string  categoryName = subItems[3].Text;
                            string  information  = subItems[4].Text;
                            string  education    = subItems[5].Text;
                            string  experience   = subItems[6].Text;
                            byte    age          = Convert.ToByte(subItems[7].Text);
                            string  cityName     = subItems[8].Text;
                            decimal salary       = Convert.ToDecimal(subItems[9].Text);
                            string  phoneNumber  = subItems[10].Text;

                            Announcement announcement;
                            using (HrMatchContext db = new HrMatchContext())
                            {
                                int categoryID = db.Categories.FirstOrDefault(c => c.Name.Equals(categoryName)).ID;
                                int cityID     = db.Cities.FirstOrDefault(c => c.Name.Equals(cityName)).ID;

                                announcement = db.Announcements
                                               .FirstOrDefault(a => a.Name.Equals(name) && a.CompanyName.Equals(companyName) && a.CategoryID.Equals(categoryID) && a.CityID.Equals(cityID) && a.Information.Equals(information) && a.Education.Equals(education) && a.Experience.Equals(experience) && a.Age.Equals(age) && a.Salary.Equals(salary) && a.PhoneNumber.Equals(phoneNumber));
                            }

                            Form11 form11 = new Form11(activeWorker, announcement);
                            form11.ShowDialog();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("You must add Your CV for Any Apply!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void myCvInfo_Click(object sender, EventArgs e)
 {
     using (HrMatchContext db = new HrMatchContext())
     {
         CV cv = db.CVs.FirstOrDefault(c => c.UserId == user.ID);
         if (cv != null)
         {
             new JobseekerCvInfoPage(user).ShowDialog();
         }
         else
         {
             MessageBox.Show("Can't find any CV - At First add CV", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
 private void addCV_Click(object sender, EventArgs e)
 {
     using (HrMatchContext db = new HrMatchContext())
     {
         CV cv = db.CVs.FirstOrDefault(c => c.UserId == user.ID);
         if (cv == null)
         {
             new JobseekerAddCVPage(user).ShowDialog();
         }
         else
         {
             MessageBox.Show("You already have active CV - for change delete it", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Exemplo n.º 20
0
        private void JobseekerJobForYouPage_Load(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                var myCv = db.CVs.FirstOrDefault(c => c.UserId == user.ID);
                if (myCv != null)
                {
                    var myCvVac = db.Vacancies.Where(x =>
                                                     x.Category == myCv.Category &&
                                                     x.City == myCv.City &&
                                                     x.Salary >= myCv.Salary
                                                     ).ToList();
                    if (myCvVac.Count > 0)
                    {
                        foreach (var item in myCvVac)
                        {
                            vacForYou.Add(new VacForYou()
                            {
                                ID         = item.ID,
                                JobTitle   = item.JobTitle,
                                Company    = item.Company,
                                Category   = item.Category,
                                City       = item.City,
                                Salary     = item.Salary,
                                Age        = item.Age,
                                Education  = item.Education,
                                Experience = item.Experience,
                                Phone      = item.Phone,
                                About      = item.About
                            });
                        }
                    }
                    else
                    {
                        MessageBox.Show("Can't find any Vacancy based your CV", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Dispose();
                    }
                }
                else
                {
                    MessageBox.Show("Can't find any CV - At First add CV", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Dispose();
                }
            }

            VacancyForYou.DataSource          = vacForYou;
            VacancyForYou.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
        }
Exemplo n.º 21
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (CheckFields())
            {
                using (HrMatchContext db = new HrMatchContext())
                {
                    Byte.TryParse(age.Text, out byte Age);
                    Decimal.TryParse(salary.Text, out decimal Salary);

                    if (CheckHasCV())
                    {
                        categoryID = db.Categories.FirstOrDefault(c => c.Name.Equals(category.Text)).ID;
                        cityID     = db.Cities.FirstOrDefault(c => c.Name.Equals(city.Text)).ID;

                        CV activeCV = db.CVs.FirstOrDefault(c => c.UserID.Equals(UserCV.UserID));

                        activeCV.CategoryID  = categoryID;
                        activeCV.CityID      = cityID;
                        activeCV.Name        = name.Text;
                        activeCV.Surname     = surname.Text;
                        activeCV.Gender      = gender.Text;
                        activeCV.Age         = Age;
                        activeCV.Education   = education.Text;
                        activeCV.Experience  = experience.Text;
                        activeCV.Salary      = Salary;
                        activeCV.PhoneNumber = phoneNumber.Text;

                        MessageBox.Show("CV is Successfully Updated!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        int categoryID = db.Categories.FirstOrDefault(c => c.Name.Equals(category.Text)).ID;
                        int cityID     = db.Cities.FirstOrDefault(c => c.Name.Equals(city.Text)).ID;

                        CV cv = new CV(activeWorker.ID, categoryID, cityID, name.Text, surname.Text, gender.Text, Age, education.Text, experience.Text, Salary, phoneNumber.Text);
                        db.CVs.Add(cv);

                        button1.Text = "UPDATE";
                        title.Text   = "UPDATE CV";

                        MessageBox.Show("Your CV is Successfully Added!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                    db.SaveChanges();
                }
            }
        }
Exemplo n.º 22
0
 private void CvInfoPage_Load(object sender, EventArgs e)
 {
     using (HrMatchContext db = new HrMatchContext())
     {
         CV cv = db.CVs.FirstOrDefault(c => c.UserId == user.ID);
         CvInfoName.Text       = cv.Name;
         CvInfoSurname.Text    = cv.Surname;
         CvInfoGender.Text     = cv.Gender;
         CvInfoCity.Text       = cv.City;
         CvInfoCategory.Text   = cv.Category;
         CvInfoSalary.Text     = cv.Salary.ToString();
         CvInfoAge.Text        = cv.Age.ToString();
         CvInfoEducation.Text  = cv.Education;
         CvInfoExperience.Text = cv.Experience;
         CvInfoPhone.Text      = cv.Phone;
     }
 }
Exemplo n.º 23
0
        private void information_Click(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                CV cv = db.CVs.FirstOrDefault(c => c.UserID == activeWorker.ID);

                if (cv != null)
                {
                    CVInformationForm cVInformationForm = new CVInformationForm(activeWorker);
                    cVInformationForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("You haven't Added Your CV", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Exemplo n.º 24
0
        private void Form8_Load(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                foreach (var dbCategory in db.Categories)
                {
                    category.Items.Add(dbCategory.Name);
                }

                foreach (var dbCity in db.Cities)
                {
                    city.Items.Add(dbCity.Name);
                }
            }

            AddComboboxItems();
        }
        public void AddtoListView()
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                foreach (var dbCV in query)
                {
                    string categoryName = db.Categories.FirstOrDefault(c => c.ID.Equals(dbCV.CategoryID)).Name;
                    string cityName     = db.Cities.FirstOrDefault(c => c.ID.Equals(dbCV.CityID)).Name;

                    string[] item = { dbCV.Name, dbCV.Surname, dbCV.Gender, dbCV.Age.ToString(), dbCV.Education, dbCV.Experience, categoryName, cityName, dbCV.Salary.ToString(), dbCV.PhoneNumber };

                    ListViewItem listViewItem = new ListViewItem(item);

                    listView.Items.Add(listViewItem);
                }
            }
        }
Exemplo n.º 26
0
        private void Form2_Load(object sender, EventArgs e)
        {
            users = new List <User>();

            using (HrMatchContext db = new HrMatchContext())
            {
                foreach (var user in db.Users)
                {
                    User dbUser = new User(user.ID, user.Username, user.Email, user.Status, user.Password);
                    users.Add(dbUser);
                }
            }

            status.Items.Add("Worker");
            status.Items.Add("Employer");

            CodeText.Text = GetRandomPassword();
        }
Exemplo n.º 27
0
        private void apply_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Do You Want to Apply this Announcement?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dialogResult.Equals(DialogResult.Yes))
            {
                using (HrMatchContext db = new HrMatchContext())
                {
                    WorkersAnnouncements workersAnnouncements = new WorkersAnnouncements(activeWorker.ID, activeAnnouncement.ID);
                    db.workersAnnouncements.Add(workersAnnouncements);

                    db.SaveChanges();
                }

                apply.Visible          = false;
                alreadyApplied.Visible = true;
            }
        }
Exemplo n.º 28
0
        private void appliedAnnouncements_Click(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                IQueryable <WorkersAnnouncements> query = db.workersAnnouncements
                                                          .Where(x => x.WorkerID == activeWorker.ID);

                if (query.Any(x => x.WorkerID == activeWorker.ID))
                {
                    AppliedAnnouncementsForm appliedAnnouncementsForm = new AppliedAnnouncementsForm(activeWorker);
                    appliedAnnouncementsForm.ShowDialog();
                }
                else
                {
                    MessageBox.Show("There is no Applied Announcement for You.", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public bool CheckHasCV()
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                foreach (var dbCV in db.CVs)
                {
                    if (dbCV.UserID.Equals(activeWorker.ID))
                    {
                        UserCV = db.CVs.FirstOrDefault(c => c.UserID.Equals(activeWorker.ID));

                        categoryName = db.Categories.FirstOrDefault(c => c.ID.Equals(UserCV.CategoryID)).Name;
                        cityName     = db.Cities.FirstOrDefault(c => c.ID.Equals(UserCV.CityID)).Name;

                        return(true);
                    }
                }
                return(false);
            }
        }
        private void Form7_Load(object sender, EventArgs e)
        {
            using (HrMatchContext db = new HrMatchContext())
            {
                CV cv = db.CVs.FirstOrDefault(c => c.UserID == activeWorker.ID);

                title.Text       = db.Users.FirstOrDefault(u => u.ID == cv.UserID).Username + "'s" + " " + "CV";
                category.Text    = db.Categories.FirstOrDefault(c => c.ID == cv.CategoryID).Name;
                city.Text        = db.Cities.FirstOrDefault(c => c.ID == cv.CityID).Name;
                name.Text        = cv.Name;
                surname.Text     = cv.Surname;
                gender.Text      = cv.Gender;
                age.Text         = cv.Age.ToString();
                education.Text   = cv.Education;
                experience.Text  = cv.Experience;
                salary.Text      = cv.Salary.ToString();
                phoneNumber.Text = cv.PhoneNumber;
            }
        }