public virtual bool InsertTracker(ICoordinate coordinate, int index) { Trackers.Insert(index, new TrackerFeature(this, new Point(coordinate), index, null)); TargetFeature.Geometry = GeometryHelper.InsertCurvePoint(TargetFeature.Geometry, coordinate, index); foreach (var topologyRule in FeatureRelationEditors) { topologyRule.UpdateRelatedFeatures(SourceFeature, TargetFeature.Geometry, SelectedTrackerIndices.ToList()); } return(true); }
public MainFormData(IList <Project> projects, int projectId, bool onlyMe, Filter filter) { Projects = new List <ClientProject>(); Projects.Add(new ClientProject(new Project { Id = -1, Name = Languages.Lang.ShowAllIssues })); foreach (Project p in projects) { Projects.Add(new ClientProject(p)); } NameValueCollection parameters = new NameValueCollection(); if (projectId != -1) { parameters.Add("project_id", projectId.ToString()); } if (RedmineClientForm.RedmineVersion >= ApiVersion.V13x) { if (projectId < 0) { try { List <Tracker> allTrackers = (List <Tracker>)RedmineClientForm.redmine.GetTotalObjectList <Tracker>(null); Trackers = allTrackers.ConvertAll(new Converter <Tracker, ProjectTracker>(TrackerToProjectTracker)); } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadTrackers, e); } Categories = null; Versions = null; } else { try { NameValueCollection projectParameters = new NameValueCollection { { "include", "trackers" } }; Project project = RedmineClientForm.redmine.GetObject <Project>(projectId.ToString(), projectParameters); Trackers = new List <ProjectTracker>(project.Trackers); } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadProjectTrackers, e); } try { Categories = new List <IssueCategory>(RedmineClientForm.redmine.GetTotalObjectList <IssueCategory>(parameters)); Categories.Insert(0, new IssueCategory { Id = 0, Name = "" }); } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadCategories, e); } try { Versions = (List <Redmine.Net.Api.Types.Version>)RedmineClientForm.redmine.GetTotalObjectList <Redmine.Net.Api.Types.Version>(parameters); Versions.Insert(0, new Redmine.Net.Api.Types.Version { Id = 0, Name = "" }); } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadVersions, e); } } Trackers.Insert(0, new ProjectTracker { Id = 0, Name = "" }); try { Statuses = new List <IssueStatus>(RedmineClientForm.redmine.GetTotalObjectList <IssueStatus>(parameters)); Statuses.Insert(0, new IssueStatus { Id = 0, Name = Languages.Lang.AllOpenIssues }); Statuses.Add(new IssueStatus { Id = -1, Name = Languages.Lang.AllClosedIssues }); Statuses.Add(new IssueStatus { Id = -2, Name = Languages.Lang.AllOpenAndClosedIssues }); } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadStatuses, e); } try { if (RedmineClientForm.RedmineVersion >= ApiVersion.V14x && projectId > 0) { List <ProjectMembership> projectMembers = (List <ProjectMembership>)RedmineClientForm.redmine.GetTotalObjectList <ProjectMembership>(parameters); ProjectMembers = projectMembers.ConvertAll(new Converter <ProjectMembership, ProjectMember>(ProjectMember.MembershipToMember)); } else { List <User> allUsers = (List <User>)RedmineClientForm.redmine.GetTotalObjectList <User>(null); ProjectMembers = allUsers.ConvertAll(new Converter <User, ProjectMember>(UserToProjectMember)); } ProjectMembers.Insert(0, new ProjectMember()); } catch (Exception) { ProjectMembers = null; //throw new LoadException(Languages.Lang.BgWork_LoadProjectMembers, e); } try { if (RedmineClientForm.RedmineVersion >= ApiVersion.V22x) { Enumerations.UpdateIssuePriorities(RedmineClientForm.redmine.GetTotalObjectList <IssuePriority>(null)); Enumerations.SaveIssuePriorities(); Enumerations.UpdateActivities(RedmineClientForm.redmine.GetTotalObjectList <TimeEntryActivity>(null)); Enumerations.SaveActivities(); } IssuePriorities = new List <Enumerations.EnumerationItem>(Enumerations.IssuePriorities); IssuePriorities.Insert(0, new Enumerations.EnumerationItem { Id = 0, Name = "", IsDefault = false }); Activities = new List <Enumerations.EnumerationItem>(Enumerations.Activities); Activities.Insert(0, new Enumerations.EnumerationItem { Id = 0, Name = "", IsDefault = false }); } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadPriorities, e); } try { if (RedmineClientForm.RedmineVersion >= ApiVersion.V24x) { CustomFields = RedmineClientForm.redmine.GetTotalObjectList <CustomField>(null); } } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadCustomFields, e); } } try { if (onlyMe) { parameters.Add("assigned_to_id", "me"); } else if (filter.AssignedToId > 0) { parameters.Add("assigned_to_id", filter.AssignedToId.ToString()); } if (filter.TrackerId > 0) { parameters.Add("tracker_id", filter.TrackerId.ToString()); } if (filter.StatusId > 0) { parameters.Add("status_id", filter.StatusId.ToString()); } else if (filter.StatusId < 0) { switch (filter.StatusId) { case -1: // all closed issues parameters.Add("status_id", "closed"); break; case -2: // all open and closed issues parameters.Add("status_id", "*"); break; } } if (filter.PriorityId > 0) { parameters.Add("priority_id", filter.PriorityId.ToString()); } if (filter.VersionId > 0) { parameters.Add("fixed_version_id", filter.VersionId.ToString()); } if (filter.CategoryId > 0) { parameters.Add("category_id", filter.CategoryId.ToString()); } if (!String.IsNullOrEmpty(filter.Subject)) { parameters.Add("subject", "~" + filter.Subject); } Issues = RedmineClientForm.redmine.GetTotalObjectList <Issue>(parameters); } catch (Exception e) { throw new LoadException(Languages.Lang.BgWork_LoadIssues, e); } }