Ejemplo n.º 1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = AlertID;
         hashCode = (hashCode * 397) ^ Code;
         hashCode = (hashCode * 397) ^ (Source != null ? Source.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Severity != null ? Severity.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Created.GetHashCode();
         hashCode = (hashCode * 397) ^ SnoozedEndDate.GetHashCode();
         hashCode = (hashCode * 397) ^ (ThresholdValue1 != null ? ThresholdValue1.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ThresholdValue2 != null ? ThresholdValue2.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ThresholdValue3 != null ? ThresholdValue3.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ThresholdValue4 != null ? ThresholdValue4.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ThresholdValue5 != null ? ThresholdValue5.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DeviceGuid != null ? DeviceGuid.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AdditionalInfo != null ? AdditionalInfo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AlertCategoryID != null ? AlertCategoryID.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Archived.GetHashCode();
         hashCode = (hashCode * 397) ^ ArchivedDate.GetHashCode();
         hashCode = (hashCode * 397) ^ TicketID.GetHashCode();
         hashCode = (hashCode * 397) ^ (AlertMessage != null ? AlertMessage.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DeviceName != null ? DeviceName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CustomerID;
         hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MessageTemplate != null ? MessageTemplate.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ FolderID.GetHashCode();
         hashCode = (hashCode * 397) ^ PollingCyclesCount.GetHashCode();
         return(hashCode);
     }
 }
 protected override void afterPopulateProps()
 {
     afterPropertySetPopulateProps();
     Owner.SetOnPropChange( OnOwnerPropChange );
     File.SetOnPropChange( OnFilePropChange );
     Link.SetOnPropChange( OnLinkPropChange );
     AcquiredDate.SetOnPropChange( OnAcquiredDatePropChange );
     Archived.SetOnPropChange( OnArchivedPropChange );
     FileType.SetOnPropChange( OnFileTypePropChange );
 }
        public int Save(Archived archived)
        {
            var dataRow = _data.Single(d => d.Id == archived.Id);

            dataRow.Status          = ConfigStatus.Archived;
            dataRow.ArchivedAuthor  = archived.Author;
            dataRow.ArchiveCreation = archived.CreationDate;

            return(dataRow.Id);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Returns HashCode</returns>
 public override int GetHashCode()
 {
     return(String.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|",
                          FunSettings?.GetHashCode() ?? 0,
                          GuestSettings?.GetHashCode() ?? 0,
                          MemberSettings?.GetHashCode() ?? 0,
                          MessagingSettings?.GetHashCode() ?? 0,
                          Security?.GetHashCode() ?? 0,
                          Channels?.GetHashCode() ?? 0,
                          Apps?.GetHashCode() ?? 0,
                          Specialization.GetHashCode(),
                          CloneFrom?.GetHashCode() ?? 0,
                          Archived.GetHashCode(),
                          GroupId?.GetHashCode() ?? 0
                          ).GetHashCode());
 }
Ejemplo n.º 5
0
        public void Archive(Note note)
        {
            _notesRepository.Save(note.Name, note.Content);

            var newName = _notesRepository.Archive(note.Name);

            NoteMetadata metadata = _notesMetadataService.Get(note.Name);

            metadata.Archived = DateTime.Now;

            _notesMetadataService.Remove(note.Name);
            _notesMetadataService.Add(Globals.ArchivePrefix + "/" + newName, metadata);

            _notesMetadataService.Save();

            Archived?.Invoke(this, new ArchivedNoteEventArgs
            {
                ArchivedNote = note
            });
        }
Ejemplo n.º 6
0
        public override IReadOnlyList <string> MergedQualifiers()
        {
            var parameters = new List <string>();

            if (Type != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "type:{0}",
                                             Type.ToParameter()));
            }

            if (In != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "in:{0}",
                                             string.Join(",", In.Select(i => i.ToParameter()))));
            }

            if (Author.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "author:{0}", Author));
            }

            if (Assignee.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "assignee:{0}", Assignee));
            }

            if (Mentions.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "mentions:{0}", Mentions));
            }

            if (Commenter.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "commenter:{0}", Commenter));
            }

            if (Involves.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "involves:{0}", Involves));
            }

            if (Team.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "team:{0}", Team));
            }

            if (State.HasValue)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "state:{0}", State.Value.ToParameter()));
            }

            if (Labels != null)
            {
                parameters.AddRange(Labels.Select(label => string.Format(CultureInfo.InvariantCulture, "label:\"{0}\"", label)));
            }

            if (No.HasValue)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "no:{0}", No.Value.ToParameter()));
            }

            if (Language != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:\"{0}\"", Language.ToParameter()));
            }

            if (Is != null)
            {
                parameters.AddRange(Is.Select(x => string.Format(CultureInfo.InvariantCulture, "is:{0}", x.ToParameter())));
            }

            if (Created != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "created:{0}", Created));
            }

            if (Updated != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "updated:{0}", Updated));
            }

            if (Merged != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "merged:{0}", Merged));
            }

            if (Status.HasValue)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "status:{0}", Status.Value.ToParameter()));
            }

            if (Head.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "head:{0}", Head));
            }

            if (Base.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "base:{0}", Base));
            }

            if (Closed != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "closed:{0}", Closed));
            }

            if (Comments != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "comments:{0}", Comments));
            }

            if (User.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "user:{0}", User));
            }

            if (Repos.Any())
            {
                var invalidFormatRepos = Repos.Where(x => !x.IsNameWithOwnerFormat());
                if (invalidFormatRepos.Any())
                {
                    throw new RepositoryFormatException(invalidFormatRepos);
                }

                parameters.AddRange(Repos.Select(x => string.Format(CultureInfo.InvariantCulture, "repo:{0}", x)));
            }

            if (Milestone.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "milestone:\"{0}\"", Milestone.EscapeDoubleQuotes()));
            }

            if (Archived != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "archived:{0}", Archived.ToString().ToLower()));
            }

            // Add any exclusion parameters
            if (Exclusions != null)
            {
                parameters.AddRange(Exclusions.MergedQualifiers());
            }

            return(new ReadOnlyCollection <string>(parameters));
        }
