private void applied_vacancies_Click(object sender, EventArgs e) { dataForSearch.Hide(); dataGridView1.Hide(); vacancieList.Hide(); appliedVacancies.BringToFront(); appliedVacancies.Show(); using (HRContext db = new HRContext()) { //var result = (from v in crntEmp.Vacancies // select new // { // v.Id, // v.VacancieName, // v.CompanyName, // v.Category, // v.Description, // v.Age, // v.Study, // v.WorkExperience, // v.City, // v.Salary, // v.Mobile // }).ToList(); var result = crntEmp.Vacancies.ToList(); appliedVacancies.DataSource = result; appliedVacancies.Refresh(); db.SaveChanges(); } }
private void see_all_vacancies_Click(object sender, EventArgs e) { dataForSearch.Hide(); dataGridView1.Hide(); vacancieList.BringToFront(); vacancieList.Show(); using (HRContext db = new HRContext()) { var result = (from v in db.Vacancies join hr in db.HRs on v.HrId equals hr.Id select new { v.VacancieName, v.CompanyName, v.Category, v.Description, v.Age, v.Study, v.WorkExperience, v.City, v.Salary, v.Mobile, hr.Username }).ToList(); vacancieList.DataSource = result; vacancieList.Refresh(); db.SaveChanges(); } }
private void searchButton_Click(object sender, EventArgs e) { using (HRContext db = new HRContext()) { var keyword = searchBox.Text; var result = (from v in db.Vacancies join hr in db.HRs on v.HrId equals hr.Id select new { v.VacancieName, v.CompanyName, v.Category, v.Description, v.Age, v.Study, v.WorkExperience, v.City, v.Salary, v.Mobile, hr.Username }).ToList(); var filtered = result.Where(x => x.VacancieName.ToLower().Contains(keyword.ToLower()) || x.CompanyName.ToLower().Contains(keyword.ToLower()) || x.Category.ToLower().Contains(keyword.ToLower()) || x.Description.ToLower().Contains(keyword.ToLower()) || x.Study.ToLower().Contains(keyword.ToLower()) || x.WorkExperience.ToLower().Contains(keyword.ToLower()) || x.City.ToLower().Contains(keyword.ToLower()) || x.Username.ToLower().Contains(keyword.ToLower())).ToList(); dataForSearch.DataSource = filtered; dataForSearch.Refresh(); db.SaveChanges(); } }
private void sign_in_Click(object sender, EventArgs e) { using (HRContext db = new HRContext()) { var selectedEmployee = db.Employees.FirstOrDefault(x => x.Username == username.Text && x.Password == password.Text); var selectedHR = db.HRs.FirstOrDefault(hr => hr.Username == username.Text && hr.Password == password.Text); if (selectedEmployee != null) { currentId = selectedEmployee.Id; Form5 menuEmp = new Form5(); menuEmp.Show(); menuEmp.GetCurrentEmployee(currentId); } else if (selectedHR != null) { currentHrId = selectedHR.Id; Form7 menuHR = new Form7(); menuHR.Show(); menuHR.GetCurrentHR(currentHrId); } else { MessageBox.Show("Enter valid information"); } } }
private void vacancieList_CellContentClick(object sender, DataGridViewCellEventArgs e) { using (HRContext db = new HRContext()) { for (int i = 0; i < vacancieList.Rows.Count; i++) { var currentCell = vacancieList.Rows[i].Cells[0]; var nameCell = vacancieList.Rows[i].Cells[1]; var selectedVacancie = db.Vacancies.FirstOrDefault(v => v.VacancieName == nameCell.Value.ToString()); if (currentCell.Selected) { // crntEmp - sign in eden iscidir. current Employer crntEmp.Vacancies.Add(selectedVacancie); vacancie.Employees.Add(crntEmp); db.SaveChanges(); } else { continue; } } } }
private void searchButton_Click(object sender, EventArgs e) { using (HRContext db = new HRContext()) { var keyword = searchBox.Text; var result = (from v in db.CVs select new { v.Name, v.Surname, v.Age, v.Gender, v.Study, v.WorkExperience, v.Category, v.City, v.MininumSalary, v.Mobile }).ToList(); var filtered = result.Where(x => x.Name.ToLower().Contains(keyword.ToLower()) || x.Surname.ToLower().Contains(keyword.ToLower()) || x.Gender.ToLower().Contains(keyword.ToLower()) || x.Study.ToLower().Contains(keyword.ToLower()) || x.WorkExperience.ToLower().Contains(keyword.ToLower()) || x.Category.ToLower().Contains(keyword.ToLower()) || x.City.ToLower().Contains(keyword.ToLower()) || x.Mobile.ToLower().Contains(keyword.ToLower())).ToList(); dataForSearch.DataSource = filtered; dataForSearch.Refresh(); db.SaveChanges(); } }
public void GetCurrentEmployee(int id) { using (HRContext db = new HRContext()) { currentId = id; crntEmp = db.Employees.FirstOrDefault(x => x.Id == currentId); } }
public void GetCurrentHR(int id) { using (HRContext db = new HRContext()) { currentHrId = id; crntHR = db.HRs.FirstOrDefault(x => x.Id == currentHrId); } }
private void applications_Click(object sender, EventArgs e) { application.Show(); using (HRContext db = new HRContext()) { db.Vacancies.Load(); var myVacancies = db.Vacancies.Local; vacancieBindingSource1.DataSource = myVacancies.Where(x => x.HrId == currentHrId); } }
private void vacancieList_CellContentClick(object sender, DataGridViewCellEventArgs e) { using (HRContext db = new HRContext()) { //var myVacancie = vacancieList.CurrentRow.DataBoundItem; //crntEmp.Vacancies.Add((Vacancie)myVacancie); //var myVacancies = crntEmp.Vacancies; //db.SaveChanges(); } }
void GetMyCv() { using (HRContext db = new HRContext()) { var myCv = db.CVs.FirstOrDefault(c => c.EmployeeId == crntEmp.Id); name.Text = myCv.Name; surname.Text = myCv.Surname; age.Text = myCv.Age.ToString(); gender.Text = (string)myCv.Gender; study.Text = myCv.Study; workexperience.Text = myCv.WorkExperience; category.Text = myCv.Category; city.Text = myCv.City; minimumSalary.Text = myCv.MininumSalary.ToString(); telephone.Text = myCv.Mobile; } }
private void recommendation_Click(object sender, EventArgs e) { dataForSearch.Hide(); dataGridView1.Hide(); appliedVacancies.Hide(); vacancieList.BringToFront(); vacancieList.Show(); using (HRContext db = new HRContext()) { var myCv = db.CVs.FirstOrDefault(x => x.EmployeeId == crntEmp.Id); var result = (from v in db.Vacancies join hr in db.HRs on v.HrId equals hr.Id select new { v.VacancieName, v.CompanyName, v.Category, v.Description, v.Age, v.Study, v.WorkExperience, v.City, v.Salary, v.Mobile, hr.Username }).ToList(); var recommented = result.Where(v => v.VacancieName.Equals(myCv.Category) || v.Category.Equals(myCv.Category) || v.Age.Equals(myCv.Age) || v.Study.Equals(myCv.Study) || v.WorkExperience.Equals(myCv.WorkExperience) || v.City.Equals(myCv.City) || v.Salary.Equals(myCv.MininumSalary)).ToList(); vacancieList.DataSource = recommented; vacancieList.Refresh(); db.SaveChanges(); } }
//public bool IsTelephoneValid(string tel) //{ // Regex pattern = new Regex(@"^([+]994)?([70]|[50]|[51]|[55])\d{7}$"); // bool valid = false; // valid = pattern.IsMatch(tel); // if (valid == true) // { // return valid; // } // else // { // MessageBox.Show("Enter valid telephone number"); // telephone.Text = ""; // return valid; // } //} void Run() { using (HRContext db = new HRContext()) { cV.Name = name.Text; cV.Surname = surname.Text; cV.Age = (int)age.Value; cV.Gender = (string)gender.SelectedItem; cV.Study = (string)study.SelectedItem; cV.WorkExperience = (string)workExperience.SelectedItem; cV.Category = (string)category.SelectedItem; cV.City = city.Text; cV.MininumSalary = (int)minSalary.Value; cV.Mobile = telephone.Text; cV.EmployeeId = crntEmp.Id; db.CVs.Add(cV); db.SaveChanges(); Form5 menuEmp = new Form5(); menuEmp.Show(); menuEmp.GetCurrentEmployee(currentId); } }
void Run() { using (HRContext db = new HRContext()) { vacancie.VacancieName = nameOfVacancie.Text; vacancie.CompanyName = nameOfCompany.Text; vacancie.Category = (string)category.SelectedItem; vacancie.Age = (int)age.Value; vacancie.Description = description.Text; vacancie.Study = (string)study.SelectedItem; vacancie.WorkExperience = (string)workExperience.SelectedItem; vacancie.City = city.Text; vacancie.Salary = (int)salary.Value; vacancie.Mobile = telephone.Text; vacancie.HrId = currentHrId; db.Vacancies.Add(vacancie); crntHR.Vacancies.Add(vacancie); db.SaveChanges(); Form7 form7 = new Form7(); form7.Show(); form7.GetCurrentHR(currentHrId); } }
private void submit_Click(object sender, EventArgs e) { using (HRContext db = new HRContext()) { bool em = IsValidEmail(email.Text); bool p = IsValidPassword(password.Text); if (em == false || p == false) { return; } else { if (username.Text == "" || email.Text == "" || status.SelectedIndex == -1 || password.Text == "" || repassword.Text == "" || type_random.Text == "") { MessageBox.Show("Fill out all fields!"); } else { if (password.Text != repassword.Text) { MessageBox.Show("Password and repassword do not match."); } else { if (random.Text != type_random.Text) { MessageBox.Show("Confirm that you are a human."); } else { if (status.SelectedIndex == 0) { employee.Username = username.Text; employee.Email = email.Text; employee.Status = (string)status.SelectedItem; employee.Password = password.Text; db.Employees.Add(employee); db.SaveChanges(); MessageBox.Show("Employee account submited successfuly"); Clear(); Form4 form4 = new Form4(); form4.Show(); form4.GetCurrentEmp(employee.Id); } else if (status.SelectedIndex == 1) { hR.Username = username.Text; hR.Email = email.Text; hR.Status = (string)status.SelectedItem; hR.Password = password.Text; db.HRs.Add(hR); db.SaveChanges(); MessageBox.Show("HR account submited successfuly"); Clear(); } } } } } } }