private void DoUpdate() { List <Task> targetItems = targetProjectView.Find(targetFind); List <Task> sourceItems = sourceProjectView.Find(targetFind); foreach (Hansoft.ObjectWrapper.Task targetTask in targetItems) { Hansoft.ObjectWrapper.Task sourceTask = sourceItems.FirstOrDefault(s => s.LinkedTasks.Contains(targetTask)); if (sourceTask != null) { foreach (ColumnMapping mapping in columnMappings) { // TODO: Simplify the sequence below if (mapping.SourceColumn.IsCustomColumn && mapping.TargetColumn.IsCustomColumn && (mapping.SourceColumn.CustomColumn.m_Type == mapping.TargetColumn.CustomColumn.m_Type)) { targetTask.SetCustomColumnValue(mapping.TargetColumn.CustomColumn, CustomColumnValue.FromInternalValue(targetTask, mapping.TargetColumn.CustomColumn, sourceTask.GetCustomColumnValue(mapping.SourceColumn.CustomColumn).InternalValue)); } else { object sourceValue; if (mapping.SourceColumn.IsCustomColumn) { sourceValue = sourceTask.GetCustomColumnValue(mapping.SourceColumn.CustomColumn); } else { sourceValue = sourceTask.GetDefaultColumnValue(mapping.SourceColumn.DefaultColumnType); } if (mapping.TargetColumn.IsCustomColumn) { string endUserString; if (sourceValue is float || sourceValue is double) { endUserString = String.Format(new System.Globalization.CultureInfo("en-US"), "{0:F1}", sourceValue); } else { endUserString = sourceValue.ToString(); } targetTask.SetCustomColumnValue(mapping.TargetColumn.CustomColumn, endUserString); } else { targetTask.SetDefaultColumnValue(mapping.TargetColumn.DefaultColumnType, sourceValue); } } } } } }