示例#1
0
        public IActionResult Edit(int?id)
        {
            Issue issue;

            if (id != null)
            {
                issue = issuesData.GetById((int)id);
                if (issue is null)
                {
                    return(NotFound());
                }
            }
            else
            {
                issue = new Issue();
                issue.CreationDate = DateTime.Now.Date.AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute);
            }


            var issue_model = new IssueViewModel
            {
                Content       = issue.Content,
                CreationDate  = issue.CreationDate,
                ExecutionDate = issue.ExecutionDate,
                Header        = issue.Header,
                Id            = issue.Id,
                Status        = issue.Status,
                StatusId      = issue.StatusId,
                //Issue = issue,
                Statuses = issuesData.GetStatuses()
            };

            return(View(issue_model));
        }
示例#2
0
        public async Task <IActionResult> CreateIssue(IssueViewModel issueVM, int statusId, int storyId, int sprintId)
        {
            if (ModelState.IsValid)
            {
                Status status = await _plansService.GetStatus(new ServiceContext()
                {
                    ContextId = "TEST"
                }, issueVM.StatusId);

                Story story = await _plansService.GetStory(new ServiceContext()
                {
                    ContextId = "TEST"
                }, issueVM.StoryId);

                Issue issue = issueVM.ViewModelToEntity(status, story);

                await _plansService.CreateIssue(new ServiceContext()
                {
                    ContextId = "TEST"
                }, issue);

                return(RedirectToAction(nameof(Index), new { id = issueVM.SprintId }));
            }
            issueVM.StatusId = statusId;
            issueVM.StoryId  = storyId;
            issueVM.SprintId = sprintId;
            return(View(issueVM));
        }
示例#3
0
        private void Create(IssueViewModel viewModel)
        {
            int userId = HttpContext.Current.User.Identity.GetUserId <int>();

            if (!_groupService.IsGroupOwner(viewModel.GroupId, userId))
            {
                throw new ArgumentException("Wrong groupId or group does not belong to you");
            }

            var group = _groupService.Get(viewModel.GroupId);

            viewModel.IssueNumber = ++group.IssuesTotal;
            _groupRepository.Update(group);

            int     issueId = _issueRepository.Add(viewModel.ToEntity());
            Comment comment = new Comment()
            {
                CreatedAt = DateTime.Now,
                IssueId   = issueId,
                Text      = string.IsNullOrWhiteSpace(viewModel.Text)? string.Empty : viewModel.Text,
                UserId    = userId,
                IsEdited  = false
            };

            _commentRepository.Add(comment);
        }
示例#4
0
        public ActionResult AlertRemove(Guid id)
        {
            var context = PortalCrmConfigurationManager.CreateServiceContext();

            var issue = context.CreateQuery("adx_issue").FirstOrDefault(adxIssue => adxIssue.GetAttributeValue <Guid>("adx_issueid") == id);

            if (issue == null || !Authorized(context, issue))
            {
                return(new EmptyResult());
            }

            var issueDataAdapter = new IssueDataAdapter(issue);
            var user             = PortalCrmConfigurationManager.CreatePortalContext().User;

            if (user == null)
            {
                return(new EmptyResult());
            }

            issueDataAdapter.DeleteAlert(user.ToEntityReference());

            var issueViewModel = new IssueViewModel
            {
                Issue = issueDataAdapter.Select(),
                CurrentUserHasAlert = issueDataAdapter.HasAlert()
            };

            return(PartialView("Tracking", issueViewModel));
        }
        public ActionResult SearchIssue(IssueViewModel Model)
        {
            StoreService service = new StoreService();

            Model = service.SearchIssue(Model);
            return(PartialView("_IssueGrid", Model.IssueList));
        }
示例#6
0
        public ActionResult CreateIssue(IssueViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "IssueProblem");

                return(View());
                //Redirect tek nje error page
            }


            Issue issue = new Issue()
            {
                Code     = viewModel.Code,
                Date     = DateTime.Now,
                Category = viewModel.Category,
                Item     = viewModel.Item,
                Priority = viewModel.Priority,
                Status   = viewModel.Status,
                Note     = viewModel.Note
            };

            _context.Issues.Add(issue);
            _context.SaveChanges();

            return(View());
        }
