Exemplo n.º 1
0
        private void btn_Search_Click(object sender, EventArgs e)
        {
            NotesTblBLL noteBLL = new NotesTblBLL();
            string      sql     = "SELECT noteID,patientName,patientCode,patientPhone,clinicName,doctorName,dayCreate FROM notesTbl " +
                                  " WHERE 1=1 ";

            if (ckb_patientName.Checked)
            {
                sql += " AND patientName LIKE N'%" + txt_Keyword.Text + "%' ";
            }
            if (ckb_patientCode.Checked)
            {
                sql += " AND patientCode LIKE N'%" + txt_Keyword.Text + "%' ";
            }
            if (ckb_patientPhone.Checked)
            {
                sql += " AND patientPhone LIKE N'%" + txt_Keyword.Text + "%' ";
            }
            if (ckb_clinicName.Checked)
            {
                sql += " AND clinicName LIKE N'%" + txt_Keyword.Text + "%' ";
            }
            if (ckb_doctorName.Checked)
            {
                sql += " AND doctorName LIKE N'%" + txt_Keyword.Text + "%' ";
            }
            if (ckb_dayCreate.Checked)
            {
                sql += " AND CONVERT(VARCHAR(25), dayCreate, 126) LIKE N'%" + txt_Keyword.Text + "%' ";
            }
            dt = new DataTable();
            dt = noteBLL.SearchNotes(sql);
            dgv_Result.AutoGenerateColumns = false;
            dgv_Result.DataSource          = dt;
        }
Exemplo n.º 2
0
        //Button Search

        private void btn_Search_Click_1(object sender, EventArgs e)
        {
            NotesTblBLL  noteBLL     = new NotesTblBLL();
            NotesTblInfo objNoteInfo = new NotesTblInfo();

            objNoteInfo.ClinicName   = txt_clinicName.Text;
            objNoteInfo.PatientName  = txt_patientName.Text;
            objNoteInfo.PatientCode  = txt_patientCode.Text;
            objNoteInfo.PatientPhone = txt_patientPhone.Text;
            objNoteInfo.DoctorName   = txt_doctorName.Text;
            objNoteInfo.DayCreate    = dtp_dayCreate.Value.ToShortDateString();
            DataTable tbResult = noteBLL.GetSearchedNotes(objNoteInfo);

            dgv_Result.AutoGenerateColumns = false;
            dgv_Result.DataSource          = tbResult;
        }
Exemplo n.º 3
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("Bạn thực sự muốn xóa phiếu này?", "Xóa phiếu", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                int          noteID = Convert.ToInt32(dgv_Result.CurrentRow.Cells[0].Value.ToString());
                NotesTblInfo note   = new NotesTblInfo();
                note.NoteID = noteID;
                NotesTblBLL noteBLL = new NotesTblBLL();
                noteBLL.Delete(note);
                string sql = "SELECT noteID,patientName,patientCode,patientPhone,clinicName,doctorName,dayCreate FROM notesTbl " +
                             " WHERE 1=1 ";
                if (ckb_patientName.Checked)
                {
                    sql += " AND patientName LIKE N'%" + txt_Keyword.Text + "%' ";
                }
                if (ckb_patientCode.Checked)
                {
                    sql += " AND patientCode LIKE N'%" + txt_Keyword.Text + "%' ";
                }
                if (ckb_patientPhone.Checked)
                {
                    sql += " AND patientPhone LIKE N'%" + txt_Keyword.Text + "%' ";
                }
                if (ckb_clinicName.Checked)
                {
                    sql += " AND clinicName LIKE N'%" + txt_Keyword.Text + "%' ";
                }
                if (ckb_doctorName.Checked)
                {
                    sql += " AND doctorName LIKE N'%" + txt_Keyword.Text + "%' ";
                }
                if (ckb_dayCreate.Checked)
                {
                    sql += " AND CONVERT(VARCHAR(25), dayCreate, 126) LIKE N'%" + txt_Keyword.Text + "%' ";
                }
                dt = new DataTable();
                dt = noteBLL.SearchNotes(sql);
                dgv_Result.AutoGenerateColumns = false;
                dgv_Result.DataSource          = dt;
            }
        }