Ejemplo n.º 7
0
        public Product
        (
            Identifier id,
            Category category,
            Name name,
            Description description,
            Price price,
            Quantity quantity,
            IEnumerable <File> files
        )
        {
            if (id == null)
            {
                throw new ArgumentException($"{nameof(id)} must not be null", nameof(id));
            }

            if (category == null)
            {
                throw new ArgumentException($"{nameof(category)} must not be null", nameof(category));
            }

            if (name == null)
            {
                throw new ArgumentException($"{nameof(name)} must not be null", nameof(name));
            }

            if (description == null)
            {
                throw new ArgumentException($"{nameof(description)} must not be null", nameof(description));
            }

            if (price == null)
            {
                throw new ArgumentException($"{nameof(price)} must not be null", nameof(price));
            }

            if (quantity == null)
            {
                throw new ArgumentException($"{nameof(quantity)} must not be null", nameof(quantity));
            }

            if (files == null)
            {
                throw new ArgumentException($"{nameof(files)} must not be null", nameof(files));
            }

            if (!files.Any())
            {
                throw new ArgumentException($"{nameof(files)} must have at least a file", nameof(files));
            }

            Id          = id;
            Category    = category;
            Name        = name;
            Description = description;
            Price       = price;
            Quantity    = quantity;

            AddRange(files);

            Activated = new Activated(this);
            Archived  = new Archived(this);
            Deleted   = new Deleted(this);

            Status = Activated;
        }
