/// <summary> /// Sets the Record Histor details. /// </summary> /// <param name="recordHistories">RecordHistories.</param> /// <param name="recordElement">XmlElement.</param> private void CreateRecordHistories(RecordHistories recordHistories, XmlElement recordElement) { XmlElement RecordHistoriesElement = objXmlDocument.CreateElement("recordHistories"); recordElement.AppendChild(RecordHistoriesElement); foreach (RecordHistory objRecordHistory in recordHistories.History) { XmlElement HistoryElement = objXmlDocument.CreateElement("history"); RecordHistoriesElement.AppendChild(HistoryElement); XmlAttribute HistoryOrder = objXmlDocument.CreateAttribute("order"); HistoryElement.Attributes.Append(HistoryOrder); HistoryOrder.Value = objRecordHistory.Order; if (objRecordHistory.Attributes != null) { foreach (Attributes objAttribute in objRecordHistory.Attributes) { XmlElement AttributeElement = objXmlDocument.CreateElement("attribute"); HistoryElement.AppendChild(AttributeElement); //Creating attributes for Attribute Element. if (objAttribute.Name.ToString().Length > 0) { XmlAttribute AttributeName = objXmlDocument.CreateAttribute("name"); AttributeElement.Attributes.Append(AttributeName); AttributeName.Value = objAttribute.Name; } if (objAttribute.Value.ToString().Length > 0) { XmlAttribute AttributeValue = objXmlDocument.CreateAttribute("value"); AttributeElement.Attributes.Append(AttributeValue); AttributeValue.Value = objAttribute.Value; } } } } }
/// <summary> /// Sets the record histories. /// </summary> /// <param name="selectedID">The selected ID.</param> /// <returns>RecordHistories.</returns> private RecordHistories SetRecordHistories(string selectedID) { string strCamlQuery = string.Empty; string strTerminated = string.Empty; DataRow[] objSelectedIDHistory = null; RecordHistories objRecordHistories = null; ArrayList arlHistory = new ArrayList(); int intIndex = 0; try { if (dtHistoryDetails != null && dtHistoryDetails.Rows.Count > 0) { objRecordHistories = new RecordHistories(); objSelectedIDHistory = dtHistoryDetails.Select("Master_ID =" + selectedID); foreach (DataRow objDataRow in objSelectedIDHistory) { arlHistory.Add(SetRecordHistory(objDataRow, intIndex + 1)); intIndex++; } objRecordHistories.History = arlHistory; } return objRecordHistories; } catch { throw; } }