示例#7
0
        public async Task <IActionResult> CreateAsync(int projectId, IssueViewModel model)
        {
            model.CanEdit = true;
            var projectResult =
                await projects.GetProjectForEditingAsync <ProjectViewModel>(projectId, User);

            if (projectResult.NotificationType == NotificationType.Error)
            {
                this.AddNotification(projectResult.Message, projectResult.NotificationType);
                return(RedirectToAction("Index", "Projects"));
            }

            await PerformServerValidationsAsync(projectResult.Value, model);

            if (!ModelState.IsValid)
            {
                await GetDropdownValues(projectId);

                return(View(model));
            }

            var result = await issues.CreateIssueAsync(projectId, model, User);

            this.AddNotification(result.Message, result.NotificationType);

            return(RedirectToAction("Edit", "Projects", new { id = projectId }));
        }
        public CarViewModel CarIssues(string id)
        {
            var car    = this.db.Cars.FirstOrDefault(c => c.Id == id);
            var issues = this.db.Issues.Where(i => i.CarId == car.Id).ToArray();

            var issuesViewModel = new List <IssueViewModel>();

            foreach (var issue in issues)
            {
                var issueViewModel = new IssueViewModel()
                {
                    Id          = issue.Id,
                    Description = issue.Description,
                    IsFixed     = issue.IsFixed,
                };
                issuesViewModel.Add(issueViewModel);
            }

            var carViewModel = new CarViewModel()
            {
                Id     = car.Id,
                Model  = car.Model,
                Year   = car.Year,
                Issues = issuesViewModel,
            };

            return(carViewModel);
        }
示例#9
0
        private async Task PerformServerValidationsAsync(ProjectViewModel project,
                                                         IssueViewModel newIssue, IssueListModel oldIssue = null)
        {
            if (project.Issues.Any(i => i.Title == newIssue.Title && i.Id != newIssue.Id))
            {
                ModelState.AddModelError(nameof(newIssue.Title),
                                         "Project already has an issue with this Title");
            }

            if (oldIssue == null && newIssue.DueDate <= DateTime.Today ||
                oldIssue?.DueDate != newIssue.DueDate && newIssue.DueDate <= DateTime.Today)
            {
                ModelState.AddModelError(nameof(newIssue.DueDate),
                                         "Date must be in the future");
            }

            if (project.Priorities.All(p => p != newIssue.Priority))
            {
                ModelState.AddModelError(nameof(newIssue.Priority),
                                         "Priority is not valid for this Project");
            }

            if (!await labels.LabelsExistInProjectAsync(project.Id.Value, newIssue.SelectedLabelIds))
            {
                ModelState.AddModelError(nameof(newIssue.SelectedLabelIds),
                                         "Not all Labels are valid for this Project");
            }

            if (oldIssue != null &&
                !GetAvailableStatuses(oldIssue.Status).Contains(newIssue.Status))
            {
                ModelState.AddModelError(nameof(newIssue.Status),
                                         "Status transition is not valid");
            }
        }
示例#10
0
        // GET: Issues/Edit/5
        public async Task <IActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var issue = await _context.Issue
                        .Include(i => i.Project)
                        .FirstOrDefaultAsync(i => i.Id == id);

            if (issue == null)
            {
                return(NotFound());
            }

            var viewmodel = new IssueViewModel()
            {
                Id          = issue.Id,
                Name        = issue.Name,
                Description = issue.Description,
                Priority    = issue.Priority,
                Severity    = issue.Severity,
                Status      = issue.Status,
                Project     = issue.Project.Id,
                Projects    = _context.Project.ToList(),
            };

            return(View(viewmodel));
        }
