Пример #1
0
        private void InitDoor()
        {
            u1 = new OfficeUser() { Birthday = DateTime.Today, EmployeeNumber = "12046", Gender = Gender.Male, Name = "Devin" };
             t1 = new Teacher() { Birthday = Convert.ToDateTime("1984-1-1"), EmployeeNumber = "12334", Gender = Gender.Female, Major = "Math", Name = "StevenMath" };
            Session.SaveOrUpdate(u1);
            Session.SaveOrUpdate(t1);
            Student s1 = new Student() { Birthday = Convert.ToDateTime("1983-12-20"), Gender = Gender.Male, Name = "Jack" };
            Session.SaveOrUpdate(s1);
            Lab l1 = new Lab() { Address = "Teaching Tower 1", Description = "For chemistry", Size = 70, LabSubject = "Primary Chemistry" };
            Classroom cr1 = new Classroom() { Address = "Teaching Building 2", Description = "Common Room", RoomNumber = "402", Size = 150 };
            Session.SaveOrUpdate(l1);
            Session.SaveOrUpdate(cr1);
            Session.Flush();

            Education e1=new Education(){Employee = t1,GraduateYear = 2003,University = "UESTC"};
            Education e11 = new Education() { Employee = t1, GraduateYear = 2007, University = "BJU" };
            Education e2 = new Education() { Employee = u1, GraduateYear = 2001, University = "USTC" };
            t1.Educations.Add(e1);
            t1.Educations.Add(e11);
            u1.Educations.Add(e2);
            DoorKey doorKey = new DoorKey() { Name = "401 Key" };
            doorKey.Employees = new List<Employee>();
            doorKey.Employees.Add(u1);
            doorKey.Employees.Add(t1);
            Session.SaveOrUpdate(doorKey);
            Session.Flush();
        }
Пример #2
0
        public Result(Age a, Sex s, Profession p, Education e, YesNo cit, 
		               List<Technology> tech, Frequency pub, Frequency home,
		               NumPass single, List<PassType> passType, Frequency pChange,
		               YesNo sharePass,YesNo pSecure, YesNo passHome,YesNo pMobile, 
		               YesNo hWifiPass, YesNo hWifiFire, YesNo hVirusSoftware, YesNo softUpdate, 
		               SecureLevel sLevel, SharePersonalInfo postPersonal, Frequency pWifi)
        {
            m_age = a;
            m_sex = s;
            m_profession = p;
            m_education = e;
            m_usCitizen = cit;
            m_technologyList = tech;
            m_publicComputer = pub;
            m_homeComputer = home;
            m_singlePass = single;
            m_passType = passType;
            m_passChangeFreq = pChange;
            m_sharePassword = sharePass;
            m_passSecure = pSecure;
            m_passHomePC = passHome;
            m_passForMobile = pMobile;
            m_homeWifiPass = hWifiPass;
            m_homeWifiFirewall = hWifiFire;
            m_homeVirusSoftware = hVirusSoftware;
            m_softwareUpdates = softUpdate;
            m_securityLevel = sLevel;
            m_postPersonalInfo = postPersonal;
            m_publicWifi = pWifi;
        }
Пример #3
0
 public Student(String N, String SN, DateTime D, Education E, int Gn)
     : base(N, SN, D)
 {
     StudentEducation = E;
     GroupNumber = Gn;
     ExamArray = new Exam[10];
     TestsArray = new System.Collections.ArrayList();
 }
Пример #4
0
 public Student(string namE, string surnamE, DateTime datE,  Education e, int gn, int excount)
     : base(namE,surnamE,datE)
 {
     this.Educ = e;
     this.GroupN = gn;
     TestList = new ArrayList();
     Exams = new Exam[excount];
 }
 public void addEducation(Education e, int userID)
 {
     using (var db = new PortfolioUnleashedContext())
     {
         db.Users.Include("ContactInfoes").Include("Educations").Include("Links").Include("Portfolios").Include("QuickReferences").FirstOrDefault(user => user.Id == userID).Educations.Add(e);
         db.SaveChanges();
     }
 }
Пример #6
0
 public Student()
     : base()
 {
     Educ = Education.Bachelor;
     GroupN = 0;
     TestList = new ArrayList();
     Exams = new Exam[10];
 }
Пример #7
0
 //Конструктор без параметров для инициализации по умолчанию
 public Student()
 {
     Person = new Person();
     education = Education.Bachelor;
     numberGroup = 1;
     exams = new Exam[0];
     listTests = new ArrayList();
 }
Пример #8
0
        private int numberGroup; //13

        #endregion Fields

        #region Constructors

        //Конструктор  c  параметрами    типа  Person,  Education,  int  для  инициализации соответствующих полей класса
        public Student(Person person, Education education, int numberGroup)
        {
            Person = person;
            this.education = education;
            this.numberGroup = numberGroup;
            exams = new Exam[0];
            listTests = new ArrayList();
        }
Пример #9
0
 public Student()
 {
     Name = "Иван";
     Surname = "Иванов";
     DateOfBirth = new DateTime(2001, 1, 1);
     FormEd = (Education)1;
     Group = 21;
 }
Пример #10
0
 public Student()
     : base()
 {
     StudentEducation = (Education)1;
     GroupNumber = 0;
     ExamArray = new Exam[10];
     TestsArray= new System.Collections.ArrayList();
 }
Пример #11
0
 public Student(Person p, Education edu, int groupNumber)
 {
     this.edu = edu;
     this.groupNumber = groupNumber;
     base.Name = p.AccessName;
     base.Family = p.AccessFamily;
     base.BirthDate = p.Date;
 }
