Пример #1
0
        private static string Set(string content)
        {
            string returningString = "ERROR";

            HCV_Class_Library.HCVDAL                dal     = new HCV_Class_Library.HCVDAL();
            HCV_Class_Library.HCVPatient            patient = new HCV_Class_Library.HCVPatient();
            HCV_Class_Library.HCV                   hcv     = new HCV_Class_Library.HCV(dal);
            HCV_Class_Library.HCVStringManipulation adapter = new HCV_Class_Library.HCVStringManipulation();

            // Trim the beginning and ending label
            // Split the contents into 3 sections: HCN, VCode, PostalCode
            content = adapter.TearOffBeginningAndEnd(content);
            string[] patientInfo = content.Split(',');


            // Find the HCVPatient
            patient = hcv.GetHCVPatient(patientInfo[0]);
            if (patient != null)
            {
                // Create a new HCVPatient
                // Update the HCVDatabase with the new patient information
                patient = hcv.CreateHCVPatient(patientInfo[0], patientInfo[1], patientInfo[2]);
                if (hcv.UpdateHCVPatient(patientInfo[0], patient))
                {
                    returningString = "VALID";
                }
            }
            return(returningString);
        }
Пример #2
0
        private static string[] Get(string content)
        {
            HCV_Class_Library.HCVDAL            dal     = new HCV_Class_Library.HCVDAL();
            HCV_Class_Library.HCV               hcv     = new HCV_Class_Library.HCV(dal);
            List <HCV_Class_Library.HCVPatient> patient = new List <HCV_Class_Library.HCVPatient>();

            HCV_Class_Library.HCVStringManipulation adapter = new HCV_Class_Library.HCVStringManipulation();


            // Set up the main string by removing the beginning and ending flags
            // split the main string into a group of patient strings
            content = adapter.TearOffBeginningAndEnd(content);
            string[] patientList = content.Split('/');

            // Create a string of only health card numbers we are looking for
            // AKA. Trim off vcode and postal code for each string
            string[] HealthCardOnly = new string[patientList.Length];
            for (int i = 0; i < patientList.Length; i++)
            {
                HealthCardOnly[i] = adapter.TearOffVCodeAndPostal(patientList[i]);
            }

            // Get the list of patients
            // Recombine the patient strings for comparing
            patient = hcv.GetHCVPatient(HealthCardOnly);
            string[] FoundPatient    = adapter.ConstructCompareString(patient);
            string[] returningString = new string[patientList.Length];

            // Compare each string to what we recieved to what we found and create a list
            // of results
            for (int i = 0; i < patientList.Length; i++)
            {
                if (FoundPatient[i] == patientList[i])
                {
                    returningString[i] = "VALID";
                }
                else if (FoundPatient[i].IndexOf(HealthCardOnly[i]) > -1)
                {
                    returningString[i] = "VCODE";
                }
                else
                {
                    returningString[i] = "PUNKO";
                }
            }
            return(returningString);
        }