예제 #1
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("M");
            if (!IsSystem)
            {
                writer.WriteAttributeString("sys", IsSystem.ToString());
            }

            if (IsPrivate)
            {
                writer.WriteAttributeString("pri", IsPrivate.ToString());
            }

            if (Sender != null && Sender.Length != 0)
            {
                writer.WriteAttributeString("sen", Sender);
            }

            if (Receiver != null && Receiver.Length != 0)
            {
                writer.WriteAttributeString("rec", Receiver);
            }

            writer.WriteString(Text);

            writer.WriteEndElement();
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.SUBJECT, Subject);
            writer.WriteElementString(RedmineKeys.NOTES, Notes);

            if (Id != 0)
            {
                writer.WriteBoolean(RedmineKeys.PRIVATE_NOTES, PrivateNotes);
            }

            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteElementString(RedmineKeys.IS_PRIVATE, IsPrivate.ToString(CultureInfo.InvariantCulture).ToLowerInv());

            writer.WriteIdIfNotNull(RedmineKeys.PROJECT_ID, Project);
            writer.WriteIdIfNotNull(RedmineKeys.PRIORITY_ID, Priority);
            writer.WriteIdIfNotNull(RedmineKeys.STATUS_ID, Status);
            writer.WriteIdIfNotNull(RedmineKeys.CATEGORY_ID, Category);
            writer.WriteIdIfNotNull(RedmineKeys.TRACKER_ID, Tracker);
            writer.WriteIdIfNotNull(RedmineKeys.ASSIGNED_TO_ID, AssignedTo);
            writer.WriteIdIfNotNull(RedmineKeys.PARENT_ISSUE_ID, ParentIssue);
            writer.WriteIdIfNotNull(RedmineKeys.FIXED_VERSION_ID, FixedVersion);

            writer.WriteValueOrEmpty(RedmineKeys.ESTIMATED_HOURS, EstimatedHours);
            writer.WriteIfNotDefaultOrNull(RedmineKeys.DONE_RATIO, DoneRatio);

            writer.WriteDateOrEmpty(RedmineKeys.START_DATE, StartDate);
            writer.WriteDateOrEmpty(RedmineKeys.DUE_DATE, DueDate);
            writer.WriteDateOrEmpty(RedmineKeys.UPDATED_ON, UpdatedOn);

            writer.WriteArray(RedmineKeys.UPLOADS, Uploads);
            writer.WriteArray(RedmineKeys.CUSTOM_FIELDS, CustomFields);

            writer.WriteListElements(RedmineKeys.WATCHER_USER_IDS, (IEnumerable <IValue>)Watchers);
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writer"></param>
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.SUBJECT, Subject);
            writer.WriteElementString(RedmineKeys.NOTES, Notes);

            if (Id != 0)
            {
                writer.WriteElementString(RedmineKeys.PRIVATE_NOTES, PrivateNotes.ToString().ToLowerInvariant());
            }

            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteStartElement(RedmineKeys.IS_PRIVATE);
            writer.WriteValue(IsPrivate.ToString().ToLowerInvariant());
            writer.WriteEndElement();

            writer.WriteIdIfNotNull(Project, RedmineKeys.PROJECT_ID);
            writer.WriteIdIfNotNull(Priority, RedmineKeys.PRIORITY_ID);
            writer.WriteIdIfNotNull(Status, RedmineKeys.STATUS_ID);
            writer.WriteIdIfNotNull(Category, RedmineKeys.CATEGORY_ID);
            writer.WriteIdIfNotNull(Tracker, RedmineKeys.TRACKER_ID);
            writer.WriteIdIfNotNull(AssignedTo, RedmineKeys.ASSIGNED_TO_ID);
            writer.WriteIdIfNotNull(ParentIssue, RedmineKeys.PARENT_ISSUE_ID);
            writer.WriteIdIfNotNull(FixedVersion, RedmineKeys.FIXED_VERSION_ID);

            writer.WriteValueOrEmpty(EstimatedHours, RedmineKeys.ESTIMATED_HOURS);
            writer.WriteValueOrEmpty(DoneRatio, RedmineKeys.DONE_RATIO);
            writer.WriteDateOrEmpty(StartDate, RedmineKeys.START_DATE);
            writer.WriteDateOrEmpty(DueDate, RedmineKeys.DUE_DATE);
            writer.WriteDateOrEmpty(UpdatedOn, RedmineKeys.UPDATED_ON);

            writer.WriteArray(Uploads, RedmineKeys.UPLOADS);
            writer.WriteArray(CustomFields, RedmineKeys.CUSTOM_FIELDS);

            writer.WriteListElements(Watchers as IList <IValue>, RedmineKeys.WATCHER_USER_IDS);
        }
