Esempio n. 1
0
        /// <summary>
        ///     Returns the latest SIC Codes before specified date/time
        /// </summary>
        /// <param name="maxDate">Ignore SIC codes changes after this date/time - if empty returns the latest SIC codes</param>
        /// <returns>The employer SIC codes</returns>
        public IEnumerable <OrganisationSicCode> GetSicCodes(DateTime?maxDate = null)
        {
            if (maxDate == null || maxDate.Value == DateTime.MinValue)
            {
                maxDate = SectorType.GetAccountingStartDate().AddYears(1);
            }

            return(OrganisationSicCodes.Where(s => s.Created < maxDate.Value && (s.Retired == null || s.Retired.Value > maxDate.Value)));
        }
Esempio n. 2
0
        public string GetSicSource(DateTime?maxDate = null)
        {
            if (maxDate == null || maxDate.Value == DateTime.MinValue)
            {
                maxDate = SectorType.GetAccountingStartDate().AddYears(1);
            }

            return(OrganisationSicCodes
                   .FirstOrDefault(s => s.Created < maxDate.Value && (s.Retired == null || s.Retired.Value > maxDate.Value))
                   ?.Source);
        }
Esempio n. 3
0
        public EmployerRecord ToEmployerRecord()
        {
            var address = ActiveAddress;

            return(new EmployerRecord()
            {
                Id = OrganisationId,
                Name = OrganisationName,
                CompanyNumber = PrivateSectorReference,
                SicSectors = GetSicSectors(",<br/>"),
                SicCodes = OrganisationSicCodes?.Select(sic => sic.SicCodeId).ToDelimitedString(),
                Address1 = address.Address1,
                Address2 = address.Address2,
                Address3 = address.Address3,
                Country = address.Country,
                PostCode = address.PostCode,
                PoBox = address.PoBox
            });
        }
 public IEnumerable <OrganisationSicCode> GetLatestSicCodes()
 {
     return(OrganisationSicCodes.Where(s => s.Retired == null).OrderByDescending(s => s.Created));
 }
 /// <summary>
 ///     Returns the latest organisation name before specified date/time
 /// </summary>
 /// <param name="accountingDate">Ignore name changes after this date/time - if empty returns the latest name</param>
 /// <returns>The name of the organisation</returns>
 public IEnumerable <OrganisationSicCode> GetSicCodes(DateTime accountingDate)
 {
     return(OrganisationSicCodes.Where(s =>
                                       s.Created < accountingDate && (s.Retired == null || s.Retired.Value > accountingDate)));
 }
 public string GetSicSource(DateTime accountingDate)
 {
     return(OrganisationSicCodes.FirstOrDefault(s =>
                                                s.Created < accountingDate && (s.Retired == null || s.Retired.Value > accountingDate))
            ?.Source);
 }
 public string GetLatestSicSource()
 {
     return(OrganisationSicCodes.Where(s =>
                                       s.Retired == null).OrderByDescending(s => s.Created).FirstOrDefault()
            ?.Source);
 }
Esempio n. 8
0
 public string GetSicSectors(string delimiter = ", ")
 {
     return(OrganisationSicCodes.Select(s => s.SicCode.SicSection.Description).ToDelimitedString(delimiter));
 }