示例#1
0
        //---------------------------------CHANGE PATIENT -------------------------
        //------------FILL BOXES--------------------
        private void fill_change_patient()
        {
            ComboBoxSelect cbs = new ComboBoxSelect("Edit patient", "Select patient", "exec select_assigned_patients;|details|id");

            cbs.ShowDialog();
            if (cbs.canceled)
            {
                tabControl1.SelectedIndex = 0;
            }
            else
            {
                current_patient_id = cbs.selectedValueReturn;
                SQLVarContainer id = new SQLVarContainer(SqlDbType.Int, "@id", current_patient_id);
                DataSet         ds = Program.SQL.GetDataQuery("exec select_patients_by_id", id, ";");
                current_patient_age = ds.Tables[0].Rows[0]["age"].ToString();
                SQLVarContainer   insurance = new SQLVarContainer(SqlDbType.Int, "@insu", ds.Tables[0].Rows[0]["insurance"].ToString());
                SQLVarContainer   age       = new SQLVarContainer(SqlDbType.Int, "@age", current_patient_age);
                SQLVarContainer[] vars      = { insurance, age };
                change_bed.DataSource       = Program.SQL.GetDataQuery("exec select_beds_by_insurance", vars, ";").Tables[0];
                change_bed.DisplayMember    = "label";
                change_bed.ValueMember      = "id";
                change_doctor.DataSource    = Program.SQL.GetDataQuery("exec select_doctor;").Tables[0];
                change_doctor.DisplayMember = "details";
                change_doctor.ValueMember   = "id";
                change_bed.SelectedValue    = ds.Tables[0].Rows[0]["bed"].ToString();
                change_doctor.SelectedValue = ds.Tables[0].Rows[0]["doctor"].ToString();
            }
        }
示例#2
0
        //---------------------------------EDIT PATIENT -------------------------
        //------------FILL BOXES--------------------
        private void fill_edit_patient()
        {
            ComboBoxSelect cbs = new ComboBoxSelect("Edit patient", "Select patient", "exec select_free_patients;|details|id");

            cbs.ShowDialog();
            if (cbs.canceled)
            {
                tabControl1.SelectedIndex = 0;
            }
            else
            {
                SQLVarContainer id = new SQLVarContainer(SqlDbType.Int, "@id", cbs.selectedValueReturn);

                DataSet ds = Program.SQL.GetDataQuery("exec select_patients_by_id", id, ";");
                edit_name.Text        = ds.Tables[0].Rows[0]["fullname"].ToString();
                edit_rel_contact.Text = ds.Tables[0].Rows[0]["contact"].ToString();
                edit_phone.Text       = ds.Tables[0].Rows[0]["phone"].ToString();
                edit_address.Text     = ds.Tables[0].Rows[0]["address"].ToString();
                DateTime dt = Convert.ToDateTime(ds.Tables[0].Rows[0]["birthday"].ToString());
                dt = Convert.ToDateTime(dt.ToShortDateString());
                edit_birthday.Text           = dt.ToString("yyyy-MM-dd");
                edit_insurance.DataSource    = Program.SQL.GetDataQuery("exec select_insurance").Tables[0];
                edit_insurance.DisplayMember = "description";
                edit_insurance.ValueMember   = "id";
                edit_insurance.SelectedValue = ds.Tables[0].Rows[0]["insurance"].ToString();
                current_patient_id           = ds.Tables[0].Rows[0]["id"].ToString();
            }
        }