示例#11
0
        public async Task <IActionResult> Create([Bind("Name,Description,Severity,Priority,Status,Project")] IssueViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                Issue issue = new Issue()
                {
                    Name        = viewModel.Name,
                    Description = viewModel.Description,
                    Severity    = viewModel.Severity,
                    Priority    = viewModel.Priority,
                    Status      = viewModel.Status,
                    Project     = _context.Project.Find(viewModel.Project),
                };
                _context.Add(issue);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Details), new { id = issue.Id }));
            }
            var currentuserid = _userManager.GetUserId(User);

            viewModel.Projects = await _context.UserProject
                                 .Where(up => up.UserId.Equals(currentuserid))
                                 .Select(up => up.Project)
                                 .Include(p => p.CreatedBy)
                                 .Include(p => p.LastModifiedBy)
                                 .ToListAsync();

            return(View(viewModel));
        }
        public void IssueViewModel_can_be_assigned_from_raw_entity()
        {
            Issue issueEntity = Mock.Of <Issue>(
                i => i.Title == "Title" &&
                i.ShortDescription == "Short" &&
                i.LongDescription == "Long" &&
                i.StateAbbrev == "MO" &&
                i.IsStateIssue == true &&
                i.FundingGoal == 75000.00 &&
                i.CreatedAt == DateTime.Now &&
                i.UpdatedAt == DateTime.Now &&
                i.Id == 1 &&
                i.AuthorID == "authorId" &&
                i.FundingRaised == 2500 &&
                i.IsFundable == true &&
                i.IsVotableIssue == false &&
                i.VoteCountNeeded == 0 &&
                i.Votes == new List <Vote>() &&
                i.Author.Id == "AuthorID" &&
                i.GetPrettyPercentage() == "60" &&
                i.VotesLeftUntilApproval() == 1500
                );

            IssueViewModel vm = issueEntity;

            Assert.AreEqual("Title", vm.Title);
            Assert.AreEqual("Short", vm.ShortDescription);
            Assert.AreEqual("Long", vm.LongDescription);
            Assert.AreEqual("MO", vm.StateAbbrev);
            Assert.IsTrue(vm.IsStateIssue);
            Assert.AreEqual(75000.00, vm.FundingGoal);
            Assert.AreEqual("60", vm.ApprovalPercentage);
            Assert.AreEqual(1500, vm.VotesLeftUntilApproval);
            Assert.AreEqual(1, vm.Id);
        }
        // GET: IssueViewModel/Create
        public ActionResult Create(int?projectId)
        {
            if (projectId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                //zamiast tego można przekierować do IssueController
            }

            var columns             = db.Columns.Where(p => p.Board.ProjectId == projectId).ToList();
            var columnsToSelectList = new List <SelectListItem>();

            columnsToSelectList.Add(new SelectListItem()
            {
                Text = "BACKLOG", Value = ""
            });
            foreach (Column col in columns)
            {
                columnsToSelectList.Add(new SelectListItem()
                {
                    Text = col.Name, Value = col.Id.ToString()
                });
            }

            IssueViewModel issueViewModel = new IssueViewModel();

            issueViewModel.ProjectId   = projectId.GetValueOrDefault();
            issueViewModel.ProjectName = db.Projects.Where(p => p.Id == projectId).FirstOrDefault().Name;
            issueViewModel.ColumnsList = columnsToSelectList;

            return(View(issueViewModel));
        }
示例#14
0
        public async Task <IActionResult> Get(int?issue)
        {
            if (!issue.HasValue)
            {
                return(StatusCode(400, "Invalid parameter(s)."));
            }

            //Get issue
            var data = await _issueRepository.Get(issue.Value);

            if (data == null)
            {
                return(StatusCode(404, String.Format("Unable to find issue with ID '{0}'.", issue.Value)));
            }

            //Convert to view model
            var result = new IssueViewModel
            {
                IssueId     = data.IssueId,
                RoomCode    = data.RoomCode,
                CreatedOn   = data.CreatedOn,
                Resolved    = data.Resolved,
                Description = data.Description
            };

            return(Ok(result));
        }
示例#15
0
        public async Task <IActionResult> Update([FromBody] IssueViewModel model)
        {
            if (model == null)
            {
                return(StatusCode(400, "Invalid parameter(s)."));
            }

            Issue issue = new Issue
            {
                IssueId     = model.IssueId,
                RoomCode    = model.RoomCode,
                CreatedOn   = model.CreatedOn,
                Description = model.Description,
                Resolved    = model.Resolved
            };

            //Update issue
            var result = await _issueRepository.Update(issue);

            if (result == null)
            {
                return(StatusCode(500, "A problem occured while updating the issue. Please try again!"));
            }

            return(Ok(new IssueViewModel
            {
                IssueId = result.IssueId,
                RoomCode = result.RoomCode,
                Description = result.Description,
                CreatedOn = result.CreatedOn,
                Resolved = result.Resolved
            }));
        }