Пример #12
0
 public Student(Person p, Education f, int g)
     : base(p.gsFirst, p.gsSecond, p.Date)
 {
     form = f;
     group = g;
     exams = new Exam[0];
     tests = new ArrayList();
 }
Пример #13
0
 public Student()
     : base()
 {
     form = (Education) 1;
     group = 23;
     exams = new Exam[0];
     tests = new ArrayList();
 }
Пример #14
0
 public Student(Person p, Education FormOfEducation, int NumberOfGroup)
 {
     Name = p.Name;
     Family = p.Family;
     Born = p.Born;
     this.FormOfEducation = FormOfEducation;
     this.NumberGroup = NumberOfGroup;
     tests = new ArrayList();
 }
Пример #15
0
 public VMEducation(Education education)
 {
     School = education.School;
     Degree = education.Degree;
     StartYear = (int)education.StartYear;
     EndYear = (int)education.EndYear;
     Id = education.Id;
     UserId = education.UserId;
 }
Пример #16
0
 public Student(Person person, Education education, int group)
     : base()
 {
     fName = person.FirstName;
     lName = person.LastName;
     date = person.Date;
     this.education = education;
     this.group = group;
 }
Пример #17
0
 public Student(string name, string surname, DateTime dateofbirth, Education formEd, int group)
 {
     //Stud = stud;
     Name = name;
     Surname = surname;
     DateOfBirth = dateofbirth;
     FormEd = formEd;
     Group = group;
 }
 public async Task<ActionResult> Redigera(Education education)
 {
     if (ModelState.IsValid)
     {
         db.Entry(education).State = EntityState.Modified;
         await db.SaveChangesAsync();
         return RedirectToAction("Index");
     }
     return View(education);
 }
 public IServiceResults<int> Add(Education model)
 {
     _education.Add(model);
     var saveResult = _uow.SaveChanges();
     return new ServiceResults<int>
     {
         IsSuccessfull = saveResult.ToBool(),
         Message = saveResult.ToMessage(BusinessMessage.Error),
         Result = model.EducationId
     };
 }
        public async Task<ActionResult> Skapa(Education education)
        {
            if (ModelState.IsValid)
            {
                education.CreatedOn = DateTime.Now;
                db.Educations.Add(await education.AssignValuesAsync(db));
                await db.SaveChangesAsync();
                return RedirectToAction("Index");
            }

            return View(education);
        }
 public Education Update(Education education)
 {
     var sqlQuery =
         "UPDATE Education " +
         "SET Name          = @Name, " +
         "    City          = @City, " +
         "    State         = @State, " +
         "    GraduationYear = @GraduationYear, " +
         "    Major         = @Major " +
         "WHERE Id = @Id";
     this._db.Execute(sqlQuery, education);
     return education;
 }
    public void Institution_Method()
    {
      Assert.Throws<ArgumentNullException>(() => IEducationExtensions.Institution<IEducation>(null, "institution"));
      Assert.Throws<ArgumentNullException>(() => Enumerable.Empty<IEducation>().Institution(null));
      Assert.Throws<ArgumentException>(() => Enumerable.Empty<IEducation>().Institution(string.Empty));

      Assert.False(Enumerable.Empty<IEducation>().Institution("institution").Any());

      var first = new Education { Institution = "FIRST" };
      var second = new Education { Institution = "Second" };
      var educations = new[] { null, first, second };
      Assert.True(ReferenceEquals(first, educations.Institution("first").Single()));
      Assert.True(ReferenceEquals(second, educations.Institution("second").Single()));
    }
    public void Year_Method()
    {
      Assert.Throws<ArgumentNullException>(() => IEducationExtensions.Year<IEducation>(null));

      Assert.False(Enumerable.Empty<IEducation>().Year().Any());

      var first = new Education { Year = 0 };
      var second = new Education { Year = 1 };
      var third = new Education { Year = 2 };

      var educations = new[] { null, first, second, third };
      Assert.True(educations.Year(1).SequenceEqual(new[] { second, third }));
      Assert.True(educations.Year(null, 1).SequenceEqual(new[] { first, second }));
      Assert.True(educations.Year(0, 2).SequenceEqual(new[] { first, second, third }));
    }
Пример #24
0
 public static List<Education> educationListFromVMEducationList(List<VMEducation> vmEducations)
 {
     List<Education> educations = new List<Education>();
     foreach(VMEducation vmEducation in vmEducations)
     {
         Education education = new Education()
         {
             School = vmEducation.School,
             Degree = vmEducation.Degree,
             StartYear = (short)(vmEducation.StartYear),
             EndYear = (short)(vmEducation.EndYear),
             Id = vmEducation.Id
         };
         educations.Add(education);
     }
     return educations;
 }
 public Education Add(Education education)
 {
     var sqlQuery = "INSERT INTO Education" +
                 "(StudentId, " +
                 "Name, " +
                 "City, " +
                 "State, " +
                 "GraduationYear, " +
                 "Major) VALUES" +
                 "(@StudentId, " +
                 "@Name, " +
                 "@City, " +
                 "@State, " +
                 "@GraduationYear, " +
                 "@Major )" +
                 "SELECT CAST(SCOPE_IDENTITY() as int)";
     var userId = this._db.Query<int>(sqlQuery, education).Single();
     education.Id = userId;
     return education;
 }
 public async Task<ActionResult> Index(List<EducationModel> model)
 {
     if (ModelState.IsValid)
     {
         bool educationStored = false;
         using (var client = new DataServiceClient())
         {
             client.Open();
             var education = new List<Education>();
             foreach (var ed in model)
             {
                 var temp = new Education();
                 temp.applicantId = Convert.ToInt32(this.Session["ApplicantId"]);
                 temp.degreeMajor = ed.degree;
                 temp.graduatedYN = ed.graduated;
                 temp.street = ed.street;
                 temp.city = ed.city;
                 temp.stateAbrev = ed.state;
                 temp.zip = ed.zip;
                 temp.name = ed.name;
                 temp.yearFrom = ed.yearFrom;
                 temp.yearTo = ed.yearTo;
                 temp.applicantId = ed.applicantId;
                 temp.educationId = ed.educationId;
                 education.Add(temp);
             }
             educationStored = await client.updateEducationsAsync(education.ToArray());
             client.Close();
         }
         if (educationStored)
         {
             this.Session["Education"] = "Done";
             return RedirectToAction("Index", "References");
         }
         else
         {
             //error occured storing education 
         }
     }
     return View(model);
 }