Ejemplo n.º 8
0
        internal override void WriteWPTDetails(XmlWriter writer, GPXWriter gpx)
        {
            base.WriteWPTDetails(writer, gpx);
            if (!gpx.IncludeGroundSpeakExtensions)
            {
                return;
            }
            writer.WriteStartElement(CACHE_PREFIX, "cache", GPXWriter.NS_CACHE);
            if (String.IsNullOrEmpty(CacheID))
            {
                writer.WriteAttributeString("id", gpx.GetNextGUID().ToString());
            }
            else
            {
                writer.WriteAttributeString("id", CacheID);
            }
            writer.WriteAttributeString("available", Available.ToString());
            writer.WriteAttributeString("archived", Archived.ToString());
            // Temp until smart-tag like support
            if (HasCorrected)
            {
                writer.WriteElementString(CACHE_PREFIX, "name", GPXWriter.NS_CACHE, "(*) " + CacheName);
            }
            else
            {
                writer.WriteElementString(CACHE_PREFIX, "name", GPXWriter.NS_CACHE, CacheName);
            }
            writer.WriteElementString(CACHE_PREFIX, "placed_by", GPXWriter.NS_CACHE, PlacedBy);
            writer.WriteStartElement(CACHE_PREFIX, "owner", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("id", OwnerID);
            writer.WriteString(CacheOwner);
            writer.WriteEndElement();
            writer.WriteElementString(CACHE_PREFIX, "type", GPXWriter.NS_CACHE, GetCTypeString(TypeOfCache));
            writer.WriteElementString(CACHE_PREFIX, "container", GPXWriter.NS_CACHE, Container);
            List <CacheAttribute> attrs = gpx.GetAttributes(this.Name);

            writer.WriteStartElement(CACHE_PREFIX, "attributes", GPXWriter.NS_CACHE);
            foreach (CacheAttribute curr in attrs)
            {
                writer.WriteStartElement(CACHE_PREFIX, "attribute", GPXWriter.NS_CACHE);
                if (!String.IsNullOrEmpty(curr.ID))
                {
                    writer.WriteAttributeString("id", curr.ID);
                }
                if (curr.Include)
                {
                    writer.WriteAttributeString("inc", "1");
                }
                else
                {
                    writer.WriteAttributeString("inc", "0");
                }
                writer.WriteString(curr.AttrValue);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
            writer.WriteElementString(CACHE_PREFIX, "difficulty", GPXWriter.NS_CACHE, Difficulty.ToString("0.#", CultureInfo.InvariantCulture));
            writer.WriteElementString(CACHE_PREFIX, "terrain", GPXWriter.NS_CACHE, Terrain.ToString("0.#", CultureInfo.InvariantCulture));
            writer.WriteElementString(CACHE_PREFIX, "country", GPXWriter.NS_CACHE, Country);
            writer.WriteElementString(CACHE_PREFIX, "state", GPXWriter.NS_CACHE, State);
            StringBuilder shortDescription = new StringBuilder();

            if (HasCorrected)
            {
                shortDescription.Append(Catalog.GetString("Original Coordinate:"));
                shortDescription.Append(Utilities.getCoordString(OrigLat, OrigLon));
                shortDescription.Append("<br/>");
            }
            if (gpx.WriteAttributes)
            {
                attrs = gpx.GetAttributes(this.Name);
                foreach (CacheAttribute curr in attrs)
                {
                    if (curr.Include)
                    {
                        shortDescription.Append(Catalog.GetString("Y:"));
                    }
                    else
                    {
                        shortDescription.Append(Catalog.GetString("N:"));
                    }
                    shortDescription.Append(curr.AttrValue);
                    shortDescription.Append("<br/>");
                }
                if (attrs.Count > 0)
                {
                    shortDescription.Append("<hr noshade/>");
                }
            }
            if (!String.IsNullOrEmpty(Notes))
            {
                shortDescription.Append(Notes);
                shortDescription.Append("<hr noshade/>");
            }
            shortDescription.Append(ShortDesc);
            writer.WriteStartElement(CACHE_PREFIX, "short_description", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("html", "True");
            if (gpx.HTMLOutput == HTMLMode.GARMIN)
            {
                writer.WriteCData(Utilities.HTMLtoGarmin(shortDescription.ToString()));
            }
            else if (gpx.HTMLOutput == HTMLMode.PLAINTEXT)
            {
                writer.WriteCData(Utilities.HTMLtoText(shortDescription.ToString()));
            }
            else
            {
                writer.WriteCData(shortDescription.ToString());
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "long_description", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("html", "True");
            if (gpx.HTMLOutput == HTMLMode.GARMIN)
            {
                writer.WriteCData(Utilities.HTMLtoGarmin(LongDesc));
            }
            else if (gpx.HTMLOutput == HTMLMode.PLAINTEXT)
            {
                writer.WriteCData(Utilities.HTMLtoText(LongDesc));
            }
            else
            {
                writer.WriteCData(LongDesc);
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "encoded_hints", GPXWriter.NS_CACHE);
            writer.WriteAttributeString("html", "True");
            if (gpx.HTMLOutput == HTMLMode.GARMIN || gpx.HTMLOutput == HTMLMode.PLAINTEXT)
            {
                writer.WriteCData(Utilities.HTMLtoText(Hint));
            }
            else
            {
                writer.WriteCData(Hint);
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "logs", GPXWriter.NS_CACHE);
            if (gpx.IsMyFinds)
            {
                CacheLog log = gpx.CacheStore.GetLastFindLogBy(this.Name, gpx.MyFindsOwner);
                if (log.LogStatus == "find")
                {
                    log.LogStatus = "Found it";
                }
                log.WriteToGPX(writer);
            }
            else
            {
                List <CacheLog> logs   = gpx.GetCacheLogs(this.Name);
                int             iCount = 0;
                foreach (CacheLog log in logs)
                {
                    if ((iCount >= gpx.LogLimit) && (gpx.LogLimit != -1))
                    {
                        break;
                    }
                    else
                    {
                        log.WriteToGPX(writer);
                    }
                    iCount++;
                }
            }
            writer.WriteEndElement();
            writer.WriteStartElement(CACHE_PREFIX, "travelbugs", GPXWriter.NS_CACHE);
            List <TravelBug> bugs = gpx.GetTravelBugs(this.Name);

            foreach (TravelBug bug in bugs)
            {
                bug.WriteToGPX(writer);
            }
            writer.WriteEndElement();
            writer.WriteEndElement();
        }
Ejemplo n.º 9
0
        public override void OnCommand(Command command)
        {
            Event @event;

            if (command is Archive)
            {
                var archive = command as Archive;
                @event = new Archived
                {
                    EntityId = archive.EntityId
                };
            }
            else if (command is Create)
            {
                var create = command as Create;
                @event = new Created
                {
                    EntityId   = Guid.NewGuid(),
                    DOB        = create.DOB,
                    FirstName  = create.FirstName,
                    Gender     = create.Gender,
                    LastName   = create.LastName,
                    MiddleName = create.MiddleName,
                    Prefix     = create.Prefix,
                    Suffix     = create.Suffix
                };
            }
            else if (command is ChangeName)
            {
                var changeName = command as ChangeName;
                @event = new NameChanged
                {
                    EntityId   = changeName.EntityId,
                    FirstName  = changeName.FirstName,
                    LastName   = changeName.LastName,
                    MiddleName = changeName.MiddleName,
                    Prefix     = changeName.Prefix,
                    Suffix     = changeName.Suffix
                };
            }
            else if (command is UpdateDOB)
            {
                var updateDOB = command as UpdateDOB;
                @event = new DOBChanged
                {
                    EntityId = updateDOB.EntityId,
                    DOB      = updateDOB.DOB,
                };
            }
            else if (command is UpdateGender)
            {
                var updateGender = command as UpdateGender;
                @event = new GenderUpdated
                {
                    EntityId = updateGender.EntityId,
                    Gender   = updateGender.Gender
                };
            }
            else
            {
                throw new NotImplementedException($"The type '{command.GetType().FullName}' does not have a handler");
            }

            this.Write(@event);
        }
Ejemplo n.º 10
0
        public override IReadOnlyList <string> MergedQualifiers()
        {
            var parameters = new List <string>();

            if (In != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "in:{0}", string.Join(",", In)));
            }

            if (Size != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "size:{0}", Size));
            }

            if (Forks != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "forks:{0}", Forks));
            }

            if (Fork != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "fork:{0}", Fork.ToParameter()));
            }

            if (Stars != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "stars:{0}", Stars));
            }

            if (Language != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "language:\"{0}\"", Language.ToParameter()));
            }

            if (User.IsNotBlank())
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "user:{0}", User));
            }

            if (Created != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "created:{0}", Created));
            }

            if (Updated != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "pushed:{0}", Updated));
            }

            if (Archived != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "archived:{0}", Archived.ToString().ToLower()));
            }

            if (Topic != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "topic:{0}", Topic.ToLower()));
            }

            if (Topics != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "topics:{0}", Topics.ToString().ToLower()));
            }
            if (License != null)
            {
                parameters.Add(string.Format(CultureInfo.InvariantCulture, "license:{0}", License.ToParameter()));
            }

            return(parameters);
        }