示例#16
0
        private List <IssueViewModel> CreateIssueViews(List <Issue> filteredIssues)
        {
            var filteredIssueViews = new List <IssueViewModel>();
            var admins             = admin.GetAllAdmins();
            var issueStatuses      = issueStatus.GetAllIssueStatuses();

            foreach (Issue i in filteredIssues)
            {
                var rv = new IssueViewModel();
                rv.Issue                = i;
                rv.AssignedToLabel      = admin.GetUserNameById(i.AssignedTo);
                rv.IssueStatusNameLabel = issueStatus.GetIssueStatusNameById(i.IssueStatus);
                rv.AssignedTo           = GetListOfAdmins(admins, -1);
                rv.IssueStatusName      = GetListOfIssueStatuses(issueStatuses, -1);
                rv.OwnerLink            = string.Empty;
                rv.Issue.SiteRoot       = VerifyAndFixTralingSlash(rv.Issue.SiteRoot);

                if (rv.Issue.CreatedBy != "Anonymous")
                {
                    rv.OwnerLink = String.Concat(rv.Issue.SiteRoot, rv.Issue.CreatedBy);
                }
                filteredIssueViews.Add(rv);

                rv.PackageLink = String.Concat(rv.Issue.SiteRoot, rv.Issue.PackageID, "/", rv.Issue.PackageVersion);
            }
            return(filteredIssueViews);
        }
示例#17
0
        public virtual async Task <IActionResult> CreateIssue([FromBody] IssueViewModel issue, [FromRoute][Required] int?projectId)
        {
            var project = await db.Project
                          .Include(project => project.Issues)
                          .Include(project => project.UserProjects)
                          .SingleOrDefaultAsync(project => project.Id == projectId);

            var userId = UserId();

            if (!project.UserProjects.Any(link => link.UserId == userId))
            {
                return(Forbid());
            }

            var model = mapper.Map <Issue>(issue);

            model.Status = IssueStatus.New;
            var max = project.Issues.Max(i => i.Index);

            model.Index = max == null ? 0 : max + 1;

            project.Issues.Add(model);
            await db.SaveChangesAsync();

            return(StatusCode(201));
        }
示例#18
0
        public HashSet <IssueViewModel> RetrieveAllIssues(string status, string query)
        {
            User currentUser = this.LoginRepository.RetrieveCurrentlyLogged();
            HashSet <IssueViewModel> issuesVm  = new HashSet <IssueViewModel>();
            List <Issue>             allIssues = this.IssueRepository.All().ToList();

            if (status != null && status != "All")
            {
                allIssues = allIssues.Where(i => i.Status.ToString() == status).ToList();
            }

            if (query != null)
            {
                query     = WebUtility.UrlDecode(query);
                allIssues = allIssues.Where(i => i.Name.ToLower().Contains(query.ToLower())).ToList();
            }

            ConfigureIssueMapper(currentUser);
            foreach (Issue issue in allIssues)
            {
                IssueViewModel ivm = Mapper.Map <IssueViewModel>(issue);

                issuesVm.Add(ivm);
            }

            return(issuesVm);
        }
示例#19
0
        public async Task <IActionResult> UpdateIssue(int id, IssueViewModel issueVM)
        {
            if (id != issueVM.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                Status status = await _plansService.GetStatus(new ServiceContext()
                {
                    ContextId = "TEST"
                }, issueVM.StatusId);

                Story story = await _plansService.GetStory(new ServiceContext()
                {
                    ContextId = "TEST"
                }, issueVM.StoryId);

                Issue issue = issueVM.ViewModelToEntity(status, story);

                await _plansService.UpdateIssue(new ServiceContext()
                {
                    ContextId = "TEST"
                }, issue);

                return(RedirectToAction(nameof(Index), new { id = issueVM.SprintId }));
            }

            return(View(issueVM));
        }
        public async Task <ServiceResult <Issue> > CreateIssueAsync(
            int projectId, IssueViewModel model, ClaimsPrincipal user)
        {
            var project = db.Projects.SingleOrDefault(p => p.Id == projectId);

            if (project == null)
            {
                return(new ServiceResult <Issue>("Project not found"));
            }

            if (!IsAdmin(user) && !IsProjectLead(project.LeaderId, user))
            {
                return(new ServiceResult <Issue>(
                           "Only admin or project lead can perform this action"));
            }

            var newIssue = Mapper.Map <Issue>(model);

            newIssue.Key    = string.Concat(model.Title.Split().Select(word => word.ToUpper()[0]));
            newIssue.Status = IssueStatus.Open;

            project.Issues.Add(newIssue);
            await db.SaveChangesAsync();

            return(new ServiceResult <Issue>(newIssue, "Issue has been added"));
        }
