public void setschedule(List <TTBackOrder> ttids, List <string> unschedule) { if (!CurrentContext.Valid) { return; } foreach (var ttid in unschedule) { Defect d = new Defect(Convert.ToInt32(ttid)); d.ORDER = -1; d.Store(); } foreach (var ttid in ttids) { DefectBase d; if (ttid.moved) { d = new Defect(ttid.ttid); //will add history record about moving } else { d = new DefectBase(ttid.ttid); } if (d.BACKORDER != ttid.backorder) { d.BACKORDER = ttid.backorder; d.Store(); } } }
private DefectBase ChangeDispo(int ttid, string disp) { Defect d = new Defect(ttid); if (d.DISPO == disp)//already set { return new DefectBase(ttid); } if (Defect.Locked(ttid.ToString())) { return null; } d.DISPO = disp; if (Convert.ToInt32(d.DISPO) == DefectDispo.GetWorkingRec()) { if (d.ORDER < 1) { d.ORDER = 1; } } d.Store(); return new DefectBase(Convert.ToInt32(ttid)); }
public void settaskBase(List <DefectBase> defects) { foreach (DefectBase d in defects) { Defect dstore = new Defect(d.ID); dstore.FromAnotherObject(d); if (dstore.IsModified()) { dstore.Store(); } } }
public void copyTasks(string ttids) { string[] ids = ttids.Split(','); foreach (string id in ids) { Defect old = new Defect(int.Parse(id)); Defect d = new Defect(Defect.New(old.SUMMARY)); d.From(old); d.DISPO = old.DISPO; d.Store(); } }
public int copyTask(int ttid) { Defect old = new Defect(ttid); Defect d = new Defect(Defect.New(old.SUMMARY)); d.From(old); d.AUSER = ""; d.ESTIM = 0; d.ORDER = -1; d.Store(); return(d.ID); }
public int orderDefect(int ttid, int order) { CurrentContext.Validate(); Defect d = new Defect(ttid); if (Defect.Locked(ttid.ToString())) { return d.ORDER; } d.ORDER = order; d.Store(); return d.ORDER; }
public int estimateDefect(int ttid, int estim) { CurrentContext.Validate(); Defect d = new Defect(ttid); if (Defect.Locked(ttid.ToString())) { return d.ESTIM; } d.ESTIM = estim; d.Store(); return d.ESTIM; }
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 DefectBase scheduletask(string ttid, string date) { if (Defect.Locked(ttid)) { return(null); } Defect d = new Defect(Convert.ToInt32(ttid)); d.DISPO = DefectDispo.GetWorkingRec().ToString(); d.DATE = date; d.Store(); return(new DefectBase(Convert.ToInt32(ttid))); }
public DefectPlan newTask(string summary, int trackerid) { CurrentContext.ValidateAdmin(); if (string.IsNullOrEmpty(summary) || trackerid < 0) { return(null); } Tracker t = new Tracker(trackerid); summary += "@" + t.NAME; Defect d = new Defect(Defect.New(summary)); d.AddMessage("tag:" + t.GetTag(), CurrentContext.UserID); d.ESTIM = 1; d.Store(); return(new DefectPlan(d)); }
public string settask(Defect d) { CurrentContext.Validate(); Defect dstore = new Defect(d.ID); if (d.ORDER != dstore.ORDER) { //copy object specifics for multiple savings from same page: only order change should be processed. d.BACKORDER = dstore.BACKORDER; } dstore.FromAnotherObject(d); dstore.REQUESTRESET = d.REQUESTRESET; if (dstore.IsModified()) { dstore.Store(); } return "OK"; }
public string assignDefect(int ttid, int userid) { CurrentContext.Validate(); Defect d = new Defect(ttid); if (Defect.Locked(ttid.ToString())) { return ""; } d.AUSER = userid.ToString(); if (d.DISPO == DefectDispo.EnumCannotStartIDs()[0].ToString()) { d.DISPO = DefectDispo.EnumWorkable()[0].ID.ToString(); } d.ORDER = 1; d.Store(); return d.AUSER; }
public void addSickness(string details, int ttuserid) { if (!CurrentContext.Valid) { return; } if (string.IsNullOrEmpty(details) || ttuserid < 1) { return; } DateTime dt = DateTime.Today; Defect d = new Defect(Defect.New("SICKNESS DAY " + dt.Year)); d.DESCR = $"{CurrentContext.User.PERSON_NAME}: {details}"; d.AUSER = ttuserid.ToString(); d.DISPO = DefectDispo.GetWorkingRec().ToString(); d.ESTIM = 8; d.COMP = DefectComp.GetVacationRec()[0].ToString(); d.DATE = dt.ToString(defDateFormat); d.Store(); TasksBot.SendMessage(Settings.CurrentSettings.TELEGRAMCOMPANYCHANNEL, $"🌡{details}"); }
public void SetTaskTestStatus(string ttid, string failed, string userphone) { try { MPSUser bsu = MPSUser.FindUserbyPhone(userphone); if (bsu == null) { Logger.Log($"Cannot update task {ttid} by testing system. User was not found by phone number: {userphone}"); return; } Defect d = new Defect(ttid); d.SetUpdater(bsu); string lockguid = Guid.NewGuid().ToString(); var lt = Defect.Locktask(ttid.ToString(), lockguid, bsu.ID.ToString()); bool locked = lt.globallock != lockguid; bool testFail; bool testcancel = false; if (!bool.TryParse(failed, out testFail)) { testcancel = true; } if (locked) { MPSUser lu = new MPSUser(lt.lockedby); TasksBot.SendMessage(lu.CHATID, $"You was disconnected from the task by the testing system to update task status!{Settings.CurrentSettings.GetTTAnchor(int.Parse(ttid), "disconnect.png")}"); NotifyHub.lockTaskForceUpdatePages(int.Parse(ttid), lockguid, bsu.ID); lt = Defect.Locktask(ttid.ToString(), lockguid, bsu.ID.ToString()); } List <DefectDispo> disp = (testcancel || testFail) ? DefectDispo.EnumTestsFailed() : DefectDispo.EnumTestsPassed(); if (disp.Count > 0) { if (!testcancel) { d.DISPO = disp[0].ID.ToString(); } else { d.AddMessage("Test request have been ignored", bsu.ID); } d.Store(); Defect.UnLocktask(ttid, lt.globallock); if (!testcancel) { DefectUser du = new DefectUser(d.AUSER); if (du.TRID > -1) { MPSUser worker = new MPSUser(du.TRID); string result = "Succeeded!"; string img = "taskokay.png"; if (testcancel) { result = "Cancelled!"; img = "bin.png"; } else if (testFail) { result = "Failed!"; img = "taskfail.png"; } TasksBot.SendMessage(worker.CHATID, $"The task tests have been marked as BST {result} by {bsu.PERSON_NAME}{Settings.CurrentSettings.GetTTAnchor(int.Parse(ttid), img)}"); } } } } catch (Exception e) { Logger.Log(e); } }
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); } }