Пример #1
0
        private static string GetCurrentValueOrigin(IssueAttribute attribute,
                                                    [CanBeNull] object currentValue,
                                                    Guid startVersionGuid,
                                                    [NotNull] ExceptionLineage lineage,
                                                    out DateTime?importDate)
        {
            string origin = null;

            importDate = null;

            foreach (ManagedExceptionVersion exceptionObject in
                     lineage.GetAll()
                     .OrderByDescending(e => e.VersionBeginDate))
            {
                if (!Equals(exceptionObject.GetValue(attribute), currentValue))
                {
                    // value is different --> next version (by date) must have introduced this value
                    break;
                }

                if (exceptionObject.VersionUuid == startVersionGuid)
                {
                    // start version for search (excluded) reached
                    break;
                }

                // value is equal
                origin     = exceptionObject.VersionImportOrigin;
                importDate = exceptionObject.VersionBeginDate;
            }

            return(origin);
        }
Пример #2
0
            public Field(IssueAttribute attribute, [NotNull] FieldDefinition definition)
            {
                Assert.ArgumentNotNull(definition, nameof(definition));

                Attribute  = attribute;
                Definition = definition;
            }
        public object GetValue(IssueAttribute attribute)
        {
            object value;

            return(_editableAttributes.TryGetValue(attribute, out value)
                                       ? value
                                       : null);
        }
Пример #4
0
        private FieldDefinition GetFieldDefinition(IssueAttribute attribute)
        {
            FieldDefinition definition;

            return(_definitionsByAttribute.TryGetValue(attribute, out definition)
                                       ? definition
                                       : null);
        }
Пример #5
0
            Action ActivatePageAndNavigate(IssueAttribute issueAttribute, Type type)
            {
                Action navigationAction = null;

                if (issueAttribute.NavigationBehavior == NavigationBehavior.PushAsync)
                {
                    return(async() =>
                    {
                        var page = ActivatePage(type);
                        TrackOnInsights(page);
                        await Navigation.PushAsync(page);
                    });
                }

                if (issueAttribute.NavigationBehavior == NavigationBehavior.PushModalAsync)
                {
                    return(async() =>
                    {
                        var page = ActivatePage(type);
                        TrackOnInsights(page);
                        await Navigation.PushModalAsync(page);
                    });
                }

                if (issueAttribute.NavigationBehavior == NavigationBehavior.Default)
                {
                    return(async() =>
                    {
                        var page = ActivatePage(type);
                        TrackOnInsights(page);
                        if (page is ContentPage || page is CarouselPage)
                        {
                            await Navigation.PushAsync(page);
                        }
                        else if (page is Shell)
                        {
                            Application.Current.MainPage = page;
                        }
                        else
                        {
                            await Navigation.PushModalAsync(page);
                        }
                    });
                }

                if (issueAttribute.NavigationBehavior == NavigationBehavior.SetApplicationRoot)
                {
                    return(() =>
                    {
                        var page = ActivatePage(type);
                        TrackOnInsights(page);
                        Application.Current.MainPage = page;
                    });
                }

                return(navigationAction);
            }
        public void SetValue(IssueAttribute attribute, [CanBeNull] object value)
        {
            if (attribute == IssueAttribute.ExceptionStatus)
            {
                // normalize the status value
                value = ExceptionObjectUtils.GetNormalizedStatus(value as string);
            }

            _editableAttributes[attribute] = value;
        }
Пример #7
0
        private void WriteValue([NotNull] ManagedExceptionVersion managedExceptionVersion,
                                IssueAttribute attribute,
                                [NotNull] IRowBuffer buffer)
        {
            int fieldIndex = GetFieldIndex(attribute);

            object rawValue = managedExceptionVersion.GetValue(attribute);

            buffer.Value[fieldIndex] = FormatValue(rawValue);
        }
Пример #8
0
        private int GetFieldIndex(IssueAttribute attribute)
        {
            int fieldIndex;

            if (!_attributeFieldIndexes.TryGetValue(attribute, out fieldIndex))
            {
                fieldIndex = _targetFields.GetIndex(attribute, _targetTable);
                _attributeFieldIndexes.Add(attribute, fieldIndex);
            }

            return(fieldIndex);
        }
