/// <summary> /// Add a lodged card references to container /// </summary> /// <param name="dr">SqlDataReader</param> public void AddReference(SqlDataReader dr) { LodgedCardReferenceValue value = new LodgedCardReferenceValue(dr); this.references.Add(nr, value); nr++; }
/// <summary> /// Build the response to return to caller /// </summary> /// <returns>Response (XML)</returns> public string GetResponse() { // Let's first log that we have processed request for the caler LogResponse(); // we can know build the response string strData = Const.XmlHeader + Xml_Response_Open_Tag + Xml_Response_Duration_Open_Tag + GetDuration() + Xml_Response_Duration_Close_Tag; if (!IsError()) { // The request was successfully processed strData += Xml_Response_Value_Open_Tag; // Get all references IDictionaryEnumerator it = GetReferences().GetReferences(); while (it.MoveNext()) { // Fetch and add each references to response LodgedCardReferenceValue reference = (LodgedCardReferenceValue)it.Value; strData += Xml_Response_Value_LodgedCardReference_Open_Tag + Xml_Response_Value_Key_Open_Tag + reference.GetKey() + Xml_Response_Value_Key_Close_Tag + Xml_Response_Value_Label_Open_Tag + reference.GetLabel() + Xml_Response_Value_Label_Close_Tag; if (!String.IsNullOrEmpty(reference.GetValue())) { strData += Xml_Response_Value_Value_Open_Tag + reference.GetValue() + Xml_Response_Value_Value_Close_Tag; } strData += Xml_Response_Value_LodgedCardReference_Close_Tag; } strData += Xml_Response_Value_Close_Tag; } else { // On a rencontré une erreur // On va retourner les tags d'exception // sans les tags de valeur strData += Xml_Response_Exception_Open_Tag + Xml_Response_Exception_Count_Open_Tag + GetExceptionCount() + Xml_Response_Exception_Count_Close_Tag + Xml_Response_Exception_Code_Open_Tag + GetExceptionCode() + Xml_Response_Exception_Code_Close_Tag + Xml_Response_Exception_Severity_Open_Tag + GetExceptionSeverity() + Xml_Response_Exception_Severity_Close_Tag + Xml_Response_Exception_Type_Open_Tag + GetExceptionType() + Xml_Response_Exception_Type_Close_Tag + Xml_Response_Exception_Message_Open_Tag + GetExceptionMessage() + Xml_Response_Exception_Message_Close_Tag + Xml_Response_Exception_Close_Tag; } strData += Xml_Response_Close_Tag; return(strData); }