Пример #27
0
        public static void Create(string education)
        {
            if (education.Length == 0) { throw new Exception("Invalid experience."); }

            JobBoardDataContext db = new JobBoardDataContext();

            // Make sure we don't already have a education entry for this
            int existing = db.Educations.Where(x => x.edu_level == education).Count();
            if (existing > 0) { throw new Exception("Existing entry."); }

            // Create new education level
            Education ed = new Education {
                id = Guid.NewGuid(),
                edu_level = education,
                date_added = DateTime.Now
            };

            // Save education
            db.Educations.InsertOnSubmit(ed);
            db.SubmitChanges();
        }
Пример #28
0
        public void ShouldTransformEducationToEntity()
        {
            var param = new Education
            {
                EducationId = 1,
                City = "Ipsum City",
                Country = "Dolor Republic",
                State = "Lorem State",
                SchoolName = "Fudge School",
                YearAttended = DateTime.UtcNow,
                YearGraduated = DateTime.UtcNow,
                EducationType = new EducationType { EducationTypeId = 1, EducationTypeName = "Grade School" },
                UserId = 1
            };

            var result = EducationMapper.ToEntity(param);

            Assert.IsInstanceOf(typeof(Db.Education), result);
            Assert.NotNull(result);
            Assert.IsNull(result.EducationType);
            Assert.AreNotEqual(0, result.EducationTypeId);
        }
Пример #29
0
        public static Db.Education ToEntity(Education education)
        {
            if (education == null) return null;
            if (education.EducationType == null) return null;

            return new Db.Education
                {
                    City = education.City,
                    Country = education.Country,
                    Course = education.Course,
                    SchoolName = education.SchoolName,
                    State = education.State,
                    YearAttended = education.YearAttended,
                    YearGraduated = education.YearGraduated,
                    EducationTypeId = education.EducationType.EducationTypeId,
                    EducationId = education.EducationId,
                    UserId = education.UserId,
                    CreatedBy = education.CreatedBy,
                    CreatedDate = education.CreatedDate,
                    ModifiedBy = education.ModifiedBy,
                    ModifiedDate = education.ModifiedDate
                };
        }
        public static EducationDTO EducationToDTO(Education education)
        {
            DateTime?inputStartDate = education.StartDate;

            if (education.StartDate.HasValue)
            {
                inputStartDate = education.StartDate.GetValueOrDefault();
            }
            DateTime?inputEndDate = education.EndDate;

            if (education.EndDate.HasValue)
            {
                inputEndDate = education.EndDate.GetValueOrDefault();
            }
            return(new EducationDTO
            {
                ResumeId = education.ResumeId,
                Order = education.Order,
                SchoolName = education.SchoolName,
                StartDate = inputStartDate,
                EndDate = inputEndDate,
                Major = education.Major
            });
        }
Пример #31
0
        private static double ConvertParamHigherEducationToDouble(Education higherEducation)
        {
            switch (higherEducation)
            {
            case Education.MoreHigher:
            {
                return(W_EDUCATION_MORE_HIGHER);
            }

            case Education.Higher:
            {
                return(W_EDUCATION_HIGHER);
            }

            case Education.HigherIncomplete:
            {
                return(W_EDUCATION_HIGHER_INCOMPLETE);
            }

            case Education.Vocational:
            {
                return(W_EDUCATION_VOCATIONAL);
            }

            case Education.Secondary:
            {
                return(W_EDUCATION_SECONDARY);
            }

            case Education.LowerSecondary:
            {
                return(W_EDUCATION_LOWER_SECONDARY);
            }
            }
            return(-1);
        }
Пример #32
0
        public IActionResult Edit(int id, Education education)
        {
            if (id != education.ID)
            {
                return(View());
            }

            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                _context.Educations.Update(education);
                _context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
            }

            return(View());
        }
Пример #33
0
        public async Task UpdateAsync_WithInvalidData_ReturnsFalse()
        {
            string expectedResult = "MajorTest";

            var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>()
                                                 .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                                 .Options);

            var model = new Education()
            {
                Major     = expectedResult,
                Institute = "InstituteTest",
                From      = 2000,
                To        = 2001,
            };

            await context.AddAsync(model);

            context.SaveChanges();

            var serviceModel = new EducationServiceModel()
            {
                Id = model.Id,
            };

            var educationsService = new EducationsService(new EfRepository <Education>(context),
                                                          new EfRepository <Resume>(context));

            var result = await educationsService.UpdateAsync(serviceModel);

            Assert.False(result);

            var actualResult = (await context.EducationsHistory.SingleAsync(e => e.Id == model.Id)).Major;

            Assert.Equal(expectedResult, actualResult);
        }
