protected static void SaveStackTrace(string issueKey, string stackTrace) { IssueModel issue = null; string fileName = $"stacktrace_{DateTime.Now:yyyy-MM-ddTHH-mm-ss.fff}.txt"; try { string targetFilePath = FileUtils.WriteStackTrace(stackTrace, fileName); issue = new IssueModel() { Key = issueKey, AttachmentFilePaths = new List <string>() { targetFilePath } }; } catch (SaveAttachmentException exception) { issue = new IssueModel() { Key = issueKey, Summary = exception.Message }; } IssueManager.AddIssue(issue); }
/// <summary> /// Gets the total owned issue count. /// </summary> /// <returns></returns> protected string GetTotalOwnedIssueCount() { var user = Membership.GetUser(); if (user == null) { return("0"); } if (user.ProviderUserKey == null) { return("0"); } var queryClauses = new List <QueryClause> { // do not include disabled projects new QueryClause("AND", "iv.[ProjectDisabled]", "=", "0", SqlDbType.Int), // do not include disabled issues new QueryClause("AND", "iv.[Disabled]", "=", "0", SqlDbType.Int), // add the user id to the filtered field new QueryClause("AND", "iv.[IssueOwnerUserId]", "=", user.ProviderUserKey.ToString(), SqlDbType.NVarChar) }; // return the projects in the list box, this represents all the projects the user has access to // pre filtered on the page load queryClauses.AddRange(GetProjectQueryClauses(true)); return(IssueManager.PerformQuery(queryClauses, null).Count.ToString()); }
public override bool Run(IssueManager issueManager) { LogDebugMessage(string.Concat("START: ", DateTime.Now.ToString())); GetWorkspaceItems(issueManager); LogDebugMessage(string.Concat("END: ", DateTime.Now.ToString())); return(true); }
public void Attach(ITextEditor editor) { this.editor = editor; inspectionManager = new IssueManager(editor); codeManipulation = new CodeManipulation(editor); renderer = new CaretReferenceHighlightRenderer(editor); // Patch editor options (indentation) to project-specific settings if (!editor.ContextActionProviders.IsReadOnly) { contextActionProviders = AddInTree.BuildItems <IContextActionProvider>("/SharpDevelop/ViewContent/TextEditor/C#/ContextActions", null); editor.ContextActionProviders.AddRange(contextActionProviders); } // Create instance of options adapter and register it as service var formattingPolicy = CSharpFormattingPolicies.Instance.GetProjectOptions( SD.ProjectService.FindProjectContainingFile(editor.FileName)); options = new CodeEditorFormattingOptionsAdapter(editor.Options, formattingPolicy.OptionsContainer); var textEditor = editor.GetService <TextEditor>(); if (textEditor != null) { var textViewServices = textEditor.TextArea.TextView.Services; // Unregister any previous ITextEditorOptions instance from editor, if existing, register our impl. textViewServices.RemoveService(typeof(ITextEditorOptions)); textViewServices.AddService(typeof(ITextEditorOptions), options); // Set TextEditor's options to same object originalEditorOptions = textEditor.Options; textEditor.Options = options; } }
private void LeerRepositorioDeIncidencias() { try { this.Cursor = Cursors.WaitCursor; var gestor = new IssueManager(); DirectoryInfo scriptDirectoryInfo = new DirectoryInfo(txtSourceFolder.Text); if (scriptDirectoryInfo.Exists) { List <IssueEntity> incidencias = gestor.CrearIncidencias(scriptDirectoryInfo); IndexarIncidencias(incidencias); MostrarRepositorioDeIncidencias(); } else { txtSourceFolder.Text = string.Empty; } } catch (ApplicationException appEx) { MessageBox.Show(appEx.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { this.Cursor = Cursors.Default; } }
/// <summary> /// Get all Workspaces and it filters by "Url = items" and "BadgeCount > 0" /// If there are Items in the workspace, it updates the BadgeCount. /// If there are no Items in the workspace, it resets the BadgeCount. /// </summary> /// <param name="issueManager"></param> public void GetWorkspaceItems(IssueManager issueManager) { try { NavigationCardsManager navigationCardsManager = new NavigationCardsManager(issueManager); List <NavigationCard> workspaces = navigationCardsManager.GetAll(); foreach (NavigationCard workspace in workspaces.ToList()) { if (workspace.Url == "items" && workspace.BadgeCount > 0) { IssuesFilter filter = ChangeSystemFilterTypesMe(workspace.Filter, (int)workspace.UserId, false); List <IssueDto> workspaceItems = issueManager.GetFiltered(filter, true); if (workspaceItems.Count() > 0) { UpdateBadgeCount(workspace, workspaceItems, navigationCardsManager, false); } else { UpdateBadgeCount(workspace, workspaceItems, navigationCardsManager, true); } } } } catch (Exception exception) { GeminiApp.LogException(exception, false, string.Concat("Run Method GetWorkspaceItems: ", exception.Message)); } }
public bool CreateNewIssueRevision(int revision, int issueId, string repository, string revisionAuthor, string revisionDate, string revisionMessage, string changeset = "", string branch = "") { if (issueId <= 0) { throw new ArgumentOutOfRangeException("issueId"); } var projectId = IssueManager.GetById(issueId).ProjectId; //authentication checks against user access to project if (ProjectManager.GetById(projectId).AccessType == ProjectAccessType.Private && !ProjectManager.IsUserProjectMember(UserName, projectId)) { throw new UnauthorizedAccessException(string.Format(LoggingManager.GetErrorMessageResource("ProjectAccessDenied"), UserName)); } var issueRevision = new IssueRevision { Revision = revision, IssueId = issueId, Author = revisionAuthor, Message = revisionMessage, Repository = repository, RevisionDate = revisionDate, Changeset = changeset, Branch = branch }; return(IssueRevisionManager.SaveOrUpdate(issueRevision)); }
/// <summary> /// Binds the data. /// </summary> public void BindData() { var allCategories = CategoryManager.GetByProjectId(ProjectId); tvCategory.Nodes.Clear(); var tree = tvCategory.Nodes; if (ShowRoot) { tree.Add(new TreeNode(GetLocalResourceObject("RootCategory").ToString(), "")); } var depth = ShowRoot ? 1 : 0; PopulateTreeView(tree, depth, allCategories); var tn = new TreeNode { Text = String.Format("{0}</a></td><td style='width:100%;text-align:right;'><a>{1} ", GetLocalResourceObject("Unassigned"), IssueManager.GetCountByProjectAndCategoryId(ProjectId)), NavigateUrl = String.Format("~/Issues/IssueList.aspx?pid={0}&c={1}", ProjectId, 0) }; tvCategory.Nodes.Add(tn); tvCategory.ExpandAll(); }
public override bool Run(IssueManager issueManager) { if (!issueManager.UserContext.Config.EmailAlertsEnabled) { return(true); } issueManager.UserContext.User.Entity = new User(issueManager.UserContext.User.Entity); issueManager.UserContext.User.Entity.Language = "en-US"; _issueManager = issueManager; _templates = GeminiApp.Container.Resolve <IAlertTemplates>().FindWhere(c => c.AlertType != AlertTemplateType.Breeze).ToList(); _types = new MetaManager(issueManager).TypeGetAll(); _permissionSets = new PermissionSetManager(issueManager).GetAll(); _organizations = new OrganizationManager(issueManager).GetAll(); _languages = new LanguageManager(issueManager).GetActive(); ProcessAppNavCardAlerts(); ProcessWatcherAlerts(); return(true); }
public void TakeScreenshot() { if (!IsInitialized()) { return; } if (!(driverInstance is RemoteWebDriver)) { Console.WriteLine("Unsupported driver type: " + driverInstance.GetType()); return; } string screenshotName = $"screenshot_{DateTime.Now:yyyy-MM-ddTHH-mm-ss.fff}.jpeg"; string relativeScreenshotPath = Constants.ATTACHMENTS_DIR + "\\" + screenshotName; string fullScreenshotPath = FileUtils.Solution_dir + relativeScreenshotPath; FileUtils.CheckOrCreateDir(Path.GetDirectoryName(fullScreenshotPath)); var screenshot = ((ITakesScreenshot)driverInstance).GetScreenshot(); screenshot.SaveAsFile(fullScreenshotPath, ScreenshotImageFormat.Jpeg); string issueKey = GetIssue(); IssueManager.SetAttachments(issueKey, relativeScreenshotPath); }
/// <summary> /// Gets the total assigned issue count. /// </summary> /// <returns></returns> protected string GetTotalAssignedIssueCount() { var user = ViewIssueMemberDropDown.SelectedValue; if (string.IsNullOrEmpty(user)) { return("0"); } var queryClauses = new List <QueryClause> { // do not include disabled projects new QueryClause("AND", "iv.[ProjectDisabled]", "=", "0", SqlDbType.Int), // do not include disabled issues new QueryClause("AND", "iv.[Disabled]", "=", "0", SqlDbType.Int), // add the user id to the filtered field new QueryClause("AND", "iv.[IssueAssignedUserId]", "=", user, SqlDbType.NVarChar) }; // return the projects in the list box, this represents all the projects the user has access to // pre filtered on the page load queryClauses.AddRange(GetProjectQueryClauses(true)); return(IssueManager.PerformQuery(queryClauses, null).Count.ToString()); }
public Preferences(Settings settings, IssueManager issueManager, string settingsFile) : this() { NewSettings = settings; _issueManager = issueManager; _settingsFile = settingsFile; foreach (string item in NewSettings.Repositories) { lstAvailableRepos.Items.Add(item); } foreach (string item in NewSettings.DefaultLabels) { lstDefaultLabels.Items.Add(item); } if (!string.IsNullOrEmpty(NewSettings.ZenHubToken)) { txtToken.Text = TokenProvided; } if (!string.IsNullOrEmpty(NewSettings.GitHubToken)) { txtGitHubToken.Text = TokenProvided; } if (!string.IsNullOrEmpty(NewSettings.DefaultTitle)) { txtDefaultTitle.Text = NewSettings.DefaultTitle; } }
public async Task <ActionResult> Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } WorkIssue workIssue = IssueManager.GetById(id.Value); if (User.Identity.IsAuthenticated) { workIssue.AddViewer(User.Identity.Name); await IssueManager.UpdateAsync(workIssue); } if (workIssue == null) { return(HttpNotFound()); } workIssue = BuildContent(workIssue); var _view = Mapper.Map <WorkIssue, IssueView>(workIssue); if (Request.IsAjaxRequest()) { return(PartialView("Issues/_IssueItem", _view)); } return(View(_view)); }
public bool CreateNewIssueAttachment(int issueId, string creatorUserName, string fileName, string contentType, byte[] attachment, int size, string description) { if (issueId <= 0) { throw new ArgumentOutOfRangeException("issueId"); } var projectId = IssueManager.GetById(issueId).ProjectId; //authentication checks against user access to project if (ProjectManager.GetById(projectId).AccessType == Common.ProjectAccessType.Private && !ProjectManager.IsUserProjectMember(UserName, projectId)) { throw new UnauthorizedAccessException(string.Format(LoggingManager.GetErrorMessageResource("ProjectAccessDenied"), UserName)); } var issueAttachment = new IssueAttachment { Id = Globals.NEW_ID, Attachment = attachment, Description = description, DateCreated = DateTime.Now, ContentType = contentType, CreatorDisplayName = string.Empty, CreatorUserName = creatorUserName, FileName = fileName, IssueId = issueId, Size = size }; return(IssueAttachmentManager.SaveOrUpdate(issueAttachment)); }
public void TestPerformQuery() { List <QueryClause> clauses = new List <QueryClause>(); QueryClause q = new QueryClause() { BooleanOperator = "OR", ComparisonOperator = "=", DataType = SqlDbType.Int, FieldName = "IssueCategoryId", FieldValue = null }; clauses.Add(q); q = new QueryClause() { BooleanOperator = "AND", ComparisonOperator = "<>", DataType = SqlDbType.Int, FieldName = "IssueStatusId", FieldValue = "3" }; clauses.Add(q); List <Issue> results = IssueManager.PerformQuery(clauses, 96); foreach (Issue result in results) { Console.WriteLine("Id: {1}; Title: {0}", result.Title, result.Id); } Assert.IsTrue(results.Count > 0); }
public void TestCreateNewIssueClean() { Issue issue = new Issue() { Id = 0, ProjectId = 95, Title = "This is an issue added from the unit test", Description = "This is a new description", CategoryId = 409, CategoryName = "Category 4", PriorityId = 12, PriorityName = "High", StatusId = 27, StatusName = "New Status", IssueTypeId = 18, IssueTypeName = "Task", AssignedDisplayName = "Davin Dubeau", AssignedUserId = Guid.Empty, AssignedUserName = "******", MilestoneId = 35, MilestoneName = "Release 1", AffectedMilestoneId = 35, AffectedMilestoneName = "Release 1", Visibility = 0, TimeLogged = 0, Estimation = 34, Progress = 55, Disabled = false, Votes = 1, CreatorDisplayName = "Davin Dubeau", CreatorUserId = Guid.Empty, CreatorUserName = "******", DateCreated = DateTime.Now, OwnerDisplayName = "Davin Dubeau", OwnerUserId = Guid.Empty, OwnerUserName = "******", LastUpdate = DateTime.Now, LastUpdateDisplayName = "Davin Dubeau", LastUpdateUserName = "******", DueDate = DateTime.MinValue }; //Issue newIssue = new Issue(0, ProjectId, string.Empty, string.Empty, "This is an issue added from the unit test", "This is a new description", // 409, "Category 4", 12, "High", // string.Empty, 27, "New Status", string.Empty, 18, // "Task", string.Empty,7, "Fixed", string.Empty, // "admin","Davin Dubeau", Guid.Empty, "Davin Dubeau", // "admin", Guid.Empty, "Davin Dubeau", "admin", Guid.Empty, DateTime.Now, // 35, "Release 1", string.Empty, null, 35, "Release 1", // string.Empty, 0, // 0, 0, DateTime.MinValue, DateTime.MinValue, "admin", "Davin Dubeau", // 25, false, 0); IssueManager.SaveOrUpdate(issue); Assert.IsTrue(issue.Id != 0); Issue FetchedIssue = IssueManager.GetById(issue.Id); Assert.IsNotNull(FetchedIssue); }
public override bool Run(IssueManager issueManager) { // app logic for run event LogDebugMessage("Started Run"); return(true); }
public ManageIssue(IssueManager issueManager, Settings settings, FileLogger logger, object[] epicList) : this() { _issueManager = issueManager; _logger = logger; _settings = settings; cboEpics.Items.AddRange(epicList); }
private void AddChildVersions(List <Countersoft.Gemini.Commons.Entity.Version> versions, int projectId, IssuesFilter filter, List <Countersoft.Gemini.Commons.Entity.Version> child, ref List <IssueDto> issues) { foreach (var version in child) { issues.AddRange(IssueManager.GetRoadmap(projectId, filter, version.Id)); AddChildVersions(versions, projectId, filter, versions.FindAll(v => v.ParentId == version.Id), ref issues); } }
public override bool Run(IssueManager issueManager) { // app logic for run event LogDebugMessage("Started Run"); return true; }
/// <summary> /// Checks the disabled users and executes the MergeAndDelete-Method /// </summary> /// <param name="issueManager"></param> public void CheckDisabledUsers(IssueManager issueManager) { UserManager userManager = new UserManager(GeminiApp.Cache(), GeminiApp.UserContext(), issueManager.GeminiContext); var allUsers = userManager.GetAll(); DateTime currentDate = DateTime.Now; var time = GetAppConfigSettings("disabledForDays").Value; int days = Convert.ToInt32(time); foreach (var user in allUsers) { if (user.Entity.Active == false) { var activeUserIndex = GetActiveUsersFromOrganisation(issueManager, user.Entity); DateTime lastupdateIncludeMonths = user.Entity.Revised.AddDays(days); int disabledUserId = user.Entity.Id; if (activeUserIndex.Count != 0 && lastupdateIncludeMonths < DateTime.Now) { string firstActiveUserOrganisation = activeUserIndex[0]; foreach (var activeUser in allUsers) { if (activeUser.Entity.Username == firstActiveUserOrganisation) { try { MergeAndDelete(activeUser.Entity, user.Entity, disabledUserId, userManager); break; } catch (Exception e) { string message = string.Format("Folgender User konnte nicht gemerged oder gelöscht werden: {0} ", user.Entity.Fullname); GeminiApp.LogException(e, false, message); } } } } else if (lastupdateIncludeMonths < DateTime.Now) { foreach (var activeUser in allUsers) { if (activeUser.Entity.Username == GetAppConfigSettings("defaultUser").Value) { try { MergeAndDelete(activeUser.Entity, user.Entity, disabledUserId, userManager); break; } catch (Exception e) { string message = string.Format("Folgender User konnte nicht gemerged oder gelöscht werden: {0} ", user.Entity.Fullname); GeminiApp.LogException(e, false, message); } } } } } } }
private static void GetSettlementMilitiaChangeDueToIssues(Settlement settlement, ref ExplainedNumber result) { float value; if (IssueManager.DoesSettlementHasIssueEffect(DefaultIssueEffects.SettlementMilitia, settlement, out value)) { result.Add(value, _issues); } }
private static void FailedTest(IssueModel issueModel) { JiraInfoProvider.SaveStackTrace(issueModel.Key, TestContext.CurrentContext.Result.StackTrace); issueModel.Summary = TestContext.CurrentContext.Result.Message; issueModel.Status = Status.Failed; IssueManager.AddIssue(issueModel); }
public async Task <ActionResult> DeleteConfirmed(Guid id) { IssueManager.Delete(id); if (Request.IsAjaxRequest()) { return(PartialView("_DeleteMsg", "Đã xóa")); } return(RedirectToAction("Index")); }
private static void FailedTest(string key, TestResult testResult, IssueModel issue) { JiraInfoProvider.SaveStackTrace(key, GetStackTrace(testResult.TestFailureException)); issue.Summary = testResult.TestFailureException.Message; issue.Status = Status.Failed; IssueManager.AddIssue(issue); }
private static void GetSettlementGarrisonChangeDueToIssues(Settlement settlement, ref ExplainedNumber result) { float value; if (IssueManager.DoesSettlementHasIssueEffect(DefaultIssueEffects.SettlementGarrison, settlement, out value)) { result.Add(value, WangSettlementGarrisonModel._issues, null); } }
private static void FailedTest(IssueModel issueModel, ScenarioContext context) { JiraInfoProvider.SaveStackTrace(issueModel.Key, context.TestError.StackTrace); issueModel.Summary = context.TestError.Message; issueModel.Status = Status.Failed; IssueManager.AddIssue(issueModel); }
public static List <Issue> CreateRandomIssues(string preTitle, string preDescription, int numIssues) { List <Issue> outputIssues = new List <Issue>(); List <Project> ps = ProjectManager.GetAllProjects(); if (ps.Count > 0) { Project p = ps[0]; int StartIssueCount = IssueManager.GetByProjectId(p.Id).Count; RandomProjectData prand = new RandomProjectData(p); for (int i = 0; i < numIssues; i++) { // Get Random yet valid data for the current project Category c = prand.GetCategory(); Milestone ms = prand.GetMilestone(); Status st = prand.GetStatus(); Priority pr = prand.GetPriority(); IssueType isst = prand.GetIssueType(); Resolution res = prand.GetResolution(); string assigned = prand.GetUsername(); // creator is also the owner string createdby = prand.GetUsername(); var issue = new Issue { ProjectId = p.Id, Id = Globals.NEW_ID, Title = preTitle + RandomStrings.RandomString(30), CreatorUserName = createdby, DateCreated = DateTime.Now, Description = preDescription + RandomStrings.RandomString(250), DueDate = DateTime.MinValue, IssueTypeId = isst.Id, AffectedMilestoneId = ms.Id, AssignedUserName = assigned, CategoryId = c.Id, MilestoneId = ms.Id, OwnerUserName = createdby, PriorityId = pr.Id, ResolutionId = res.Id, StatusId = st.Id, Estimation = 0, Visibility = 1 }; IssueManager.SaveOrUpdate(issue); // To return to the unit tests outputIssues.Add(issue); } } return(outputIssues); }
private void cmdRevert_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; try { var gestor = new IssueManager(); string directorioActual = string.Empty; string scriptActual = string.Empty; IEnumerable <IssueEntity> listaIncidencias = new List <IssueEntity>(); try { gestor.BeginTransaction(); listaIncidencias = ObtenerIncidenciasSeleccionadas(tvwTarget, SortDirection.Descending); foreach (var incidencia in listaIncidencias) { directorioActual = incidencia.Nombre; // recupera los scripts en orden inverso. for (int i = incidencia.Scripts.Keys.Count - 1; i >= 0; i--) { scriptActual = incidencia.Scripts[i + 1].Nombre; gestor.RevertirScript(incidencia.Scripts[i + 1]); } incidencia.Aplicada = false; } gestor.CommitTransaction(); } catch (Exception ex) { gestor.RollbackTransaction(); foreach (var i in listaIncidencias) { i.Aplicada = false; } frmMensaje frm = new frmMensaje(); frm.Mensaje = string.Format("Se ha producido un error al revertir el script {0} de la incidencia {1}.", scriptActual, directorioActual); frm.Detalle = ex.Message + "\n" + "\n" + ex.StackTrace; frm.ShowDialog(); } LeerIncidenciasAplicadas(); LeerRepositorioDeIncidencias(); MostrarIncidenciasAplicadas(); MostrarRepositorioDeIncidencias(); } catch (ApplicationException appEx) { MessageBox.Show(appEx.Message); } this.Cursor = Cursors.Default; }
public async Task <ActionResult> AddTimeToDo(Guid id) { WorkIssue workIssue = IssueManager.GetById(id); if (Request.IsAjaxRequest()) { return(PartialView("Issues/_AddTime", workIssue)); } return(RedirectToAction("Index")); }
public void TestDeleteIssue() { bool result = IssueManager.Delete(IssueId); Assert.IsTrue(result, "No changes were made to the issue"); Issue issue = IssueManager.GetById(IssueId); Assert.IsTrue(issue.Disabled); }
public override bool Run(IssueManager issueManager) { if (!issueManager.UserContext.Config.EmailAlertsEnabled) return true; issueManager.UserContext.User.Entity = new User(issueManager.UserContext.User.Entity); issueManager.UserContext.User.Entity.Language = "en-US"; _issueManager = issueManager; _templates = GeminiApp.Container.Resolve<IAlertTemplates>().FindWhere(c => c.AlertType != AlertTemplateType.Breeze).ToList(); _types = new MetaManager(issueManager).TypeGetAll(); _permissionSets = new PermissionSetManager(issueManager).GetAll(); _organizations = new OrganizationManager(issueManager).GetAll(); ProcessAppNavCardAlerts(); ProcessWatcherAlerts(); return true; }