public object GetSection(string searchquery) { ECCASection result = null; result = SteelSectionCollection.Query(searchquery)[0]; return(result); }
private bool IsUnique(ECCASection newSection) { bool result = true; if (getSection(newSection.Designation) == null) { result = true; } return(result); }
public void CreateDummySection() { ECCASection NewSection = new ECCASection(); NewSection.Designation = "UCTest"; if (IsUnique(NewSection)) { SectionList.Add(NewSection); } }
private void AddAndReplace(ECCASection newEccasection) { for (int i = 0; i < SectionList.Count; i++) { ECCASection eccasection = SectionList[i]; if (eccasection.Designation == newEccasection.Designation) { eccasection = newEccasection; } } }
public ECCASection getSection(string newSectionDesignation) { ECCASection result = null; if (SectionList.Count > 0) { foreach (ECCASection eccaSection in SectionList) { if (eccaSection.Designation == newSectionDesignation) { result = eccaSection; break; } } } return(result); }
bool tryParseSectionShort(DataTable dt) { bool result = false; List <String> fieldNameList = new List <string>(); formattedSectionList = new List <ECCASection>(); foreach (DataRow dr in dt.Rows) { ECCASection newSection = new ECCASection(); //set the properties of the element per column newSection.CategoryName = txt_Category.Text; newSection.SubCategory = txt_SubCategory.Text; foreach (DataColumn dc in dt.Columns) { string columnName = dc.ToString(); string columnValue = dr[dc].ToString(); //check section fields columnName FieldInfo[] fieldValues = typeof(ECCASection).GetFields(); for (int i = 0; i < fieldValues.Length; i++) { FieldInfo field = fieldValues[i]; Type fieldType = field.FieldType; if (field.Name == columnName) { if (field.FieldType == typeof(string)) { field.SetValue(newSection, columnValue); } else if (field.FieldType == typeof(double)) { field.SetValue(newSection, Utils.ConvertMeToDouble(columnValue)); } } } } formattedSectionList.Add(newSection); } return(result); }
private void trv_DataTree_AfterSelect(object sender, TreeViewEventArgs e) { TreeNode selectedNode = e.Node; MessageBox.Show(selectedNode.FullPath); string[] splittedSelection = selectedNode.FullPath.Split('\\'); string selectedElement = splittedSelection[splittedSelection.Length - 1]; string selectedElementType = splittedSelection[1]; if (selectedElementType == "Sections") { ECCASection selection = ECCalcAidData.GetSection(selectedElement) as ECCASection; dgv_Data.DataSource = selection.ToDataTable(); } else if (selectedElementType == "Materials") { ECCAMaterial selection = ECCalcAidData.GetMAterial(selectedElement) as ECCAMaterial; dgv_Data.DataSource = selection.ToDataTable(); } }
public void CreateNewSection() { ECCASection NewSection = new ECCASection(); SectionList.Add(NewSection); }