Пример #1
0
        public IActionResult CreateRelationship(int experienceId, int personId)
        {
            PersonExperience personExperience = new PersonExperience(personId, experienceId);

            db.PeopleExperiences.Add(personExperience);
            db.SaveChanges();
            return(RedirectToAction("Details", new { id = experienceId }));
        }
Пример #2
0
 private void AssertPersonExperience(PersonExperience exp,
                                     UpsertPersonExperienceCommand sut)
 {
     Assert.NotNull(exp);
     Assert.Equal(1, exp.ExperienceId);
     Assert.Equal(sut.CompanyName, exp.CompanyName);
     Assert.Equal(sut.Location, exp.Location);
     Assert.Equal(sut.Position, exp.Position);
     Assert.Equal(sut.FromDate, exp.FromDate);
     Assert.Equal(sut.ToDate, exp.ToDate);
     Assert.Equal(Defaults.PersonId, exp.PersonId);
 }
        public IActionResult Create(Experience experience)
        {
            db.Experiences.Add(experience);
            var persons = Request.Form["PersonId"];

            for (int i = 0; i < persons.Count; i++)
            {
                PersonExperience pe = new PersonExperience();
                pe.PersonId     = int.Parse(persons[i]);
                pe.ExperienceId = experience.ExperienceId;
                db.PersonExperiences.Add(pe);
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        internal static async Task SeedExperience(this ILifetimeScope scope,
                                                  int experienceId = 1,
                                                  int personId     = Defaults.PersonId,
                                                  bool seedDuty    = true,
                                                  bool seedSkill   = true)
        {
            var db = scope.Resolve <AppDbContext>();

            var toAdd = new PersonExperience()
            {
                ExperienceId = experienceId,
                PersonId     = personId,
                CompanyName  = "CompanyName",
                FromDate     = Defaults.Today.AddDays(-10),
                ToDate       = Defaults.Today.AddDays(-1),
                Location     = "Location",
                ModifyDate   = Defaults.Today,
                Position     = "Position",
            };

            if (seedDuty)
            {
                var duty = new PersonExperienceDuty()
                {
                    DutyId = 1,
                    Name   = "DutyName"
                };
                if (seedSkill)
                {
                    duty.PersonExperienceDutySkill = new List <PersonExperienceDutySkill>()
                    {
                        new PersonExperienceDutySkill()
                        {
                            Id    = 1,
                            Skill = SkillHelper.CreateSkill()
                        }
                    };
                }
                toAdd.PersonExperienceDuty = new List <PersonExperienceDuty>()
                {
                    duty
                };
            }
            db.PersonExperience.Add(toAdd);
            await db.SaveChangesAsync();
        }
Пример #5
0
        private void SavePositions_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                List <PersonPosition> positions = new List <PersonPosition>();
                positions = PersonPositions.Items.OfType <PersonPosition>().ToList();
                foreach (PersonPosition pos in positions)
                {
                    pos.isMainPosition = false;
                    if (_info is null)
                    {
                        pos.emplid = 0;
                    }
                    else
                    {
                        pos.emplid = _info.emplid;
                    }
                }
                positions.Find(p => p.positionId == (short)code.SelectedValue).isMainPosition = true;
                _model.UpdatePersonPosition(positions);

                PersonExperience experience = new PersonExperience
                {
                    positionExp       = Convert.ToInt16(positionExp.Text),
                    totalExp          = Convert.ToInt16(totalExp.Text.ToString()),
                    specializationExp = Convert.ToInt16(specExp.Text),
                    lastChangesDate   = lastChanges.SelectedDate.ToString()
                };
                if (_info is null)
                {
                    experience.emplid = 0;
                }
                else
                {
                    experience.emplid = _info.emplid;
                }

                _model.UpdatePedExp(experience);
            }
            catch (Exception ex) { MessageBox.Show("Невірно введені дані"); }
        }
