public List<DefectEvent> gettaskevents(string ttid) { CurrentContext.Validate(); if (string.IsNullOrEmpty(ttid)) return null; return DefectEvent.GetEventsByTask(Convert.ToInt32(ttid)); }
protected override void OnProcessComplexColumn(string col, object val) { if (col == _Desc) { string sql = string.Format("UPDATE {2} SET DESCRPTN = '{0}' WHERE IDDEFREC = (SELECT IDRECORD FROM {3} D WHERE D.DEFECTNUM = {1})", val.ToString().Replace("'", "''"), _id, _RepTable, _Tabl); SQLExecute(sql); return; } if (col == _Specs) { string sql = string.Format("UPDATE {2} SET REPROSTEPS = '{0}' WHERE IDDEFREC = (SELECT IDRECORD FROM {3} D WHERE D.DEFECTNUM = {1})", val.ToString().Replace("'", "''"), _id, _RepTable, _Tabl); SQLExecute(sql); return; } else if (col == _Est || col == _EstId) { DefectEvent.AddEventByTask(IDREC, DefectEvent.Eventtype.estimated, ESTIMBY, "", ESTIM); return; } else if (col == _AsUser) { if (!string.IsNullOrEmpty(AUSER)) { DefectEvent.AddEventByTask(IDREC, DefectEvent.Eventtype.assigned, GetUpdater().TTUSERID, "", -1, Convert.ToInt32(AUSER)); } return; } else { base.OnProcessComplexColumn(col, val); } }
public void spendEvent(int id, int hrs) { CurrentContext.Validate(); DefectEvent de = new DefectEvent(id); de.TIME = hrs.ToString(); de.Store(); NotifyHub.NotifyPlanChange(CurrentContext.UserID); }
public DefectBase startEvent(int ttid, string disp, int hrs, string date) { CurrentContext.Validate(); DateTime dt = DateTime.ParseExact(date, IdBasedObject.defDateFormat, CultureInfo.InvariantCulture); int id = Defect.GetIDbyTT(ttid); DefectEvent.AddEventByTask(id, DefectEvent.Eventtype.worked, CurrentContext.TTUSERID, "I have worked on this task", hrs, -1, dt); NotifyHub.NotifyDefectChange(id); return ChangeDispo(ttid, disp); }
public async Task <bool> SetGloabalDispo(int ttid, GlobalDispo dispo, string email) { var dispRef = await DefectDispo.GetDispoFromGlobal(dispo); string currentlock = Guid.NewGuid().ToString(); var user = DefectUser.FindByEmail(email); if (user == null) { return(false); } LockInfo li = await Defect.LocktaskAsync(ttid.ToString(), currentlock, user.TRID.ToString(), true); Defect d = new Defect(ttid); d.SetUpdater(new MPSUser(user.TRID)); d.DISPO = dispRef.idRecord.ToString(); if (d.PRIMARYHOURS == null) { d.PRIMARYHOURS = d.SPENT; } d.Store(); DefectEvent.AddEventByTask(d.IDREC, DefectEvent.Eventtype.QualityAssurance, user.ID, "Changed disposition to " + dispo); await Defect.UnLocktaskAsync(user.TRID.ToString(), currentlock); var settings = Settings.CurrentSettings; if (d.ID.ToString() == settings.RELEASETTID) { if (dispo == GlobalDispo.testStarted) { VersionBuilder.SendAlarm("✅Release build has been finished. Testing is starting..."); } else { VersionBuilder.SendAlarm("❌Failed to build version. Please check the logs!!!"); } } else { DefectUser du = new DefectUser(d.AUSER); MPSUser worker = new MPSUser(du.TRID); var attr = dispo.GetAttributeOfType <DisplayAttribute>(); TasksBot.SendMessage(worker.CHATID, $"{attr.Description}. The task tests have been marked as {dispRef.Descriptor} by automation system. {settings.GetTTAnchor(ttid, attr.Name)}"); if (dispo == GlobalDispo.testStarted) { string mess = $"New task from {user.FULLNAME} is ready for tests!{settings.GetTTAnchor(ttid, d.FIRE ? "taskfire.png" : "")}"; await TestChannel.SendMessageAsync(mess); } } return(true); }
public static void SendVersionAlarm() { string details = ""; string version = ""; Git git = new Git(Settings.CurrentSettings.TEMPGIT); foreach (var f in git.GetTopCommit().EnumFiles()) { if (f.Name.ToLower().Contains("changelog.txt")) { foreach (var d in f.Diff) { if (d.StartsWith("+")) { string line = d.Substring(1).Replace("<", "<").Replace(">", ">").Trim(); if (line.StartsWith("==")) { version = line.Replace("=", "").Trim(); } else { if (line.StartsWith("TT")) { if (line.EndsWith("@nolog", StringComparison.OrdinalIgnoreCase)) { continue; } Match m = Regex.Match(line, "TT[0-9]+"); if (m.Success) { string ttid = m.Value.Replace("TT", ""); line = string.Format("<a href='{0}{1}{2}'>{3}</a>", Settings.CurrentSettings.GLOBALSITEURL, StaticSettings.DefectUrl, ttid, line.Substring(0, Math.Min(line.Length, 120))); int id; if (Defect.GetIDbyTT(int.Parse(ttid), out id)) { DefectEvent.AddEventByTask(id, DefectEvent.Eventtype.versionIncluded, CurrentContext.TTUSERID, version, -1, -1, null); } } } details += line + Environment.NewLine; } } } } } details = details.Trim(); if (!string.IsNullOrEmpty(details)) { SendAlarm(string.Format("📢<a href='{3}versionchanges.aspx'>{0}</a> has been setup.{1}List of changes:{1}{2}{1}The build will be started as soon as possible." + $"👤:{CurrentContext.UserLogin()}", version, Environment.NewLine, details, Settings.CurrentSettings.GLOBALSITEURL)); } DefectPlan.UpdateEDD(); }
public List<DefectEventDefect> getDayEvents(string date) { CurrentContext.Validate(); List<DefectEventDefect> res = new List<DefectEventDefect>(); if (string.IsNullOrEmpty(date)) return res; DateTime dt = DateTime.ParseExact(date, IdBasedObject.defDateFormat, CultureInfo.InvariantCulture); foreach (var i in DefectEvent.GetEventsByDay(dt, CurrentContext.TTUSERID)) { res.Add(new DefectEventDefect(i)); } return res; }
protected override void PostStore() { if (REQUESTRESET) { DefectHistory.DelHisotoryByTask(IDREC); DefectEvent.DelHisotoryByTask(IDREC); _HistoryChanges = "Task was reset."; } if (!string.IsNullOrEmpty(_HistoryChanges)) { DefectHistory.AddHisotoryByTask(IDREC, _HistoryChanges, GetUpdater().TTUSERID.ToString()); _HistoryChanges = ""; } base.PostStore(); }
public void FinishBuild(int id, string requestguid) { try { DefectBuild b = new DefectBuild(id) { STATUS = DefectBuild.BuildStatus.finishedok.ToString(), TESTGUID = requestguid }; b.Store(); if (Settings.CurrentSettings.RELEASETTID == b.TTID.ToString() && b.TYPE == (int)DefectBuild.BuildType.releasebuild) { //release builder sends its own notifications return; } Defect d = new Defect(b.TTID); DefectUser u = new DefectUser(b.TTUSERID); d.SetUpdater(new MPSUser(u.TRID)); List <DefectDispo> dsps = DefectDispo.EnumTestsStarted(); if (dsps.Count > 0) { string currentlock = Guid.NewGuid().ToString(); LockInfo li = Defect.Locktask(b.TTID.ToString(), currentlock, u.TRID.ToString(), true); d.DISPO = dsps[0].ID.ToString(); if (d.PRIMARYHOURS == null) { d.PRIMARYHOURS = d.SPENT; } d.Store(); DefectEvent.AddEventByTask(id, DefectEvent.Eventtype.QualityAssurance, b.TTUSERID, "Sent for QA Automation"); Defect.UnLocktask(u.TRID.ToString(), currentlock); } if (Settings.CurrentSettings.RELEASETTID == b.TTID.ToString()) { VersionBuilder.SendAlarm("✅New internal release build has been finished. Testing is starting..."); } else { try { string mess = $"New task from {u.FULLNAME} is ready for tests!{Settings.CurrentSettings.GetTTAnchor(b.TTID, d.FIRE ? "taskfire.png" : "")}"; TestChannel.SendMessage(mess); } catch (Exception e) { Logger.Log(e); } } string bst_b = d.BSTBATCHES.Trim(); string bst_c = d.BSTCOMMANDS.Trim(); if (!string.IsNullOrEmpty(bst_b) || !string.IsNullOrEmpty(bst_c)) { string batches = string.Join(",", bst_b.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries)); string commands = string.Join(",", bst_c.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries)); using (var wcClient = new WebClient()) { var reqparm = new NameValueCollection(); reqparm.Add("guid", requestguid); reqparm.Add("commaseparatedbatches", batches); reqparm.Add("commaseparatedcommands", commands); reqparm.Add("priority", d.TESTPRIORITY); //reqparm.Add("branch", d.BRANCHBST); wcClient.UploadValues(Settings.CurrentSettings.BSTSITESERVICE + "/StartTest", reqparm); } } } catch (Exception e) { Logger.Log(e); } }
public TrackerResults getItems(int trackerid) { CurrentContext.Validate(); TrackerResults res = new TrackerResults(); res.TRACKER = new Tracker(trackerid); List <DefectBase> defs = (new DefectBase()).Enum(res.TRACKER.GetFilter()); DateTime now = DateTime.Now; DateTime start = now - new TimeSpan((int)now.DayOfWeek - 1, now.Hour, now.Minute, now.Second); DateTime end = start + new TimeSpan(6, 23, 59, 59); DateTime?edd = null; var work = DefectDispo.EnumWorkableIDs(); foreach (var def in defs) { res.STATS.TOTAL++; res.STATS.TOTALHOURS += def.ESTIM; var d = def.GetCreated().GetValueOrDefault(); if (d >= start && d <= end) { res.STATS.CREATED++; res.STATS.CREATEDHOURS += def.ESTIM; } var e = def.GetEDD(); if (work.Contains(def.GetDispo()) && e != null) { if (edd == null) { edd = e; } else if (e > edd) { edd = e; } res.STATS.REMAINHOURS += def.ESTIM - def.SPENT; } } if (edd != null) { res.STATS.EDD = edd.GetValueOrDefault().ToString(IdBasedObject.defDateFormat, CultureInfo.InvariantCulture); } var ids = defs.Select(x => (decimal)x.IDREC).ToList(); res.STATS.SPENTHOURS = DefectEvent.Spent(ids, start, end); res.STATS.FINISHED = DefectEvent.Included(ids, start, end); string COLORDEFS = ""; foreach (var disp in DefectDispo.Enum()) { int estim = 0; foreach (var def in defs) { if (def.DISPO == disp.ID.ToString()) { estim += def.ESTIM; } } if (estim > 0) { COLORDEFS += $"{estim}:{disp.COLOR};"; } } if (res.TRACKER.COLORDEFS != COLORDEFS) { res.TRACKER.COLORDEFS = COLORDEFS; res.TRACKER.Store(); } res.ITEMS = DefectPlan.Convert2Plan(defs); return(res); }
public void delEvent(int id) { CurrentContext.Validate(); DefectEvent.Delete(id); NotifyHub.NotifyPlanChange(CurrentContext.UserID); }
public DefectBase versionChange(int ttid, string version) { int id = Defect.GetIDbyTT(ttid); DefectEvent.AddEventByTask(id, DefectEvent.Eventtype.versionIncluded, CurrentContext.TTUSERID, version, -1, -1, null); return new DefectBase(ttid); }