Пример #34
0
        public ActionResult <RequestResponse> PostEducation(Education education)
        {
            var currentDate = DateTime.Now;

            education.CreatedOn  = currentDate;
            education.ModifiedOn = currentDate;

            var result = _educationRepository.SaveEducation(education);

            if (result > 0)
            {
                return(new RequestResponse
                {
                    Status = "Success",
                    Remarks = "Employee Education added successfully"
                });
            }

            return(new RequestResponse
            {
                Status = "Failure",
                Remarks = "Add new record action failed"
            });
        }
Пример #35
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,PhoneNumber,Email,ImageLocation,ProgramName,ProgramImageLocation,ProgramBio,EducationStreet,EducationCity,EducationState,EducationZipCode,IdentityUserId")] Education education)
        {
            if (ModelState.IsValid)
            {
                string              url      = $"https://maps.googleapis.com/maps/api/geocode/json?address={education.EducationStreet},+{education.EducationCity},+{education.EducationState}&key={APIKeys.GeocodeKey}";
                HttpClient          client   = new HttpClient();
                HttpResponseMessage response = await client.GetAsync(url);

                string jsonResult = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode)
                {
                    JObject geoCode = JObject.Parse(jsonResult);
                    education.Lat  = (double)geoCode["results"][0]["geometry"]["location"]["lat"];
                    education.Long = (double)geoCode["results"][0]["geometry"]["location"]["lng"];
                }
                _context.Add(education);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdentityUserId"] = new SelectList(_context.Users, "Id", "Id", education.IdentityUserId);
            return(View(education));
        }
Пример #36
0
        public override void CalculateEnrollment(Population population)
        {
            Education adultsEducation      = population.GetAdultsEducation();
            Education youngAdultsEducation = population.GetYoungAdultsEducation();

            int totalStudent = youngAdultsEducation.GetWellEducated()
                               + adultsEducation.GetWellEducated();

            if (totalStudent == 0)
            {
                return;
            }

            enrollment = Math.Min(totalStudent, GetTotalCapacity());

            float adultRatio = adultsEducation.GetWellEducated() / totalStudent;

            adultsEducation.AddHighlyEducated(GetGraduators(
                                                  (int)(enrollment * adultRatio))
                                              );
            youngAdultsEducation.AddHighlyEducated(GetGraduators(
                                                       (int)(enrollment * (1 - adultRatio)))
                                                   );
        }
Пример #37
0
        public ActionResult Create([Bind(Include = "MonthStart,MonthEnd,YearStart,YearEnd,InstitutionName,Notes")] Education education)
        {
            if (ModelState.IsValid)
            {
                education.CreatedById  = User.Identity.GetUserId();
                education.ModifiedById = education.CreatedById;
                education.DateCreated  = DateTime.Now;
                education.DateModified = education.DateCreated;
                try
                {
                    db.Educations.Add(education);
                    db.SaveChanges();
                }
                catch (DbUpdateException ex) {
                    var errorHelper = new ControllerHelpers();
                    return(errorHelper.CreateErrorPage(ex.InnerException.InnerException.Message, "Educations", "Create"));
                }
                return(RedirectToAction("Index"));
            }

            ViewBag.Month = UserHelpers.GetMonths();
            ViewBag.Year  = UserHelpers.GetYears();
            return(View(education));
        }
Пример #38
0
        public Education GetRecentAddedData()
        {
            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();

            string        qrey      = "SELECT TOP(1) * from dbo.education order by id Desc";
            SqlCommand    command   = new SqlCommand(qrey, connection);
            SqlDataReader reader    = command.ExecuteReader();
            var           education = new Education();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    education.Id         = Convert.ToInt32(reader["id"]);
                    education.School     = Convert.ToString(reader["school"]);
                    education.College    = Convert.ToString(reader["college"]);
                    education.University = Convert.ToString(reader["university"]);
                }
            }
            connection.Close();
            return(education);
        }
Пример #39
0
        private void Btn_edctn_save_Click(object sender, EventArgs e)
        {
            Education edctn    = new Education();
            Regex     rgxName  = new Regex("[A-z]");
            Regex     rgxPrice = new Regex(@"\[0\-9\]\{0,15\}");

            if (!rgxName.IsMatch(frm_edctn_name.Text))
            {
                MessageBox.Show("Fill in the form");
            }
            else if (!rgxPrice.IsMatch(frm_edctn_price.Text))
            {
                MessageBox.Show("Not enter Letters");
            }
            else
            {
                using (AcademyEntities aem = new AcademyEntities())
                {
                    AcademyMngtSystem.Model.Group   grp  = aem.Groups.FirstOrDefault(x => x.Id == selectedId);
                    AcademyMngtSystem.Model.Teacher tchr = aem.Teachers.FirstOrDefault(t => t.Id == selectedId);
                    if (grp != null)
                    {
                        edctn.Groups.Add(grp);
                    }
                    if (tchr != null)
                    {
                        edctn.Teachers.Add(tchr);
                    }
                    edctn.Name  = frm_edctn_name.Text;
                    edctn.Price = Convert.ToInt32(frm_edctn_price.Text);
                    aem.Educations.Add(edctn);
                    edctn_datagridview.DataSource = aem.Educations.ToList();
                    aem.SaveChanges();
                }
            }
        }
