예제 #1
0
        public void SerializeMSHQueue()
        {
            String filename = @"c:\temp\msh.bin";

            var prov = HCAssignmentDataProviderFactory.GetLiveProvider();

            List <MSH> mshList = prov.GetMSH();


            //mshList[0].ObrList[0].ObxList[0].HCAssignment = "Anthrax";


            MSH anotherOne = mshList[4].DeepCopy();

            anotherOne.MSH_ID                       = "1000";
            anotherOne.ObrList[0].OBR_ID            = "1001";
            anotherOne.ObrList[0].ObxList[0].OBX_ID = "1002";
            anotherOne.ObrList[0].ObxList           = null;

            mshList.Add(anotherOne);

            FileStream stream    = File.Create(filename);
            var        formatter = new BinaryFormatter();

            formatter.Serialize(stream, mshList);
            stream.Close();


            stream = File.OpenRead(filename);
            Console.WriteLine("Deserializing vector");
            var v1 = (List <MSH>)formatter.Deserialize(stream);

            stream.Close();
        }
예제 #2
0
        public void SerializeHL7()
        {
            var prov = HCAssignmentDataProviderFactory.GetProvider();

            List <MSH> msh = prov.GetMSH();

            List <Tuple <String, String> > hl7Messages = new List <Tuple <string, string> >();

            foreach (var item in msh)
            {
                hl7Messages.Add(new Tuple <string, string>(
                                    item.MSH_ID, prov.GetHL7Message(Convert.ToInt32(item.MSH_ID)
                                                                    )));
            }

            string output = JsonConvert.SerializeObject(hl7Messages);

            File.WriteAllText(@"c:\temp\hl7Messages.json", output);

            string input = File.ReadAllText(@"c:\temp\hl7Messages.json");


            List <Tuple <String, String> > two = JsonConvert.DeserializeObject <List <Tuple <String, String> > >(input);

            Assert.IsTrue(two.Count > 0);
        }
예제 #3
0
        public ActionResult Save(int MSH_ID, string Note, List <ChangeSetData> ChangeSet)
        {
            var    prov         = HCAssignmentDataProviderFactory.GetProvider();
            String errorMessage = "";
            String username     = System.Web.HttpContext.Current.User.Identity.Name;
            var    success      = prov.Save(username, MSH_ID, Note == null ? "" : Note, ChangeSet, out errorMessage);

            return(Json(new ResponseStatus()
            {
                Success = success == true ? ResponseStatus.ApiResponseStatus.Success : ResponseStatus.ApiResponseStatus.Failure,
                ErrorMessage = errorMessage
            }));
        }
예제 #4
0
        public ActionResult FailedQueItems()
        {
            var prov = HCAssignmentDataProviderFactory.GetProvider();

            List <MSH> msh = prov.GetMSH();

            var tree = TreeViewHelper.Transform(msh);

            var ret = new TreeViewData()
            {
                MSHData     = msh,
                TreeData    = tree,
                AssignCodes = prov.GetAssignmentCodes(),
                TreeConfig  = new TreeConfig()
            };

            return(Json(ret, JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public void SerializeHealthCode()
        {
            String filename = @"c:\temp\hca.bin";

            var prov = HCAssignmentDataProviderFactory.GetLiveProvider();

            var hcaList = prov.GetAssignmentCodes();


            FileStream stream    = File.Create(filename);
            var        formatter = new BinaryFormatter();

            formatter.Serialize(stream, hcaList);
            stream.Close();


            stream = File.OpenRead(filename);
            Console.WriteLine("Deserializing");
            var v1 = (List <HealthConditionAssignment>)formatter.Deserialize(stream);

            stream.Close();
        }
예제 #6
0
        public String HL7Data(int msh_id)
        {
            var prov = HCAssignmentDataProviderFactory.GetProvider();

            return(prov.GetHL7Message(msh_id));
        }