public ActionResult Evaluate(IFormCollection formCollection, RetroViewModel retroViewModel) { foreach (var key in formCollection.AsParallel()) { string retroDate = formCollection["RetroDate"]; var skillIDs = formCollection["SkillID"].ToList(); var levels = formCollection["Level"].ToList(); for (int i = 0; i < skillIDs.Count(); i++) { Console.WriteLine(i); int skillID = ConvertToInt(skillIDs[i]); Level levelID = ConvertToLevel(levels[i]); var retro = new Retro() { RetroDate = Convert.ToDateTime(retroDate), Level = (Level)levelID, SkillID = skillID }; PostARetroItem(retro); } ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator."); return(RedirectToAction("Report")); } return(View(retroViewModel)); }
public RetroDTO(Retro retro, string activeUserId) { this.Id = retro.Id; this.Name = retro.Name; this.Groups = retro.Groups .OrderBy(g => g.WhenCreated) .Select(g => new GroupDTO(g, activeUserId)); this.IsOwner = activeUserId.ToString() == retro.OwnerId; }
public Retro Build() { if (m_retro == null) { throw new Exception("Use one of the retrobuilder methods before using Build() to build a retro"); } var retro = m_retro; m_retro = null; return(retro); }
private bool PostARetroItem(Retro retro) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(Startup.APIURL + "retros"); //HTTP POST var postTask = client.PostAsJsonAsync <Retro>("retros", retro); postTask.Wait(); var result = postTask.Result; return(result.IsSuccessStatusCode ? true : false); } }
public RetroBuilder ValidRetro() { m_retro = new Retro(Guid.NewGuid()) { Positives = CreateValidPositives(), Negatives = CreateValidNegatives(), Actions = CreateValidActions(), Writer = CreateValidWriter(), StartTime = DateTime.Now, EndTime = DateTime.Now }; return(this); }
public Task Delete(Retro retro) { var gotValue = m_retroJsonpathDictionary.TryGetValue(retro.Id, out var jsonPath); if (gotValue) { File.Delete(jsonPath); return(Task.CompletedTask); } throw new ArgumentOutOfRangeException( $"Could not find and retro with id: {retro.Id} in any json file in : {Configuration.PathForJsonFiles}"); }
public async Task <bool> TryPostRetro(string webHook, Retro retro, CancellationToken token = default(CancellationToken)) { var duration = retro.EndTime - retro.StartTime; var durationString = $"{duration.Hours}h:{duration.Minutes}m:{duration.Seconds}s"; m_messageBuilder.AddAttachement( "Retrospective summary", color: "transient", footer: $"Writer: @{retro.Writer.NickName}\nDuration: {durationString}"); if (retro.Positives != null && retro.Positives.Any()) { m_messageBuilder.AddAttachement( "Positives", color: PositiveColor, slackFieldsFunc: () => retro.Positives.Select(positive => new SlackField { Value = "- " + positive.Text }).ToList()); } if (retro.Negatives != null && retro.Negatives.Any()) { m_messageBuilder.AddAttachement( "Negatives", color: NegativeColor, slackFieldsFunc: () => retro.Negatives.Select(negative => new SlackField { Value = "- " + negative.Text }).ToList()); } if (retro.Actions != null && retro.Actions.Any()) { m_messageBuilder.AddAttachement( "Actions", color: NeutralColor, slackFieldsFunc: () => retro.Actions.Select(action => new SlackField { Value = "- " + action.Text }).ToList()); } var slackMessage = m_messageBuilder.Build(); var content = SerializeAndCreateStringContent(slackMessage); var response = await httpClient.PostAsync(webHook, content, token); return(response.IsSuccessStatusCode); }
public RetroBuilder InvalidRetro() { m_retro = ValidRetro().Build(); m_retro = new Retro(Guid.Empty) { Writer = null, StartTime = default(DateTime), EndTime = default(DateTime), Positives = m_retro.Positives, Negatives = m_retro.Negatives, Actions = m_retro.Actions }; return(this); }
public async Task <OperationResult <RetroDTO> > Handle(CreateRetroRequest request) { Retro newRetro; do { newRetro = new Retro(request.RetroName, this.userContextProvider.GetUserId()); }while(this.retroReposirotory.GetByReference(newRetro.Reference).Result != null); if (request.WithDefaultGroups) { newRetro.WithDefaultGroups(); } var retro = await this.retroReposirotory.Add(newRetro); return(OperationResultCreator.Suceeded(new RetroDTO(retro, userContextProvider.GetUserId()))); }
public async Task Create(Retro retro) { EnsureJsonPathExists(); var json = JsonConvert.SerializeObject(retro); var filepathWithFileName = $"{Configuration.PathForJsonFiles}/{Configuration.JsonFilesPrefix}-{retro.EndTime.ToString(Configuration.JsonDateFormat)}.json"; if (File.Exists(filepathWithFileName)) { File.Delete(filepathWithFileName); } using (FileStream fs = File.Create(filepathWithFileName)) { var encoded = Encoding.ASCII.GetBytes(json); await fs.WriteAsync(encoded, 0, encoded.Length); m_retroJsonpathDictionary.Add(retro.Id, filepathWithFileName); } }
public async Task <bool> TryDeleteAsync(Retro retro) { try { await m_retroRepository.Delete(retro); return(true); } catch (Exception e) { if (e is ArgumentOutOfRangeException) { return(false); } else { throw e; } } }
public async Task <bool> TrySaveAsync(Retro retro) { if (!retro.IsValid) { return(false); } { try { await m_retroRepository.Create(retro); return(true); } catch (Exception e) { throw e; } } }
public void Update(bool bValidate, Retro.AuditType auditType, bool transactionFurnished) { if (transactionFurnished) { UpdateLoaded(bValidate, TemplateDef, auditType); } else { using (TransactionScope transScope = new TransactionScope(Data.Common.TransactionScopeOption)) { UpdateLoaded(bValidate, TemplateDef, auditType); transScope.Complete(); } } }
private Retro.AuditType GetAuditTypeAsOrphaned(Retro.AuditType defaultAuditType) { if (!_isOrphaned && RetroModel == Retro.RetroModel.OnWithEditLanguage) { _isOrphaned = true; return Retro.AuditType.Orphaned; } return defaultAuditType; }
//Note - The caller is expected to set TransactionScope for this call private void UpdateLoaded(bool bValidate, string sXml, Retro.AuditType auditType) { string sTerm1 = null; string sTerm2 = null; DateTime? dtTerm3 = null; string sTerm4 = null; string sTerm5 = null; DateTime? dtTerm6 = null; DateTime? dtTerm7 = null; //Save values of External Terms to the ExternalTermValue table foreach (Term t in BasicTerms) if (t.TermType == TermType.External) { ExternalTerm extTerm = t as ExternalTerm; if (!extTerm.ValuesLoaded) extTerm.LoadValues(); extTerm.SaveValues(true); } GetTerms(ref sTerm1, ref sTerm2, ref dtTerm3, ref sTerm4, ref sTerm5, ref dtTerm6, ref dtTerm7); string sKeyWords = GetKeyWords(); if (!_isOrphaned) _isOrphaned = auditType == Retro.AuditType.Orphaned; if (PrimaryFacility == null) Data.ManagedItem.UpdateManagedItem(ManagedItemID, ItemNumber, State.Status, State.Name, State.ID, sTerm1, sTerm2, dtTerm3, sTerm4, sTerm5, dtTerm6, dtTerm7, sKeyWords, FacilityTerm.GetXml(null), FacilityTerm.GetXml(null), _isOrphaned); else Data.ManagedItem.UpdateManagedItem(ManagedItemID, ItemNumber, State.Status, State.Name, State.ID, sTerm1, sTerm2, dtTerm3, sTerm4, sTerm5, dtTerm6, dtTerm7, sKeyWords, FacilityTerm.GetXml(PrimaryFacility.SelectedFacilityIDs), FacilityTerm.GetXml(OwningFacilityIDs), _isOrphaned); Business.BasicTerms.Save(this, ref sXml, bValidate); //Update the Scheduled Events, but only if this method is being called from the web app (not from the scheduled job) if (System.Web.HttpContext.Current != null) UpdateScheduledEvents(ScheduledEvent.ExecutedCalculationType.UsePreviousValue); //Update all the other portions of the xml, if they have been loaded (assumes they were modified)... if (ComplexListsLoaded) { UpdateTermGroupNames(); Business.ComplexLists.Save(this, ref sXml, bValidate); } if (WorkflowLoaded) Business.Workflows.Save(this, ref sXml, bValidate); if (TermDependenciesLoaded) Business.TermDependency.Save(this, ref sXml, bValidate); if (EventsLoaded) Business.Events.Save(this, ref sXml, bValidate); if (ExtensionsLoaded) Business.Extensions.Save(this, ref sXml, bValidate); if (CommentsLoaded) Business.Comments.Save(this, ref sXml, bValidate); if (TermGroupsLoaded) Business.TermGroups.Save(this, ref sXml, bValidate); if (DocumentsLoaded) Business.ITATDocuments.Save(this, ref sXml, bValidate); //Save the attachments, but only if this method is being called from the web app (not from the scheduled job) if (System.Web.HttpContext.Current != null) { SaveAttachments(); } Business.Template.UpdateTemplateDef(this, sXml); Guid personId = Business.SecurityHelper.GetLoggedOnPersonId(); byte[] templateDefZipped = Utility.CompressionHelper.Compress(sXml); Data.ManagedItem.InsertManagedItemAudit(ManagedItemID, personId, DateTime.Now, State.Name, State.ID, State.Status, templateDefZipped, (int)auditType); Data.ManagedItem.UpdateManagedItemStateRole(ManagedItemID, Utility.ListHelper.EliminateDuplicates(State.AccessorRoleNames)); }
// Use this for initialization private void Start() { // add button functions // reset RealGlobals ResetRG.GetComponent <Button>().onClick.AddListener(() => { if (RealGlobalCooldown > 0) { LuaScriptBinder.ClearVariables(); RealGlobalCooldown = 60 * 2; ResetRG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Real Globals Erased!" : "REEL GOLBELZ DELEET!!!!!"; } else { RealGlobalCooldown = 60 * 2; ResetRG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???"; } }); // reset AlMightyGlobals ResetAG.GetComponent <Button>().onClick.AddListener(() => { if (AlMightyGlobalCooldown > 0) { LuaScriptBinder.ClearAlMighty(); AlMightyGlobalCooldown = 60 * 2; ResetAG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "AlMighty Globals Erased!" : "ALMEIGHTIZ DELEET!!!!!"; } else { AlMightyGlobalCooldown = 60 * 2; ResetAG.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???"; } }); // clear Save ClearSave.GetComponent <Button>().onClick.AddListener(() => { if (SaveCooldown > 0) { File.Delete(Application.persistentDataPath + "/save.gd"); SaveCooldown = 60 * 2; ClearSave.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Save wiped!" : "RIP"; } else { SaveCooldown = 60 * 2; ClearSave.GetComponentInChildren <Text>().text = !GlobalControls.crate ? "Are you sure?" : "R U SUR???"; } }); // toggle safe mode Safe.GetComponent <Button>().onClick.AddListener(() => { ControlPanel.instance.Safe = !ControlPanel.instance.Safe; // save Safe Mode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFSafeMode", DynValue.NewBoolean(ControlPanel.instance.Safe), true); Safe.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Safe mode: " + (ControlPanel.instance.Safe ? "On" : "Off")) : ("SFAE MDOE: " + (ControlPanel.instance.Safe ? "ON" : "OFF")); }); Safe.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Safe mode: " + (ControlPanel.instance.Safe ? "On" : "Off")) : ("SFAE MDOE: " + (ControlPanel.instance.Safe ? "ON" : "OFF")); // toggle retrocompatibility mode Retro.GetComponent <Button>().onClick.AddListener(() => { GlobalControls.retroMode = !GlobalControls.retroMode; // save RetroMode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFRetroMode", DynValue.NewBoolean(GlobalControls.retroMode), true); Retro.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Retrocompatibility Mode: " + (GlobalControls.retroMode ? "On" : "Off")) : ("RETORCMOAPTIILBIYT MOD: " + (GlobalControls.retroMode ? "ON" : "OFF")); }); Retro.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Retrocompatibility Mode: " + (GlobalControls.retroMode ? "On" : "Off")) : ("RETORCMOAPTIILBIYT MOD: " + (GlobalControls.retroMode ? "ON" : "OFF")); // toggle pixel-perfect fullscreen Fullscreen.GetComponent <Button>().onClick.AddListener(() => { ScreenResolution.perfectFullscreen = !ScreenResolution.perfectFullscreen; // save RetroMode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFPerfectFullscreen", DynValue.NewBoolean(ScreenResolution.perfectFullscreen), true); Fullscreen.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Blurless Fullscreen: " + (ScreenResolution.perfectFullscreen ? "On" : "Off")) : ("NOT UGLEE FULLSCREEN: " + (ScreenResolution.perfectFullscreen ? "ON" : "OFF")); }); Fullscreen.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Blurless Fullscreen: " + (ScreenResolution.perfectFullscreen ? "On" : "Off")) : ("NOT UGLEE FULLSCREEN: " + (ScreenResolution.perfectFullscreen ? "ON" : "OFF")); // change window scale Scale.GetComponent <Button>().onClick.AddListener(() => { double maxScale = System.Math.Floor(Screen.currentResolution.height / 480.0); if (ScreenResolution.windowScale < maxScale) { ScreenResolution.windowScale += 1; } else { ScreenResolution.windowScale = 1; } if (Screen.height != ScreenResolution.windowScale * 480 && !Screen.fullScreen) { ScreenResolution.SetFullScreen(false); } // save RetroMode preferences to AlMighties LuaScriptBinder.SetAlMighty(null, "CYFWindowScale", DynValue.NewNumber(ScreenResolution.windowScale), true); Scale.GetComponentInChildren <Text>().text = !GlobalControls.crate ? ("Window Scale: " + ScreenResolution.windowScale.ToString() + "x") : ("WEENDO STRECH: " + ScreenResolution.windowScale.ToString() + "X"); }); ScreenResolution.windowScale--; Scale.GetComponent <Button>().onClick.Invoke(); // Discord Rich Presence // Change Discord Status Visibility Discord.GetComponent <Button>().onClick.AddListener(() => { Discord.GetComponentInChildren <Text>().text = (!GlobalControls.crate ? "Discord Display: " : "DEESCORD DESPLAY: ") + DiscordControls.ChangeVisibilitySetting(1); }); Discord.GetComponentInChildren <Text>().text = (!GlobalControls.crate ? "Discord Display: " : "DEESCORD DESPLAY: ") + DiscordControls.ChangeVisibilitySetting(0); // exit Exit.GetComponent <Button>().onClick.AddListener(() => { SceneManager.LoadScene("ModSelect"); }); // Crate Your Frisk if (!GlobalControls.crate) { return; } // labels GameObject.Find("OptionsLabel").GetComponent <Text>().text = "OPSHUNS"; GameObject.Find("DescriptionLabel").GetComponent <Text>().text = "MORE TXET"; // buttons ResetRG.GetComponentInChildren <Text>().text = "RESTE RELA GOLBALZ"; ResetAG.GetComponentInChildren <Text>().text = "RESTE ALMIGTY GOLBALZ"; ClearSave.GetComponentInChildren <Text>().text = "WYPE SAV"; Exit.GetComponentInChildren <Text>().text = "EXIT TOO MAD SELCT"; }
public virtual bool SaveComplexLists(XmlDocument xmlTemplateDoc, bool bValidate, Retro.AuditType auditType) { UpdateTermGroupNames(); return Business.ComplexLists.Save(xmlTemplateDoc, this, bValidate); }
public async Task <Retro> Add(Retro newRetro) { var result = await MemStateEngine.Execute(new AddRetro(newRetro)); return(result); }
public DeleteRetro(Retro retro) { this.Retro = retro; }
public static bool PromoteTemplate(Guid TemplateID, TemplateStatusType status, Retro.AuditType auditType) { bool promoted = true; using (TransactionScope transScope = new TransactionScope(Data.Common.TransactionScopeOption)) { string sDraftTemplateXML = GetTemplateDef(null, TemplateID, DefType.Draft); string sDraftTemplateXML_NoVersion = null; if (!string.IsNullOrEmpty(sDraftTemplateXML)) sDraftTemplateXML_NoVersion = sDraftTemplateXML.Replace(GetVersion(sDraftTemplateXML), ""); string sFinalTemplateXML = GetTemplateDef(null, TemplateID, DefType.Final); string sFinalTemplateXML_NoVersion = null; if (!string.IsNullOrEmpty(sFinalTemplateXML)) sFinalTemplateXML_NoVersion = sFinalTemplateXML.Replace(GetVersion(sFinalTemplateXML), ""); bool attemptPromotion = true; if (!string.IsNullOrEmpty(sDraftTemplateXML_NoVersion) && !string.IsNullOrEmpty(sFinalTemplateXML_NoVersion)) attemptPromotion = !sDraftTemplateXML_NoVersion.Equals(sFinalTemplateXML_NoVersion); if (attemptPromotion) { Data.Template.UpdateFinalTemplateDef(TemplateID, sDraftTemplateXML); Data.Template.InsertTemplateAudit(TemplateID, Business.SecurityHelper.GetLoggedOnPersonId(), (short)status, sDraftTemplateXML, (int)auditType); } else promoted = false; transScope.Complete(); } return promoted; }
//Replaces the "terms" portion of the xml stored in the database with the version //currently stored in memory public virtual bool SaveBasicTerms(XmlDocument xmlTemplateDoc, bool bValidate, Retro.AuditType auditType) { if (bValidate) { bool bFoundFacilitySystemTerm = false; foreach (Term t in _basicTerms) { if (t.SystemTerm && t.TermType == TermType.Facility) { //RULE: There can be at most one facility system term if (bFoundFacilitySystemTerm) return false; else bFoundFacilitySystemTerm = true; } } } if (Business.BasicTerms.Save(xmlTemplateDoc, this, bValidate)) return SaveEvents(xmlTemplateDoc, EventType.Renewal, bValidate); return false; }
public override XmlElement Export(XmlDocument doc, XmlElement parent) { XmlElement current = base.Export(doc, parent); if (ActiveFrom != null) { current.SetAttribute("ACTIVE_FROM", ActiveFrom.ToString()); } if (ActiveTill != null) { current.SetAttribute("ACTIVE_TILL", ActiveTill.ToString()); } if (Confcal != null) { current.SetAttribute("CONFCAL", Confcal.ToString()); } if (Date != null) { current.SetAttribute("DATE", Date.ToString()); } if (Days != null) { current.SetAttribute("DAYS", Days.ToString()); } if (DaysAndOr != null) { current.SetAttribute("DAYS_AND_OR", DaysAndOr.ToString()); } if (DaysCal != null) { current.SetAttribute("DAYSCAL", DaysCal.ToString()); } if (Level != null) { current.SetAttribute("LEVEL", Level.ToString()); } if (MaxWait != null) { current.SetAttribute("MAXWAIT", MaxWait.ToString()); } if (Retro != null) { current.SetAttribute("RETRO", Retro.ToString()); } if (Shift != null) { current.SetAttribute("SHIFT", Shift.ToString()); } if (ShiftNum != null) { current.SetAttribute("SHIFTNUM", ShiftNum.ToString()); } if (TagsActiveFrom != null) { current.SetAttribute("TAGS_ACTIVE_FROM", TagsActiveFrom.ToString()); } if (TagsActiveTill != null) { current.SetAttribute("TAGS_ACTIVE_TILL", TagsActiveTill.ToString()); } if (WeekDays != null) { current.SetAttribute("WEEKDAYS", WeekDays.ToString()); } if (Weekscal != null) { current.SetAttribute("WEEKSCAL", Weekscal.ToString()); } if (JAN != null) { current.SetAttribute("JAN", JAN.ToString()); } if (FEB != null) { current.SetAttribute("FEB", FEB.ToString()); } if (MAR != null) { current.SetAttribute("MAR", MAR.ToString()); } if (APR != null) { current.SetAttribute("APR", APR.ToString()); } if (MAY != null) { current.SetAttribute("MAY", MAY.ToString()); } if (JUN != null) { current.SetAttribute("JUN", JUN.ToString()); } if (JUL != null) { current.SetAttribute("JUL", JUL.ToString()); } if (AUG != null) { current.SetAttribute("AUG", AUG.ToString()); } if (SEP != null) { current.SetAttribute("SEP", SEP.ToString()); } if (OCT != null) { current.SetAttribute("OCT", OCT.ToString()); } if (NOV != null) { current.SetAttribute("NOV", NOV.ToString()); } if (DEC != null) { current.SetAttribute("DEC", DEC.ToString()); } return(current); }
public void Update(bool bValidate, Retro.AuditType auditType) { Update(bValidate, auditType, false); }
public static void LoadRetroOptionsDropDown(DropDownList ddl, bool addAll, Retro.RetroModel selectedValue) { ddl.Items.Clear(); Retro.RetroModel[] values = (Retro.RetroModel[])Enum.GetValues(typeof(Retro.RetroModel)); foreach (Retro.RetroModel value in values) { if (value != Retro.RetroModel.Off) { ListItem itm = new ListItem(string.Format("{0:G}", Utility.EnumHelper.GetDescription(value)), string.Format("{0:D}", value)); itm.Selected = (value == selectedValue); ddl.Items.Add(itm); } } if (addAll) ddl.Items.Add(new ListItem("All", "-1")); }
public async Task Update(Retro retro) { await this.MemStateEngine.Execute(new UpdateRetro(retro)); }