Пример #40
0
        public List <Education> GetEducations()
        {
            var educationList = new List <Education>();

            using (var sqlite_conn = CreateConnection())
            {
                var sqlite_cmd = sqlite_conn.CreateCommand();
                sqlite_cmd.CommandText =
                    "SELECT Id, Begin, End, Name FROM Education ORDER BY Begin, End, Name";

                var sqlite_datareader = sqlite_cmd.ExecuteReader();
                while (sqlite_datareader.Read())
                {
                    var education = new Education();
                    education.Id         = Guid.Parse(sqlite_datareader.GetString(0));
                    education.Begin      = sqlite_datareader.GetInt32(1);
                    education.End        = sqlite_datareader.GetInt32(2);
                    education.SchoolName = sqlite_datareader.GetString(3);
                    educationList.Add(education);
                }
            }

            return(educationList);
        }
Пример #41
0
 public EditStudentPage(Student student)
 {
     InitializeComponent();
     CurrentStudent                      = student;
     GroupComboBox.ItemsSource           = AppData.Context.Group.ToList();
     EducationComboBox.ItemsSource       = AppData.Context.Education.ToList();
     BasicOfLearningComboBox.ItemsSource = AppData.Context.BasicOfLearning.ToList();
     if (CurrentStudent != null)
     {
         CurrentGroup                       = AppData.Context.Group.Where(c => c.Id == CurrentStudent.IdGroup).FirstOrDefault();
         CurrentEducation                   = AppData.Context.Education.Where(c => c.Id == CurrentStudent.IdEducation).FirstOrDefault();
         CurrentBasicOfLearning             = AppData.Context.BasicOfLearning.Where(c => c.Id == CurrentStudent.IdBasicOfLearning).FirstOrDefault();
         CurrentAddress                     = AppData.Context.Address.Where(c => c.Id == CurrentStudent.IdAddress).FirstOrDefault();
         CurrentPassport                    = AppData.Context.Passport.Where(c => c.Id == CurrentStudent.IdPassport).FirstOrDefault();
         SaveButton.Content                 = "Сохранить";
         LastNameTextBox.Text               = CurrentStudent.LastName;
         FirstNameTextBox.Text              = CurrentStudent.FirstName;
         MiddleNameTextBox.Text             = CurrentStudent.MiddleName;
         DateOfBirthDatePicker.SelectedDate = CurrentStudent.DateOfBirth;
         PhoneNumberTextBox.Text            = CurrentStudent.PhoneNumber;
         GroupComboBox.SelectedItem         = CurrentGroup as Group;
         EducationComboBox.SelectedItem     = CurrentEducation as Education;
         PassportTextBox.Text               = CurrentPassport.Serial + CurrentPassport.Number;
         DateOfIssueDatePicker.SelectedDate = CurrentPassport.DateOfIssue;
         IssuedByWhomTextBox.Text           = CurrentPassport.IssuedByWhom;
         AreaTextBox.Text                   = CurrentAddress.Region;
         CityTextBox.Text                   = CurrentAddress.City;
         StreetTextBox.Text                 = CurrentAddress.Street;
         HouseTextBox.Text                  = CurrentAddress.House;
         ApartmentTextBox.Text              = CurrentAddress.Apartment;
     }
     else
     {
         this.Title = "Добавление обучающегося";
     }
 }
        public async System.Threading.Tasks.Task <IActionResult> EditEducation(EducationViewModel model)
        {
            if (model.EndDate.Equals(default(DateTime)) || string.IsNullOrEmpty(model.EndDate.ToString()))
            {
                return(View(model));
            }

            var education = new Education
            {
                Id       = model.Id,
                PersonId = model.PersonId,
                EndDate  = model.EndDate,
                File     = model.File
            };

            var files = HttpContext.Request.Form.Files;

            if (files.Count > 0)
            {
                var allowedExtensions = new[] { ".png", ".jpg" };
                using (var memoryStream = new MemoryStream())
                {
                    await  files[0].CopyToAsync(memoryStream);
                    string fileExtension = Path.GetExtension(files[0].FileName);
                    if (!allowedExtensions.Contains(fileExtension))
                    {
                        return(View(model));
                    }
                    education.File = memoryStream.ToArray();
                }
            }

            this._educationService.UpdateEducation(education);

            return(RedirectToAction("EditProfile", "Person", new { personId = model.PersonId }));
        }
Пример #43
0
        private void GetEducation(GenericProfileData profileData)
        {
            Print($"Getting rows", ConsoleColor.Blue);
            var rows = _driver.FindElementsByXPath("//div[@id='education']//div[@class='_5cds _2lcw']");

            foreach (var row in rows)
            {
                var education = new Education();

                // institution
                var qq = ElementIsPresent(row, By.ClassName("_3-8_"), true);
                education.Institution = qq?.Text;

                // type
                qq = ElementIsPresent(row, By.ClassName("_52ja"), true);
                if (qq.FindElements(By.CssSelector("span")).Count == 0)
                {
                    education.Type = qq?.Text;
                }

                // profile
                qq = ElementIsPresent(row, By.ClassName("concs"), true);
                education.Profile = qq?.Text;

                // time
                qq = ElementIsPresent(row, By.ClassName("_52j9"), true);
                education.GetType().GetField("Time").SetValue(education, qq?.Text);

                // comment
                qq = ElementIsPresent(row, By.ClassName("_5p1r"), true);
                education.Comment = qq?.Text;

                Print($"Adding education {education}", ConsoleColor.DarkGreen);
                profileData.AddData("Education", education);
            }
        }