Пример #9
0
 public ExceptionAttributeConflict(IssueAttribute attribute,
                                   object updateValue,
                                   object currentValue,
                                   object originalValue,
                                   [CanBeNull] string currentValueOrigin,
                                   DateTime?currentValueImportDate)
 {
     Attribute              = attribute;
     UpdateValue            = updateValue;
     CurrentValue           = currentValue;
     OriginalValue          = originalValue;
     CurrentValueOrigin     = currentValueOrigin;
     CurrentValueImportDate = currentValueImportDate;
 }
Пример #10
0
        private ExceptionAttributeConflict CreateConflict(
            IssueAttribute attribute, object newValue, object currentValue,
            object originalValue, Guid lineageUuid, Guid startVersionGuid)
        {
            ExceptionLineage lineage = _lineages[lineageUuid];

            DateTime?currentValueImportDate;
            string   currentValueOrigin = GetCurrentValueOrigin(
                attribute, currentValue, startVersionGuid, lineage,
                out currentValueImportDate);

            return(new ExceptionAttributeConflict(attribute,
                                                  newValue, currentValue, originalValue,
                                                  currentValueOrigin,
                                                  currentValueImportDate));
        }
Пример #11
0
        public IField CreateField(IssueAttribute attribute, bool optional = false)
        {
            FieldDefinition definition = GetFieldDefinition(attribute);

            if (definition == null)
            {
                if (optional)
                {
                    return(null);
                }

                throw new ArgumentException($@"Field definition not found for {attribute}",
                                            nameof(attribute));
            }

            return(definition.CreateField());
        }
Пример #12
0
        public string GetName(IssueAttribute attribute, bool optional = false)
        {
            FieldDefinition fieldDefinition = GetFieldDefinition(attribute);

            if (fieldDefinition == null)
            {
                if (optional)
                {
                    return(null);
                }

                throw new ArgumentException(
                          $@"No field definition for attribute {attribute}",
                          nameof(attribute));
            }

            return(fieldDefinition.Name);
        }
Пример #13
0
			Action ActivatePageAndNavigate (IssueAttribute issueAttribute, Type type)
			{
				Action navigationAction = null;

				if (issueAttribute.NavigationBehavior == NavigationBehavior.PushAsync) {
					return async () => {
						var page = ActivatePage (type);
						TrackOnInsights (page);
						await Navigation.PushAsync (page);
					};
				}

				if (issueAttribute.NavigationBehavior == NavigationBehavior.PushModalAsync) {
					return async () => {
						var page = ActivatePage (type);
						TrackOnInsights (page);
						await Navigation.PushModalAsync (page);
					};
				}

				if (issueAttribute.NavigationBehavior == NavigationBehavior.Default) {
					return async () => {
						var page = ActivatePage (type);
						TrackOnInsights (page);
						if (page is ContentPage || page is CarouselPage) {
							
							await Navigation.PushAsync (page);

						} else {
							await Navigation.PushModalAsync (page);
						}
					}; 
				}

				if (issueAttribute.NavigationBehavior == NavigationBehavior.SetApplicationRoot) {
					return () => {
						var page = ActivatePage (type);
						TrackOnInsights (page);
						Application.Current.MainPage = page;
					};
				}

				return navigationAction;
			}
Пример #14
0
        public int GetIndex(IssueAttribute attribute, ITable table, bool optional = false)
        {
            Assert.ArgumentNotNull(table, nameof(table));

            FieldDefinition fieldDefinition = GetFieldDefinition(attribute);

            if (fieldDefinition != null)
            {
                string fieldName = fieldDefinition.Name;

                return(GetIndex(fieldName, table, optional));
            }

            if (optional)
            {
                return(-1);
            }

            throw new ArgumentException(
                      $@"No field definition for attribute {attribute}",
                      nameof(attribute));
        }
Пример #15
0
 private static bool HasField([NotNull] ITable table,
                              IssueAttribute attribute,
                              [NotNull] IIssueTableFields fields)
 {
     return(fields.GetIndex(attribute, table, optional: true) >= 0);
 }
Пример #16
0
 protected int GetIndex(IssueAttribute attribute, bool optional = false)
 {
     return(_fields.GetIndex(attribute, _table, optional));
 }
Пример #17
0
 private static IssueTableFields.Field Map(IssueAttribute attribute,
                                           [NotNull] FieldDefinition definition)
 {
     return(new IssueTableFields.Field(attribute, definition));
 }
Пример #18
0
 public bool HasField(IssueAttribute attribute, ITable table)
 {
     return(GetIndex(attribute, table, optional: true) >= 0);
 }