Beispiel #1
0
 private static bool ProjectHasTasks(DataTable table)
 {
     if (table.Rows.Count > 0)
     {
         DataRow row = table.Rows[0];
         foreach (string column in _mapping.TaskMap.Values)
         {
             if(table.HasColumn(column) && row[column] != System.DBNull.Value && !string.IsNullOrEmpty(row[column].ToString()))
             {
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #2
0
        private static bool ValidateResourceColumns(IEnumerable<Field> fields, DataTable inputTable, List<string> errors)
        {
            bool valid = true;
            if (fields != null)
            {
                foreach (var field in fields)
                {

                    if (inputTable.HasColumn(field.Source) )
                    {
                        foreach (DataRow row in inputTable.AsEnumerable().GroupBy(t => t.Field<string>(field.Source)).Select(t=>t.First()))
                        {
                            if (row[field.Source] != System.DBNull.Value && row[field.Source] != null && !string.IsNullOrEmpty(row[field.Source].ToString()))
                            {
                                if (!Repository.GetResources().Resources.Any(t => t.RES_NAME.Trim().ToUpper() == row[field.Source].ToString().Trim().ToUpper()))
                            {
                                valid = false;
                                errors.Add(string.Format("Resource Validation Error: Resource {0} specified in the column name ={1} not found", row[field.Source].ToString(),field.Source));
                            }
                            }
                        }
                    }
                }
            }
            return valid;
        }
Beispiel #3
0
        public static bool ValidateTaskCustomFields(DataTable inputTable, List<string> errors)
        {
            bool valid = true;
            foreach (var customField in _mapping.Task.CustomFields)
            {
                var sourcecolumn = customField.Source;
                if (!inputTable.HasColumn(sourcecolumn))
                    continue;

                var targetColumn = customField.Target;
                if (!customDataSet.CustomFields.Any(t => t.MD_PROP_NAME == targetColumn))
                {
                    Console.WriteLine("Validation Error: Incorrect target mapping found for task custom field source ={0},target={1}", sourcecolumn, targetColumn);
                    errors.Add(string.Format("Validation Error: Incorrect target mapping found for task custom field source ={0},target={1}", sourcecolumn, targetColumn));
                    valid = false;
                }
            }
            return valid;
        }