Exemple #1
0
        public static List <Vacancy> Vacancies(Specialization specialization)
        {
            var vacancy = new List <Vacancy>();

            using (var context = new Context())
            {
                foreach (var m in context.Vacancy_.Include("Specialization").Include("Employer"))
                {
                    if (specialization != null)
                    {
                        if (m.Specialization.Id == specialization.Id)
                        {
                            vacancy.Add(m);
                        }
                    }
                }
            }
            return(vacancy);
        }
Exemple #2
0
        public static List <Employee> Employees(Grades grade, Specialization specialization)
        {
            var emp = new List <Employee>();

            using (var context = new Context())
            {
                foreach (var c in context.Employee_.Include("Grade").Include("Specializations"))
                {
                    if (grade != null && specialization != null)
                    {
                        if (c.Grade.Id == grade.Id)
                        {
                            if (c.Specializations.Id == specialization.Id)
                            {
                                emp.Add(c);
                            }
                        }
                    }
                    else
                    if (grade != null)
                    {
                        if (c.Grade.Id == grade.Id)
                        {
                            emp.Add(c);
                        }
                    }
                    else

                    if (specialization != null)
                    {
                        if (c.Specializations.Id == specialization.Id)
                        {
                            emp.Add(c);
                        }
                    }
                    else
                    {
                        emp.Add(c);
                    }
                }
            }
            return(emp);
        }
Exemple #3
0
 public void AddVacancy(Employer employer, string vacancyname, string salary, string adress, string number, string contactperson, Specialization sp)
 {
     using (var context = new Context())
     {
         var vacanc = new Vacancy()
         {
             VacancyName    = vacancyname,
             Salary         = salary,
             Address        = adress,
             Number         = number,
             ContactPerson  = contactperson,
             Specialization = context.Specializations_.FirstOrDefault(x => x.Id == sp.Id),
             Employer       = context.Employer_.FirstOrDefault(m => m.Login == employer.Login)
         };
         if (employer.Vacancies == null)
         {
             context.Employer_.FirstOrDefault(x => x.Login == employer.Login).Vacancies = new List <Vacancy>();
         }
         context.Vacancy_.Add(vacanc);
         context.SaveChanges();
     }
 }
Exemple #4
0
 public void SaveEmployee(string name, string login, string password, string education, Specialization specialization, Grades grade, DateTime birthdate)
 {
     using (var context = new Context())
     {
         Employee employee = new Employee()
         {
             Name            = name,
             Login           = login,
             Password        = GetHash(password),
             Education       = education,
             BirthDate       = birthdate,
             Specializations = context.Specializations_.FirstOrDefault(x => x.Id == specialization.Id),
             Grade           = context.Grade_.FirstOrDefault(m => m.Id == grade.Id)
         };
         context.Employee_.Add(employee);
         context.SaveChanges();
     }
 }