public async System.Threading.Tasks.Task <ActionResult> Issues() { SessionInfo sessionInfo = (SessionInfo)HttpContext.Session["SessionInfo"]; if (!sessionInfo.Connected) { return(RedirectToAction("ConnectToProject", "Project")); } else { //Preparing model and metrics object GitHubMetrics ghMetrics = new GitHubMetrics(sessionInfo.ProjectDetails.GitHubProjectName, sessionInfo.ProjectDetails.GitHubProjectOwner, sessionInfo.ProjectDetails.GitHubToken); IssuesModel model = new IssuesModel(); model.AverageIssueClosingTime = await ghMetrics.CalculateAverageIssueClosingTimeAsync(); model.ClosedIssues = await ghMetrics.CountClosedIssuesAsync(); model.OpenedIssues = await ghMetrics.CountOpenedIssuesAsync(); model.EstimatedTimeToCloseAllIssues = await ghMetrics.CalculateEstimatedTimeToCloseAllIssuesAsync(); model.ExpectedDateForClosingAllIssues = DateTime.Now + model.EstimatedTimeToCloseAllIssues; model.ClosedIssuesForMonth = await ghMetrics.CountClosedIssuesForLastSixMonthsAsync(); model.UserWithLargestIssuesClosed = null; return(View(model)); } }
public async Task DeleteIssueAsync(IssuesModel model) { var entity = new IssueBlobs { Type = model.Type, Content = ByteConverterHelper.ReturnBytes(model), RequestId = model.RequestId, Id = model.Id }; await Repo.DeleteAsync(entity).ConfigureAwait(false); }
public ActionResult Create() { ViewBag.CurrentView = "Prioritization"; IssuesModel objIssue = new IssuesModel(); PopulateViewBag(); return(View(objIssue)); }
public async Task <int> AddIssueAsync(IssuesModel model) { var entity = new IssueBlobs { Type = model.Type, Content = ByteConverterHelper.ReturnBytes(model), RequestId = model.RequestId }; var id = await Repo.InsertAsync(entity); model.Id = id; entity = new IssueBlobs { Type = model.Type, Content = ByteConverterHelper.ReturnBytes(model), RequestId = model.RequestId, Id = id }; var result = await Repo.UpdateAsync(entity).ConfigureAwait(false); return(result ? id : -1); }
/// <summary> /// Преобразует задачу в объект кластера /// </summary> public ClusterObject convertToClusterObject(IssuesModel issues) { double[] issueArray = new double[COUNTWORDS]; string[] issueWordsArray = String.Concat(issues.title.ToLower(), " ", issues.description.ToLower()).Split(' '); for (int i = 0; i < COUNTWORDS; i++) { if (issueWordsArray.Contains(DICTIONARY[i])) { issueArray[i] = 1; } else { issueArray[i] = 0; } } return(new ClusterObject(issues.iid.ToString(), issueArray, issues.title, issues.time_stats.total_time_spent, issues.time_stats.time_estimate)); }
public ActionResult Create(IssuesModel model) { ViewBag.CurrentView = "Prioritization"; if (ModelState.IsValid) { //dbPrioritization.Set<IssuesModel>().Add(model); dbPrioritization.IssuesModels.Add(model); dbPrioritization.SaveChanges(); return(View("Index")); } else { PopulateViewBag(); return(View(model)); } }
private void button1_Click(object sender, EventArgs e) { if (band != false ) { string dir = Path.Combine(@"C:\Users\OMARHUCHINRODRIGUEZ\Documents\GitHub\ScrumRepo\gotcSplash\bin\Debug\Cache", tempImage); int iduser = Querys.QueryLogin("idUser","user",string.Format("name='{0}'", Name[comboBox2.SelectedIndex])).idUser; Files.saveToCache(tempImage,dir); //File.SetAttributes(@"C:\Users\OMARHUCHINRODRIGUEZ\Documents\GitHub\ScrumRepo\gotcSplash\bin\Debug\Cache", FileAttributes.Normal); //File.Copy(Path.Combine(@"C:\Users\OMARHUCHINRODRIGUEZ\Documents\GitHub\ScrumRepo\gotcSplash\bin\Debug\Cache", tempImage), tempImage, true); IssuesModel Issue = new IssuesModel(); Issue.issueTitle = textBox1.Text; Issue.issueDescription = textBox2.Text; Issue.idAsigned=iduser; Issue.label = textBox3.Text; Issue.links = textBox4.Text; Issue.image = tempImage.Replace("/","\\"); BDQuery.AddToBase(Issue,"issues"); MessageBox.Show("Issue agregada"); } }
/// <summary> /// Orders the issues descending by the <see cref="IssueState"/>. /// </summary> /// <param name="issues">The issues.</param> /// <returns></returns> private IssuesModel Order(IssuesModel issues) { issues.Issues = issues.Issues.OrderByDescending(x => x.Issue).ToList(); return(issues); }
private async Task <Response> ReportNonRequestIssue(int providerId, string type, IssueState issue, string comment) { var currentIssues = await IssuesService.GetAllAsync(); var notifyModel = new NotificationModel { User = Username, NotificationType = NotificationType.Issue, DateTime = DateTime.Now, Body = issue == IssueState.Other ? comment : issue.ToString().ToCamelCaseWords() }; var model = new IssueModel { Issue = issue, UserReported = Username, UserNote = !string.IsNullOrEmpty(comment) ? $"{Username} - {comment}" : string.Empty, }; var existing = currentIssues.FirstOrDefault(x => x.ProviderId == providerId && !x.Deleted && x.IssueStatus == IssueStatus.PendingIssue); if (existing != null) { existing.Issues.Add(model); await IssuesService.UpdateIssueAsync(existing); return(Response.AsJson(new JsonResponseModel { Result = true })); } if (type == "movie") { var movieApi = new TheMovieDbApi(); var result = await movieApi.GetMovieInformation(providerId); if (result != null) { notifyModel.Title = result.Title; // New issue var issues = new IssuesModel { Title = result.Title, PosterUrl = "https://image.tmdb.org/t/p/w150/" + result.PosterPath, ProviderId = providerId, Type = RequestType.Movie, IssueStatus = IssueStatus.PendingIssue }; issues.Issues.Add(model); var issueId = await IssuesService.AddIssueAsync(issues); await NotificationService.Publish(notifyModel); return(Response.AsJson(new JsonResponseModel { Result = true })); } } if (type == "tv") { var tv = new TvMazeApi(); var result = tv.ShowLookupByTheTvDbId(providerId); if (result != null) { var banner = result.image?.medium; if (!string.IsNullOrEmpty(banner)) { banner = banner.Replace("http", "https"); } notifyModel.Title = result.name; // New issue var issues = new IssuesModel { Title = result.name, PosterUrl = banner, ProviderId = providerId, Type = RequestType.TvShow, IssueStatus = IssueStatus.PendingIssue }; issues.Issues.Add(model); var issueId = await IssuesService.AddIssueAsync(issues); await NotificationService.Publish(notifyModel); return(Response.AsJson(new JsonResponseModel { Result = true })); } } return(Response.AsJson(new JsonResponseModel { Result = false, Message = "Album Reports are not supported yet!" })); }
private async Task <Response> ReportRequestIssue(int requestId, IssueState issue, string comment) { var model = new IssueModel { Issue = issue, UserReported = Username, UserNote = !string.IsNullOrEmpty(comment) ? $"{Username} - {comment}" : string.Empty, }; var request = await RequestService.GetAsync(requestId); var issueEntity = await IssuesService.GetAllAsync(); var existingIssue = issueEntity.FirstOrDefault(x => x.RequestId == requestId); var notifyModel = new NotificationModel { User = Username, NotificationType = NotificationType.Issue, Title = request.Title, DateTime = DateTime.Now, Body = issue == IssueState.Other ? comment : issue.ToString().ToCamelCaseWords() }; // An issue already exists if (existingIssue != null) { if (existingIssue.Issues.Any(x => x.Issue == issue)) { return (Response.AsJson(new JsonResponseModel { Result = false, Message = "This issue has already been reported!" })); } existingIssue.Issues.Add(model); var result = await IssuesService.UpdateIssueAsync(existingIssue); await NotificationService.Publish(notifyModel); return(Response.AsJson(result ? new JsonResponseModel { Result = true } : new JsonResponseModel { Result = false })); } // New issue var issues = new IssuesModel { Title = request.Title, PosterUrl = request.PosterPath, RequestId = requestId, Type = request.Type, IssueStatus = IssueStatus.PendingIssue }; issues.Issues.Add(model); var issueId = await IssuesService.AddIssueAsync(issues); request.IssueId = issueId; await RequestService.UpdateRequestAsync(request); await NotificationService.Publish(notifyModel); return(Response.AsJson(new JsonResponseModel { Result = true })); }