示例#1
0
        public PersonnelType GetTypeByIdPersonnel(int id)
        {
            string    query = "select pt.id, pt.name from PersonnelType as pt, Personnel as p where p.personnelType = pt.id and p.id = " + id;
            DataTable data  = DataProvider.Instance.ExcuteQuery(query);

            if (data.Rows.Count > 0)
            {
                PersonnelType pt = new PersonnelType(data.Rows[0]);
                return(pt);
            }
            return(null);
        }
示例#2
0
        public List <PersonnelType> GetListPersonnelType()
        {
            List <PersonnelType> list = new List <PersonnelType>();

            DataTable data = DataProvider.Instance.ExcuteQuery("select * from PersonnelType");

            foreach (DataRow item in data.Rows)
            {
                PersonnelType pt = new PersonnelType(item);
                list.Add(pt);
            }

            return(list);
        }
示例#3
0
        void LoadPositionByIdPersonnel(int id)
        {
            PersonnelType pt    = PersonnelTypeDAO.Instance.GetTypeByIdPersonnel(id);
            int           index = -1;
            int           i     = 0;

            foreach (PersonnelType item in cbb_pos.Items)
            {
                if (item.ID == pt.ID)
                {
                    index = i;
                    break;
                }
                i++;
            }
            cbb_pos.SelectedIndex = i;
        }
示例#4
0
        private static List <OrganisationPersonnel> ExtractSoleTraderOrganisationPersonnel(List <SubmittedApplicationAnswer> answers, Guid organisationId, string questionId, PersonnelType personnelType)
        {
            var submittedAnswersOrganisationPersonnel = answers.Where(answer => answer.QuestionId == questionId).GroupBy(a => a.RowNumber).ToList();
            var organisationPersonnel = new List <OrganisationPersonnel>();

            var submittedAnswersOrganisationSoleTrader = answers.Where(answer => answer.QuestionId == QuestionIdOrganisationNameSoleTrade);
            var submittedAnswersOrganisationTypeSoleTraderOrPartnership = answers.Where(answer => answer.QuestionId == QuestionIdSoleTraderOrPartnership);

            if (submittedAnswersOrganisationPersonnel.Count > 0 && submittedAnswersOrganisationTypeSoleTraderOrPartnership.Any())
            {
                foreach (var person in submittedAnswersOrganisationPersonnel)
                {
                    var orgPersonnel = new OrganisationPersonnel
                    {
                        OrganisationId = organisationId,
                        PersonnelType  = personnelType,
                        Name           = submittedAnswersOrganisationSoleTrader.FirstOrDefault()?.Answer
                    };
                    foreach (var record in person)
                    {
                        if (record.Answer == null)
                        {
                            continue;
                        }
                        var dobArray = record.Answer.Split(",");
                        if (dobArray.Length != 2)
                        {
                            continue;
                        }
                        orgPersonnel.DateOfBirthMonth = int.Parse(dobArray[0]);
                        orgPersonnel.DateOfBirthYear  = int.Parse(dobArray[1]);
                    }
                    organisationPersonnel.Add(orgPersonnel);
                }
            }
            else if (submittedAnswersOrganisationTypeSoleTraderOrPartnership.Any() &&
                     submittedAnswersOrganisationTypeSoleTraderOrPartnership.FirstOrDefault()?.Answer == SoleTraderType)
            {
                var orgPersonnel = new OrganisationPersonnel
                {
                    OrganisationId = organisationId,
                    PersonnelType  = personnelType,
                    Name           = submittedAnswersOrganisationSoleTrader.FirstOrDefault()?.Answer
                };
                organisationPersonnel.Add(orgPersonnel);
            }
            return(organisationPersonnel);
        }
示例#5
0
        private static List <OrganisationPersonnel> ExtractTabularAnswerOrganisationPersonnel(List <SubmittedApplicationAnswer> answers, Guid organisationId, string questionId, PersonnelType personnelType)
        {
            var submittedAnswersOrganisationPersonnel = answers.Where(answer => answer.QuestionId == questionId).GroupBy(a => a.RowNumber).ToList();
            var organisationPersonnel = new List <OrganisationPersonnel>();

            foreach (var person in submittedAnswersOrganisationPersonnel)
            {
                var orgPersonnel = new OrganisationPersonnel
                {
                    OrganisationId = organisationId,
                    PersonnelType  = personnelType,
                };
                foreach (var record in person)
                {
                    switch (record.ColumnHeading)
                    {
                    case "Name":
                        orgPersonnel.Name = record.Answer;
                        break;

                    case "Date of birth":
                        var dob = Convert.ToDateTime(record.Answer);
                        orgPersonnel.DateOfBirthMonth = dob.Month;
                        orgPersonnel.DateOfBirthYear  = dob.Year;
                        break;
                    }
                }
                organisationPersonnel.Add(orgPersonnel);
            }
            return(organisationPersonnel);
        }