public ApplicationResponse(string applicationId)
 {
     try
     {
         _applicationId = Guid.Parse(applicationId);
         _status        = Enum.ApplicationStatus.NOTDEFINED;
     }
     catch (Exception ex)
     {
         Console.WriteLine("{0} Exception caught.", ex);
         Logs.ErrorLog(ex.ToString());
     }
 }
 private void ObjectFill(SqlDataReader reader)
 {
     try
     {
         _applicationId = Guid.Parse(reader[0].ToString());
         _status        = (Enum.ApplicationStatus)System.Enum.Parse(typeof(Enum.ApplicationStatus), reader[1].ToString());
         _serviceId     = reader[2].ToString();
         _issuerId      = reader[3].ToString();
         _issueDate     = DateTime.Parse(reader[4].ToString());
         _rcvDate       = DateTime.Parse(reader[5].ToString());
         if (reader[7] != null && reader[7].ToString() != "")
         {
             _prdcRsltDate = DateTime.Parse(reader[6].ToString());
             _result       = new XmlDocument();
             _result.LoadXml(reader[7].ToString());
             _errors = new XmlDocument();
             if (reader[8] != null && reader[8].ToString() != "")
             {
                 _errors.LoadXml(reader[8].ToString());
             }
             //TODO: получение списка ошибок
             _errorList = Error.SelectAllByApplicationId(_applicationId);
         }
         CreDate  = DateTime.Parse(reader[9].ToString());
         IsActive = bool.Parse(reader[10].ToString());
         if (reader[11] != null)
         {
             _requestCount = int.Parse(reader[11].ToString());
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("{0} Exception caught.", ex);
         Logs.ErrorLog(ex.ToString());
     }
 }
        /// <summary>
        /// Конструктор из первоначального ответа API 2.0
        /// </summary>
        /// <param name="receiveApplicationResultResponse"></param>
        public ApplicationResponse(XmlDocument receiveApplicationResultResponse)
        {
            try
            {
                #region Errors
                XmlNodeList xmlNL = receiveApplicationResultResponse.GetElementsByTagName("error");
                if (xmlNL.Count > 0)
                {
                    _errorList = new List <Error>();
                    foreach (XmlNode xmlNode in xmlNL)
                    {
                        Error error = new Error(xmlNode.Attributes["code"].Value, xmlNode.InnerText);
                        _errorList.Add(error);
                        string er = string.Format("{0} - {1}", xmlNode.Attributes["code"].Value, xmlNode.InnerText);
                        Console.WriteLine("{0} Exception caught.", er);
                        Logs.ErrorLog(er);
                        error = null;
                    }
                    _errors = receiveApplicationResultResponse;
                    //TODO: придумать как XmlNodeList сохранить в БД
                }
                else
                {
                    xmlNL = receiveApplicationResultResponse.GetElementsByTagName("apl:error");
                    if (xmlNL.Count > 0)
                    {
                        _errorList = new List <Error>();
                        foreach (XmlNode xmlNode in xmlNL)
                        {
                            Error error = new Error(xmlNode.Attributes["code"].Value, xmlNode.InnerText);
                            _errorList.Add(error);
                            string er = string.Format("{0} - {1}", xmlNode.Attributes["code"].Value, xmlNode.InnerText);
                            Console.WriteLine("{0} Exception caught.", er);
                            Logs.ErrorLog(er);
                            error = null;
                        }
                        _errors = receiveApplicationResultResponse;
                        //TODO: придумать как XmlNodeList сохранить в БД
                    }
                }
                #endregion Errors

                xmlNL = receiveApplicationResultResponse.GetElementsByTagName("applicationId");
                if (xmlNL.Count == 0)
                {
                    xmlNL = receiveApplicationResultResponse.GetElementsByTagName("ws:applicationId");
                }
                _applicationId = Guid.Parse(xmlNL[0].InnerText);
                xmlNL          = receiveApplicationResultResponse.GetElementsByTagName("status");
                if (xmlNL.Count == 0)
                {
                    xmlNL = receiveApplicationResultResponse.GetElementsByTagName("ws:status");
                }
                _status    = (Enum.ApplicationStatus)System.Enum.Parse(typeof(Enum.ApplicationStatus), xmlNL[0].InnerText);
                _serviceId = receiveApplicationResultResponse.GetElementsByTagName("serviceId")[0].InnerText; //Const.ServiceId;
                xmlNL      = receiveApplicationResultResponse.GetElementsByTagName("issuerId");
                if (xmlNL.Count == 0)
                {
                    xmlNL = receiveApplicationResultResponse.GetElementsByTagName("ws:issuerId");
                }
                _issuerId  = xmlNL[0].InnerText;
                _issueDate = DateTime.Parse(receiveApplicationResultResponse.GetElementsByTagName("issueDate")[0].InnerText);
                _rcvDate   = DateTime.Parse(receiveApplicationResultResponse.GetElementsByTagName("rcvDate")[0].InnerText);
                xmlNL      = receiveApplicationResultResponse.GetElementsByTagName("prdcRsltDate");
                if (xmlNL.Count != 0)
                {
                    xmlNodeList = receiveApplicationResultResponse.GetElementsByTagName("prdcRsltDate");
                    if (xmlNodeList.Count > 0)
                    {
                        _prdcRsltDate = DateTime.Parse(xmlNodeList[0].InnerText);
                    }
                    _result = receiveApplicationResultResponse;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("{0} Exception caught.", ex);
                Logs.ErrorLog(ex.ToString());
            }
        }
 public ApplicationResponse()
 {
     _status = Enum.ApplicationStatus.NOTDEFINED;
 }