private CustomXmlResponse Response(CustomXmlMessage aXmlMessage, CreateInstanceCustomXmlResponse aCreateInstance) { CustomXmlResponse xmlResponse = null; do { xmlResponse = ClassFactory.Tcp.GetResponse(aXmlMessage, aCreateInstance); }while (ProcessedResponse(aXmlMessage, xmlResponse)); return(xmlResponse); }
public CustomXmlResponse GetResponse(CustomXmlMessage aXmlMessage, CreateInstanceCustomXmlResponse aCreateInstance) { String StrXMLResponse = RequestServer(aXmlMessage.Xml); try { CustomXmlResponse response = aCreateInstance(StrXMLResponse); return(response); } catch (XmlException) { throw new EDataCommunication(String.Format(DataCommunicationStrings.ErrorXMLResponse, aCreateInstance.Method.Name)); } }
private Boolean ProcessedResponse(CustomXmlMessage aMessage, CustomXmlResponse aResponse) { switch (aResponse.Error.Code) { case 0: if (aResponse.Type != aMessage.Type) { throw new EDataCommunication(String.Format(ExceptionStrings.ItIsExpectedMessage, aMessage.Type, aResponse.Type)); } break; case 3: Boolean resultLogin = Login(ObjectFactory.Employee().UserBarCode); if (resultLogin) { aMessage.Session = ObjectFactory.Session().Session; // На случай перелогинивания } return(resultLogin); default: throw new EXmlResponseException(String.Format(ExceptionStrings.CallFailed, aResponse.Type, aResponse.Error.NodeValue), aResponse.Error.Code); } return(false); }