Пример #6
0
        public PersonInfoView(PersonInfoModel infoModel, bool editable)
        {
            InitializeComponent();
            if (editable == true)
            {
                PanelPersonInfo.IsEnabled  = true;
                PanelPositions.IsEnabled   = true;
                PanelEducation.IsEnabled   = true;
                PanelMilitary.IsEnabled    = true;
                PanelDisability.IsEnabled  = true;
                PanelMentalCheck.IsEnabled = true;
            }
            infoModel.RunTasksPersonInfo();
            _model = infoModel;

            _info           = _model.Info;
            _positions      = _model.Positions.Item1;
            _experience     = _model.Positions.Item2;
            _diplomas       = _model.Diplomas;
            _militaryInfo   = _model.Military;
            _disabilityInfo = _model.Disability;
            _mentalCheck    = _model.MentalCheck;

            PersonPositions.Items.Clear();
            GridEducation.Items.Clear();

            LastName.Text          = _info.surname;
            FirstName.Text         = _info.firstname;
            MidName.Text           = _info.patronymic;
            iid.Text               = _info.iid.ToString();
            Phone.Text             = _info.phone.ToString();
            Address.Text           = _info.emplAddress;
            BirthDate.SelectedDate = Convert.ToDateTime(_info.birthdate);
            CyclKomis.Text         = _info.cyclKomis;
            Position.Text          = _info.position;
            pedWork.IsChecked      = _info.pedWorkload;
            milLiable.IsChecked    = _info.isMilitaryBound;
            isRetired.IsChecked    = _info.isRetired;
            sex.Text               = _info.sex.ToString();
        }
Пример #7
0
        public static void Seed(InteractiveCvContext context)
        {
            // Look for any Person.
            if (context.Person.Any())
            {
                return;   // DB has been seeded
            }

            var person = new Person {
                Name = "Full Name", Birthday = DateTime.Parse("1986-03-14"), AboutMe = "About me text", Location = "City, Country", EmailAddress = "Emailaddress"
            };

            context.Person.Add(person);
            context.SaveChanges();

            var education = new PersonEducation {
                PersonID = 1, SchoolName = "School Name", Course = "Course Title", Description = "Course Description", Location = "City, Country", StartDate = DateTime.Parse("2010-09-01"), EndDate = DateTime.Parse("2013-6-30")
            };

            context.PersonEducation.Add(education);
            context.SaveChanges();

            var experience = new PersonExperience {
                PersonID = 1, CompanyName = "Company Name", Function = "Function Title", Location = "City, Country", StartDate = DateTime.Parse("2013-09-01"), EndDate = DateTime.Parse("2015-6-30"), WebsiteUrl = "www.company.be", Description = "Function Description"
            };

            context.PersonExperience.Add(experience);
            context.SaveChanges();

            var categories = new AbilityCategory[]
            {
                new AbilityCategory {
                    Description = "Skills"
                },
                new AbilityCategory {
                    Description = "Tools"
                }
            };

            foreach (AbilityCategory c in categories)
            {
                context.AbilityCategory.Add(c);
            }
            context.SaveChanges();

            var abilities = new PersonAbility[]
            {
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 1, Description = "SQL", Score = 3
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 1, Description = "C#", Score = 4
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 1, Description = "HTML(5)", Score = 3
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 1, Description = "CSS", Score = 3
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 1, Description = "Java", Score = 3
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 1, Description = "Bootstrap Framework", Score = 2
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 2, Description = "Visual Studio", Score = 3
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 2, Description = "GitHub", Score = 2
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 2, Description = "Microsoft Office", Score = 3
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 2, Description = "SQL Server", Score = 2
                },
                new PersonAbility {
                    PersonID = 1, AbilityCategoryID = 2, Description = "Windows Powershell", Score = 2
                }
            };

            foreach (PersonAbility p in abilities)
            {
                context.PersonAbility.Add(p);
            }
            context.SaveChanges();
        }