/// <summary> /// Assigns the properties of the Value Object and adds Display Object /// </summary> /// <param name="objDisplay"></param> /// <param name="columnName"></param> /// <returns></returns> private Display CreateDisplayColumnNames(Display display, string strColumnName) { Value objValue = new Value(); objValue.InnerText = strColumnName; if(!display.Value.Contains(objValue)) display.Value.Add(objValue); return display; }
/// <summary> /// Creates the value. /// </summary> /// <param name="objAttribute">The attribute Object.</param> /// <param name="AttributeElement">The attribute element.</param> private void CreateValue(Display display, XmlElement displayElement) { try { //Loop through all the value object in Attribute object. foreach(Value objValue in display.Value) { //creating the Value Element. XmlElement ValueElement = objXmlDocument.CreateElement(VALUE); displayElement.AppendChild(ValueElement); //Setting the Innertext value for each value. ValueElement.InnerText = objValue.InnerText; } } catch(Exception) { throw; } }
/// <summary> /// Instantiates the Entity Object /// </summary> /// <param name="objEntity"></param> /// <returns></returns> private Entity SetEntityAttributes(Entity entity) { try { ArrayList arlAttributes = new ArrayList(); bool blnIsDisplayAllColumns = false; CheckBox chbSelectAll = chbHeaderColumn; CheckBox chbSelectColumn = null; TextBox txtCriteria = null; DropDownList cboOperator = null; if(chbSelectAll.Checked) { blnIsDisplayAllColumns = true; } else { Display objDisplay = new Display(); objDisplay.Value = new ArrayList(); entity.Display = objDisplay; for(int intIndex = 0; intIndex < tblColumnNames.Rows.Count; intIndex++) { if(!blnIsDisplayAllColumns) { chbSelectColumn = (CheckBox)tblColumnNames.Rows[intIndex].Cells[0].FindControl("chbColumns"); if(chbSelectColumn.Checked) { entity.Display = CreateDisplayColumnNames(entity.Display, tblColumnNames.Rows[intIndex].Cells[1].Text.ToString()); } } } } for(int intIndex = 0; intIndex < tblColumnNames.Rows.Count; intIndex++) { txtCriteria = (TextBox)tblColumnNames.Rows[intIndex].Cells[3].FindControl("txtCriteria"); cboOperator = (DropDownList)tblColumnNames.Rows[intIndex].Cells[2].FindControl("cboOperator"); if(cboOperator.SelectedIndex > 0 && txtCriteria.Text.Trim().Length > 0) { arlAttributes.Add(CreateAttribute(tblColumnNames.Rows[intIndex].Cells[1].Text.ToString(), cboOperator.SelectedItem.Text.ToString(), txtCriteria.Text.ToString())); } } if(arlAttributes.Count > 1) { entity.AttributeGroups = CreateAttributeGroup(arlAttributes); } else { entity.Attribute = arlAttributes; } } catch { throw; } return entity; }