예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string folderPath = TextBoxFolder.Text;

            string[] files = InputOutput.ReadFilesFromFolder(folderPath);

            if (files == null)
            {
                MessageBox.Show("No xml file found in the folder. Please make sure folder path is valid.");
                return;
            }

            List <CustomerInfoRequest> custInfoList = new List <CustomerInfoRequest>();

            foreach (var file in files)
            {
                string xmlInputData = InputOutput.ReadFileContent(file);

                CustomerInfoRequest obj = Serializer.GetCustomerInfoRequest(xmlInputData);
                if (obj != null)
                {
                    custInfoList.Add(obj);
                }
            }

            if (custInfoList.Count > 0)
            {
                itemDataGrid.ItemsSource = custInfoList;
            }
        }
예제 #2
0
        public static CustomerInfoRequest GetCustomerInfoRequest(string xmlInputData)
        {
            CustomerInfoRequest obj = new CustomerInfoRequest();

            try
            {
                XDocument doc = XDocument.Parse(xmlInputData);
                IEnumerable <XElement> xElments = doc.Descendants("Image1");
                XElement customerInfoReqElm     = xElments.First();
                obj.externalId      = customerInfoReqElm.Element("externalId").Value;
                obj.image_id        = customerInfoReqElm.Element("image_id").Value;
                obj.DateTime        = customerInfoReqElm.Element("DateTime").Value;
                obj.ConfidenceScore = customerInfoReqElm.Element("ConfidenceScore").Value;
                obj.matchStatus     = customerInfoReqElm.Element("matchStatus").Value;
                obj.capturedImage   = InputOutput.ReadImageFromBase64String(customerInfoReqElm.Element("capturedImage").Value);
                obj.MatchedImage    = InputOutput.ReadImageFromBase64String(customerInfoReqElm.Element("MatchedImage").Value);

                if (obj.matchStatus.Equals(Constants.VERIFIED))
                {
                    //var bitmap = InputOutput.BitmapImageToBitmap(obj.capturedImage);
                    //InputOutput.DrawBitmapWithGreenBorder(bitmap);
                    //obj.capturedImage = InputOutput.BitmapToBitmapImage(bitmap);
                }
            }
            catch
            {
                // Log error
                return(null);
            }
            return(obj);
        }