private void BtnSearch_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            FrmSearchHn frm = new FrmSearchHn(bc, FrmSearchHn.StatusConnection.host);

            frm.ShowDialog(this);
            String[] an = bc.sPtt.an.Split('/');
            //if (an.Length > 1)
            //{
            //    txtAN.Value = an[0];
            //    txtAnCnt.Value = an[1];
            //}
            //else
            //{
            clearText();
            if (bc.sPtt.an.Replace("/", "").Length > 0)
            {
                lbVn.Text   = "AN :";
                txtVN.Value = bc.sPtt.an.Trim();
                txtHn.Value = bc.sPtt.Hn.Trim();
                lbName.Text = bc.sPtt.Name;
            }
            else if (bc.sPtt.vn.Length > 0)
            {
                lbVn.Text   = "VN :";
                txtVN.Value = bc.sPtt.vn.Trim();
                txtHn.Value = bc.sPtt.Hn.Trim();
                lbName.Text = bc.sPtt.Name;
            }
            else
            {
                MessageBox.Show("ไม่พบ ข้อมูล an หรือ vn", "");
                return;
            }
            //txtAN.Value = bc.sPtt.an;
            //txtAnCnt.Value = "";
            ////}
            //txtHn.Value = bc.sPtt.Hn;
            //txtName.Value = bc.sPtt.Name;
            //txtVN.Value = bc.sPtt.vn;
            //txtVisitDate.Value = bc.sPtt.visitDate;
            //txtPreNo.Value = bc.sPtt.preno;

            //txtAnDate.Value = bc.sPtt.anDate;
            //chkIPD.Checked = bc.sPtt.statusIPD.Equals("I") ? true : false;

            //if (chkIPD.Checked)
            //{
            //    txtVisitDate.Hide();
            //    txtAnDate.Show();
            //    label6.Text = "AN Date :";
            //}
            //else
            //{
            //    txtVisitDate.Show();
            //    txtAnDate.Hide();
            //    label6.Text = "Visit Date :";
            //}
        }
        private void BtnHn_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            FrmSearchHn frm = new FrmSearchHn(bc, FrmSearchHn.StatusConnection.host);

            frm.ShowDialog(this);
            txtHn.Value   = bc.sPtt.Hn;
            txtName.Value = bc.sPtt.Name;
            setGrf();
        }
        private void BtnHn_Click(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
            FrmSearchHn frm = new FrmSearchHn(bc, FrmSearchHn.StatusConnection.host);

            frm.ShowDialog(this);
            String[] an = bc.sPtt.an.Split('/');
            //if (an.Length > 1)
            //{
            //    txtAN.Value = an[0];
            //    txtAnCnt.Value = an[1];
            //}
            //else
            //{
            txtAN.Value    = bc.sPtt.an;
            txtAnCnt.Value = "";
            //}
            txtHn.Value        = bc.sPtt.Hn;
            txtName.Value      = bc.sPtt.Name;
            txtVN.Value        = bc.sPtt.vn;
            txtVisitDate.Value = bc.sPtt.visitDate;
            txtPreNo.Value     = bc.sPtt.preno;

            txtAnDate.Value = bc.sPtt.anDate;
            chkIPD.Checked  = bc.sPtt.statusIPD.Equals("I") ? true : false;

            if (chkIPD.Checked)
            {
                txtVisitDate.Hide();
                txtAnDate.Show();
                label6.Text = "AN Date :";
            }
            else
            {
                txtVisitDate.Show();
                txtAnDate.Hide();
                label6.Text = "Visit Date :";
            }
            DataTable dt = new DataTable();

            dt = bc.bcDB.labexDB.selectByVn(txtHn.Text.Trim(), txtVN.Text.Trim().Replace("/", ".").Replace("(", ".").Replace(")", ""));
            if (dt.Rows.Count > 0)
            {
                le.Id       = dt.Rows[0][bc.bcDB.labexDB.labex.Id].ToString();
                le.Hn       = dt.Rows[0][bc.bcDB.labexDB.labex.Hn].ToString();
                le.Vn       = dt.Rows[0][bc.bcDB.labexDB.labex.Vn].ToString();
                le.YearId   = dt.Rows[0][bc.bcDB.labexDB.labex.YearId].ToString();
                txtId.Value = le.Id;
            }
            else
            {
                le.Id     = "";
                le.Hn     = txtHn.Text.Trim();
                le.Vn     = txtVN.Text.Trim();
                le.YearId = DateTime.Now.Year.ToString();
            }
            if (!bc.iniC.windows.ToLower().Equals("windowsxp"))
            {
                C1PdfDocumentSource pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("1"));
                fvLabOut1.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("2"));
                fvLabOut2.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("3"));
                fvLabOut3.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("4"));
                fvLabOut4.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("5"));
                fvLabOut5.DocumentSource = pds;
                pds = new C1PdfDocumentSource();
                pds.LoadFromStream(loadPDF("6"));
                fvLabOut6.DocumentSource = pds;
            }
            else
            {
                lbName1.Text = "...";
                lbName2.Text = "...";
                lbName3.Text = "...";
                lbName4.Text = "...";
                lbName5.Text = "...";
                lbName6.Text = "...";
                loadPDF("1");
                loadPDF("2");
                loadPDF("3");
                loadPDF("4");
                loadPDF("5");
                loadPDF("6");
            }
        }