void UpdatePrState(SupportedGitHubRepos supportedRepo, long prNumber, ItemState prCurrentState, ItemState prNewState) { if (prCurrentState.Equals(prNewState)) { Logger.LogInfo("Pr#'{0}', requested state '{1}' and current state '{2}' are same. Exiting.....", prNumber.ToString(), prNewState.ToString(), prCurrentState.ToString()); } Repository r = GetRepository(supportedRepo); PullRequest pr = GetPullRequest(r.Name, prNumber); Logger.LogInfo("Pr#'{0}', requested state to be set:'{1}', current state is:'{2}'", prNumber.ToString(), prNewState.ToString(), pr.State.ToString()); if (pr.State == prCurrentState) { PullRequestUpdate pru = new PullRequestUpdate(); pru.State = prNewState; pr = OC.PullRequest.Update(r.Id, (int)prNumber, pru).GetAwaiter().GetResult(); Logger.LogInfo("Pr#'{0}', requested state to be set:'{1}', current state is:'{2}'", prNumber.ToString(), prNewState.ToString(), pr.State.ToString()); } if (!pr.State.Equals(prNewState)) { Logger.LogError("Unable to set PR state to:'{0}'", prNewState.ToString()); } }
public override string ToString() { StringBuilder sb = new StringBuilder($"{{ ItemId = {ItemID}"); sb.Append($", InventoryNumber = {InventoryNumber}"); sb.Append($", OldInventoryNumber = {OldInventoryNumber}"); sb.Append($", SerialNumber = {SerialNumber}"); sb.Append($", AccreditationNumber = {AccreditationNumber}"); sb.Append($", YellowNumber = {YellowNumber}"); sb.Append($", ItemName = {ItemName}"); sb.Append($", Manufacturer = {Manufacturer}"); sb.Append($", ModelType = {ModelType}"); sb.Append($", ItemNatureID = {ItemNatureID}"); sb.Append($", ItemNature = {ItemNature?.ToString()}"); sb.Append($", ItemTypeID = {ItemTypeID}"); sb.Append($", ItemType = {ItemType?.ToString()}"); sb.Append($", ProductionYear = {ProductionYear?.ToShortDateString()}"); sb.Append($", DepartmentID = {DepartmentID}"); sb.Append($", Department = {Department?.ToString()}"); sb.Append($", SectionID = {SectionID}"); sb.Append($", Section = {Section?.ToString()}"); sb.Append($", EmployeeID = {EmployeeID}"); sb.Append($", Employee = {Employee?.ToString()}"); sb.Append($", BuildingID = {BuildingID}"); sb.Append($", Building = {Building?.ToString()}"); sb.Append($", FloorID = {FloorID}"); sb.Append($", Floor = {Floor?.ToString()}"); sb.Append($", Room = {Room}"); sb.Append($", ItemStateID = {ItemStateID}"); sb.Append($", ItemState = {ItemState?.ToString()}"); sb.Append($", DateOfCreation = {DateOfCreation?.ToShortDateString()}"); sb.Append($", BruttoPrice = {BruttoPrice}"); sb.Append($", DateOfScrap = {DateOfScrap?.ToShortDateString()}"); sb.Append($", Comment = {Comment}"); sb.Append(" }"); return(sb.ToString()); }
public override String ToString() { return(state.ToString()); }
/// <summary> /// Gets a copy of the Collection containing all changes made to it /// since it was last loaded, or since ItemList.AcceptChanges() /// was called, filtered by itemState. /// </summary> /// <typeparam name="List<T>"></typeparam> /// <param name="list"></param> /// <param name="itemState"></param> /// <returns></returns> public static CustomList <T> GetChanges <T>(this CustomList <T> list, ItemState itemState) { return(list.FindAll(PredicateBuilder.Build <T>("item.State == ASL.DATA;.ItemState." + itemState.ToString() + ""))); }
/// <summary> /// Item Information /// </summary> /// <returns></returns> public override String ToString() { return(String.Format("Item Name = {0},Item State = {1}", GetType().Name, state.ToString())); }
protected async Task <int> UpdateIssueItemState(IConsole console, string issueReference, ItemState newState, string comment) { try { var(issue, repository) = await GetIssueAsync(issueReference); // Check if we're working with an already closed issue if (issue.State == newState) { _reporter.Warn($"Issue {repository.Owner.Login}/{repository.Name}#{issue.Number} is already {newState.ToString().ToLower()}. No action taken."); return(ReturnCodes.Error); } // Add an optional comment if (!string.IsNullOrEmpty(comment)) { await GitHubClient.Issue.Comment.Create(repository.Owner.Login, repository.Name, issue.Number, comment); } // Close the issue await GitHubClient.Issue.Update(repository.Owner.Login, repository.Name, issue.Number, new IssueUpdate { State = newState }); if (newState == ItemState.Closed) { console.Write("Closed "); } else { console.Write("Re-opened "); } console.Write($"{repository.Owner.Login}/{repository.Name}#{issue.Number}", ConsoleColor.Yellow); console.WriteLine(); } catch (CommandValidationException e) { _reporter.Error(e.Message); return(ReturnCodes.Error); } return(ReturnCodes.Ok); }