Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled  = false;
            tbIdKunde.Text   = tbIdKunde.Text.Replace(" ", ""); // Remove spaces
            tbIdPasient.Text = tbIdPasient.Text.Replace(" ", "");
            Application.DoEvents();

            string idKunde   = tbIdKunde.Text;
            string idPasient = (tbIdPasient.Text.Trim().Length > 0) ? tbIdPasient.Text : idKunde;

            String [] referansenummer = this.tbRefnr.Text.Trim().Split(new char[] { ';', ',' });


            List <String> reseptliste;

            NettapotekClient.NettapotekClient cl = new NettapotekClient.NettapotekClient();

            cl.clientCert  = apotekCert;
            cl.serviceCert = RFCert;
            cl.useSHA1     = cbSigning.Checked;
            // cl.testFromInternet = cbInternet.Checked;
            cl.RFUtleverer = RFUtleverer;
            cl.RFNA        = RFNA;


            cl.msgIdFirstM9na1 = tbMessageIdFirstM9na1.Text;

            lvResepter.Items.Clear();
            tbAntall.Text = "  --  ";
            Application.DoEvents()
            ;
            cl.samlText = getSamlToken();

            DateTime startTime = DateTime.Now;

            //cl.intercept = cbIntercept.Checked ;
            cl.intercept   = interceptToolStripMenuItem.Checked;
            cl.preproduced = false;
            reseptliste    = cl.getNARespetliste(idKunde, idPasient, referansenummer);

            if (interceptToolStripMenuItem.Checked == true)
            {
                messageIntercept editor = new messageIntercept(cl.lastLogFileName);
                editor.ShowDialog();
                cl.intercept   = false;
                cl.preproduced = true;

                reseptliste = cl.getNARespetliste(idKunde, idPasient, referansenummer);
            }


            cl.intercept   = false;
            cl.preproduced = false;

            tbResponseTime.Text = DateTime.Now.Subtract(startTime).TotalMilliseconds.ToString();
            //reseptliste = cl.getRespetliste(idKunde, idPasient);

            tbAntall.Text = cl.antallResepterM9NA2.ToString();
            tbMessageIdFirstM9na1.Text = cl.msgIdFirstM9na1;
            tbMessageIdM9na1.Text      = cl.msgIdLastM9na1;
            tbMessageIdM9na2.Text      = cl.msgIdLastM9na2;

            if (reseptliste == null)
            {
                MessageBox.Show(cl.errorMessage, "Feilmelding");
            }
            else
            {
                foreach (String s in reseptliste)
                {
                    String[] reseptParts = s.Split(new char[] { '@' });
                    //lbResepter.Items.Add(s);
                    //lbResepter.Items[lbResepter.Items.Count - 1].BackColor = Color.Red;
                    ListViewItem resp = new ListViewItem(s);
                    resp.Tag  = reseptParts[0]; // Resept id
                    resp.Text = reseptParts[2];

                    switch (reseptParts[1]) // Reseptstatus
                    {
                    case "E":

                        break;

                    case "U":
                        resp.BackColor = Color.Yellow;

                        break;

                    case "T":
                        resp.ForeColor = Color.Red;

                        break;

                    case "R":
                        resp.ForeColor = Color.LightSlateGray;

                        break;
                    }

                    resp.ToolTipText = reseptParts[3];

                    lvResepter.Items.Add(resp);
                }
            }

            wbDiag.Navigate(dataDir + "\\" + cl.lastLogFileName);

            button1.Enabled = true;
        }
Esempio n. 2
0
        private void lvResepter_DoubleClick(object sender, EventArgs e)
        {
            if (lvResepter.SelectedItems.Count == 0)
            {
                return;
            }
            ListViewItem i      = lvResepter.SelectedItems[0];
            string       resept = i.Text;
            //String[] info = resept.Split(new char[] { ':' });
            String reseptID = (string)i.Tag;

            tbDetaljer.Text = "m9na2:" + Environment.NewLine + lvResepter.SelectedItems[0].ToolTipText;

            lvResepter.Enabled = false;
            Application.DoEvents();

            string idKunde   = tbIdKunde.Text;
            string idPasient = (tbIdPasient.Text.Trim().Length > 0) ? tbIdPasient.Text : idKunde;


            NettapotekClient.NettapotekClient cl = new NettapotekClient.NettapotekClient();

            cl.clientCert  = apotekCert;
            cl.serviceCert = RFCert;
            cl.useSHA1     = cbSigning.Checked;
            //cl.testFromInternet = cbInternet.Checked;
            cl.RFUtleverer = RFUtleverer;
            cl.RFNA        = RFNA;


            cl.msgIdFirstM9na1 = tbMessageIdFirstM9na1.Text;
            cl.msgIdLastM9na1  = tbMessageIdM9na1.Text;
            cl.msgIdLastM9na2  = tbMessageIdM9na2.Text;

            cl.samlText = getSamlToken();

            DateTime startTime    = DateTime.Now;
            Guid     reseptIdGUID = new Guid(reseptID);



            cl.intercept   = interceptToolStripMenuItem.Checked;
            cl.preproduced = false;
            String detaljer = cl.getNARespetDetajer(idKunde, idPasient, reseptIdGUID.ToString());

            if (interceptToolStripMenuItem.Checked == true)
            {
                messageIntercept editor = new messageIntercept(cl.lastLogFileName);
                editor.ShowDialog();
                cl.intercept   = false;
                cl.preproduced = true;

                detaljer = cl.getNARespetDetajer(idKunde, idPasient, reseptIdGUID.ToString());
            }



            cl.intercept   = false;
            cl.preproduced = false;


            //  String detaljer = cl.getNARespetDetajer(idKunde, idPasient, reseptIdGUID.ToString() );
            tbResponseTime.Text   = DateTime.Now.Subtract(startTime).TotalMilliseconds.ToString();
            tbMessageIdM9na3.Text = cl.msgIdLastM9na3;
            tbMessageIdM9na4.Text = cl.msgIdLastM9na4;

            //reseptliste = cl.getRespetliste(idKunde, idPasient);

            if (detaljer == null)
            {
                MessageBox.Show(cl.errorMessage, "Feilmelding");
            }
            else
            {
                tbDetaljer.Text += Environment.NewLine + " ------------- " + Environment.NewLine + "m9na4:" + Environment.NewLine + detaljer;
            }

            lvResepter.Enabled = true;

            wbDiag.Navigate(dataDir + "\\" + cl.lastLogFileName);
        }