示例#21
0
        public IActionResult <IssueViewModel> All()
        {
            try
            {
                var issues = this.service.All();

                var issueViewModel = new IssueViewModel();

                foreach (var issue in issues)
                {
                    issueViewModel.Id   = issue.Id;
                    issueViewModel.Date = DateTime.Today;
                    issueViewModel.Name = issue.Name;
                }

                return(this.View(issueViewModel));
            }
            catch (Exception ex)
            {
                throw new Exception($"Exeption of type: {ex.GetType().Name} and Message: {ex.Message} has been thrown.");
            }
            //            return null;
            //            //display issuecollectionviewmodel
            //            //display issues - > query them
            //            //user from session
            //            //display issueviewModel
        }
        public void Issue(IssueViewModel model)
        {
            var command = new IssueInvoiceCommand(
                model.Date,
                model.Currency,
                model.Amount,
                model.Taxes,
                model.TotalPrice,
                model.Description,
                model.PaymentTerms,
                model.PurchaseOrderNumber,
                model.Customer.OriginalId,
                model.Customer.Name,
                Settings.Address,
                Settings.City,
                Settings.PostalCode,
                Settings.Country,
                Settings.TaxId,
                Settings.TaxId,
                Settings.CompanyName,
                Settings.Address,
                Settings.City,
                Settings.PostalCode,
                Settings.Country,
                Settings.TaxId,
                string.Empty
                );

            Bus.Send(command);
        }
        public IssueViewModel GetIssueViewModel()
        {
            var model = new IssueViewModel();

            model.Date = DateTime.Now;
            return(model);
        }
示例#24
0
        public void TestInit()
        {
            votableIssue  = Mock.Of <Issue>(i => i.Id == 1 && i.IsVotableIssue == true && i.Author.Id == "AuthId" && i.GetPrettyPercentage() == "67");
            fundableIssue = Mock.Of <Issue>(i => i.IsFundable == true && i.Author.Id == "AuthId");
            newIssue      = Mock.Of <IssueViewModel>();
            votableIssues = new List <Issue>()
            {
                votableIssue, votableIssue, votableIssue
            };
            fundableIssues = new List <Issue>()
            {
                fundableIssue, fundableIssue, fundableIssue
            };

            _repo = new Mock <IIssueRepository>();
            _repo.Setup(r => r.Find(1)).Returns(votableIssue);
            _repo.Setup(r => r.Add(newIssue)).Verifiable();
            _repo.Setup(r => r.GetAllVotableIssuesSortedByDate()).Returns(votableIssues);
            _repo.Setup(r => r.GetAllFundableIssuesSortedByDate()).Returns(fundableIssues);
            //&& r.GetAllVotableIssuesSortedByVoteCount() == votableIssues

            controller = new IssuesController(_repo.Object);

            var user            = Mock.Of <IPrincipal>(p => p.Identity.Name == "TestUid");
            var httpContextMock = Mock.Of <HttpContextBase>(ctx => ctx.User == user);

            var controllerContext = new ControllerContext {
                HttpContext = httpContextMock
            };

            controllerContext.Controller = controller;
            controller.ControllerContext = controllerContext;
        }
        public IssueView()
        {
            this.InitializeComponent();

            this.issueViewModelObject = new IssueViewModel();
            this.DataContext          = this.issueViewModelObject;
        }
示例#26
0
        public ActionResult Create([Bind(Include = "Id,Title,Description")] IssueViewModel issue, int pid)
        {
            IncludeProject(pid);
            if (ModelState.IsValid)
            {
                var user    = db.Users.Where(p => p.UserName == User.Identity.Name).FirstOrDefault();
                var project = db.Projects.Where(p => p.Id == pid).FirstOrDefault();
                var state   = db.IssueStates.Where(p => p.Name == "New").FirstOrDefault();

                db.Issues.Add(
                    new Issue()
                {
                    CreatedBy   = user,
                    CreatedOn   = DateTime.Now,
                    Title       = issue.Title,
                    Description = issue.Description,
                    State       = state,
                    Project     = project
                }
                    );

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(issue));
        }
示例#27
0
 public IssuePage(MainViewModel mainMainContext)
 {
     MainContext = mainMainContext;
     InitializeComponent();
     Context = (IssueViewModel)DataContext;
     Load();
 }
        public IssueViewModel SearchIssue(IssueViewModel model)
        {
            PetaPoco.Database db   = null;
            var            dbConn  = DataContext.Database.Connection;
            IssueViewModel Details = new IssueViewModel();

            try
            {
                using (DataContext)
                {
                    dbConn.Open();
                    db = new PetaPoco.Database(dbConn);
                    db.EnableAutoSelect = false;
                    Details.IssueList   = db.Query <Issue>("exec usp_SearchIssue " + "@LocationId",
                                                           new { LocationId = model.LocationId }).ToList();
                    dbConn.Close();
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            finally
            {
                if (dbConn != null)
                {
                    dbConn.Close();
                }
            }
            return(Details);
        }
        public ActionResult CreateIssue(IssueViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            IIssuesClient issues = new IssuesClient(
                new ApiConnection(
                    new Connection(
                        new ProductHeaderValue(_productName),
                        new InMemoryCredentialStore(
                            new Credentials(_userName, _userPass)))));
            var iss = new NewIssue(model.Title)
            {
                Body = model.Body
            };

            foreach (var label in model.Labels)
            {
                iss.Labels.Add(label);
            }

            issues.Create(_userName, _productName, iss);
            return(Redirect(model.BaseUri));
        }
        private ActionResult GetIssueView(Entity adxIssueForum, Entity adxIssue, int?page)
        {
            var issueDataAdapter = new IssueDataAdapter(adxIssue)
            {
                ChronologicalComments = true
            };

            var issue = issueDataAdapter.Select();

            var comments = FeatureCheckHelper.IsFeatureEnabled(FeatureNames.Feedback)
                                ? new PaginatedList <IComment>(page, issueDataAdapter.SelectCommentCount(), issueDataAdapter.SelectComments)
                                : null;

            var issueViewModel = new IssueViewModel
            {
                IssueForum = new IssueForumDataAdapter(adxIssueForum).Select(),
                Issue      = issue,
                Comments   = new IssueCommentsViewModel {
                    Comments = comments, Issue = issue
                },
                CurrentUserHasAlert = issueDataAdapter.HasAlert()
            };

            return(View("Issue", issueViewModel));
        }
 public void SetUp()
 {
     Factory.Rebind<GitHubApiBase>().To<GitHubApiMock>().InScope(o => this);
     Factory.Rebind<ILoginView>().To<LoginViewMock>();
     Factory.Rebind<IIssueEditor>().To<IssueEditorMock>();
     Factory.Rebind<IAddComment>().To<AddCommentMock>();
     _gitHubViewModel = Factory.Get<IssueViewModel>();
 }
 /// <summary>
 /// Determines whether this instance can add the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns><c>true</c> if this instance can add the specified item; otherwise, <c>false</c>.</returns>
 private bool CanAdd(IssueViewModel item)
 {
     return item != null && ParentIssues.All(pi => pi.Model.Id != item.Model.Id);
 }
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 private void RemoveParent(IssueViewModel item)
 {
     ParentsViewModel.RelationIssues.Remove(item);
     ChildSearch();
 }
 /// <summary>
 /// Adds the parent.
 /// </summary>
 /// <param name="issue">The issue.</param>
 public void AddParent(IssueViewModel issue)
 {
     ParentsViewModel.RelationIssues.Add(issue);
     ChildSearch();
 }
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 private void RemoveChild(IssueViewModel item)
 {
     ChildrenViewModel.RelationIssues.Remove(item);
     ParentSearch();
 }
 /// <summary>
 /// Adds the parent.
 /// </summary>
 /// <param name="issue">The issue.</param>
 private void AddChild(IssueViewModel issue)
 {
     ChildrenViewModel.RelationIssues.Add(issue);
     ParentSearch();
 }
 /// <summary>
 /// Adds the parent.
 /// </summary>
 /// <param name="issue">The issue.</param>
 public void AddParent(IssueViewModel issue)
 {
     ParentIssues.Add(issue);
 }
 /// <summary>
 /// Adds the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 private void Add(IssueViewModel item)
 {
     ParentIssues.Add(item);
 }
 /// <summary>
 /// Removes the specified item.
 /// </summary>
 /// <param name="item">The item.</param>
 private void Remove(IssueViewModel item)
 {
     ParentIssues.Remove(item);
 }
示例#40
0
        /// <summary>
        /// Asyncs the search.
        /// </summary>
        public async void AsyncSearch()
        {
            List<Issue> issues =
                await Task<List<Issue>>.Factory.StartNew(() => _board.GetIssues(Filter.ToModel()).ToList());

            List<IssueViewModel> removeAllList = AllIssues.Where(i => !issues.Contains(i.Model)).ToList();

            bool hasChanged = false;

            foreach (IssueViewModel issueViewModel in removeAllList)
            {
                AllIssues.Remove(issueViewModel);
                hasChanged = true;
            }

            foreach (Issue issue in issues)
            {
                var model = new IssueViewModel(this, issue);
                if (!AllIssues.Contains(model))
                {
                    AllIssues.Add(model);
                    hasChanged = true;
                }
            }

            SortIssues(AllIssues);

            int skip = PageNumberCorrent != null ? (PageNumberCorrent.Number - 1)*PageCount : 0;

            List<IssueViewModel> pageIssues = AllIssues.Skip(skip).Take(PageCount).ToList();

            List<IssueViewModel> removeList = Issues.Where(i => !pageIssues.Contains(i)).ToList();

            foreach (IssueViewModel issueViewModel in removeList)
            {
                Issues.Remove(issueViewModel);
            }

            foreach (IssueViewModel issue in pageIssues)
            {
                if (!Issues.Contains(issue))
                {
                    Issues.Add(issue);
                }
            }

            if (hasChanged)
            {
                SortIssues(Issues);
                PageNumbers.Clear();
                if (AllIssues.Count > PageCount)
                {
                    for (int i = 0; i <= (AllIssues.Count - 1)/PageCount; i++)
                    {
                        PageNumbers.Add(new PageNumberViewModel(this, i + 1));
                    }
                    PageNumberCorrent = new PageNumberViewModel(this, 1);
                }
                OnPropertyChanged("PagenatorVisibility");
            }
            else
            {
                foreach (IssueViewModel issueViewModel in Issues)
                {
                    issueViewModel.UpdateSource();
                }
            }
        }
示例#41
0
 /// <summary>
 /// Sets the issue.
 /// </summary>
 /// <param name="issue">The issue.</param>
 public void SetIssue(IssueViewModel issue)
 {
     _issueModel = issue;
     _issue = issue.Model;
     Attachments.Clear();
     foreach (string attachment in _board.GetAttachments(_issue.Id))
     {
         Attachments.Add(new AttachmentViewModel(this) {FileName = attachment});
     }
     Links.Clear();
     foreach (var link in _issue.Links)
     {
         Links.Add(new LinkViewModel(this){ LinkName = link});
     }
     UpdateParents();
     UpdateChildren();
     UpdateSource();
 }
 public bool CanAdd(IssueViewModel item)
 {
     return item != null && RelationIssues.All(pi => pi.Model.Id != item.Model.Id);
 }
示例#43
0
 private void ShowOnDashboard(IssueViewModel issue)
 {
     issue.IsCustomRoot = !issue.IsCustomRoot;
     _board.Submit();
     if (IsCustomRoot)
     {
         AsyncUpdateIssues();
     }
 }