Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string   maSoBenhNhan = textBoxMaSoBenhNhan.Text;
            string   CMND         = textBoxCMND.Text;
            string   hoTen        = textBoxHoTen.Text;
            string   diaChi       = richTextBoxDiaChi.Text;
            benhNhan bn           = new benhNhan(maSoBenhNhan, hoTen, CMND, diaChi);

            Console.WriteLine(bn.ToString());
            //sent to doctor
            Sender.sentXMLInfo(bn);
            //check and insert into database
            string maSo   = textBoxMaSoBenhNhan.Text;
            var    result = from table in dbContext.benhnhans
                            where table.msbn == maSo
                            select table;

            if (result.Count() == 0)
            {
                benhNhan.msbn   = textBoxMaSoBenhNhan.Text;
                benhNhan.socmnd = textBoxCMND.Text;
                benhNhan.hoten  = textBoxHoTen.Text;
                benhNhan.diachi = richTextBoxDiaChi.Text;
                dbContext.benhnhans.InsertOnSubmit(benhNhan);
                dbContext.SubmitChanges();
            }
            labelMess.Text = "Da Cap Nhat";
            //this code is use to sent my format string
            // string info = maSoBenhNhan + ";" + CMND + ";" + hoTen + ";" + diaChi;
            //Sender.sentString(info);
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            benhNhan bn = (benhNhan)listBox1.SelectedItem;

            if (bn != null)
            {
                textBox1.Text = bn.msbn;
                textBox2.Text = bn.cmnd;
                textBox3.Text = bn.hoten;
                textBox4.Text = bn.diachi;
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            benhNhan bn = new benhNhan();

            bn.msbn   = textBox1.Text;
            bn.cmnd   = textBox2.Text;
            bn.hoten  = textBox3.Text;
            bn.diachi = textBox4.Text;
            MessageQueueTransaction transaction = new MessageQueueTransaction();

            transaction.Begin();
            queue.Send(bn, transaction);
            transaction.Commit();
        }
Ejemplo n.º 4
0
 private void SetText(benhNhan bn)
 {
     listBox1.DisplayMember = "hoten";
     listBox1.ValueMember   = "cmnd";
     listBox1.Items.Add(bn);
 }