예제 #1
0
 public ListItem MustUpdate(string line, List <ListItem> items, DataMapping mapping, List <DataMapping> unique)
 {
     if (unique.Find(_mapping => _mapping.KfColumnSelector.Equals(mapping.KfColumnSelector)) != null)
     {
         for (var i = 0; i < items.Count; i++)
         {
             foreach (var item in items[i].FieldValues)
             {
                 if (item.Key.Equals(mapping.SpColumnId))
                 {
                     if (item.Value != null && item.Value.Equals(line))
                     {
                         return(items[i]);
                     }
                 }
             }
         }
     }
     return(null);
 }
예제 #2
0
        /// <summary>
        /// this methode converts to the correct type
        /// </summary>
        /// <param name="item"></param>
        /// <param name="dataMapping"></param>
        /// <param name="columnValue"></param>
        /// <returns></returns>
        public static ListItem ConvertToCorrectTypeAndSet(ListItem item, DataMapping dataMapping, string columnValue)
        {
            if (dataMapping.SpecialType == "Date")
            {
                if (DateTime.TryParse(columnValue, out DateTime date))
                {
                    item[dataMapping.SpColumnId] = DateTime.ParseExact(columnValue, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture);;
                }
                else
                {
                    TOOLS.LogErrorwithoutExitProgram($"Error Parsing date value : {columnValue}");
                    item[dataMapping.SpColumnId] = "";
                }
            }
            else
            {
                if (columnValue != "")
                {
                    item[dataMapping.SpColumnId] = columnValue;
                }
            }

            return(item);
        }