Пример #1
0
        /// ------------------------------------------------------------------------------------
        protected override object GetValueForField(ProjectElement element, string fieldName)
        {
            if (fieldName == SessionFileType.kStatusFieldName)
            {
                var    value      = element.MetaDataFile.GetStringValue(fieldName, string.Empty, false);
                var    objectName = "Status" + Session.GetStatusAsEnumParsableString(value);
                object obj;
                if (!_statusIcons.TryGetValue(objectName, out obj))
                {
                    obj = ResourceImageCache.GetBitmap(objectName);
                    _statusIcons[objectName] = obj;
                }
                return(obj);
            }

            if (fieldName == SessionFileType.kStagesFieldName)
            {
                return(_stagesDataProvider.CreateImageForComponentStage(element.GetCompletedStages()));
            }

            if (fieldName == SessionFileType.kDateFieldName)
            {
                var date = base.GetValueForField(element, fieldName);
                return(date);
            }

            return(base.GetValueForField(element, fieldName));
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        protected override object GetSortValueForField(ProjectElement element, string fieldName)
        {
            if (fieldName == SessionFileType.kStatusFieldName)
            {
                var statusString = element.MetaDataFile.GetStringValue(fieldName, string.Empty, false);
                var status       = (Session.Status)Enum.Parse(typeof(Session.Status), Session.GetStatusAsEnumParsableString(statusString));
                return((int)status);
            }

            if (fieldName == SessionFileType.kStagesFieldName)
            {
                return(_stagesDataProvider.GetCompletedRolesKey(element.GetCompletedStages()));
            }

            if (fieldName == SessionFileType.kDateFieldName)
            {
                var dateString = base.GetValueForField(element, fieldName) as string;

                try
                {
                    //we parse it and then generate it because we're trying to migrate old, locale-specific dates to ISO8601 dates
                    return(DateTimeExtensions.ParseDateTimePermissivelyWithException(dateString).ToISO8601TimeFormatDateOnlyString());
                }
                catch (Exception e)
                {
#if DEBUG
                    ErrorReport.NotifyUserOfProblem(e, "only seeing because your'e in DEBUG mode");
#endif
                    return(DateTime.MinValue.ToISO8601TimeFormatDateOnlyString());
                }
            }

            return(base.GetSortValueForField(element, fieldName) as string);
        }