예제 #4
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Origin?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Destination?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DaysOfWeek?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (PricePerPallet?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (PricePerKilogram?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (PricePerCubicMeter?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalAvailableCapacityKG?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (EffectiveFrom?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (EffectiveTo?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TypeOfGoods?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AvailableCapacityLaden?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (CreatedOn?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Frequency?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (IsPrivate.GetHashCode());
            hashCode = hashCode * -1521134295 + (TotalAvailableCapacityLaden?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TotalAvailableCapacityM3?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AvailableCapacityKG?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (AvailableCapacityM3?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (FixedPrice?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (TruckPlate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (DeliveryDate?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ByRA.GetHashCode());
            return(hashCode);
        }
예제 #5
0
        public void SaveConfig()
        {
            StreamWriter writer = new StreamWriter(GlobalSettings.Instance.PluginsPath + "/BuddyStats/Settings.cfg", false);

            writer.WriteLine("IsPrivate=" + IsPrivate.ToString());
            writer.WriteLine("AutoUpdate=" + AutoUpdate);
            writer.Close();
            LogMessage("Settings Saved");
        }
예제 #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = KBID;
         hashCode = (hashCode * 397) ^ Timestamp.GetHashCode();
         hashCode = (hashCode * 397) ^ (Context != null ? Context.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Product != null ? Product.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Rating_Yes;
         hashCode = (hashCode * 397) ^ Rating_No;
         hashCode = (hashCode * 397) ^ Rating_Views;
         hashCode = (hashCode * 397) ^ LastModified.GetHashCode();
         hashCode = (hashCode * 397) ^ IsPrivate.GetHashCode();
         hashCode = (hashCode * 397) ^ Status;
         hashCode = (hashCode * 397) ^ Priority;
         hashCode = (hashCode * 397) ^ (Keywords != null ? Keywords.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Address != null ? Address.GetHashCode() : 0);
         return(hashCode);
     }
 }
예제 #7
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Project != null ? Project.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Tracker != null ? Tracker.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Priority != null ? Priority.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Author != null ? Author.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Category != null ? Category.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Subject != null ? Subject.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ StartDate.GetHashCode();
         hashCode = (hashCode * 397) ^ DueDate.GetHashCode();
         hashCode = (hashCode * 397) ^ DoneRatio.GetHashCode();
         hashCode = (hashCode * 397) ^ PrivateNotes.GetHashCode();
         hashCode = (hashCode * 397) ^ EstimatedHours.GetHashCode();
         hashCode = (hashCode * 397) ^ SpentHours.GetHashCode();
         hashCode = (hashCode * 397) ^ (CustomFields != null ? CustomFields.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CreatedOn.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedOn.GetHashCode();
         hashCode = (hashCode * 397) ^ ClosedOn.GetHashCode();
         hashCode = (hashCode * 397) ^ (Notes != null ? Notes.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AssignedTo != null ? AssignedTo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ParentIssue != null ? ParentIssue.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FixedVersion != null ? FixedVersion.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsPrivate.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalSpentHours.GetHashCode();
         hashCode = (hashCode * 397) ^ TotalEstimatedHours.GetHashCode();
         hashCode = (hashCode * 397) ^ (Journals != null ? Journals.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Changesets != null ? Changesets.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Attachments != null ? Attachments.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Relations != null ? Relations.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Children != null ? Children.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Uploads != null ? Uploads.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Watchers != null ? Watchers.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public bool Equals(DestinyHistoricalStatsActivity input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     ReferenceId == input.ReferenceId ||
                     (ReferenceId.Equals(input.ReferenceId))
                     ) &&
                 (
                     DirectorActivityHash == input.DirectorActivityHash ||
                     (DirectorActivityHash.Equals(input.DirectorActivityHash))
                 ) &&
                 (
                     InstanceId == input.InstanceId ||
                     (InstanceId.Equals(input.InstanceId))
                 ) &&
                 (
                     Mode == input.Mode ||
                     (Mode != null && Mode.Equals(input.Mode))
                 ) &&
                 (
                     Modes == input.Modes ||
                     (Modes != null && Modes.SequenceEqual(input.Modes))
                 ) &&
                 (
                     IsPrivate == input.IsPrivate ||
                     (IsPrivate != null && IsPrivate.Equals(input.IsPrivate))
                 ) &&
                 (
                     MembershipType == input.MembershipType ||
                     (MembershipType != null && MembershipType.Equals(input.MembershipType))
                 ));
        }
예제 #9
0
 public override int GetHashCode()
 {
     return(modulus.GetHashCode() ^ exponent.GetHashCode() ^ IsPrivate.GetHashCode());
 }
예제 #10
0
        private IObservable <Unit> done()
        {
            var nameIsAlreadyTaken = currentWorkspace
                                     .SelectMany(workspace => dataSource.Projects.GetAll(project => project.WorkspaceId == workspace.Id))
                                     .Select(existingProjectsDictionary)
                                     .CombineLatest(currentClient, Name, checkNameIsTaken);

            var projectCreation = currentWorkspace.FirstAsync()
                                  .SelectMany(workspace => checkIfCanContinue(workspace)
                                              .SelectMany(shouldContinue => !shouldContinue
                        ? Observable.Empty <Unit>()
                        : getDto(workspace)
                                                          .SelectMany(dto => interactorFactory.CreateProject(dto).Execute())
                                                          .Do(createdProject => Close(createdProject.Id))
                                                          .SelectUnit()
                                                          )
                                              );

            return(nameIsAlreadyTaken.SelectMany(taken =>
            {
                if (taken)
                {
                    throw new Exception(Resources.ProjectNameTakenError);
                }

                return projectCreation;
            }));

            IObservable <bool> checkIfCanContinue(IThreadSafeWorkspace workspace)
            {
                if (initialWorkspaceId == workspace.Id)
                {
                    return(Observable.Return(true));
                }

                return(View.Confirm(
                           Resources.WorkspaceChangedAlertTitle,
                           Resources.WorkspaceChangedAlertMessage,
                           Resources.Ok,
                           Resources.Cancel
                           ));
            }

            IObservable <CreateProjectDTO> getDto(IThreadSafeWorkspace workspace)
            => Observable.CombineLatest(
                Name.FirstAsync(),
                Color.FirstAsync(),
                currentClient.FirstAsync(),
                interactorFactory.AreProjectsBillableByDefault(workspace.Id).Execute(),
                IsPrivate.FirstAsync(),
                (name, color, client, billable, isPrivate) => new CreateProjectDTO
            {
                Name        = name.Trim(),
                Color       = color.ToHexString(),
                IsPrivate   = isPrivate,
                ClientId    = client?.Id,
                Billable    = billable,
                WorkspaceId = workspace.Id
            }
                );

            Dictionary <long, HashSet <string> > existingProjectsDictionary(IEnumerable <IThreadSafeProject> projectsInWorkspace)
            => projectsInWorkspace.Aggregate(new Dictionary <long, HashSet <string> >(), (dict, project) =>
            {
                var key = project.ClientId ?? noClientId;
                if (dict.ContainsKey(key))
                {
                    dict[key].Add(project.Name);
                    return(dict);
                }

                dict[key] = new HashSet <string> {
                    project.Name
                };
                return(dict);
            });

            bool checkNameIsTaken(Dictionary <long, HashSet <string> > projectNameDictionary, IThreadSafeClient client, string name)
            {
                var key = client?.Id ?? noClientId;

                if (projectNameDictionary.TryGetValue(key, out var projectNames))
                {
                    return(projectNames.Contains(name.Trim()));
                }

                return(false);
            }
        }
예제 #11
0
 private void toggleIsPrivate()
 {
     IsPrivate.Accept(!IsPrivate.Value);
 }
예제 #12
0
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString("subject", Subject);
            writer.WriteElementString("notes", Notes);
            if (Id != 0)
            {
                writer.WriteElementString("private_notes", PrivateNotes.ToString());
            }
            writer.WriteElementString("description", Description);
            writer.WriteIdIfNotNull(Project, "project_id");
            writer.WriteIdIfNotNull(Priority, "priority_id");
            writer.WriteIdIfNotNull(Status, "status_id");
            writer.WriteIdIfNotNull(Category, "category_id");
            writer.WriteIdIfNotNull(Tracker, "tracker_id");
            writer.WriteIdIfNotNull(AssignedTo, "assigned_to_id");
            writer.WriteElementString("is_private", IsPrivate.ToString());
            writer.WriteElementString("parent_issue_id", ParentIssue == null ? null : ParentIssue.Id.ToString(CultureInfo.InvariantCulture));
            writer.WriteIdIfNotNull(FixedVersion, "fixed_version_id");
            writer.WriteIfNotDefaultOrNull(EstimatedHours, "estimated_hours");
            if (StartDate != null)
            {
                writer.WriteElementString("start_date", StartDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            }

            if (DueDate != null)
            {
                writer.WriteElementString("due_date", DueDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            }

            if (UpdatedOn != null)
            {
                writer.WriteElementString("updated_on", UpdatedOn.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture));
            }

            if (DoneRatio != null)
            {
                writer.WriteElementString("done_ratio", string.Format(NumberFormatInfo.InvariantInfo, "{0}", DoneRatio.Value));
            }


            if (Uploads != null)
            {
                writer.WriteStartElement("uploads");
                //ajout Pierre Labrie
                writer.WriteAttributeString("type", "array");

                foreach (var u in Uploads)
                {
                    new XmlSerializer(u.GetType()).Serialize(writer, u);
                }
                writer.WriteEndElement();
            }

            if (CustomFields != null)
            {
                writer.WriteStartElement("custom_fields");
                writer.WriteAttributeString("type", "array");
                foreach (var cf in CustomFields)
                {
                    new XmlSerializer(cf.GetType()).Serialize(writer, cf);
                }
                writer.WriteEndElement();
            }

            if (Watchers != null)
            {
                writer.WriteStartElement("watcher_user_ids");
                writer.WriteAttributeString("type", "array");
                foreach (var watcher in Watchers)
                {
                    new XmlSerializer(typeof(int)).Serialize(writer, watcher.Id);
                }
                writer.WriteEndElement();
            }
        }