Beispiel #1
0
        private void OutPatientEntry_Load(object sender, EventArgs e)
        {
            this.KeyPreview = true;
            txtOpId.Text    = xDb.GetMaxId("txno", "outpatientdetails").ToString();
            cmbCaseType.Select();
            LoadGrid();
            cmbCaseType.SelectedIndex        = 0;
            cmbNoonType.SelectedIndex        = 0;
            cmbCaseType1.SelectedIndex       = 0;
            cmbOpPatientStatus.SelectedIndex = 1;
            cmbPaymentStatus.SelectedIndex   = 1;
            ConfigResponseModel configResponseModel = xDb.GetConfig();
            DoctorResponseModel doctorResponseModel = xDb.GetDoctorFromDoctorId(Convert.ToInt32(configResponseModel.DefualtDoctor));

            if (doctorResponseModel.DoctorId == 0)
            {
                MessageBox.Show("Could not Find Doctor Details");
            }
            {
                txtDoctorId.Text   = doctorResponseModel.DoctorId.ToString();
                txtDoctorName.Text = doctorResponseModel.DoctorName;
            }
            txtFees.Text = "150";
            GetMaxTokenNo();
        }
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (txtLabId.Text == "")
            {
                MessageBox.Show("Please Enter Lab Id");
                txtLabId.Focus();
                return;
            }

            LabResponseModel     labResponse     = xDb.GetLabRecordFromLabId(Convert.ToInt32(txtLabId.Text));
            PatientResponseModel patientResponse = xDb.GetPatientFromPatientId(labResponse.PatientId);
            DoctorResponseModel  doctorResponse  = xDb.GetDoctorFromDoctorId(labResponse.DoctorId);

            txtBillDate.Text    = labResponse.BillDate.ToString();
            txtPatientId.Text   = patientResponse.PatientId.ToString();
            txtPatientName.Text = patientResponse.PatientName.ToString();
            txtUhid.Text        = patientResponse.UHID.ToString();
            txtDoctorName.Text  = doctorResponse.DoctorName;

            string xQry = "select bld.lab_id,bld.test_id,ltf.test_name as TestName, " +
                          " ltf.test_description as TestDescription, " +
                          " bld.patient_test_details as PatientTestDetails  " +
                          " from billing_lab_details bld, " +
                          " m_lab_test_fees ltf, billing_lab bl" +
                          " where bld.test_id = ltf.lab_test_fees_id " +
                          " and bl.lab_id = bld.lab_id and bld.lab_id= " + txtLabId.Text;

            xDb.LoadGrid(xQry, dataGridView1);
            dataGridView1.Columns[0].Visible = false;
            dataGridView1.Columns[1].Visible = false;
            dataGridView1.Columns[2].Width   = 200;
            txtLabId.Enabled  = false;
            btnUpdate.Enabled = true;
            btnView.Enabled   = true;
        }
        private void cmbIPNo_SelectedIndexChanged(object sender, EventArgs e)
        {
            IPDetailModel        ipResponse      = xDb.GetIpDetailsFromIpNo(Convert.ToInt32(cmbIPNo.Text));
            PatientResponseModel patientResponse = xDb.GetPatientFromPatientId(ipResponse.PatientId);
            DoctorResponseModel  doctorResponse  = xDb.GetDoctorFromDoctorId(ipResponse.DoctorId);

            txtPatientName.Text = patientResponse.PatientName.ToString();
            txtDoctorName.Text  = doctorResponse.DoctorName;
            txtCaseType.Text    = xDb.GetCaseTypeNameFromCaseTypeId(ipResponse.CaseTypeId);
        }
        public DoctorResponseModel GetDoctorFromDoctorId(int xDoctorId)
        {
            DoctorResponseModel model = new DoctorResponseModel();

            using (connection = new MySqlConnection(conString))
            {
                string xQry = "select * from m_doctor where  doctor_id = " + xDoctorId + "";
                connection.Open();
                MySqlCommand comm = new MySqlCommand(xQry, connection);

                MySqlDataReader reader = comm.ExecuteReader();

                while (reader.Read())
                {
                    model = new DoctorResponseModel()
                    {
                        DoctorId   = Convert.ToInt32(reader.GetInt32(0)),
                        DoctorName = reader.GetString(1)
                    };
                }
                connection.Close();
            }
            return(model);
        }