Beispiel #1
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            String patient_name = dataGridView1.CurrentRow.Cells[1].Value.ToString();
            String emp_name     = dataGridView1.CurrentRow.Cells[2].Value.ToString();

            عمل_خطة_علاجية_لمريض op = new عمل_خطة_علاجية_لمريض();

            op.textBox1.Text = patient_name;
            op.textBox2.Text = emp_name;
            try
            {
                con.OpenConection();
                cmd = new SqlCommand("select doctors.doc_ssn from doctors,physiotherapy_Reception where doctors.doc_ssn=physiotherapy_Reception.physiotherapy_Employee_code AND doctors.full_name='" + emp_name + "'", con.returnObject());
                String x        = cmd.ExecuteScalar().ToString();
                int    emp_code = int.Parse(x);
                op.phys_emp_code = emp_code;
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
            finally { con.CloseConnection(); }
            op.phys_pat_code = int.Parse(dataGridView1.CurrentRow.Cells[0].Value.ToString());;
            op.Show();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                con.OpenConection();



                int service_code = int.Parse(comboBox3.SelectedItem.ToString());
                int deviceCode   = int.Parse(comboBox4.SelectedValue.ToString());

                string[]    pramname  = new string[5];
                string[]    pramvalue = new string[5];
                SqlDbType[] pramtype  = new SqlDbType[5];
                pramname[0]  = "@physiotherapy_patient_code";
                pramname[1]  = "@Device_code";
                pramname[2]  = "@plan_start";
                pramname[3]  = "@plan_end";
                pramname[4]  = "@session_number";
                pramvalue[0] = phys_pat_code.ToString();
                pramvalue[1] = deviceCode.ToString();
                pramvalue[2] = dateTimePicker1.Value.ToString();
                pramvalue[3] = dateTimePicker2.Value.ToString();
                pramvalue[4] = numericUpDown1.Value.ToString();
                pramtype[0]  = SqlDbType.Int;
                pramtype[1]  = SqlDbType.Int;
                pramtype[2]  = SqlDbType.Date;
                pramtype[3]  = SqlDbType.Date;
                pramtype[4]  = SqlDbType.Int;
                con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("physiotherapy_physiotherapy_Treatment_Plan", pramname, pramvalue, pramtype);
                cmd = new SqlCommand("select plan_code from physiotherapy_Treatment_Plan where physiotherapy_patient_code=" + phys_pat_code, con.returnObject());
                String      x          = cmd.ExecuteScalar().ToString();
                int         plan_code  = int.Parse(x);
                string[]    pramname1  = new string[2];
                string[]    pramvalue1 = new string[2];
                SqlDbType[] pramtype1  = new SqlDbType[2];
                pramname1[0]  = "@service_code";
                pramname1[1]  = "@plan_code";
                pramvalue1[0] = service_code.ToString();
                pramvalue1[1] = plan_code.ToString();
                pramtype1[0]  = SqlDbType.Int;
                pramtype1[1]  = SqlDbType.Int;
                con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("physiotherapy_physiotherapy_Treatment_Plan2", pramname1, pramvalue1, pramtype1);
                string[]    pramname2  = new string[2];
                string[]    pramvalue2 = new string[2];
                SqlDbType[] pramtype2  = new SqlDbType[2];
                pramname2[0]  = "@doc_code";
                pramname2[1]  = "@plan_code";
                pramvalue2[0] = phys_emp_code.ToString();
                pramvalue2[1] = plan_code.ToString();
                pramtype2[0]  = SqlDbType.VarChar;
                pramtype2[1]  = SqlDbType.Int;
                con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("physiotherapy_physiotherapy_Treatment_Plan3", pramname2, pramvalue2, pramtype2);

                MessageBox.Show("تم الحفظ");
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
            finally { con.CloseConnection(); }
        }