Exemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                String           path  = Path.Combine(Directory.GetCurrentDirectory(), "TestMOCES1.pfx");
                X509Certificate2 moces = new X509Certificate2(path, "Test1234");

                MortalityRegistrationService.MortalityRegistrationService service = new MortalityRegistrationService.MortalityRegistrationService();
                service.SetPolicy(new DGWSPolicy(moces));

                //MortalityReasonType reason = Helper.CreateTestDocument_Part2();
                MortalityReasonType reason = Helper.CreateTestDocument_Part1And2();
                String ser = serializeMort(reason);
                string str = service.Report(reason);
                System.Diagnostics.Debug.WriteLine(str);

//				service.RemoveReport("3b9a2d1e-7c2e-42d8-a596-f159ee3af4f8");
            }
            catch (SoapHeaderException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            catch (SoapException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 2
0
        public static MortalityReasonType CreateTestDocument_Part1()
        {
            MortalityReasonType mortalityReason = new MortalityReasonType();

            mortalityReason.SchemaID              = Guid.Empty.ToString();
            mortalityReason.PersonIdentifier      = new PersonIdentifierType();
            mortalityReason.PersonIdentifier.id   = "cprid";
            mortalityReason.PersonIdentifier.Item = "0703614116";

            mortalityReason.Part1And2       = new Part1And2Type();
            mortalityReason.Part1And2.Items = new Object[1];

            mortalityReason.Part1And2.Items[0] = new Part1Type();
            Part1Type part1 = (Part1Type)mortalityReason.Part1And2.Items[0];

            part1.Created = DateTime.Now;

/*			part1.AlternativeDoctor                                        = new AlternativeDoctorType();
 *                      part1.AlternativeDoctor.DoctorAddress                          = new AddressPostalType();
 *                      part1.AlternativeDoctor.DoctorAddress.StreetName               = "Test_Street";
 *                      part1.AlternativeDoctor.DoctorAddress.StreetBuildingIdentifier = "45A";
 *                      part1.AlternativeDoctor.DoctorAddress.PostCodeIdentifier       = "1660";
 *                      part1.AlternativeDoctor.DoctorAddress.DistrictName             = "Test_District";
 *                      part1.AlternativeDoctor.PersonNameStructure                    = new PersonNameStructureType();
 *                      part1.AlternativeDoctor.PersonNameStructure.PersonGivenName    = "Test_Fornavn";
 *                      part1.AlternativeDoctor.PersonNameStructure.PersonMiddleName   = "Test_Mellemnavn";
 *                      part1.AlternativeDoctor.PersonNameStructure.PersonSurnameName  = "Test_Efternavn";
 */
            part1.BornDead     = false;
            part1.BornDeadData = null;            //Test om script fanger den her. (hvis den skal fanges!?) - update: Script fanger fejl når BornDead = true.

            part1.HealthInsuranceNumber = "1";
            part1.Implants    = ImplantsType.Unknown;
            part1.InquestDate = DateTime.Now.AddDays(-1);

            part1.Item = new TimeOfDeathType();
            TimeOfDeathType timeOfDeathType = (TimeOfDeathType)part1.Item;

            timeOfDeathType.DateTimeOrDate = new DateTimeOrDateType();
            timeOfDeathType.DateTimeOrDate.ItemElementName = ItemChoiceType.DateTime;
            timeOfDeathType.DateTimeOrDate.Item            = DateTime.Now.AddDays(-2);
            timeOfDeathType.DeathSite      = new DeathSiteType();
            timeOfDeathType.DeathSite.Item = new ResidenceType();
            timeOfDeathType.DeathSite.Item = ResidenceType.NurseryHome;

            part1.Page2WillFollow   = true;
            part1.PoliceContact     = true;
            part1.PoliceStationName = "";
            part1.SignOfDeath       = SignOfDeathType.MaceratioAndCadaverositasAndLivoresAndRigor;

            return(mortalityReason);
        }
Exemplo n.º 3
0
        private static String serializeMort(MortalityReasonType type)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(MortalityReasonType));

            StringBuilder sb = new StringBuilder();

            using (StringWriter writer = new StringWriter(sb))
            {
                serializer.Serialize(writer, type);
            }
            String str = sb.ToString();

            return(str);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            try
            {
                bool useSTS = true;

//				X509Certificate2 MOCESCert = GetMOCESCertificate();
//				X509Certificate2 VOCESCert = GetVOCESCertificate();
                X509Certificate2 MOCESCert = GetSTSMOCESCertificate();
                X509Certificate2 VOCESCert = GetSTSVOCESCertificate();

                DGWSCard10Type card;

                if (useSTS)
                {
                    DGWSCard101Type idCard = GetIDCardVersion101();
                    idCard.Sign(MOCESCert);
//					DGWSCard101Type idCard = GetSystemIDCardVersion101();
//					idCard.Sign(VOCESCert);

                    XElement x = IDP.CallIdp(idCard, "SEI", "http://pan.certifikat.dk/sts/services/SecurityTokenService");

                    card = new DGWSCard101Type(x);
                }
                else
                {
//					card = GetIDCardVersion101();
//					card = GetIDCardVersion11();
                    card = GetSystemIDCardVersion101();
//					card.Sign(MOCESCert);
                    card.Sign(VOCESCert);
                }

                MortalityRegistrationService service = new MortalityRegistrationService();
                service.SetPolicy(new DGWSPolicy(card, VOCESCert));
//				service.SetPolicy(new DGWSPolicy(card, MOCESCert));
                MortalityReasonType mort = Helper.CreateTestDocument_Part1And2();
//				MortalityReasonType mort = Helper.CreateTestDocument_Part1();
                String s = service.Report(mort);
                System.Diagnostics.Debug.WriteLine(s);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 5
0
        public static MortalityReasonType CreateTestDocument_Part2()
        {
            MortalityReasonType mortalityReason = new MortalityReasonType();

            //mortalityReason.SchemaID              = "1D817F0A-0EC6-42ad-90B5-BAA6ADFFE858";
            mortalityReason.SchemaID         = Guid.Empty.ToString();
            mortalityReason.PersonIdentifier = new PersonIdentifierType();
            //mortalityReason.PersonIdentifier.id   = "";
            mortalityReason.PersonIdentifier.Item = "0703614116";


            mortalityReason.Part1And2       = new Part1And2Type();
            mortalityReason.Part1And2.Items = new Object[2];
            //mortalityReason.Part1And2.Items[0] = new Part1Type();
            //Part1Type part1                    = (Part1Type)mortalityReason.Part1And2.Items[0];
            mortalityReason.Part1And2.Items[1] = new Part2Type();
            Part2Type part2 = (Part2Type)mortalityReason.Part1And2.Items[1];

            part2.Created = DateTime.Now;

            part2.PrimaryCauseOfDeath    = new CauseOfDeathType[1];
            part2.PrimaryCauseOfDeath[0] = new CauseOfDeathType();
            part2.PrimaryCauseOfDeath[0].CauseOfDeath        = "K420";
            part2.PrimaryCauseOfDeath[0].DurationBeforeDeath = "P0Y0M10DT15H";
            part2.PrimaryCauseOfDeath[0].Version             = 1;
            //part2.PrimaryCauseOfDeath[2] = new CauseOfDeathType();
            //part2.PrimaryCauseOfDeath[2].CauseOfDeath = "TEST1234";


            part2.SecondaryCauseOfDeath    = new CauseOfDeathType[1];
            part2.SecondaryCauseOfDeath[0] = new CauseOfDeathType();
            part2.SecondaryCauseOfDeath[0].CauseOfDeath        = "K421";
            part2.SecondaryCauseOfDeath[0].DurationBeforeDeath = "P0Y0M10DT14H";
            part2.SecondaryCauseOfDeath[0].Version             = 1;

            part2.ProductnameATCCode            = new ATCElementType[3];
            part2.ProductnameATCCode[0]         = new ATCElementType();
            part2.ProductnameATCCode[0].ATCCode = "A10AB01";
            part2.ProductnameATCCode[0].ATCText = "Actrapid Novolet";
            //part2.ProductnameATCCode[1] = new ATCElementType();
            //part2.ProductnameATCCode[1].ATCCode = "V04CL";
            //part2.ProductnameATCCode[1].ATCText = "Alk (231) Secale Cereale";
            part2.ProductnameATCCode[2]         = new ATCElementType();
            part2.ProductnameATCCode[2].ATCCode = "V04CL";
            part2.ProductnameATCCode[2].ATCText = "Alk 561 Svinebørster";

            part2.DeathNonNatural = new DeathNonNaturalType();
            part2.DeathNonNatural.PlaceOfEvent = PlaceOfEventType.Amusementandparkarea;

            part2.Autopsy      = new AutopsyType();
            part2.Autopsy.Item = NoAutopsyTextReasonType.ProhibitedAutopsy;



            //part1.Created = DateTime.Parse("2009-01-24");
            //part1.HealthInsuranceNumber = "1";
            //part1.BornDead = false;
            //part1.BornDeadData = null;

            //part1.Item = new TimeOfDeathType();
            //TimeOfDeathType tod = (TimeOfDeathType)part1.Item;
            //tod.DateTimeOrDate = new DateTimeOrDateType();
            //tod.DateTimeOrDate.ItemElementName = ItemChoiceType.Date;
            //tod.DateTimeOrDate.Item = DateTime.Parse("2009-01-22");
            //tod.DeathSite = new DeathSiteType();
            //DeathSiteType deathSite = (DeathSiteType)tod.DeathSite;
            //deathSite.Item = new HospitalIdentifierType();
            //HospitalIdentifierType hospID = (HospitalIdentifierType)deathSite.Item;
            //hospID.HospitalClasifikation = "9999";//"Udenlandsk Sygehus";
            //hospID.HospitalDepartment = "999";//"Færøsk sygehusafdeling";

            //part1.SignOfDeath = SignOfDeathType.Rigor;
            //part1.InquestDate = DateTime.Parse("2009-01-23");
            //part1.PoliceContact = false;
            //part1.Implants = ImplantsType.No;
            //part1.AlternativeDoctor = null;
            //part1.PoliceStationName = String.Empty;

            return(mortalityReason);
        }
Exemplo n.º 6
0
        public static MortalityReasonType CreateTestDocument_Part1And2()
        {
            MortalityReasonType mortalityReason = new MortalityReasonType();

            //mortalityReason.SchemaID              = "1D817F0A-0EC6-42ad-90B5-BAA6ADFFE858";
            mortalityReason.SchemaID              = Guid.Empty.ToString();
            mortalityReason.PersonIdentifier      = new PersonIdentifierType();
            mortalityReason.PersonIdentifier.id   = "cprid";
            mortalityReason.PersonIdentifier.Item = "0703614116";

            mortalityReason.Part1And2       = new Part1And2Type();
            mortalityReason.Part1And2.Items = new Object[2];

            mortalityReason.Part1And2.Items[0] = new Part1Type();
            Part1Type part1 = (Part1Type)mortalityReason.Part1And2.Items[0];

            part1.Created = DateTime.Now;

            part1.AlternativeDoctor = new AlternativeDoctorType();
            part1.AlternativeDoctor.DoctorAddress            = new AddressPostalType();
            part1.AlternativeDoctor.DoctorAddress.StreetName = "Test_Street";
            part1.AlternativeDoctor.DoctorAddress.StreetBuildingIdentifier = "45A";
            part1.AlternativeDoctor.DoctorAddress.PostCodeIdentifier       = "1660";
            part1.AlternativeDoctor.DoctorAddress.DistrictName             = "Test_District";
            part1.AlternativeDoctor.PersonNameStructure = new PersonNameStructureType();
            part1.AlternativeDoctor.PersonNameStructure.PersonGivenName   = "Test_Fornavn";
            part1.AlternativeDoctor.PersonNameStructure.PersonMiddleName  = "Test_Mellemnavn";
            part1.AlternativeDoctor.PersonNameStructure.PersonSurnameName = "Test_Efternavn";

            part1.BornDead     = false;
            part1.BornDeadData = null;            //Test om script fanger den her. (hvis den skal fanges!?) - update: Script fanger fejl når BornDead = true.

            part1.HealthInsuranceNumber = "1";
            part1.Implants    = ImplantsType.Unknown;
            part1.InquestDate = DateTime.Now.AddDays(-1);

            part1.Item = new TimeOfDeathType();
            TimeOfDeathType timeOfDeathType = (TimeOfDeathType)part1.Item;

            timeOfDeathType.DateTimeOrDate = new DateTimeOrDateType();
            timeOfDeathType.DateTimeOrDate.ItemElementName = ItemChoiceType.DateTime;
            timeOfDeathType.DateTimeOrDate.Item            = DateTime.Now.AddDays(-2);
            timeOfDeathType.DeathSite      = new DeathSiteType();
            timeOfDeathType.DeathSite.Item = new ResidenceType();
            timeOfDeathType.DeathSite.Item = ResidenceType.NurseryHome;

            //part1.Page2WillFollow   = false;
            part1.PoliceContact     = true;
            part1.PoliceStationName = "";
            part1.SignOfDeath       = SignOfDeathType.MaceratioAndCadaverositasAndLivoresAndRigor;

            mortalityReason.Part1And2.Items[1] = new Part2Type();
            Part2Type part2 = (Part2Type)mortalityReason.Part1And2.Items[1];

            part2.Created = DateTime.Now;

            part2.PrimaryCauseOfDeath    = new CauseOfDeathType[3];
            part2.PrimaryCauseOfDeath[0] = new CauseOfDeathType();
            part2.PrimaryCauseOfDeath[0].CauseOfDeath = "K420";
            //part2.PrimaryCauseOfDeath[0].DurationBeforeDeath = "P0Y0M0DT15H0";
            //part2.PrimaryCauseOfDeath[0].DurationBeforeDeath = "P0Y0M0DT13H";
            part2.PrimaryCauseOfDeath[0].DurationBeforeDeath = "PT13H";
            part2.PrimaryCauseOfDeath[0].Version             = 1;
            part2.PrimaryCauseOfDeath[2] = new CauseOfDeathType();
            part2.PrimaryCauseOfDeath[2].CauseOfDeath = "K421";
            //part2.PrimaryCauseOfDeath[2].DurationBeforeDeath = "P0Y0M5DT15H";
            part2.PrimaryCauseOfDeath[2].DurationBeforeDeath = "P0Y0M0DT15H";
            part2.PrimaryCauseOfDeath[2].Version             = 1;

            part2.SecondaryCauseOfDeath    = new CauseOfDeathType[1];
            part2.SecondaryCauseOfDeath[0] = new CauseOfDeathType();
            part2.SecondaryCauseOfDeath[0].CauseOfDeath = "K429";
            //part2.SecondaryCauseOfDeath[0].DurationBeforeDeath = "P0Y0M0DT14H";
            part2.SecondaryCauseOfDeath[0].DurationBeforeDeath = "PT14H";
            part2.SecondaryCauseOfDeath[0].Version             = 1;

            part2.ProductnameATCCode            = new ATCElementType[3];
            part2.ProductnameATCCode[0]         = new ATCElementType();
            part2.ProductnameATCCode[0].ATCCode = "A10AB01";
            part2.ProductnameATCCode[0].ATCText = "Actrapid Novolet";
            part2.ProductnameATCCode[1]         = new ATCElementType();
            part2.ProductnameATCCode[1].ATCCode = "V04CL";
            part2.ProductnameATCCode[1].ATCText = "Alk (231) Secale Cereale";
            //part2.ProductnameATCCode[2] = new ATCElementType();
            //part2.ProductnameATCCode[2].ATCCode = "V04CL";
            //part2.ProductnameATCCode[2].ATCText = "Alk 561 Svinebørster";

            part2.DeathNonNatural = new DeathNonNaturalType();
            part2.DeathNonNatural.PlaceOfEvent = PlaceOfEventType.Amusementandparkarea;

            part2.Autopsy      = new AutopsyType();
            part2.Autopsy.Item = NoAutopsyTextReasonType.ProhibitedAutopsy;

            return(mortalityReason);
        }