Пример #44
0
        public async Task GetByIdAsync_WithNoExistingEducation_ReturnsNull()
        {
            string expectedResult = "MajorTest";

            var context = new JobFinderDbContext(new DbContextOptionsBuilder <JobFinderDbContext>()
                                                 .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                                 .Options);

            var model = new Education()
            {
                Major     = expectedResult,
                Institute = "InstituteTest",
                From      = 2000,
                To        = 2001,
                Resume    = new Resume()
            };

            var educationsService = new EducationsService(new EfRepository <Education>(context),
                                                          new EfRepository <Resume>(context));

            var result = await educationsService.GetByIdAsync(model.Id);

            Assert.Null(result);
        }
        public async Task <IActionResult> PatchEducation(long resumeId, long order, EducationDTO educationDTO)
        {
            Education sanitizedEducation = DTOToEducation(educationDTO);

            if (resumeId != sanitizedEducation.ResumeId)
            {
                return(BadRequest("resumeId in query params does not match resumeId in body"));
            }

            if (order != sanitizedEducation.Order)
            {
                return(BadRequest("subsection order in query params does not match subsection order in body"));
            }

            if (!await ResumeAccessAuthorized(sanitizedEducation.ResumeId))
            {
                return(GenerateResumeNotFoundError(sanitizedEducation.ResumeId));
            }

            if (!EducationExists(resumeId, order))
            {
                return(BadRequest("Associated subsection does not exist"));
            }
            _context.Entry(sanitizedEducation).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(AcceptedAtAction("PatchEducation", new { resumeId = sanitizedEducation.ResumeId, order = sanitizedEducation.Order }, educationDTO));
        }
Пример #46
0
            public void EducationTest()
            {
                // Start Add test. (Reports)
                test = extent.StartTest("Profile Education");

                //Populate the excel data
                GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathProfile, "Education");

                Education education = new Education();

                education.NavigateToEducationTab();

                //Add and Validate added Education
                education.AddNewEducation();
                education.ValidateAddedEducation();

                //Update and validate updated Education
                education.UpdateEducation();
                education.ValidateUpdateEducation();

                //Delete and Validate deleted Education
                education.DeleteEducation();
                education.ValidateDeleteEducation();
            }
Пример #47
0
        // GET: Educations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["UserId"] == null)
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            int       userId    = Convert.ToInt32(Session["UserId"]);
            Education education = db.Educations.Include("Student").Where(s => s.EducationId == id).FirstOrDefault();

            if (education.Student.User.UserId != userId)
            {
                TempData["msg"] = "Kindly login with connected account";
                RedirectToAction("Login", "Home");
            }
            if (education == null)
            {
                return(HttpNotFound());
            }
            return(View(education));
        }
Пример #48
0
        internal void Add_Education()
        {
            //read data from the excel
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPath, "AddEduction");
            Thread.Sleep(1000);
            Education.Click();
            GlobalDefinitions.WaitForElement(Global.GlobalDefinitions.driver, "XPath", AddNewEducation.Text, 2000);
            AddNewEducation.Click();
            EnterUniversity.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "university"));
            var countryOpt = new SelectElement(ChooseCountry);

            countryOpt.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "country"));
            var titleOpt = new SelectElement(ChooseTitle);

            titleOpt.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "title"));
            Degree.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "degree"));
            var graduationOpt = new SelectElement(DegreeYear);

            graduationOpt.SelectByText(GlobalDefinitions.ExcelLib.ReadData(2, "graduation year"));
            AddEdu.Click();
            Thread.Sleep(1000);
            //close the pop up window
            GlobalDefinitions.driver.FindElement(By.XPath("//a[@href ='#']")).Click();
        }
Пример #49
0
        public void StudentAbsenceByEducation()
        {
            //Method parameters: (Education education, int semesterNo)
            //Find f*g
            //Find studerende
            //Find skoledage
            //find fraværsdage i f*g
            //Udregn fravær

            //Arrange
            Education educationTest = new Education {
                Name = "Datamatiker"
            };
            int semesterNo = 3;

            List <Course> courseByEducationList = FindCourseByEducation(educationTest);

            List <Student> studentsBySemesterList = FindStudentsBySemesterNo(semesterNo);

            //Absence absenceTest1 = new Absence { Student = student, Course = courseTest1, Date = startDateTest.AddDays(14) };
            //Absence absenceTest2 = new Absence { Student = student, Course = courseTest1, Date = startDateTest.AddDays(15) };
            //Absence absenceTest3 = new Absence { Student = student, Course = courseTest2, Date = startDateTest.AddDays(1) };
            //Absence absenceTest4 = new Absence { Student = student, Course = courseTest2, Date = startDateTest.AddDays(3) };
            //Absence absenceTest5 = new Absence { Student = student, Course = courseTest2, Date = startDateTest.AddDays(8) };
            //Absence absenceTest6 = new Absence { Student = student, Course = courseTest2, Date = startDateTest.AddDays(10) };

            //List<Absence> absenceList = new List<Absence> { absenceTest1, absenceTest2, absenceTest3, absenceTest4, absenceTest5, absenceTest6 }; ;
            ////Act
            //double absDays = absenceList.Count;
            //double totalDays = FindSchoolDays(courseByEducationList);

            //double absenceInPercent = absDays / totalDays;

            ////Assert
            //Assert.Equal(0.2, absenceInPercent);
        }
        public async Task <IActionResult> Create(IFormCollection collection, Education education)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    //return BadRequest();
                    throw new Exception("Validation Error");
                }
                var created = await EducationRepo.Add(education);

                if (created == null)
                {
                    throw new Exception("Invalid Entry");
                }
                return(RedirectToAction(nameof(Index)));
            }
            catch (Exception ex)
            {
                Console.WriteLine("Create is giving an error: " + ex.Message);
                ModelState.AddModelError("", "Create actie is mislukt voor " + education.Name); // Wat je aan de gebruiker teruggeeft
                return(View());
            }
        }
