Ejemplo n.º 1
0
        public DelegateTableRow(IXLTable table, IXLRangeRow row)
        {
            string?FindFieldValue(string name)
            {
                var colNumber = table.FindColumn(col => col.FirstCell().Value.ToString() == name).ColumnNumber();

                return(row.Cell(colNumber).GetValue <string?>());
            }

            string?FindNullableFieldValue(string name)
            {
                var cellValue = FindFieldValue(name);

                return(!string.IsNullOrWhiteSpace(cellValue) ? cellValue : null);
            }

            RowNumber       = row.RowNumber();
            CandidateNumber = FindFieldValue("DelegateID");
            LastName        = FindFieldValue("LastName");
            FirstName       = FindFieldValue("FirstName");
            JobGroupId      = int.TryParse(FindFieldValue("JobGroupID"), out var jobGroupId) ? jobGroupId : (int?)null;
            Active          = bool.TryParse(FindFieldValue("Active"), out var active) ? active : (bool?)null;
            Answer1         = FindFieldValue("Answer1");
            Answer2         = FindFieldValue("Answer2");
            Answer3         = FindFieldValue("Answer3");
            Answer4         = FindFieldValue("Answer4");
            Answer5         = FindFieldValue("Answer5");
            Answer6         = FindFieldValue("Answer6");
            AliasId         = FindFieldValue("AliasID");
            Email           = FindFieldValue("EmailAddress")?.Trim();
            HasPrnRawValue  = FindFieldValue("HasPRN");
            HasPrn          = bool.TryParse(HasPrnRawValue, out var hasPrn) ? hasPrn : (bool?)null;
            Prn             = FindNullableFieldValue("PRN");
            RowStatus       = RowStatus.NotYetProcessed;
        }
Ejemplo n.º 2
0
        public CompetencyTableRow(IXLTable table, IXLRangeRow row)
        {
            string?FindFieldValue(string name)
            {
                var colNumber = table.FindColumn(col => col.FirstCell().Value.ToString().ToLower() == name).ColumnNumber();

                return(row.Cell(colNumber).GetValue <string?>());
            }

            RowNumber             = row.RowNumber();
            CompetencyGroupName   = FindFieldValue("competency group");
            CompetencyName        = FindFieldValue("competency name");
            CompetencyDescription = FindFieldValue("competency description");
            RowStatus             = RowStatus.NotYetProcessed;
        }