public List <DefectPlan> getunplanned(string userid) { CurrentContext.Validate(); DefectBase d = new DefectBase(); return(DefectPlan.Convert2Plan(d.EnumUnPlan(string.IsNullOrEmpty(userid) ? CurrentContext.User.TTUSERID : Convert.ToInt32(userid)))); }
public void UpdateEDD() { //avoid dd attacks killing server if (!HttpContext.Current.Request.IsLocal) { return; } DefectPlan.UpdateEDD(); }
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 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); }