Пример #51
0
    public EducationDto selectEducationById(String EducationId)
    {
        EducationManager mgr = new EducationManager();
        Education obj = new Education();
        obj.EducationId = EducationId;
        obj = mgr.selectEducationById(obj);

        if (obj != null)
        {
            return EducationDto.createEducationDTO(obj);
        }
        else
        {
            return null;
        }
    }
 public void Insert(Education education)
 {
     db.Education.Add(education);
     Save();
 }
 public void Update(Education education)
 {
     db.Entry(education).State = EntityState.Modified;
     Save();
 }
Пример #54
0
        public IEnumerable <KeyValuePair <TKey, Student> > EducationForm(Education value)
        {
            IEnumerable <KeyValuePair <TKey, Student> > sequence = studentsDictionary.Where(p => p.Equals(value));

            return(sequence);
        }
Пример #55
0
 public string ToString(string delimiter)
 {
     return(StartDate.ToString() + delimiter + EndDate.ToString() + delimiter + Status.ToString() + delimiter + Progress.ToString() + delimiter + Duration.ToString() + delimiter + Finished.ToString() + delimiter + RecordedDate.ToString() + delimiter + ResponseId.ToString() + delimiter + DistributionChannel.ToString() + delimiter + UserLanguage.ToString() + delimiter + TimePISFirstClick.ToString() + delimiter + TimePISLastClick.ToString() + delimiter + TimePISPageSubmit.ToString() + delimiter + TimePISClickCount.ToString() + delimiter + TimeConsentFirstClick.ToString() + delimiter + TimeConsentLastClick.ToString() + delimiter + TimeConsentPageSubmit.ToString() + delimiter + TimeConsentClickCount.ToString() + delimiter + Consent.ToString() + delimiter + ConsentMistake.ToString() + delimiter + Q177FirstClick.ToString() + delimiter + Q177LastClick.ToString() + delimiter + Q177PageSubmit.ToString() + delimiter + Q177ClickCount.ToString() + delimiter + ProlificId.ToString() + delimiter + TimeContext1FirstClick.ToString() + delimiter + TimeContext1LastClick.ToString() + delimiter + TimeContext1PageSubmit.ToString() + delimiter + TimeContext1ClickCount.ToString() + delimiter + TimeContext2FirstClick.ToString() + delimiter + TimeContext2LastClick.ToString() + delimiter + TimeContext2PageSubmit.ToString() + delimiter + TimeContext2ClickCount.ToString() + delimiter + TimeContext3FirstClick.ToString() + delimiter + TimeContext3LastClick.ToString() + delimiter + TimeContext3PageSubmit.ToString() + delimiter + TimeContext3ClickCount.ToString() + delimiter + TimeControlReportFirstClick.ToString() + delimiter + TimeControlReportLastClick.ToString() + delimiter + TimeControlReportPageSubmit.ToString() + delimiter + TimeControlReportClickCount.ToString() + delimiter + TimeUcdReportP1FirstClick.ToString() + delimiter + TimeUcdReportP1LastClick.ToString() + delimiter + TimeUcdReportP1PageSubmit.ToString() + delimiter + TimeUcdReportP1ClickCount.ToString() + delimiter + TimeUcdReportP2FirstClick.ToString() + delimiter + TimeUcdReportP2LastClick.ToString() + delimiter + TimeUcdReportP2PageSubmit.ToString() + delimiter + TimeUcdReportP2ClickCount.ToString() + delimiter + TimeS1FirstClick.ToString() + delimiter + TimeS1LastClick.ToString() + delimiter + TimeS1PageSubmit.ToString() + delimiter + TimeS1ClickCount.ToString() + delimiter + SubjUnderstanding.ToString() + delimiter + SubjClarity.ToString() + delimiter + SubjTrusted.ToString() + delimiter + TimeS2FirstClick.ToString() + delimiter + TimeS2LastClick.ToString() + delimiter + TimeS2PageSubmit.ToString() + delimiter + TimeS2ClickCount.ToString() + delimiter + SubjNext1.ToString() + delimiter + SubjNext3.ToString() + delimiter + SubjNext2.ToString() + delimiter + SubjNext4.ToString() + delimiter + SubjNext5.ToString() + delimiter + TimeOcStatusFirstClick.ToString() + delimiter + TimeOcStatusLastClick.ToString() + delimiter + TimeOcStatusPageSubmit.ToString() + delimiter + TimeOcStatusClickCount.ToString() + delimiter + OcStatusVerbal.ToString() + delimiter + OcStatusProb.ToString() + delimiter + OcStatusSlider1.ToString() + delimiter + TimeOcChildFirstClick.ToString() + delimiter + TimeOcChildLastClick.ToString() + delimiter + TimeOcChildPageSubmit.ToString() + delimiter + TimeOcChildClickCount.ToString() + delimiter + OcChildVerbal.ToString() + delimiter + OcChildProb.ToString() + delimiter + OcChildSlider1.ToString() + delimiter + TimeOcCompareFirstClick.ToString() + delimiter + TimeOcCompareLastClick.ToString() + delimiter + TimeOcComparePageSubmit.ToString() + delimiter + TimeOcCompareClickCount.ToString() + delimiter + ObjcompCompare.ToString() + delimiter + TimeOcHardFirstClick.ToString() + delimiter + TimeOcHardLastClick.ToString() + delimiter + TimeOcHardPageSubmit.ToString() + delimiter + TimeOcHardClickCount.ToString() + delimiter + Objcomp1000Hard.ToString() + delimiter + Objcomp800Hard.ToString() + delimiter + TimeSch1FirstClick.ToString() + delimiter + TimeSch1LastClick.ToString() + delimiter + TimeSch1PageSubmit.ToString() + delimiter + TimeSch1ClickCount.ToString() + delimiter + Scheuner1.ToString() + delimiter + Scheuner2.ToString() + delimiter + Scheuner3.ToString() + delimiter + TimeSch2FirstClick.ToString() + delimiter + TimeSch2LastClick.ToString() + delimiter + TimeSch2PageSubmit.ToString() + delimiter + TimeSch2ClickCount.ToString() + delimiter + Scheuner4.ToString() + delimiter + Scheuner5.ToString() + delimiter + Scheuner6.ToString() + delimiter + Scheuner7.ToString() + delimiter + Scheuner8.ToString() + delimiter + TimeSch3FirstClick.ToString() + delimiter + TimeSch3LastClick.ToString() + delimiter + TimeSch3PageSubmit.ToString() + delimiter + TimeSch3ClickCount.ToString() + delimiter + Scheuner9.ToString() + delimiter + Scheuner10.ToString() + delimiter + Scheuner11.ToString() + delimiter + Scheuner12.ToString() + delimiter + Scheuner13.ToString() + delimiter + TimeSch4FirstClick.ToString() + delimiter + TimeSch4LastClick.ToString() + delimiter + TimeSch4PageSubmit.ToString() + delimiter + TimeSch4ClickCount.ToString() + delimiter + Scheuner14.ToString() + delimiter + Scheuner15.ToString() + delimiter + Scheuner16.ToString() + delimiter + Scheuner17.ToString() + delimiter + Scheuner18.ToString() + delimiter + TimeLimitationsFirstClick.ToString() + delimiter + TimeLimitationsLastClick.ToString() + delimiter + TimeLimitationsPageSubmit.ToString() + delimiter + TimeLimitationsClickCount.ToString() + delimiter + Limitations.ToString() + delimiter + TimeNoticedFirstClick.ToString() + delimiter + TimeNoticedLastClick.ToString() + delimiter + TimeNoticedPageSubmit.ToString() + delimiter + TimeNoticedClickCount.ToString() + delimiter + ResultNoticed.ToString() + delimiter + ResultUnderstood.ToString() + delimiter + TimeSnumeracyFirstClick.ToString() + delimiter + TimeSnumeracyLastClick.ToString() + delimiter + TimeSnumeracyPageSubmit.ToString() + delimiter + TimeSnumeracyClickCount.ToString() + delimiter + SNumeracy1.ToString() + delimiter + SNumeracy2.ToString() + delimiter + SNumeracy3.ToString() + delimiter + SNumeracy4.ToString() + delimiter + SNumeracy5.ToString() + delimiter + SNumeracy6.ToString() + delimiter + SNumeracy7.ToString() + delimiter + SNumeracy8.ToString() + delimiter + TimePriorexp1FirstClick.ToString() + delimiter + TimePriorexp1LastClick.ToString() + delimiter + TimePriorexp1PageSubmit.ToString() + delimiter + TimePriorexp1ClickCount.ToString() + delimiter + CFExperience.ToString() + delimiter + CFExperienceDetail.ToString() + delimiter + TimePriorexp2FirstClick.ToString() + delimiter + TimePriorexp2LastClick.ToString() + delimiter + TimePriorexp2PageSubmit.ToString() + delimiter + TimePriorexp2ClickCount.ToString() + delimiter + TimeDemo1FirstClick.ToString() + delimiter + TimeDemo1LastClick.ToString() + delimiter + TimeDemo1PageSubmit.ToString() + delimiter + TimeDemo1ClickCount.ToString() + delimiter + Age.ToString() + delimiter + Gender.ToString() + delimiter + GenderOther.ToString() + delimiter + CombinedIncome.ToString() + delimiter + AdultsInHouse.ToString() + delimiter + ChildrenInHouse.ToString() + delimiter + Education.ToString() + delimiter + TimeDemo2FirstClick.ToString() + delimiter + TimeDemo2LastClick.ToString() + delimiter + TimeDemo2PageSubmit.ToString() + delimiter + TimeDemo2ClickCount.ToString() + delimiter + Comments.ToString() + delimiter + Design.ToString() + delimiter + TestResult.ToString() + delimiter + OCStatusAbsoluteTime.ToString() + delimiter + OCChildAbsoluteTime.ToString() + delimiter + OCCompareAbsoluteTime.ToString());
 }
Пример #56
0
 public Student()
 {
     DataOfStudent = new Person();
     Form          = 0;
     Group         = 0;
 }
Пример #57
0
 public Student(Person p, Education e, int g)
 {
     DataOfStudent = p;
     Form          = e;
     Group         = g;
 }
Пример #58
0
        public IActionResult Delete(Education education)
        {
            var result = _educationService.Delete(education);

            return(result.Success ? Ok(result) : BadRequest(result.Message));
        }
Пример #59
0
 public Student(Education educ, int group)
 {
     m_educ  = educ;
     m_group = group;
     Id      = Student._id++;
 }
 public ActionResult Create(Education education)
 {
     db.Educations.Add(education);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }