/// <summary> /// 增加一组用户 /// </summary> /// <param name="users"></param> public void Add(IEnumerable <IUser> users) { if (users != null) { Assignees.Add(users); } }
public async Task <int> UpdateToCurrent(ProjectViewModel pvm) { Model.ProjectID = pvm.ProjectID.Value; Model.ProjectName = pvm.ProjectName.Value; Model.StartDate = pvm.StartDate.Value; Model.EndDate = pvm.EndDate.Value; Model.AlertDate = pvm.AlertDate.Value; Model.Status = pvm.Status.Value; Model.Division = pvm.Division.Value; Model.Priority = pvm.Priority.Value; Model.Comments = pvm.Comments.Value; Model.Value = pvm.Value.Value; Model.Description = pvm.Description.Value; Model.Url = pvm.Url.Value; Model.Color = pvm.Color.Value; Model.Attachment = pvm.Attachment.Value; Model.CurrentValue = pvm.CurrentValue.Value; Model.Category = pvm.Category.Value; Model.Assignees = string.Join(" ", Assignees.Select(x => x.ID)); Model.Assigners = string.Join(" ", Assigners.Select(x => x.ID)); int id = await Model.InsertOrUpdate(); PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(Model))); PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(Col1))); PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(AssigneesView))); PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(AssignersView))); PropertyChanged.Invoke(this, new PropertyChangedEventArgs(nameof(DaysOpen))); return(id); }
public override void Initialize([AllowNull] ViewWithData data) { base.Initialize(data); IsLoaded = false; PullRequests = repositoryHost.ModelService.GetPullRequests(repository, pullRequests); pullRequests.Subscribe(pr => { trackingAssignees.AddItem(pr.Assignee); trackingAuthors.AddItem(pr.Author); }, () => { }); pullRequests.OriginalCompleted .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(_ => { if (listSettings.SelectedAuthor != null) { SelectedAuthor = Authors.FirstOrDefault(x => x.Login == listSettings.SelectedAuthor); } if (listSettings.SelectedAssignee != null) { SelectedAssignee = Assignees.FirstOrDefault(x => x.Login == listSettings.SelectedAssignee); } IsLoaded = true; UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor); }); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Assignee,AssigneeRate")] Assignees assignees) { if (id != assignees.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(assignees); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AssigneesExists(assignees.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(assignees)); }
public async Task Create(Assignee assignee) { await Assignees.InsertAsync(() => new AssigneeEntity { Id = assignee.Id ?? Guid.NewGuid().ToString(), Name = assignee.UserName }); }
/// <summary> /// Returns true if InventoryOrder instances are equal /// </summary> /// <param name="other">Instance of InventoryOrder to be compared</param> /// <returns>Boolean</returns> public bool Equals(InventoryOrder other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) ) && ( InventoryVariantName == other.InventoryVariantName || InventoryVariantName != null && InventoryVariantName.Equals(other.InventoryVariantName) ) && ( Created == other.Created || Created != null && Created.Equals(other.Created) ) && ( ReportDate == other.ReportDate || ReportDate != null && ReportDate.Equals(other.ReportDate) ) && ( Creator == other.Creator || Creator != null && Creator.Equals(other.Creator) ) && ( Assignees == other.Assignees || Assignees != null && Assignees.SequenceEqual(other.Assignees) ) && ( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( HasOnlyUntaggedAssets == other.HasOnlyUntaggedAssets || HasOnlyUntaggedAssets != null && HasOnlyUntaggedAssets.Equals(other.HasOnlyUntaggedAssets) )); }
async Task Load() { IsBusy = true; if (modelService == null) { modelService = await modelServiceFactory.CreateAsync(connection); } if (remoteRepository == null) { remoteRepository = await modelService.GetRepository( localRepository.Owner, localRepository.Name); Repositories = remoteRepository.IsFork ? new[] { remoteRepository.Parent, remoteRepository } : new[] { remoteRepository }; SelectedRepository = Repositories[0]; } PullRequests = modelService.GetPullRequests(SelectedRepository, pullRequests); pullRequests.Subscribe(pr => { trackingAssignees.AddItem(pr.Assignee); trackingAuthors.AddItem(pr.Author); }, () => { }); pullRequests.OriginalCompleted .ObserveOn(RxApp.MainThreadScheduler) ////.Catch<System.Reactive.Unit, Octokit.AuthorizationException>(ex => ////{ //// log.Info("Received AuthorizationException reading pull requests", ex); //// return repositoryHost.LogOut(); ////}) .Catch <System.Reactive.Unit, Exception>(ex => { // Occurs on network error, when the repository was deleted on GitHub etc. log.Error(ex, "Received Exception reading pull requests"); return(Observable.Empty <System.Reactive.Unit>()); }) .Subscribe(_ => { if (listSettings.SelectedAuthor != null) { SelectedAuthor = Authors.FirstOrDefault(x => x.Login == listSettings.SelectedAuthor); } if (listSettings.SelectedAssignee != null) { SelectedAssignee = Assignees.FirstOrDefault(x => x.Login == listSettings.SelectedAssignee); } IsBusy = false; UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor, SearchQuery); }); }
public override bool Arrive(AstroAI astronaut) { if (!Assignees.Contains(astronaut)) { Assignees.Add(astronaut); return(Arrive_individual(astronaut)); } return(false); }
public override bool Leave(AstroAI astronaut) { if (Assignees.Contains(astronaut)) { Assignees.Remove(astronaut); return(Leave_individual(astronaut)); } return(false); }
/// <summary> /// Adds the specified assignees to the issue. /// </summary> /// <param name="name">The login of the assignee.</param> public void AddAssignee(string name) { // lazily create the assignees array if (Assignees == null) { Assignees = new List <string>(); } Assignees.Add(name); }
public async Task <IActionResult> Create([Bind("Id,Assignee,AssigneeRate")] Assignees assignees) { if (ModelState.IsValid) { _context.Add(assignees); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(assignees)); }
public override bool Leave(AstroAI astronaut) { if (Assignees.Contains(astronaut)) { mySpriteRenderer.sprite = BridgeSprite; Assignees.Remove(astronaut); return(true); } return(false); }
/// <summary> /// Removes the specified assignee from the issue /// </summary> /// <param name="name">The login of the assignee to remove</param> public void RemoveAssignee(string name) { // lazily create the assignees array if (Assignees == null) { Assignees = new List <string>(); } else { Assignees.Remove(name); } }
/// <summary> /// Clears all the assignees. /// </summary> public void ClearAssignees() { // lazily create the assignees array if (Assignees == null) { Assignees = new List <string>(); } else { Assignees.Clear(); } }
public override bool Arrive(AstroAI astronaut) { if (OnTheirWay.Contains(astronaut)) { OnTheirWay.Remove(astronaut); Assignees.Add(astronaut); currentState = BehaveStationStates.Occupied; return(true); } throw new ArgumentException("Arrive: Astronaut arrived without claiming first!"); }
private Expression <Func <ChangeRequestDocument, bool> > AddAssigneeFilter( Expression <Func <ChangeRequestDocument, bool> > filterEx) { if (Assignees == null || !Assignees.Any()) { return(filterEx); } Expression <Func <ChangeRequestDocument, bool> > assigneeFilterEx = null; foreach (var assignee in Assignees) { assigneeFilterEx = assigneeFilterEx.OrElse(x => x.Assignee == assignee); } return(filterEx.AndAlso(assigneeFilterEx)); }
public override bool Leave(AstroAI astronaut) { if (Assignees.Contains(astronaut) || OnTheirWay.Contains(astronaut)) { Assignees.Remove(astronaut); OnTheirWay.Remove(astronaut); if (Assignees.Count + OnTheirWay.Count == 0) { currentState = BehaveStationStates.Abandoned; } return(true); } return(false); }
private async void LoadAssignees() { if (GitHubApi.Repository != null) { IReadOnlyList <User> assignees = await GitHubApi.GetAssignees(_repository); foreach (var assignee in assignees) { Assignees.Add(assignee); } if (_portedTfsItem != null) { SetTfsIssueAssignee(_portedTfsItem); } } }
private async void LoadAssignees(Issue issue) { if (GitHubApi.Repository != null) { IReadOnlyList <User> assignees = await GitHubApi.GetAssignees(_repository); foreach (var assignee in assignees) { Assignees.Add(assignee); } if (issue != null && issue.Assignee != null) { SetAssignee(issue.Assignee); } } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } if (InventoryVariantName != null) { hashCode = hashCode * 59 + InventoryVariantName.GetHashCode(); } if (Created != null) { hashCode = hashCode * 59 + Created.GetHashCode(); } if (ReportDate != null) { hashCode = hashCode * 59 + ReportDate.GetHashCode(); } if (Creator != null) { hashCode = hashCode * 59 + Creator.GetHashCode(); } if (Assignees != null) { hashCode = hashCode * 59 + Assignees.GetHashCode(); } if (Status != null) { hashCode = hashCode * 59 + Status.GetHashCode(); } if (HasOnlyUntaggedAssets != null) { hashCode = hashCode * 59 + HasOnlyUntaggedAssets.GetHashCode(); } return(hashCode); } }
public IssueAssigneeViewModel( Func <Task <IReadOnlyList <User> > > loadAssignees, Func <Task <User> > loadCurrentlyAssigned, Func <User, Task> updateIssue ) { DismissCommand = ReactiveCommand.Create(); var derivedFunc = new Func <User, IssueAssigneeItemViewModel>(x => { var vm = new IssueAssigneeItemViewModel(x); if (_selectedUser != null) { vm.IsSelected = x.Id == _selectedUser.Id; } vm.GoToCommand .Select(_ => vm.IsSelected ? x : null) .Subscribe(user => { foreach (var a in Assignees.Where(y => y != vm)) { a.IsSelected = false; } updateIssue(user).ToBackground(); DismissCommand.ExecuteIfCan(); }); return(vm); }); var assignees = new ReactiveList <User>(); Assignees = assignees.CreateDerivedCollection( derivedFunc, filter: x => x.Name.ContainsKeyword(SearchKeyword), signalReset: this.WhenAnyValue(x => x.SearchKeyword)); LoadCommand = ReactiveCommand.CreateAsyncTask(async _ => { _selectedUser = (await loadCurrentlyAssigned()); assignees.Reset(await loadAssignees()); }); }
public override void Initialize([AllowNull] ViewWithData data) { base.Initialize(data); IsLoaded = false; PullRequests = repositoryHost.ModelService.GetPullRequests(repository, pullRequests); pullRequests.Subscribe(pr => { trackingAssignees.AddItem(pr.Assignee); trackingAuthors.AddItem(pr.Author); }, () => { }); pullRequests.OriginalCompleted .ObserveOn(RxApp.MainThreadScheduler) .Catch <System.Reactive.Unit, Octokit.AuthorizationException>(ex => { log.Info("Received AuthorizationException reading pull requests", ex); return(repositoryHost.LogOut()); }) .Catch <System.Reactive.Unit, Exception>(ex => { // Occurs on network error, when the repository was deleted on GitHub etc. log.Info("Received Exception reading pull requests", ex); return(Observable.Empty <System.Reactive.Unit>()); }) .Subscribe(_ => { if (listSettings.SelectedAuthor != null) { SelectedAuthor = Authors.FirstOrDefault(x => x.Login == listSettings.SelectedAuthor); } if (listSettings.SelectedAssignee != null) { SelectedAssignee = Assignees.FirstOrDefault(x => x.Login == listSettings.SelectedAssignee); } IsLoaded = true; UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor); }); }
public override void Initialize([AllowNull] ViewWithData data) { base.Initialize(data); IsLoaded = false; PullRequests = repositoryHost.ModelService.GetPullRequests(repository, pullRequests); pullRequests.Subscribe(pr => { trackingAssignees.AddItem(pr.Assignee); trackingAuthors.AddItem(pr.Author); }, () => { }); pullRequests.OriginalCompleted .ObserveOn(RxApp.MainThreadScheduler) .Catch <System.Reactive.Unit, Octokit.AuthorizationException>(ex => { // TODO: Do some decent logging here return(repositoryHost.LogOut()); }) .Catch <System.Reactive.Unit, Octokit.NotFoundException>(ex => { //this is caused when repository was deleted on github return(Observable.Empty <System.Reactive.Unit>()); }) .Subscribe(_ => { if (listSettings.SelectedAuthor != null) { SelectedAuthor = Authors.FirstOrDefault(x => x.Login == listSettings.SelectedAuthor); } if (listSettings.SelectedAssignee != null) { SelectedAssignee = Assignees.FirstOrDefault(x => x.Login == listSettings.SelectedAssignee); } IsLoaded = true; UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor); }); }
public IssueUpdate ToUpdate() { var milestoneId = Milestone == null ? new int?() : Milestone.Number; var assignees = Assignees == null ? null : Assignees.Select(x => x.Login); var labels = Labels == null ? null : Labels.Select(x => x.Name); ItemState state; var issueUpdate = new IssueUpdate { Body = Body, Milestone = milestoneId, State = (State.TryParse(out state) ? (ItemState?)state : null), Title = Title }; if (assignees != null) { foreach (var assignee in assignees) { issueUpdate.AddAssignee(assignee); } } if (labels != null) { foreach (var label in labels) { issueUpdate.AddLabel(label); } } return(issueUpdate); }
Task Load() { IsBusy = true; PullRequests = modelService.GetPullRequests(SelectedRepository, pullRequests); pullRequests.Subscribe(pr => { trackingAssignees.AddItem(pr.Assignee); trackingAuthors.AddItem(pr.Author); }, () => { }); pullRequests.OriginalCompleted .ObserveOn(RxApp.MainThreadScheduler) .Catch <System.Reactive.Unit, Exception>(ex => { // Occurs on network error, when the repository was deleted on GitHub etc. log.Error(ex, "Received Exception reading pull requests"); return(Observable.Empty <System.Reactive.Unit>()); }) .Subscribe(_ => { if (listSettings.SelectedAuthor != null) { SelectedAuthor = Authors.FirstOrDefault(x => x.Login == listSettings.SelectedAuthor); } if (listSettings.SelectedAssignee != null) { SelectedAssignee = Assignees.FirstOrDefault(x => x.Login == listSettings.SelectedAssignee); } IsBusy = false; UpdateFilter(SelectedState, SelectedAssignee, SelectedAuthor, SearchQuery); }); return(Task.CompletedTask); }
public async Task <string[]> GetAllIds() { return(await Assignees.Select(o => o.Id) .ToArrayAsync()); }
protected override bool Reason2Warn(float threshold = 0.7f) { // a reason to warn is if there exists an astronaut at this station with less than (threshold * 100)% health return(Assignees.Any(astronaut => astronaut.myBody.getLifePercentage() <= threshold)); }
public void NotifyByEmail() { //get list of recipients to see if we actually have someone to email List <string> recips = new List <string>(); if (Assignees.Any(x => x.Name == "DATA")) { recips = new List <string> { "Nils.Bergmann @lenderlive.com", "Dallin.Beutler @lenderlive.com", "Cameron.Thibeaux @lenderlive.com", "Robert.Cerami @lenderlive.com", "Mike.Auyeung @lenderlive.com", "Bradley.Gill @lenderlive.com", "nils.bergmann @lenderlive.com", "Andrew.Matel @lenderlive.com", "wesley.rollings @lenderlive.com", "luke.stanley @lenderlive.com", "Wesley.Hamilton @lenderlive.com", "britney.clark @lenderlive.com", "*****@*****.**" }; } recips.AddRange(Assignees.Select(x => x.Value).Where(x => !string.IsNullOrEmpty(x))); if (recips.Count <= 0) { return; } string build = VersionSelector.SelectedVersionEnum.Name; string Subject = "EMS- " + build + " Notification: " + Model.ProjectName; // simplest html table showing relevant info string HTMLBody = $@"<table> <tr><td><b>Project: </b></td><td> { Model.ProjectName }<td/></tr> <tr><td><b>Description: </b></td><td> { Model.Description}<td/></tr>" + (Model.EndDate.HasValue ? ($@"<tr><td><b>End Date: </b></td><td> { Model.EndDate.Value.ToShortDateString()} <td/></tr>)") : "") + $@"<tr><td><b>Status: </b></td><td> { Model.Status}<td/></tr> <tr><td><b>Division: </b></td><td> { Model.Division}<td/></tr> <tr><td><b>Division: </b></td><td> { Model.Category}<td/></tr> <tr><td><b>Assigned To: </b></td><td> { string.Join(", ", recips)}<td/></tr> <tr><td><b>Comments: </b></td><td> { EMS2.Utility.RtfToHtmlConverter.ConvertRtfToHtml(Model.Comments)}<td/></tr> </table> "; //SMTP is a server service thing for sending mail. Quite relaxed SMTP smtp = new SMTP(); List <string> emails = recips; List <string> assigners = Assigners.Select(x => x.Value).ToList(); smtp.Recipients = emails; smtp.CCRecipients = assigners; smtp.bodyMessage = HTMLBody; smtp.subject = Subject; smtp.from = "EMS " + build + " <*****@*****.**>"; //Don't send a prompt to robert, but yes to everyone else. talk about customization! //if (!EMSSession.IsAdmin) //{ // var result = MessageBox.Show("Do you want to send an email to " + string.Join(", ", emails) + "\n" + "with " + string.Join(", ", assigners) + " CC'd?", "Confirm Email", MessageBoxButton.YesNo); // if (result != MessageBoxResult.Yes) return; //} // send the email on a separate thread so that we don't have to wait for the SMTP server. new Thread(() => { try { Thread.CurrentThread.IsBackground = true; /* run your code here */ smtp.SendEmail(); } catch (Exception ex) { MessageBox.Show(ex.Message).ToString(); } }).Start(); //mail.Send(); }//butNotify_Click