/// <summary>Validate a requets envelope</summary> internal static NRA_ABIS_Envelope.Response Request(NRA_ABIS_Envelope.Request request, NRA_ABIS_Envelope.EnvelopeType envelope_type, DateTime request_date_time , bool header_cprid, bool header_guid, bool header_reference_uid , bool detail_fingerprint, bool detail_portrait, bool detail_signature, bool detail_template) { try { //--------------------------------------------------------------------------------- //validate the request object if (request == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_request_object) }); } //--------------------------------------------------------------------------------- //validate the request header if (request.Header == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_header_object) }); } if (header_cprid && request.Header.CPRID == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_cpr_id) }); } if (header_guid && request.Header.Guid == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_guid) }); } if (header_reference_uid && string.IsNullOrEmpty(request.Header.ReferenceUID)) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_reference_uid) }); } if (request.Header.RequestType == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_request_type) }); } if (request.Header.RequestType != envelope_type) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.invalid_request_type) }); } //--------------------------------------------------------------------------------- //validate request detail if (request.Detail == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_detail_object) }); } //--------------------------------------------------------------------------------- //validate request detail fingerprint if (detail_fingerprint) { if (request.Detail.Fingerprint == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_fingerprint_object) }); } if (request.Detail.Fingerprint.Count < 1) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_fingerprint_data) }); } for (int i = 0; i < request.Detail.Fingerprint.Count; i++) { if (request.Detail.Fingerprint[i].Status == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_fingerprint_status, i) }); } if (request.Detail.Fingerprint[i].ImageData == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_fingerprint_image_data, i) }); } if (request.Detail.Fingerprint[i].ImageData.Length < min_fingerprint_image_data_length) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.invalid_fingerprint_image_data_length, i) }); } if (request.Detail.Fingerprint[i].ImageFormat == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_fingerprint_image_format, i) }); } if (request.Detail.Fingerprint[i].Postion == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_fingerprint_position, i) }); } if (request.Detail.Fingerprint[i].Quality == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_fingerprint_quality, i) }); } } } //--------------------------------------------------------------------------------- //validate request detail portrait if (detail_portrait) { if (request.Detail.Portrait == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_object) }); } if (request.Detail.Portrait.Count < 1) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_data) }); } for (int i = 0; i < request.Detail.Portrait.Count; i++) { if (request.Detail.Portrait[i].ImageDataICAO == null && request.Detail.Portrait[i].ImageDataOriginal == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_image_data, i) }); } if (request.Detail.Portrait[i].ImageDataICAO != null && request.Detail.Portrait[i].ImageDataOriginal != null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.double_portrait_image_data, i) }); } if (request.Detail.Portrait[i].ImageDataICAO == null) { if (request.Detail.Portrait[i].CropHeight == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_crop_height, i) }); } if (request.Detail.Portrait[i].CropLeft == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_crop_left, i) }); } if (request.Detail.Portrait[i].CropTop == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_crop_top, i) }); } if (request.Detail.Portrait[i].CropWidth == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_crop_width, i) }); } if (request.Detail.Portrait[i].ImageDataOriginal == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_image_data_original, i) }); } if (request.Detail.Portrait[i].ImageDataOriginal.Length < min_portrait_image_data_original_length) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.invalid_portrait_image_data_original_length, i) }); } if (request.Detail.Portrait[i].ImageFormat == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_image_format, i) }); } } if (request.Detail.Portrait[i].ImageDataOriginal == null) { if (request.Detail.Portrait[i].ImageDataICAO == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_portrait_image_data_icao, i) }); } if (request.Detail.Portrait[i].ImageDataICAO.Length < min_portrait_image_data_icao_length) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.invalid_portrait_image_data_icao_length, i) }); } } } } //--------------------------------------------------------------------------------- //validate request detail signature if (detail_signature) { if (request.Detail.Signature == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_signature_object) }); } if (request.Detail.Signature.Count < 1) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_signature_data) }); } for (int i = 0; i < request.Detail.Signature.Count; i++) { if (request.Detail.Signature[i].ImageData == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_signature_image_data, i) }); } if (request.Detail.Signature[i].ImageData.Length < min_signature_image_data_length) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.invalid_signature_image_data_length, i) }); } if (request.Detail.Signature[i].ImageFormat == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_signature_image_format, i) }); } } } //--------------------------------------------------------------------------------- //validate request detail template if (detail_template) { if (request.Detail.Template == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_template_object) }); } if (request.Detail.Template.Count < 1) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_template_data) }); } for (int i = 0; i < request.Detail.Template.Count; i++) { if (request.Detail.Template[i].Template == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_template_image_data, i) }); } if (request.Detail.Template[i].Template.Length < min_template_data_length) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.invalid_template_data_length, i) }); } if (request.Detail.Template[i].TemplateFormat == null) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, request_date_time, Exception_Type.no_template_format, i) }); } } } //--------------------------------------------------------------------------------- } catch (Exception ex) { } return(null); }
/// <summary>Asyncronous : Operation for identifying CPR using biometric information</summary> public NRA_ABIS_Envelope.Response Biometric_Identification(NRA_ABIS_Envelope.Request request) { DateTime request_date_time = DateTime.Now; NRA_ABIS_Envelope.EnvelopeType envelope_type = NRA_ABIS_Envelope.EnvelopeType.Biometric_Identification; NRA_ABIS_Envelope.Response response = null; try { //validate request response = Validate.Request(request, envelope_type, request_date_time, true, false, false, true, true, false, false); if (response != null) { return(response); } //List<Fingerprint> FingerList = new List<Fingerprint>(); //List<Fingerprint> TempFingerList = biometricInfo.fingerprints.OfType<Fingerprint>().ToList(); //if (TempFingerList.Count < 1) //{ // //response = new IdentificationResponse(); // genericResponse = new GenericResponse() { ResponseCode = 1005, ResponseMessage = "No Fingerprints Images Available", ResponseObject = response }; // cslog.WriteToTransactionLog(string.Format("Log Source Server: {0}, {1}, Log Source: {2}, {3}, Log Message: {4}", Environment.MachineName, Environment.NewLine, "BiometricIdentification", Environment.NewLine, "No Fingerprints Images Available")); // //return genericResponse; //} //foreach (Fingerprint fin in TempFingerList) //{ // if (fin != null) // { // if (fin.status != 0 && fin.wsqImage != null) // { // FingerList.Add(fin); // } // } //} // Determine which fingers are available and send them for matching //response = new IdentificationResponse() //{ // CPR_ID = long.Parse(DateTime.Now.ToString("yyMMddHHmmssfff")) // , // ReferenceUniqID = Guid.NewGuid().ToString().ToUpper() //}; //cslog.WriteToTransactionLog(string.Format("Log Source Server: {0}, {1}, Log Source: {2}, {3}, Log Message: {4}", Environment.MachineName, Environment.NewLine, "FingerprintIdentification", Environment.NewLine, "Total of: " + FingerList.Count.ToString() + " Recieved For a Fingerprint Identification")); //cslog.WriteToTransactionLog(string.Format("Log Source Server: {0}, {1}, Log Source: {2}, {3}, Log Message: {4}", Environment.MachineName, Environment.NewLine, "FingerprintIdentification", Environment.NewLine, "Sending Transaction with Reference ID: " + response.ReferenceUniqID + " For Fingerprint Identification")); //genericResponse = new GenericResponse() { ResponseCode = 1001, ResponseMessage = "Successful Biometric identification", ResponseObject = response }; //return genericResponse; //return return(response); } catch (Exception ex) { return(new NRA_ABIS_Envelope.Response() { Footer = Request_Exceptions.Set_Exception(envelope_type, ex) }); } finally { //set the response date time response.Footer.ResponseDateTime = DateTime.Now; } }