private ITCapQuestion CreateQuestion(Capability owner) { ITCapQuestion ques = new ITCapQuestion(); owner.Owner.TotalChildren++; ques.Name = questionList.Text; ques.IsDefault = false; owner.QuestionsOwned.Add(ques); ques.Type = "attribute"; ques.Owner = owner; ques.ID = ClientDataControl.db.GetScoringEntityID(ques.Name); return ques; }
public abstract void SaveCapabilityGapInfo(Capability capability);
//this is for the button in the first colun of datagrid. //checks what syayes its currently in, and changes the collapsable text private void loadSurveyFromDataGrid_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 0 && e.RowIndex != -1) { DataGridViewButtonCell cell = (DataGridViewButtonCell)loadSurveyFromDataGrid.Rows[e.RowIndex].Cells[e.ColumnIndex]; cell.UseColumnTextForButtonValue = false; if ((string)cell.Value == "-") cell.Value = "+"; else cell.Value = "-"; ScoringEntity ent = currentGrid.Rows[e.RowIndex].DataBoundItem as ScoringEntity; ent.ChangeChildrenVisibility(); ChangeGridVisibility(); return; } else if (e.ColumnIndex == 1) { } else if (e.RowIndex > 0) { ScoringEntity ent = currentGrid.Rows[e.RowIndex].DataBoundItem as ScoringEntity; if (ent.Type == "capability") { Capability cap = (Capability)ent; currentcap = cap; GetClientObjectives(currentcap); } else { ClearBottomPanel(); } } }
private Capability CreateCapability(Domain owner) { Capability cap = new Capability(); Capability.AllCapabilities.Add(cap); owner.TotalChildren++; owner.CapabilitiesOwned.Add(cap); cap.CapName = capabilitiesList.Text; cap.IsDefault = false; cap.Owner = owner; cap.Type = "capability"; cap.ID = ClientDataControl.db.GetScoringEntityID(cap.CapName); capabilities.Add(cap); return cap; }
//loads the cpaabilities for the given domain paramenter private void LoadCapabilities(Domain dom) { string[] capabilityInfoArray = ClientDataControl.db.GetDefaultCapabilityNames(dom.Name); int capCount = 1; foreach (string capabilityInfo in capabilityInfoArray) { Capability cap = new Capability(); cap.CapName = capabilityInfo; cap.IsDefault = true; Capability.AllCapabilities.Add(cap); dom.CapabilitiesOwned.Add(cap); dom.TotalChildren++; capabilities.Add(cap); cap.Owner = dom; cap.Type = "capability"; cap.ID = ClientDataControl.db.GetScoringEntityID(cap.CapName); entities.Add(cap); //loads all questions that are owned by this capability LoadQuestions(cap); //panel1.MouseEnter += new EventHandler(panel1_MouseEnter); capCount++; } }
//load all the questions ownes by the given paramter capability private void LoadQuestions(Capability cap) { string[] questionInfoArray = ClientDataControl.db.GetDefaultITCAPQuestionNames(cap.CapName, cap.Owner.Name); questionCount = 1; foreach (string questionInfo in questionInfoArray) { ITCapQuestion question = new ITCapQuestion(); question.Name = questionInfo; question.IsDefault = questionInfo.Last() == 'Y'; question.comment = new List<string>(); cap.Owner.TotalChildren++; cap.QuestionsOwned.Add(question); question.Owner = cap; question.Type = "attribute"; question.ID = ClientDataControl.db.GetScoringEntityID(question.Name); entities.Add(question); questionCount++; } }
// TODO: If desired, change parameters to Find method to search based on a property of Capability. public Capability Find(Capability masterRecord) { foreach (Capability lMasterRecord in this) if (lMasterRecord == masterRecord) // Found it return lMasterRecord; return null; // Not found }
public override void SaveCapabilityGapInfo(Capability capability) { XElement client = ClientDataControl.Client.EntityObject as XElement; XElement capGapInfo; if (!GetCapabilityGapInfo(capability.CapName, out capGapInfo)) { capGapInfo = new XElement("CAPABILITYGAPINFO"); XElement capabilityEnt; GetCapability(capability.CapName, out capabilityEnt); capGapInfo.Add(new XElement("CAPABILITY", capability.CapName)); capGapInfo.Add(new XElement("GAPTYPE", "None")); capGapInfo.Add(new XElement("GAP", "0")); capGapInfo.Add(new XElement("PRIORITIZEDGAPTYPE", "None")); capGapInfo.Add(new XElement("PRIORITIZEDGAP", "0")); client.Element("CAPABILITYGAPINFOS").Add(capGapInfo); changeLog.Add("ADD CAPABILITYGAPINFO " + client.Element("NAME").Value.Replace(' ', '~') + " " + capability.CapName.Replace(' ', '~')); } switch (capability.GapType1) { case ScoringEntity.GapType.High: capGapInfo.Element("GAPTYPE").Value = "High"; break; case ScoringEntity.GapType.Middle: capGapInfo.Element("GAPTYPE").Value = "Middle"; break; case ScoringEntity.GapType.Low: capGapInfo.Element("GAPTYPE").Value = "Low"; break; case ScoringEntity.GapType.None: capGapInfo.Element("GAPTYPE").Value = "None"; break; } switch (capability.PrioritizedGapType1) { case ScoringEntity.PrioritizedGapType.High: capGapInfo.Element("PRIORITIZEDGAPTYPE").Value = "High"; break; case ScoringEntity.PrioritizedGapType.Middle: capGapInfo.Element("PRIORITIZEDGAPTYPE").Value = "Middle"; break; case ScoringEntity.PrioritizedGapType.Low: capGapInfo.Element("PRIORITIZEDGAPTYPE").Value = "Low"; break; case ScoringEntity.PrioritizedGapType.None: capGapInfo.Element("PRIORITIZEDGAPTYPE").Value = "None"; break; } capGapInfo.Element("PRIORITIZEDGAP").Value = capability.PrioritizedCapabilityGap.ToString(); capGapInfo.Element("GAP").Value = capability.CapabilityGap.ToString(); changeLog.Add("UPDATE CAPABILITYGAPINFO " + client.Element("NAME").Value.Replace(' ', '~') + " " + capability.CapName.Replace(' ', '~') + " " + capGapInfo.Element("GAPTYPE").Value.Replace(' ', '~') + " " + capGapInfo.Element("PRIORITIZEDGAPTYPE").Value.Replace(' ', '~') + " " + capGapInfo.Element("GAP").Value + " " + capGapInfo.Element("PRIORITIZEDGAP").Value); }
public int Add(Capability masterRecord) { return List.Add(masterRecord); }
// TODO: If you changed the parameters to Find (above), change them here as well. public bool Contains(Capability masterRecord) { return (Find(masterRecord) != null); }
public void Remove(Capability masterRecord) { List.Remove(masterRecord); }
public void Insert(int index, Capability masterRecord) { List.Insert(index, masterRecord); }
public int IndexOf(Capability masterRecord) { for (int i = 0; i < List.Count; i++) if (this[i] == masterRecord) // Found it return i; return -1; }
public override bool OpenITCAP(ITCapTool itcapForm) { CLIENT client = ClientDataControl.Client.EntityObject as CLIENT; List<ITCAP> itcapList = (from ent in client.ITCAP orderby ent.ITCAPQUESTION.ID select ent).ToList(); ITCAPQUESTION itcqEnt; CAPABILITY capEnt; DOMAIN domEnt; string itcqName; string capName; string domName; foreach (ITCAP itcap in itcapList) { itcqEnt = itcap.ITCAPQUESTION; capEnt = itcqEnt.CAPABILITY; domEnt = capEnt.DOMAIN; itcqName = itcqEnt.NAME.TrimEnd(); capName = capEnt.NAME.TrimEnd(); domName = domEnt.NAME.TrimEnd(); Domain domain; Capability capability; ITCapQuestion itcapQuestion; domain = itcapForm.domains.Find(delegate(Domain dom) { return dom.Name == domName; }); if (domain == null) { domain = new Domain(); domain.Name = domName; domain.IsDefault = domEnt.DEFAULT == "Y"; domain.Type = "domain"; domain.Visible = true; domain.ID = domEnt.ID.TrimEnd(); //itcapForm.LoadCapabilities(dom); itcapForm.domains.Add(domain); } capability = itcapForm.capabilities.Find(delegate(Capability cap) { return cap.CapName == capName; }); if (capability == null) { capability = new Capability(); Capability.AllCapabilities.Add(capability); capability.CapName = capName; capability.IsDefault = capEnt.DEFAULT == "Y"; domain.CapabilitiesOwned.Add(capability); domain.TotalChildren++; capability.Type = "capability"; capability.ID = capEnt.ID.TrimEnd(); itcapForm.capabilities.Add(capability); capability.Owner = domain; //LoadQuestions(cap); } itcapQuestion = new ITCapQuestion(); itcapQuestion.Name = itcqName; itcapQuestion.IsDefault = itcqEnt.DEFAULT == "Y"; itcapQuestion.AsIsScore = itcap.ASIS.HasValue ? itcap.ASIS.Value : 0; itcapQuestion.ToBeScore = itcap.TOBE.HasValue ? itcap.TOBE.Value : 0; //itcapQuestion.AddComment(itcap.COMMENT); itcapQuestion.Type = "attribute"; itcapQuestion.ID = itcqEnt.ID.TrimEnd(); capability.Owner.TotalChildren++; capability.QuestionsOwned.Add(itcapQuestion); itcapQuestion.Owner = capability; } foreach (Domain domain in itcapForm.domains) { itcapForm.entities.Add(domain); foreach (Capability capability in domain.CapabilitiesOwned) { itcapForm.entities.Add(capability); foreach (ITCapQuestion itcapQuestion in capability.QuestionsOwned) { itcapForm.entities.Add(itcapQuestion); } } } return true; }
private void GetClientObjectives(Capability cap) { capabilityNameLabel.Visible = true; BuildObjectiveMappingArea(); }
public override void SaveCapabilityGapInfo(Capability capability) { CLIENT client = ClientDataControl.Client.EntityObject as CLIENT; CAPABILITYGAPINFO capGapInfo; if(!GetCapabilityGapInfo(capability.CapName, client, out capGapInfo)) { capGapInfo = new CAPABILITYGAPINFO(); capGapInfo.CLIENT = ClientDataControl.Client.EntityObject as CLIENT; CAPABILITY capabilityEnt; GetCapability(capability.CapName, out capabilityEnt); capGapInfo.CAPABILITY = capabilityEnt; dbo.AddToCAPABILITYGAPINFO(capGapInfo); } switch(capability.GapType1) { case ScoringEntity.GapType.High: capGapInfo.GAPTYPE = "High"; break; case ScoringEntity.GapType.Middle: capGapInfo.GAPTYPE = "Middle"; break; case ScoringEntity.GapType.Low: capGapInfo.GAPTYPE = "Low"; break; case ScoringEntity.GapType.None: capGapInfo.GAPTYPE = "None"; break; } switch (capability.PrioritizedGapType1) { case ScoringEntity.PrioritizedGapType.High: capGapInfo.PRIORITIZEDGAPTYPE = "High"; break; case ScoringEntity.PrioritizedGapType.Middle: capGapInfo.PRIORITIZEDGAPTYPE = "Middle"; break; case ScoringEntity.PrioritizedGapType.Low: capGapInfo.PRIORITIZEDGAPTYPE = "Low"; break; case ScoringEntity.PrioritizedGapType.None: capGapInfo.PRIORITIZEDGAPTYPE = "None"; break; } capGapInfo.GAP = capability.CapabilityGap; capGapInfo.PRIORITIZEDGAP = capability.PrioritizedCapabilityGap; }
public override bool OpenITCAP(ITCapTool itcapForm) { if (ClientDataControl.Client.EntityObject == null) { MessageBox.Show("Must choose client before opening ITCAP", "Error"); return false; } List<XElement> itcapList = (ClientDataControl.Client.EntityObject as XElement).Element("ITCAPS").Elements("ITCAP").ToList(); XElement itcqEnt; XElement capEnt; XElement domEnt; string itcqName; string capName; string domName; foreach (XElement itcap in itcapList) { itcqName = itcap.Element("ITCAPQUESTION").Value; capName = itcap.Element("CAPABILITY").Value; domName = itcap.Element("DOMAIN").Value; Domain domain; Capability capability; ITCapQuestion itcapQuestion; domain = itcapForm.domains.Find(delegate(Domain dom) { return dom.Name == domName; }); if (domain == null) { domain = new Domain(); domain.Name = domName; if (!GetDomain(domName, out domEnt)) { MessageBox.Show("Error: Could not find domain related to this ITCAP Entry", "Error"); break; } domain.IsDefault = domEnt.Element("DEFAULT").Value == "Y"; domain.Type = "domain"; domain.Visible = true; itcapForm.domains.Add(domain); domain.ID = domEnt.Element("ID").Value; } capability = itcapForm.capabilities.Find(delegate(Capability cap) { return cap.CapName == capName; }); if (capability == null) { capability = new Capability(); capability.CapName = capName; if(!GetCapability(capName, out capEnt)) { MessageBox.Show("Error: Could not find capability related to this ITCAP Entry", "Error"); break; } capability.IsDefault = capEnt.Element("DEFAULT").Value == "Y"; domain.CapabilitiesOwned.Add(capability); domain.TotalChildren++; capability.Type = "capability"; itcapForm.capabilities.Add(capability); capability.Owner = domain; capability.ID = capEnt.Element("ID").Value; //LoadQuestions(cap); } itcapQuestion = new ITCapQuestion(); itcapQuestion.Name = itcqName; if (!GetITCAPQuestion(itcqName, out itcqEnt)) { MessageBox.Show("Error: Could not find question related to this ITCAP Entry", "Error"); break; } itcapQuestion.IsDefault = itcqEnt.Element("DEFAULT").Value == "Y"; itcapQuestion.AsIsScore = Convert.ToSingle(itcap.Element("ASIS").Value); itcapQuestion.ToBeScore = Convert.ToSingle(itcap.Element("TOBE").Value); capability.Owner.TotalChildren++; itcapQuestion.Type = "attribute"; capability.Owner.TotalChildren++; capability.QuestionsOwned.Add(itcapQuestion); itcapQuestion.Owner = capability; itcapQuestion.ID = itcqEnt.Element("ID").Value; } foreach (Domain domain in itcapForm.domains) { itcapForm.entities.Add(domain); foreach (Capability capability in domain.CapabilitiesOwned) { itcapForm.entities.Add(capability); foreach (ITCapQuestion itcapQuestion in capability.QuestionsOwned) { itcapForm.entities.Add(itcapQuestion); } } } return true; }