コード例 #1
0
        //send to form6



        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            xx1 = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();

            //create procedure clinic_select_nationality_gender_name(@x int)
            //     as
            //     select nationality,gender,patient_name as 'اسم المريض'  from Registeration_patientRegisteration  where patient_id =@x;
            //      select CE_AName from tb_Contracting_Entities,Registeration_patientRegisteration where tb_Contracting_Entities.CE_Id=Registeration_patientRegisteration.catogrical_code and patient_id=@x;


            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int };
            name_input = new string[] { "@x" };
            values     = new string[] { xx1 };
            SqlDataReader dr = con1.ShowDataInGridViewUsingStoredProcDR("clinic_select_nationality_gender_name", name_input, values, types);

            dr.Read();

            xx6 = dr[0].ToString();
            xx5 = dr[1].ToString();
            xx2 = dr[2].ToString();
            dr.NextResult(); dr.Read();
            xx4 = dr[0].ToString();

            dr.Close();

            تعديل_الفئه_الماليه_للمريض_الخارجى f6 = new تعديل_الفئه_الماليه_للمريض_الخارجى(xx1, xx2, xx4, xx5, xx6);


            f6.Show();
            this.Close();
            con1.CloseConnection();
        }
コード例 #2
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            /*
             * create procedure [dbo].[clinic_حجز_العياده_clinic_service](@c int)
             * as
             * begin
             * select SLS_Aname from tb_Second_Level_Service where [SLS_Service_Category]='Outer_Clinic' and [SLS_Status]=1 and c_code=@c
             * end
             *
             */
            names = listBox1.Text;
            con1.OpenConection();
            // types = new SqlDbType[] {SqlDbType.NVarChar };
            //name_input = new string[] { "@ser" };
            //values = new string[] { names };
            types      = new SqlDbType[] { SqlDbType.Int };
            name_input = new string[] { "@c" };
            values     = new string[] { code.ToString() };
            dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_حجز_العياده_clinic_service", name_input, values, types);

            //con = new SqlConnection(@"server=SANDRA-PC\SQLEXPRESS;database=project_db; Integrated Security=true;");
            //con.Open();
            //cmd = new SqlCommand("select clinic_code from clinic where arabic_name like'" + names + "%'"+"select arabic_des from clinic_service where ccode=" + code + "" , con);

            while (dr.Read())
            {
                listBox3.Items.Clear();
                service = dr[0].ToString();
                listBox3.Items.Add(service);
            }
            MessageBox.Show("انت قمت باختيار عيادة " + " " + names);
            dr.Close();
            con1.CloseConnection();
        }
コード例 #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (can_selest__ == 1)
            {
                can_selest__  = 0;
                textBox1.Text = "";

                try
                {
                    con1.OpenConection();
                    types      = new SqlDbType[] { SqlDbType.Text };
                    name_input = new string[] { "@set_name" };
                    values     = new string[] { set_name };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setscope_Endoscope_settings_data_select", name_input, values, types);
                    while (dr.Read())
                    {
                        textBox1.Text          = dr[0].ToString();
                        textBox4.Text          = dr[1].ToString();
                        textBox5.Text          = dr[2].ToString();
                        comboBox2.SelectedItem = dr[5].ToString();

                        if (int.Parse(dr[3].ToString()) == 1)
                        {
                            checkBox1.Checked = true;
                        }
                        if (int.Parse(dr[4].ToString()) == 1)
                        {
                            radioButton1.Checked = true;
                        }
                        else
                        {
                            radioButton2.Checked = true;
                        }
                    }
                    dr.Close();
                    con1.CloseConnection();
                }
                catch (Exception exp)
                {
                    MessageBox.Show(exp.Message + "  error");
                }
            }


            اضافةToolStripMenuItem.Visible = true;
            if (panel2.Visible == true)
            {
                panel2.Visible = false;
            }
            if (panel3.Visible == true)
            {
                panel3.Visible = false;
            }



            panel1.Visible = true;
        }
コード例 #4
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string time1 = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();

                id_d     = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString());
                end_name = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
                //.Show(time);
                //MessageBox.Show(id_d.ToString());
                con.CloseConnection();
                con.OpenConection();
                string[]    pramname  = new string[1];
                string[]    pramvalue = new string[1];
                SqlDbType[] pramtype  = new SqlDbType[1];
                pramname[0]  = "@name";
                pramvalue[0] = end_name;
                pramtype[0]  = SqlDbType.NVarChar;
                SqlDataReader dr     = con.ShowDataInGridViewUsingStoredProcDR("setescope_Endoscope_settings_data_select_id", pramname, pramvalue, pramtype);
                int           end_id = 0;
                while (dr.Read())
                {
                    end_id = Convert.ToInt32(dr[0].ToString());
                }

                string[]    pramnam  = new string[3];
                string[]    pramvalu = new string[3];
                SqlDbType[] pramtyp  = new SqlDbType[3];
                pramnam[0]  = "@dt";
                pramnam[1]  = "@st";
                pramnam[2]  = "@endo";
                pramvalu[0] = d;
                pramvalu[1] = time1;
                pramvalu[2] = end_id.ToString();
                pramtyp[0]  = SqlDbType.NVarChar;
                pramtyp[1]  = SqlDbType.NVarChar;
                pramtyp[2]  = SqlDbType.Int;
                dr.Close();
                dr = con.ShowDataInGridViewUsingStoredProcDR("setescope_setescope_operation_select_id", pramnam, pramvalu, pramtyp);

                //cmd = new SqlCommand("setescope_setescope_operation_select_id", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@dt", d);
                //cmd.Parameters.AddWithValue("@st", time);
                //cmd.Parameters.AddWithValue("@endo", textBox2.Text);
                //SqlDataReader dr = cmd.ExecuteReader();-
                while (dr.Read())
                {
                    id_op = Convert.ToInt32(dr[0].ToString());
                    // MessageBox.Show(id_op.ToString());
                }
                con.CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
        private void Form2_Load(object sender, EventArgs e)
        {
            try
            {
                con1.OpenConection();

                //create PROCEDURE setescope_rooms_select_name_and_code (@code int)
                //as
                //begin
                //select RoomCode,ArabicName from Endoscope_room where RoomCode= @code
                //end
                //cmd = new SqlCommand("select RoomCode,ArabicName from Endoscope_room where RoomCode=" + code + ";", con);
                //cmd = new SqlCommand("setescope_rooms_select_name_and_code", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@code", Convert.ToInt32(code));
                //dr = cmd.ExecuteReader();

                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@code" };
                values     = new string[] { Convert.ToString(code) };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_rooms_select_name_and_code", name_input, values, types);
                dt.Load(dr);
                textBox1.Text = dt.Rows[0][0].ToString();
                textBox5.Text = dt.Rows[0][1].ToString();
                textBox6.Text = اداره.code3.ToString();
                textBox7.Text = اداره.name1;
                textBox8.Text = مخزن_مستلزمات_المنظار.code2.ToString();
                textBox9.Text = مخزن_مستلزمات_المنظار.name;
                con1.CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (dateTimePicker1.Value.Date < dateTimePicker2.Value.Date)
                {
                    //    create PROCEDURE setescope_receive_request_select (@d1 date ,@d2 date)
                    //as
                    //begin
                    //select req_id as 'رقم الطلب', req_date as 'تاريخ الطلب' ,pid as 'كودالمريض' , patient_endo.name as 'اسم المريض',
                    //doctors.name as 'اسم الطبيب' ,EndoscopeCode as 'كود العمليه',EndoscopeName as 'العمليه' , ArabicName as 'غرفه العمليه',accept_date as 'تاريخ الموافقه' ,commentes as 'ملاحظات'
                    //from receive_request ,patient_endo ,doctors ,Endoscope_settings_data as s ,Endoscope_room as e
                    //where patient_endo.id = receive_request.pid
                    //and doctors.Do_id = did
                    //and s.EndoscopeCode = endo_id
                    //and e.RoomCode = rid
                    //and receive_request.flag like 'no'
                    //and req_date between @d1 and @d2
                    //end

                    //con.Open();
                    //cmd = new SqlCommand("setescope_receive_request_select", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@d1", dateTimePicker1.Text);
                    //cmd.Parameters.AddWithValue("@d2", dateTimePicker2.Text);
                    string d1 = dateTimePicker1.Value.ToString("yyyy-MM-dd");
                    string d2 = dateTimePicker2.Value.ToString("yyyy-MM-dd");
                    con1.OpenConection();
                    types      = new SqlDbType[] { SqlDbType.Date, SqlDbType.Date };
                    name_input = new string[] { "@d1", "@d2" };
                    values     = new string[] { d1, d2 };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_receive_request_select", name_input, values, types);
                    DataTable dt = new DataTable();
                    dataGridView1.Visible    = true;
                    dataGridView1.DataSource = null;
                    dataGridView1.Rows.Clear();
                    dataGridView1.Refresh();
                    //dt.Clear();

                    dt.Load(dr);
                    dataGridView1.DataSource = dt;
                    dr.Close();
                    con1.CloseConnection();
                }
                else
                {
                    MessageBox.Show("برجاء ادخال تاريخ مناسب");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #7
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string Arabicname = comboBox2.Text;

            try
            {
                //create procedure setescope_Endoscope_room_select_code(@arb_name nvarchar(30))
                //as
                //begin
                //select RoomCode from Endoscope_room where ArabicName=@arb_name;
                //end
                con.OpenConection();
                string[]    pramname  = new string[1];
                string[]    pramvalue = new string[1];
                SqlDbType[] pramtype  = new SqlDbType[1];
                pramname[0]  = "@arb_name";
                pramvalue[0] = Arabicname;
                pramtype[0]  = SqlDbType.NVarChar;

                SqlDataReader dr = con.ShowDataInGridViewUsingStoredProcDR("setescope_Endoscope_room_select_code", pramname, pramvalue, pramtype);


                c = Convert.ToInt32(dr["RoomCode"]);
                roomflag(c);

                dr.Close();
                con.CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
        //For add patient to clinic
        private void button2_Click(object sender, EventArgs e)
        {
            //create procedure clinic_محرك_البحث_للحجز_treat_patient_insert(@fn varchar(50),@c varchar(30))
            //as
            //begin
            //declare @pid int
            //set @pid=(select patient_id from Registeration_patientRegisteration where patient_name like N'%'+@fn+'%')
            //insert into Treat_Patient(pid,c_code) values(@pid,@c)
            //end


            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.VarChar, SqlDbType.VarChar };
            name_input = new string[] { "@fn", "@c" };
            values     = new string[] { f_name, clinic_name.ToString() };
            con1.ExecuteNonQueryProcedure("clinic_محرك_البحث_للحجز_treat_patient_insert", name_input, values, types);
            con1.CloseConnection();



            //create procedure clinic_محرك_البحث_للحجز_patient_select(@fn varchar(50))
            //as
            //begin
            //select patient_name, catogrical_code from Registeration_patientRegisteration where patient_name like N'%'+@fn+'%'
            //end
            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.VarChar };
            name_input = new string[] { "@fn" };
            values     = new string[] { f_name };
            SqlDataReader dr = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_البحث_للحجز_patient_select", name_input, values, types);

            dr.Read();
            MessageBox.Show("لفد تم الادخال بنجاح");
            حجز_العياده f = new حجز_العياده();


            f.Focus();
            this.DialogResult = DialogResult.OK;

            f.Focus();
            dr.Close();
            con1.CloseConnection();
        }
コード例 #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                /*create PROCEDURE setescope_rooms_select_for_check (@roomcode int)
                 *  as
                 *  begin
                 *  select RoomCode,ArabicName from Endoscope_room where RoomCode =@roomcode
                 *  end
                 *
                 */
                //con = new SqlConnection(@"server=ENGY\SQLEXPRESS;database=setescope;Integrated Security=true;");
                //con.Open();
                ////cmd = new SqlCommand("select RoomCode,ArabicName from Endoscope_room where RoomCode = '"+textBox1.Text+"';", con);
                //cmd = new SqlCommand("setescope_rooms_select_for_check", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@roomcode", textBox1.Text);
                //dr = cmd.ExecuteReader();
                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@roomcode" };
                values     = new string[] { textBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_rooms_select_for_check", name_input, values, types);

                if (dr.Read())
                {
                    MessageBox.Show("هذه الغرفه موجوده بالفعل");
                    dr.Close();
                }
                else if (textBox1.Text == "" || textBox2.Text == "")
                {
                    MessageBox.Show("برجاء استكمال بيانات الغرفه");
                }
                else
                {
                    dr.Close();
                    //create PROCEDURE setescope_rooms_insert_new_room (@roomcode int,@aname nvarchar(30))
                    //as
                    //begin
                    //insert into Endoscope_room (RoomCode,ArabicName) values (@roomcode,@aname)
                    //end
                    //// cmd = new SqlCommand("insert into Endoscope_room (RoomCode,ArabicName) values ('" + textBox1.Text + "',N'" + textBox2.Text + "');", con);
                    // cmd = new SqlCommand("setescope_rooms_insert_new_room", con);
                    // cmd.CommandType = CommandType.StoredProcedure;
                    // cmd.Parameters.Add("@aname", SqlDbType.NVarChar).Value = textBox2.Text;
                    // cmd.Parameters.AddWithValue("@roomcode", Convert.ToInt32( textBox1.Text));
                    // cmd.ExecuteNonQuery();
                    con1.OpenConection();
                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar };
                    name_input = new string[] { "@roomcode", "@name" };
                    values     = new string[] { textBox1.Text, textBox2.Text };
                    con1.ExecuteNonQueryProcedure("setescope_rooms_insert_new_room", name_input, values, types);

                    MessageBox.Show("تم اضافه الغرفه");
                }
                con1.CloseConnection();
                con1.OpenConection();
                dataGridView1.Visible    = true;
                dataGridView1.DataSource = null;
                dataGridView1.Rows.Clear();
                dataGridView1.Refresh();
                dt.Clear();

                //create PROCEDURE setescope_rooms_selectall
                //as
                //begin
                //select RoomCode as 'كود الغرفه',ArabicName as 'الاسم عربى' from Endoscope_room;
                //end
                //cmd = new SqlCommand("select RoomCode as 'كود الغرفه',ArabicName as 'الاسم عربى' from Endoscope_room;", con);
                //cmd = new SqlCommand("setescope_rooms_selectall", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("setescope_rooms_selectall");
                dt.Load(dr);
                dataGridView1.DataSource = dt;
                dr.Close();
                con1.CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #10
0
        private void كتابة_اقرار_المنظار_Load(object sender, EventArgs e)
        {
            try
            {
                con1.OpenConection();

                /*
                 * create PROCEDURE setescope_approval_select_patienName_and_id (@id int)
                 *  as
                 *  select name , type_of_visit from patient_endo where id=@id
                 */
                //cmd = new SqlCommand("setescope_approval_select_patienName_and_id", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@id", كتابه_اقرار_مناظير.c);
                //dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@id" };
                values     = new string[] { Convert.ToString(كتابه_اقرار_مناظير.c) };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_approval_select_patienName_and_id", name_input, values, types);
                dt         = new DataTable();
                dt.Load(dr);
                textBox1.Text  = كتابه_اقرار_مناظير.c.ToString();
                textBox2.Text  = dt.Rows[0][0].ToString();
                textBox11.Text = dt.Rows[0][1].ToString();
                dr.Close();
                con1.CloseConnection();
                con1.OpenConection();

                //cmd = new SqlCommand("setescope_approval_select_doctorName", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@doctorName", كتابه_اقرار_مناظير.dn);
                //dr = cmd.ExecuteReader();
                //create PROCEDURE setescope_approval_select_doctorName (@doctorName nvarchar(30))
                //as
                //select Do_id  from doctors where name = @doctorName
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@doctorName" };
                values     = new string[] { Convert.ToString(كتابه_اقرار_مناظير.dn) };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_approval_select_doctorName", name_input, values, types);
                dt         = new DataTable();
                dt.Load(dr);
                textBox5.Text = كتابه_اقرار_مناظير.dn.ToString();
                textBox6.Text = dt.Rows[0][0].ToString();
                dr.Close();
                con1.CloseConnection();
                con1.OpenConection();

                //cmd = new SqlCommand("setescope_approval_select_EndoscopeName", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@EndoscopeName", كتابه_اقرار_مناظير.opn);
                //dr = cmd.ExecuteReader();
                //create PROCEDURE setescope_approval_select_EndoscopeName (@EndoscopeName nvarchar(50))
                //as
                //select EndoscopeCode  from Endoscope_settings_data where EndoscopeName = @EndoscopeName
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@EndoscopeName" };
                values     = new string[] { Convert.ToString(كتابه_اقرار_مناظير.opn) };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_approval_select_EndoscopeName", name_input, values, types);
                dt         = new DataTable();
                dt.Load(dr);
                textBox3.Text = كتابه_اقرار_مناظير.opn.ToString();
                textBox4.Text = dt.Rows[0][0].ToString();
                dr.Close();
                con1.CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #11
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            dataGridView1.Visible = true;
            try
            {
                con1.OpenConection();
                if (textBox1.Text != "" && textBox2.Text != "")
                {
                    //create PROCEDURE setescope_departement_select_name_and_code (@aname nvarchar(30),@code int)
                    //as
                    //begin
                    //select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart where aname like N'%'+@aname+'%' and code2 = @code ;
                    //end

                    //cmd = new SqlCommand("select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart where code2 = '" + textBox1.Text + "' or aname like '" + textBox2.Text + "%';", con);
                    //cmd = new SqlCommand("setescope_departement_select_name_and_code", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.Add("@aname", SqlDbType.NVarChar).Value = textBox2.Text;
                    //cmd.Parameters.AddWithValue("@code", Convert.ToInt32(textBox1.Text));
                    types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.Int };
                    name_input = new string[] { "@aname", "@code" };
                    values     = new string[] { textBox2.Text, textBox1.Text };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_departement_select_name_and_code", name_input, values, types);
                }
                else if (textBox1.Text != "")
                {
                    //create PROCEDURE setescope_departement_select_code (@code int)
                    //as
                    //begin
                    //select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart where code2 = @code ;
                    //end
                    //cmd = new SqlCommand("select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart where code2 = '" + textBox1.Text + "';", con);
                    //cmd = new SqlCommand("setescope_departement_select_code", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@code", Convert.ToInt32(textBox1.Text));
                    types      = new SqlDbType[] { SqlDbType.Int };
                    name_input = new string[] { "@code" };
                    values     = new string[] { textBox1.Text };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_departement_select_code", name_input, values, types);
                }
                else if (textBox2.Text != "")
                {
                    //create PROCEDURE setescope_departement_select_name (@aname nvarchar(30))
                    //as
                    //begin
                    //select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart where aname like N'%'+@aname+'%' ;
                    //end
                    //cmd = new SqlCommand("select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart where aname like '" + textBox2.Text + "%';", con);
                    //cmd = new SqlCommand("setescope_departement_select_name", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.Add("@aname", SqlDbType.NVarChar).Value = textBox2.Text;
                    types      = new SqlDbType[] { SqlDbType.NVarChar };
                    name_input = new string[] { "@aname" };
                    values     = new string[] { textBox2.Text };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_departement_select_name", name_input, values, types);
                }
                else
                {
                    //create PROCEDURE setescope_departement_selectall
                    //as
                    //begin
                    //select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart ;
                    //end
                    //cmd = new SqlCommand("select code2 as 'الكود',aname as 'الاسم عربى',lname as 'الاسم انجليزى' from depart ;", con);
                    //cmd = new SqlCommand("setescope_departement_selectall", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    dr = con1.DataReader("setescope_departement_selectall");
                }

                dataGridView1.DataSource = null;

                DataTable dt = new DataTable();
                dt.Load(dr);
                dataGridView1.DataSource = dt;
                con1.CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #12
0
        private void button3_Click(object sender, EventArgs e)
        {
            dataGridView1.Columns.Clear();
            //con = new SqlConnection("server=localhost;database=graduationDB;uid=root;pwd=root");
            //con.Open();
            string begin = dateTimePicker1.Value.ToString("yyyy-MM-dd");
            string end   = dateTimePicker2.Value.ToString("yyyy-MM-dd");

            if (dateTimePicker1.Value.Date > dateTimePicker2.Value.Date)
            {
                MessageBox.Show("التاريخ الاول يجب ان يكون اقل من التاريخ الثاني ");
            }
            else
            {
                if (textBox2.Text == "" && textBox3.Text == "" && textBox5.Text == "" && textBox6.Text == "")
                {
                    /*create procedure clinic_search_patient_visit_select(@pid int , @begin date, @end date)
                     *  as
                     *  begin
                     *   select num_of_visit , start_date ,service_name from patient_visit where p_id = @pid and start_date between @begin and  @end
                     *  end
                     *
                     */

                    int y = Convert.ToInt32(textBox1.Text);
                    con1.OpenConection();
                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Date, SqlDbType.Date };
                    name_input = new string[] { "@pid", "@begin", "@end" };
                    values     = new string[] { y.ToString(), begin, end };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_search_patient_visit_select", name_input, values, types);
                    dt         = new DataTable();
                    dt.Load(dr);

                    dataGridView1.Visible = true;
                    // con1.CloseConnection();

                    DataGridViewTextBoxColumn tex1 = new DataGridViewTextBoxColumn();
                    tex1.HeaderText = "كود_المريض";
                    dataGridView1.Columns.Add(tex1);

                    DataGridViewTextBoxColumn tex2 = new DataGridViewTextBoxColumn();
                    tex2.HeaderText = "اسم_المريض";
                    dataGridView1.Columns.Add(tex2);


                    dataGridView1.DataSource = dt;
                    dr.Close();

                    DateTime begin1 = dateTimePicker1.Value;
                    DateTime end1   = dateTimePicker2.Value;

                    //       cmd.CommandText = "select english_name  as اسم_العيادة ,doc_name as اسم_الدكتور  from clinic,doctor, shift_time"
                    //+ " where clinic_code=shift_time.c_code and doctor_id = d_id and CAST(Start_Time AS DATE )  between '"
                    //+ begin1 + "' and '" + end1 + "'  and shift_time.c_code  = any(select c_code from Treat_Patient where PId = "
                    //+ int.Parse(textBox1.Text) + " ) and start_time = any(select start_date from patient_visit where p_id ="
                    //+ int.Parse(textBox1.Text) + " )";

                    /*
                     *
                     *
                     *
                     *  create procedure clinic_search_patient_visit_select_1(@begin1 datetime, @end1 datetime, @pid int)
                     *  as
                     *  begin
                     *    select english_name ,doc_name from clinic,doctor, shift_time
                     *           where clinic_code=shift_time.c_code and doctor_id = d_id and CAST(Start_Time AS DATE )  between
                     *           @begin1 and @end1 and shift_time.c_code  = any(select c_code from Treat_Patient where PId =@pid) and start_time = any(select start_date from patient_visit where p_id = @pid);
                     *
                     *  end
                     *
                     *
                     */

                    y          = Convert.ToInt32(textBox1.Text);
                    types      = new SqlDbType[] { SqlDbType.DateTime, SqlDbType.DateTime, SqlDbType.Int };
                    name_input = new string[] { "@begin1", "@end1", "@pid" };
                    values     = new string[] { begin1.ToString(), end1.ToString(), y.ToString() };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_search_patient_visit_select_1", name_input, values, types);

                    int i = 0;

                    DataGridViewTextBoxColumn tbc = new DataGridViewTextBoxColumn();
                    tbc.HeaderText = "اسم_العيادة";
                    dataGridView1.Columns.Add(tbc);
                    DataGridViewTextBoxColumn tbc2 = new DataGridViewTextBoxColumn();
                    tbc2.HeaderText = "اسم_الدكتور";
                    dataGridView1.Columns.Add(tbc2);
                    //after reading datareader have exception
                    try
                    {
                        while (dr.Read())
                        {
                            dataGridView1.Rows[i].Cells[0].Value = textBox1.Text;
                            dataGridView1.Rows[i].Cells[1].Value = textBox4.Text;
                            dataGridView1.Rows[i].Cells[5].Value = dr[0].ToString();
                            dataGridView1.Rows[i].Cells[6].Value = dr[1].ToString();
                            i++;
                        }
                    }
                    catch (Exception ex) { }
                    dr.Close();
                    con1.CloseConnection();
                }

                else if (textBox6.Text == "" && textBox3.Text == "")
                {
                    /*
                     * create procedure clinic_search_patient_visit_select_2(@begin date, @end date, @pid int, @c_code int)
                     *      as
                     *      begin
                     *       select distinct num_of_visit, start_date,service_name ,english_name, doc_name
                     *       from clinic, doctor, patient_visit,treat_patient,shift_time
                     *       where clinic_code = shift_time.c_code and doctor_id = d_id and shift_time.c_code = treat_patient.c_code
                     *       and  p_id = pid and p_id =pid and start_date between @begin and @end and treat_patient.c_code = @c_code and start_date = start_time;
                     *      end
                     *
                     */


                    con1.OpenConection();
                    int y  = Convert.ToInt32(textBox1.Text);
                    int y1 = Convert.ToInt32(textBox2.Text);
                    types      = new SqlDbType[] { SqlDbType.Date, SqlDbType.Date, SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@begin", "@end", "@pid", "@c_code" };
                    values     = new string[] { begin, end, y.ToString(), y1.ToString() };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_search_patient_visit_select_2", name_input, values, types);


                    dt = new DataTable();
                    dt.Load(dr);
                    dataGridView1.Visible = true;
                    con1.CloseConnection();
                    DataGridViewTextBoxColumn tex1 = new DataGridViewTextBoxColumn();
                    tex1.HeaderText = "كود_المريض";
                    dataGridView1.Columns.Add(tex1);

                    DataGridViewTextBoxColumn tex2 = new DataGridViewTextBoxColumn();
                    tex2.HeaderText = "اسم_المريض";
                    dataGridView1.Columns.Add(tex2);

                    dataGridView1.DataSource = dt;
                    dr.Close();

                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        dataGridView1.Rows[i].Cells[0].Value = textBox1.Text;
                        dataGridView1.Rows[i].Cells[1].Value = textBox4.Text;
                    }
                }

                else if (textBox2.Text == "" && textBox5.Text == "")
                {
                    /*create procedure clinic_search_patient_visit_select_3(@begin date, @end date, @pid int, @d_code int)
                     *  as
                     *  begin
                     *   select distinct num_of_visit, start_date,service_name,english_name, doc_name
                     *   from clinic, doctor, patient_visit,treat_patient,shift_time
                     *   where clinic_code = shift_time.c_code and doctor_id = d_id and shift_time.c_code = treat_patient.c_code
                     *   and  p_id = pid and p_id = pid and start_date between @begin and @end and d_id = @d_code and start_date = start_time;
                     *  end
                     *
                     */



                    con1.OpenConection();
                    int y  = Convert.ToInt32(textBox1.Text);
                    int y1 = Convert.ToInt32(textBox3.Text);
                    types      = new SqlDbType[] { SqlDbType.Date, SqlDbType.Date, SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@pid", "@begin", "@end", "@d_code" };
                    values     = new string[] { y.ToString(), begin, end, y1.ToString() };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_search_patient_visit_select_3", name_input, values, types);
                    dt         = new DataTable();
                    dt.Load(dr);
                    dataGridView1.Visible = true;
                    con1.CloseConnection();
                    DataGridViewTextBoxColumn tex1 = new DataGridViewTextBoxColumn();
                    tex1.HeaderText = "كود_المريض";
                    dataGridView1.Columns.Add(tex1);

                    DataGridViewTextBoxColumn tex2 = new DataGridViewTextBoxColumn();
                    tex2.HeaderText = "اسم_المريض";
                    dataGridView1.Columns.Add(tex2);


                    dataGridView1.DataSource = dt;
                    dr.Close();
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        dataGridView1.Rows[i].Cells[0].Value = textBox1.Text;
                        dataGridView1.Rows[i].Cells[1].Value = textBox4.Text;
                    }
                }

                else
                {
                    /*create procedure clinic_search_patient_visit_select_4(@begin date, @end date, @pid int, @d_code int, @c_code int)
                     *      as
                     *      begin
                     *       select distinct num_of_visit, start_date ,service_name ,english_name , doc_name
                     *       from clinic, doctor, patient_visit,treat_patient,shift_time
                     *       where clinic_code = shift_time.c_code and doctor_id = d_id and shift_time.c_code = treat_patient.c_code
                     *       and  p_id = pid and p_id = pid and start_date between  @begin  and  @end  and d_id =@d_code and treat_patient.c_code = @c_code and start_date = start_time;
                     *      end
                     *
                     *
                     */
                    //cmd = new SqlCommand();
                    //cmd.Connection = con;
                    ////cmd.CommandText = "select distinct num_of_visit as رقم_الزيارة, start_date as تاريخ_الخدمة ,service_name as اسم_الخدمة ,english_name as اسم_العيادة, doc_name as اسم_الدكتور from clinic, doctor, patient_visit,treat_patient,shift_time where clinic_code = shift_time.c_code and doctor_id = d_id and shift_time.c_code = treat_patient.c_code and  p_id = pid and p_id = " + int.Parse(textBox1.Text) + " and start_date between '" + begin + "' and '" + end + "' and d_id = " + int.Parse(textBox3.Text) + " and treat_patient.c_code = " + int.Parse(textBox2.Text) + " and start_date = start_time;";
                    //cmd.CommandText = "clinic_search_patient_visit_select_4";
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@pid", int.Parse(textBox1.Text));
                    //cmd.Parameters.AddWithValue("@begin", begin);
                    //cmd.Parameters.AddWithValue("@end", end);
                    //cmd.Parameters.AddWithValue("@d_code", int.Parse(textBox3.Text));
                    //cmd.Parameters.AddWithValue("@c_code", int.Parse(textBox2.Text));
                    //dr = cmd.ExecuteReader();
                    //cmd.Parameters.RemoveAt("@pid");
                    //cmd.Parameters.RemoveAt("@begin");
                    //cmd.Parameters.RemoveAt("@end");
                    //cmd.Parameters.RemoveAt("@d_code");
                    //cmd.Parameters.RemoveAt("@c_code");

                    con1.OpenConection();
                    int y  = Convert.ToInt32(textBox1.Text);
                    int y2 = Convert.ToInt32(textBox2.Text);
                    int y3 = Convert.ToInt32(textBox3.Text);
                    types      = new SqlDbType[] { SqlDbType.Date, SqlDbType.Date, SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@pid", "@begin", "@end", "@d_code", "@c_code" };
                    values     = new string[] { y.ToString(), begin, end, y3.ToString(), y2.ToString() };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_search_patient_visit_select_4", name_input, values, types);


                    dt = new DataTable();
                    dt.Load(dr);
                    //dataGridView1.ColumnHeadersVisible = false;
                    dataGridView1.Visible = true;
                    con1.CloseConnection();
                    DataGridViewTextBoxColumn tex1 = new DataGridViewTextBoxColumn();
                    tex1.HeaderText = "كود_المريض";
                    dataGridView1.Columns.Add(tex1);

                    DataGridViewTextBoxColumn tex2 = new DataGridViewTextBoxColumn();
                    tex2.HeaderText = "اسم_المريض";
                    dataGridView1.Columns.Add(tex2);


                    dataGridView1.DataSource = dt;
                    dr.Close();
                    for (int i = 0; i < dataGridView1.Rows.Count; i++)
                    {
                        dataGridView1.Rows[i].Cells[0].Value = textBox1.Text;
                        dataGridView1.Rows[i].Cells[1].Value = textBox4.Text;
                    }
                }
            }
        }
コード例 #13
0
        private void حفظ_Click(object sender, EventArgs e)
        {
            label11.Visible = true;
            label11.Text    = textBox2.Text;
            label12.Visible = true;
            label12.Text    = textBox6.Text;
            label13.Visible = true;
            label13.Text    = dateTimePicker1.Text;
            label14.Visible = true;
            label14.Text    = textBox3.Text;


            con.OpenConection();
            DateTime tm1 = dateTimePicker2.Value;
            string   t1  = tm1.Hour.ToString() + ':' + tm1.Minute.ToString();

            DateTime dt = dateTimePicker1.Value;
            string   d  = dateTimePicker1.Value.ToString("yyyy-MM-dd");

            DateTime tm2 = dateTimePicker3.Value;
            string   t2  = tm2.Hour.ToString() + ':' + tm2.Minute.ToString();

            try
            {
                //create procedure setescope_setescope_operation_select_id(@dt nvarchar(30),@st nvarchar(30),@endo int)
                //as
                //begin
                //select id from setescope_operation where Datee=@dt and start_time=@st and EndoscopeCode=@endo;
                //end
                con.CloseConnection();
                string[]    pramnam  = new string[3];
                string[]    pramvalu = new string[3];
                SqlDbType[] pramtyp  = new SqlDbType[3];
                pramnam[0]  = "@dt";
                pramnam[1]  = "@st";
                pramnam[2]  = "@endo";
                pramvalu[0] = d;
                pramvalu[1] = t1;
                pramvalu[2] = textBox2.Text;
                pramtyp[0]  = SqlDbType.VarChar;
                pramtyp[1]  = SqlDbType.VarChar;
                pramtyp[2]  = SqlDbType.Int;
                con.OpenConection();
                SqlDataReader dr = con.ShowDataInGridViewUsingStoredProcDR("setescope_setescope_operation_select_id", pramnam, pramvalu, pramtyp);


                while (dr.Read())
                {
                    int id_op_prev = Convert.ToInt32(dr[0].ToString());
                }
                if (!dr.HasRows)
                {
                    con.CloseConnection();
                    con.OpenConection();
                    string[]    pramname  = new string[6];
                    string[]    pramvalue = new string[6];
                    SqlDbType[] pramtype  = new SqlDbType[6];
                    pramname[0] = "@st";
                    pramname[1] = "@dt";
                    pramname[2] = "@et";
                    pramname[3] = "@p";
                    pramname[4] = "@endc";
                    pramname[5] = "@p_id";


                    pramvalue[0] = t1;
                    pramvalue[1] = d;
                    pramvalue[2] = t2;
                    pramvalue[3] = s;
                    pramvalue[4] = textBox2.Text;
                    pramvalue[5] = طلب_حجز_منظار.c.ToString();

                    pramtype[0] = SqlDbType.VarChar;
                    pramtype[1] = SqlDbType.VarChar;
                    pramtype[2] = SqlDbType.VarChar;
                    pramtype[3] = SqlDbType.VarChar;
                    pramtype[4] = SqlDbType.Int;
                    pramtype[5] = SqlDbType.Int;

                    //create procedure setescope_setescope_operation_insert(@st nvarchar(30),@dt nvarchar(30),@et nvarchar(30),@p nvarchar(30),@endc int,@p_id int)
                    // as
                    // begin
                    // insert into setescope_operation(start_time,Datee,end_time,piroirty_order,EndoscopeCode,patient_id) values(@st,@dt,@et,@p,@endc,@p_id);
                    // end
                    con.OpenConection();
                    con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("setescope_setescope_operation_insert", pramname, pramvalue, pramtype);
                    con.CloseConnection();


                    //create procedure setescope_setescope_operation_select_id(@dt nvarchar(30),@st nvarchar(30),@endo int)
                    // as
                    // begin
                    // select id from setescope_operation where Datee=@dt and start_time=@st and EndoscopeCode=@endo;
                    // end
                    con.OpenConection();
                    dr = con.ShowDataInGridViewUsingStoredProcDR("setescope_setescope_operation_select_id", pramnam, pramvalu, pramtyp);


                    int id_op = 0;
                    while (dr.Read())
                    {
                        id_op = Convert.ToInt32(dr[0].ToString());
                    }

                    con.CloseConnection();
                    con.OpenConection();

                    string[]    pramna  = new string[2];
                    string[]    pramval = new string[2];
                    SqlDbType[] pramty  = new SqlDbType[2];
                    pramna[0]  = "@oper_id";
                    pramna[1]  = "@doctor_id";
                    pramval[0] = id_op.ToString();
                    pramval[1] = textBox4.Text;
                    pramty[0]  = SqlDbType.Int;
                    pramty[1]  = SqlDbType.Int;
                    //create procedure setescope_doctor_operation_insert(@oper_id int,@doctor_id int)
                    // as
                    // begin
                    // insert into doctor_operation(id_op,Do_id) values(@oper_id,@doctor_id);
                    // end
                    int rfd = con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("setescope_doctor_operation_insert", pramna, pramval, pramty);


                    MessageBox.Show("تمت العملية بنجاح");


                    con.CloseConnection();
                }
                else
                {
                    MessageBox.Show("توجد عملية في هذا الوقت");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #14
0
        // send details about the visit of patient
        private void visit_details(object sender, DataGridViewCellEventArgs e)
        {
            string n = dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString();

            rectangleShape2.Visible = true;
            rectangleShape1.Visible = true;
            //create procedure visit_detail(@x int,@y int)
            //    as
            //    select type_of_visit,ordere,patient_status from entranceoffice_visit where visit_id=@x;
            //    select CE_AName from tb_Contracting_Entities ,Registeration_patientRegisteration where catogrical_code=CE_Id and patient_id=@y;
            //    select r_id,degree,floor details from room,entranceoffice_visit where r_id=room_id and visit_id=@x;

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
            name_input = new string[] { "@x", "@y" };
            values     = new string[] { n, x1 };
            SqlDataReader dr = con1.ShowDataInGridViewUsingStoredProcDR("visit_detail", name_input, values, types);

            dr.Read();
            string type_visit = dr[0].ToString();
            string order      = dr[1].ToString();

            label31.Text = dr[2].ToString();
            dr.NextResult(); dr.Read();
            string geha = dr[0].ToString();

            dr.NextResult(); dr.Read();
            label27.Text = dr[0].ToString() + "  /" + dr[2].ToString();
            label29.Text = dr[1].ToString();
            dr.Close();
            label19.Text    = order;
            label17.Text    = type_visit;
            label23.Text    = geha;
            label2.Visible  = true;
            label17.Visible = true;
            label16.Visible = true;
            label18.Visible = true;
            label19.Visible = true;
            label22.Visible = true;
            label23.Visible = true;
            if (type_visit == "خارجي")
            {
                label24.Visible = true;
                label25.Visible = true;
                label26.Visible = false;
                label27.Visible = false;
                label28.Visible = false;
                label29.Visible = false;
                label30.Visible = false;
                label31.Visible = false;
            }
            else
            {
                label24.Visible = false;
                label25.Visible = false;
                label26.Visible = true;
                label27.Visible = true;
                label28.Visible = true;
                label29.Visible = true;
                label30.Visible = true;
                label31.Visible = true;
            }
        }
コード例 #15
0
        private void monthCalendar1_DateSelected_1(object sender, DateRangeEventArgs e)
        {
            int c = 0;

            for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
            {
                for (int i = 0; i < tableLayoutPanel1.ColumnCount; i++)
                {
                    tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(i, j));
                    tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(i, j));
                    tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(i, j));
                    tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(i, j));
                }
            }

            date = monthCalendar1.SelectionRange.Start.ToShortDateString();

            DateTime dtm = Convert.ToDateTime(date);

            d = dtm.Year.ToString() + '-' + dtm.Month.ToString() + '-' + dtm.Day.ToString();
            try
            {
                /*
                 * create procedure setescope_select_dat(@x nvarchar(50),@end_name nvarchar(50))
                 *
                 *  as
                 *  begin
                 *   select  o.Datee,o.start_time,o.end_time,o.flag
                 *   from setescope_operation o,Endoscope_settings_data e
                 *    where o.Datee = @x and e.EndoscopeCode=o.EndoscopeCode and e.EndoscopeName=@end_name;
                 *
                 *   select p.id,p.name from
                 *   patient_endo p ,setescope_operation s,Endoscope_settings_data e
                 *   where p.id=s.patient_id and  s.Datee = @x and e.EndoscopeCode=s.EndoscopeCode and e.EndoscopeName=@end_name;
                 *
                 *    select e.EndoscopeName from Endoscope_settings_data e,setescope_operation s
                 *     where e.EndoscopeCode=s.EndoscopeCode and e.EndoscopeName=@end_name;
                 *
                 *   select d.name
                 *   from doctors d,doctor_operation o,setescope_operation s,Endoscope_settings_data e
                 *   where o.Do_id=d.Do_id and o.id_op=s.id and s.Datee = @x and e.EndoscopeCode=s.EndoscopeCode and e.EndoscopeName=@end_name and d.jop='surgeon' ;
                 *     end
                 *
                 */
                con1.OpenConection();

                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@x", "@end_name", "@s" };
                values     = new string[] { d, endo, p1.Controls[0].Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_select_dat", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count != 0)
                {
                    c++;
                }
                for (int i = 0; i < dt.Rows.Count; i += 4)
                {
                    this.tableLayoutPanel1.AutoSize = true;
                    temp = tableLayoutPanel1.RowStyles[0];
                    this.tableLayoutPanel1.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height));
                    tableLayoutPanel1.RowCount++;
                }
                if (c != 0)
                {
                    tableLayoutPanel1.RowCount--;
                }
                int n = 0;
                for (int j = 0; j < tableLayoutPanel1.RowCount; j++)
                {
                    int i = 0;
                    for (i = 0; i < tableLayoutPanel1.ColumnCount; i++)
                    {
                        if (i + n < dt.Rows.Count)
                        {
                            p             = new Panel();
                            p.Click      += p_Click;
                            p.Size        = new System.Drawing.Size(149, 101);
                            p.Location    = new Point(250, 9);
                            p.BorderStyle = BorderStyle.FixedSingle;
                            p.BackColor   = Color.AliceBlue;
                            p.Visible     = true;
                            this.tableLayoutPanel1.Controls.Add(p, i, j);

                            l1          = new Label();
                            l1.Text     = dt.Rows[i + n][1].ToString();
                            l1.AutoSize = false;
                            l1.Left     = 45;
                            l1.Top      = 3;
                            p.Controls.Add(l1);

                            l2          = new Label();
                            l2.Text     = dt.Rows[i + n][2].ToString();
                            l2.AutoSize = false;
                            l2.Left     = -50;
                            l2.Top      = 3;
                            p.Controls.Add(l2);

                            l3          = new Label();
                            l3.Text     = dt.Rows[i][0].ToString();
                            l3.AutoSize = false;
                            l3.Left     = -20;
                            l3.Top      = l1.Height;
                            p.Controls.Add(l3);
                            l4          = new Label();
                            l4.Text     = dt.Rows[i][1].ToString();
                            l4.AutoSize = false;
                            l4.Left     = -10;
                            l4.Top      = l3.Height + 20;
                            p.Controls.Add(l4);

                            l5          = new Label();
                            l5.Text     = dt.Rows[i][0].ToString();
                            l5.AutoSize = false;
                            l5.Left     = 15;
                            l5.Top      = l4.Height + 40;
                            p.Controls.Add(l5);

                            l6          = new Label();
                            l6.Text     = dt.Rows[i][0].ToString();
                            l6.AutoSize = false;
                            l6.Left     = -5;
                            l6.Top      = l5.Height + 60;
                            doc         = l6.Text;


                            //create procedure setescope_do_id(@x nvarchar(50))
                            //    as

                            //    select doc_ssn from doctors where name=@x

                            //cmd = new SqlCommand("setescope_do_id ", con);

                            //cmd.CommandType = CommandType.StoredProcedure;
                            //cmd.Parameters.AddWithValue("@x", l6.Text);
                            types      = new SqlDbType[] { SqlDbType.NVarChar };
                            name_input = new string[] { "@x" };
                            values     = new string[] { l6.Text };
                            SqlDataReader dhr;
                            dhr = con1.ShowDataInGridViewUsingStoredProcDR("setescope_do_id", name_input, values, types);

                            dhr.Read();
                            doc_id = int.Parse(dhr[0].ToString());
                            dhr.Close();
                            p.Controls.Add(l6);

                            flag            = dt.Rows[i + n][3].ToString();
                            lshape          = new Label();
                            lshape.Text     = "";
                            lshape.AutoSize = false;
                            lshape.Size     = new System.Drawing.Size(20, 20);
                            if (flag == "7agz")
                            {
                                lshape.BackColor = Color.Yellow;
                            }
                            else if (flag == "taked")
                            {
                                lshape.BackColor = Color.Green;
                            }
                            else if (flag == "start")
                            {
                                lshape.BackColor = Color.Cyan;
                            }
                            else if (flag == "finish")
                            {
                                lshape.BackColor = Color.Blue;
                            }
                            lshape.BorderStyle = BorderStyle.FixedSingle;
                            lshape.Left        = 110;
                            lshape.Top         = l1.Height;
                            p.Controls.Add(lshape);
                        }
                        else
                        {
                            break;
                        }
                    }
                    if (i == dt.Rows.Count)
                    {
                        break;
                    }
                    else
                    {
                        n += 4;
                    }
                }
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    dt.Rows.RemoveAt(i);
                }
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    dt.Rows.RemoveAt(i);
                }
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    dt.Rows.RemoveAt(i);
                }
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    dt.Rows.RemoveAt(i);
                }
            }
            catch (Exception v) { MessageBox.Show(v.Message); }
            finally
            {
                con1.CloseConnection();
            }
        }
コード例 #16
0
        // send details about the visit of patient
        private void visit_details(object sender, DataGridViewCellEventArgs e)
        {
            string n = dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString();

            rectangleShape2.Visible = true;
            rectangleShape1.Visible = true;

            /*
             * create procedure visit_detail(@x int,@y int)
             * as
             * select Type,ordere,patient_status from Patient_visit where num_Of_visit=@x;
             * select ins_name from institution ,patient where Institution=ins_code and patient_id=@y;
             * select r_id,degree,floor from room,patient_visit where r_id=room_id and num_Of_visit=@x;
             *
             */
            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
            name_input = new string[] { "@x", "@y" };
            values     = new string[] { n, x1 };
            SqlDataReader dr = con1.ShowDataInGridViewUsingStoredProcDR("visit_detail", name_input, values, types);

            dr.Read();
            string type_visit = dr[0].ToString();
            string order      = dr[1].ToString();

            label31.Text = dr[2].ToString();
            dr.NextResult(); dr.Read();
            string geha = dr[0].ToString();

            dr.NextResult(); dr.Read();
            label27.Text = dr[0].ToString() + "  /" + dr[2].ToString();
            label29.Text = dr[1].ToString();
            dr.Close();
            label19.Text    = order;
            label17.Text    = type_visit;
            label23.Text    = geha;
            label2.Visible  = true;
            label17.Visible = true;
            label16.Visible = true;
            label18.Visible = true;
            label19.Visible = true;
            label22.Visible = true;
            label23.Visible = true;
            if (type_visit == "خارجي")
            {
                label24.Visible = true;
                label25.Visible = true;
                label26.Visible = false;
                label27.Visible = false;
                label28.Visible = false;
                label29.Visible = false;
                label30.Visible = false;
                label31.Visible = false;
            }
            else
            {
                label24.Visible = false;
                label25.Visible = false;
                label26.Visible = true;
                label27.Visible = true;
                label28.Visible = true;
                label29.Visible = true;
                label30.Visible = true;
                label31.Visible = true;
            }
        }
コード例 #17
0
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            selected = listBox1.SelectedItem.ToString();
            if (selected == "تخدير")
            {
                if (tableLayoutPanel1.RowCount > 1)
                {
                    for (int j = tableLayoutPanel1.RowCount - 1; j > 0; j--)
                    {
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(0, j));
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(1, j));
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, j));
                        tableLayoutPanel1.RowStyles.RemoveAt(j);
                        tableLayoutPanel1.RowCount--;
                    }
                }
                con1.OpenConection();
                //create procedure select_docs(@id int,@type nvarchar(50))
                //as

                //select d.Do_id, d.name from doctor_operation o,doctors d where o.id_op=@id and o.Do_id=d.Do_id and jop=@type;
                //cmd = new SqlCommand("select_docs", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@id", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //cmd.Parameters.AddWithValue("@type", "Anesthesia");
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar };
                name_input = new string[] { "@id", "@type" };
                values     = new string[] { "Anesthesia", الصفحه_الرئيسيه_للمنظار.opid };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("select_docs", name_input, values, types);



                DataTable dt1 = new DataTable();
                dt1.Load(dr);
                int i;
                for (i = 0; i < dt1.Rows.Count; i++)
                {
                    if (i == 0)
                    {
                        textBox1.Text = dt1.Rows[0][0].ToString();
                        textBox2.Text = dt1.Rows[0][1].ToString();
                        l1.Add(textBox1.Text);
                    }
                    else
                    {
                        t1        = new TextBox();
                        t2        = new TextBox();
                        b1        = new Button();
                        b1.Click += b1_Click;

                        t1.Size     = textBox1.Size;
                        t1.Location = textBox1.Location;
                        t1.Font     = textBox1.Font;

                        t2.Size     = textBox2.Size;
                        t2.Location = textBox2.Location;
                        t2.Font     = textBox2.Font;

                        b1.Size            = button1.Size;
                        b1.Location        = button1.Location;
                        b1.BackgroundImage = button1.BackgroundImage;
                        b1.Margin          = button1.Margin;


                        this.tableLayoutPanel1.AutoSize = true;
                        if (tableLayoutPanel1.RowCount > 0)
                        {
                            temp = tableLayoutPanel1.RowStyles[0];
                        }
                        else
                        {
                            temp = temp1;
                        }
                        this.tableLayoutPanel1.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height));
                        tableLayoutPanel1.RowCount++;
                        this.tableLayoutPanel1.Controls.Add(t1, 2, i);
                        this.tableLayoutPanel1.Controls.Add(b1, 1, i);
                        this.tableLayoutPanel1.Controls.Add(t2, 0, i);
                        t1.Text = dt1.Rows[i][0].ToString();
                        t2.Text = dt1.Rows[i][1].ToString();
                        l1.Add(t1.Text);
                    }
                }
                rowIndex = i;
                dr.Close();
                con1.CloseConnection();
            }
            if (selected == "جراح مساعد")
            {
                if (tableLayoutPanel1.RowCount > 1)
                {
                    for (int j = tableLayoutPanel1.RowCount - 1; j > 0; j--)
                    {
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(0, j));
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(1, j));
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, j));
                        tableLayoutPanel1.RowStyles.RemoveAt(j);
                        tableLayoutPanel1.RowCount--;
                    }
                }
                con1.OpenConection();
                //create procedure select_docs(@id int,@type nvarchar(50))
                //as

                //select d.Do_id, d.name from doctor_operation o,doctors d where o.id_op=@id and o.Do_id=d.Do_id and jop=@type;

                //cmd = new SqlCommand("select_docs", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@id", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //cmd.Parameters.AddWithValue("@type", "surgeon");
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar };
                name_input = new string[] { "@id", "@type" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, "surgeon" };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("select_docs", name_input, values, types);
                DataTable dt2 = new DataTable();
                dt2.Load(dr);


                int i;
                for (i = 1; i < dt2.Rows.Count; i++)
                {
                    if (i == 1)
                    {
                        textBox1.Text = dt2.Rows[1][0].ToString();
                        textBox2.Text = dt2.Rows[1][1].ToString();
                        l2.Add(textBox1.Text);
                    }
                    else
                    {
                        t1        = new TextBox();
                        t2        = new TextBox();
                        b1        = new Button();
                        b1.Click += b1_Click;

                        t1.Size     = textBox1.Size;
                        t1.Location = textBox1.Location;
                        t1.Font     = textBox1.Font;

                        t2.Size     = textBox2.Size;
                        t2.Location = textBox2.Location;
                        t2.Font     = textBox2.Font;

                        b1.Size            = button1.Size;
                        b1.Location        = button1.Location;
                        b1.BackgroundImage = button1.BackgroundImage;
                        b1.Margin          = button1.Margin;


                        this.tableLayoutPanel1.AutoSize = true;
                        if (tableLayoutPanel1.RowCount > 0)
                        {
                            temp = tableLayoutPanel1.RowStyles[0];
                        }
                        else
                        {
                            temp = temp1;
                        }
                        this.tableLayoutPanel1.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height));
                        tableLayoutPanel1.RowCount++;
                        this.tableLayoutPanel1.Controls.Add(t1, 2, i - 1);
                        this.tableLayoutPanel1.Controls.Add(b1, 1, i - 1);
                        this.tableLayoutPanel1.Controls.Add(t2, 0, i - 1);
                        t1.Text = dt2.Rows[i][0].ToString();
                        t2.Text = dt2.Rows[i][1].ToString();
                        l2.Add(t1.Text);
                    }
                }
                rowIndex = i - 1;
                dr.Close();
                con1.CloseConnection();
            }
            if (selected == "تمريض")
            {
                if (tableLayoutPanel1.RowCount > 1)
                {
                    for (int j = tableLayoutPanel1.RowCount - 1; j > 0; j--)
                    {
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(0, j));
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(1, j));
                        tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, j));
                        tableLayoutPanel1.RowStyles.RemoveAt(j);
                        tableLayoutPanel1.RowCount--;
                    }
                }
                con1.OpenConection();

                //                create procedure select_docs(@id int,@type nvarchar(50))
                //as

                //select d.Do_id, d.name from doctor_operation o,doctors d where o.id_op=@id and o.Do_id=d.Do_id and jop=@type;
                //cmd = new SqlCommand("select_docs", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@id", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //cmd.Parameters.AddWithValue("@type", "Nursing");
                //da3= new SqlDataAdapter(cmd);
                //DataSet ds3 = new DataSet();
                //da3.Fill(ds3);
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar };
                name_input = new string[] { "@id", "@type" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, "Nursing" };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("select_docs", name_input, values, types);
                DataTable dt3 = new DataTable();
                dt3.Load(dr);

                int i;
                for (i = 0; i < dt3.Rows.Count; i++)
                {
                    if (i == 0)
                    {
                        textBox1.Text = dt3.Rows[0][0].ToString();
                        textBox2.Text = dt3.Rows[0][1].ToString();
                        l3.Add(textBox1.Text);
                    }
                    else
                    {
                        t1        = new TextBox();
                        t2        = new TextBox();
                        b1        = new Button();
                        b1.Click += b1_Click;

                        t1.Size     = textBox1.Size;
                        t1.Location = textBox1.Location;
                        t1.Font     = textBox1.Font;

                        t2.Size     = textBox2.Size;
                        t2.Location = textBox2.Location;
                        t2.Font     = textBox2.Font;

                        b1.Size            = button1.Size;
                        b1.Location        = button1.Location;
                        b1.BackgroundImage = button1.BackgroundImage;
                        b1.Margin          = button1.Margin;


                        this.tableLayoutPanel1.AutoSize = true;
                        if (tableLayoutPanel1.RowCount > 0)
                        {
                            temp = tableLayoutPanel1.RowStyles[0];
                        }
                        else
                        {
                            temp = temp1;
                        }
                        this.tableLayoutPanel1.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height));
                        tableLayoutPanel1.RowCount++;
                        this.tableLayoutPanel1.Controls.Add(t1, 2, i);
                        this.tableLayoutPanel1.Controls.Add(b1, 1, i);
                        this.tableLayoutPanel1.Controls.Add(t2, 0, i);
                        t1.Text = dt3.Rows[i][0].ToString();
                        t2.Text = dt3.Rows[i][1].ToString();
                        l3.Add(t1.Text);
                    }
                }
                rowIndex = i;
                dr.Close();
                con1.CloseConnection();
            }
        }
コード例 #18
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                /*
                 *  create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_select
                 *  as
                 *  begin
                 *  select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor
                 *  end
                 * */
                //con.Open();
                //cmd.Connection = con;
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor";
                //dr = cmd.ExecuteReader();
                con1.OpenConection();
                dr = con1.DataReader("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_select");

                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text != "" && (textBox2.Text == "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                /*
                 * create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_id_select(@id int)
                 *  as
                 *   begin
                 *  select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doctor_id=@id
                 *  end
                 *
                 * */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doctor_id='" + textBox1.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_id_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@id", SqlDbType.Int).Value = textBox1.Text;
                //dr = cmd.ExecuteReader();
                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@id" };
                values     = new string[] { textBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_id_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox2.Text != "" && (textBox1.Text == "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                /*
                 *
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_select(@name nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name like N'%'+@name+'%'
                 *      end
                 * */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name='" + textBox2.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = textBox2.Text;
                // dr = cmd.ExecuteReader();
                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@name" };
                values     = new string[] { textBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_select", name_input, values, types);

                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox3.Text != "" && (textBox1.Text == "" && (textBox2.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                /*
                 *  create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_sepciality_select(@sep nvarchar(50))
                 *  as
                 *  begin
                 * select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where specialization like N'%'+@sep+'%'
                 * end
                 *
                 *
                 * */
                // con.Open();
                // cmd.Connection = con;
                //// cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where specialization='" + textBox3.Text + "'";
                // cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_sepciality_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = textBox3.Text;
                // dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@sep" };
                values     = new string[] { textBox3.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_sepciality_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (comboBox1.Text != "" && (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && comboBox2.Text == ""))))
            {
                /*
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_select(@job nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type like N'%'+@job+'%'
                 *      end
                 *
                 * */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type='" + comboBox1.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                //dr = cmd.ExecuteReader();
                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@job" };
                values     = new string[] { comboBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (comboBox2.Text != "" && (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && comboBox1.Text == ""))))
            {
                /*
                 *
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_degree_select(@deg nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where degree like N'%'+@deg+'%'
                 *      end
                 *
                 *
                 * */

                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where degree='" + comboBox2.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_degree_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@deg", SqlDbType.NVarChar).Value = comboBox2.Text;
                //dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@deg" };
                values     = new string[] { comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_degree_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text != "" && (textBox2.Text != "" || (textBox3.Text != "" || (comboBox1.Text != "" || comboBox2.Text != ""))))
            {
                // con.Open();
                // cmd.Connection = con;
                //// cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doctor_id='" + textBox1.Text + "'";
                // cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_id_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // cmd.Parameters.Add("@id", SqlDbType.Int).Value = textBox1.Text;
                // dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@id" };
                values     = new string[] { textBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_id_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text != "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                /*
                 *
                 *  create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_sep_select(@name nvarchar(50),@sep nvarchar(50))
                 *  as
                 *  begin
                 *  select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name like N'%' + @name + '%' and specialization like N'%' + @sep + '%';
                 *  end
                 *
                 */
                // con.Open();
                // cmd.Connection = con;
                //// cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name='" + textBox2.Text + "' and specialization='" + textBox3.Text + "'";

                // cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_sep_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = textBox2.Text;
                // cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = textBox3.Text;
                // dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@name", "@sep" };
                values     = new string[] { textBox2.Text, textBox3.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_sep_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text == "" && (comboBox1.Text != "" && comboBox2.Text == ""))))
            {
                /*
                 * create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_select(@name nvarchar(50),@job nvarchar(50))
                 * as
                 * begin
                 * select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name like N'%'+@name+'%' and job_type like N'%'+@job+'%'
                 * end
                 *
                 */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name='" + textBox2.Text + "' and job_type='" + comboBox1.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = textBox2.Text;
                //cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                //dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@name", "@job" };
                values     = new string[] { textBox2.Text, comboBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text != ""))))
            {
                /*
                 *
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_degree_select(@name nvarchar(50),@deg nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name like N'%'+@name+'%' and degree like N'%'+@deg+'%'
                 *      end
                 *
                 * */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name='" + textBox1.Text + "' and degree='" + comboBox2.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_degree_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = textBox2.Text;
                //cmd.Parameters.Add("@deg", SqlDbType.NVarChar).Value = comboBox2.Text;
                //dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@name", "@deg" };
                values     = new string[] { textBox2.Text, comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_degree_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text == ""))))
            {
                /*
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_sep_select(@job nvarchar(50),@sep nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type like N'%'+@job+'%' and specialization like N'%'+@sep+'%'
                 *      end
                 *
                 * */

                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type='" + comboBox1.Text + "' and specialization='" + textBox3.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_sep_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                //cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = textBox3.Text;
                //dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@job", "@sep" };
                values     = new string[] { comboBox1.Text, textBox3.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_sep_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                /*
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_deg_select(@job nvarchar(50),@deg nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type like  N'%'+@job+'%' and degree like N'%'+@deg+'%'
                 *      end
                 *
                 * */

                // con.Open();
                // cmd.Connection = con;
                //// cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type='" + comboBox1.Text + "' and degree='" + comboBox2.Text + "'";
                // cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_deg_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                // cmd.Parameters.Add("@deg", SqlDbType.NVarChar).Value = comboBox2.Text;
                // dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@job", "@deg" };
                values     = new string[] { comboBox1.Text, comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_deg_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text != "" && (comboBox1.Text == "" && comboBox2.Text != ""))))
            {
                /*
                 *
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_sep_deg_select(@sep nvarchar(50),@deg nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where specialization like N'%'+@sep+'%' and degree like N'%'+@deg+'%'
                 *      end
                 */
                // con.Open();
                // cmd.Connection = con;
                //// cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where specialization='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'";
                // cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_sep_deg_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = textBox3.Text;
                // cmd.Parameters.Add("@deg", SqlDbType.NVarChar).Value = comboBox2.Text;
                // dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@sep", "@deg" };
                values     = new string[] { textBox3.Text, comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_sep_deg_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text == ""))))
            {
                /*
                 *
                 *  create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_sep_select(@name nvarchar(50),@job nvarchar(50),@sep nvarchar(50))
                 *  as
                 *  begin
                 *  select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name like N'%'+@name+'%' and job_type like N'%'+@job+'%' and specialization like N'%'+@sep+'%'
                 *  end
                 *
                 * */
                // con.Open();
                // cmd.Connection = con;
                //// cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name='" + textBox2.Text + "' and job_type='" + comboBox1.Text + "' and specialization='" + textBox3.Text + "'";
                // cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_sep_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = textBox2.Text;
                // cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                // cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = textBox3.Text;
                // dr = cmd.ExecuteReader();


                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@name", "@job", "@sep" };
                values     = new string[] { textBox2.Text, comboBox1.Text, textBox3.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_sep_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text == "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                /*
                 * create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_deg_select(@name nvarchar(50),@job nvarchar(50),@deg nvarchar(50))
                 * as
                 * begin
                 * select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name like N'%'+@name+'%' and job_type like N'%'+@job+'%' and degree like N'%'+@deg+'%'
                 * end
                 *
                 * */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name='" + textBox2.Text + "' and job_type='" + comboBox1.Text + "' and degree='" + comboBox2.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_deg_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = textBox2.Text;
                //cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                //cmd.Parameters.Add("@deg", SqlDbType.NVarChar).Value = comboBox2.Text;
                //dr = cmd.ExecuteReader();


                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@name", "@job", "@deg" };
                values     = new string[] { textBox2.Text, comboBox1.Text, comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_deg_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                /*
                 *
                 *      create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_sep_deg_select(@job nvarchar(50),@sep nvarchar(50),@deg nvarchar(50))
                 *      as
                 *      begin
                 *      select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type like N'%'+@job+'%' and specialization like N'%'+@sep+'%' and degree like N'%'+@deg+'%'
                 *      end
                 *
                 *
                 */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where job_type='" + comboBox1.Text + "' and specialization='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_sep_deg_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                //cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = textBox3.Text;
                //cmd.Parameters.Add("@deg", SqlDbType.NVarChar).Value = comboBox2.Text;
                //dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@job", "@sep", "@deg" };
                values     = new string[] { comboBox1.Text, textBox3.Text, comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_job_sep_deg_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                /*
                 *
                 *  create procedure clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_sep_deg_select(@name nvarchar(50),@job nvarchar(50),@sep nvarchar(50),@deg nvarchar(50))
                 *  as
                 *  begin
                 *  select doctor_id as 'الكود', doc_name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , specialization as 'التخصص' from doctor where doc_name like N'%'+@name+'%' and job_type like N'%'+@job+'%' and specialization like N'%'+@sep+'%' and degree like N'%'+@deg+'%'
                 *  end
                 *
                 * */
                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "select code as 'الكود', name as 'الاسم' , job_type as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctor where name='" + textBox2.Text + "' and job_type='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'";
                //cmd.CommandText = "clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_sep_deg_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@name", SqlDbType.NVarChar).Value = textBox2.Text;
                //cmd.Parameters.Add("@job", SqlDbType.NVarChar).Value = comboBox1.Text;
                //cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = textBox3.Text;
                //cmd.Parameters.Add("@deg", SqlDbType.NVarChar).Value = comboBox2.Text;
                //dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@name", "@job", "@sep", "@deg" };
                values     = new string[] { textBox2.Text, comboBox1.Text, textBox3.Text, comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_بحث_فريق_العمل_الطبى_doctor_name_job_sep_deg_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }
        }
コード例 #19
0
        private void dataGridView3_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            x5 = dataGridView3.Rows[e.RowIndex].Cells[0].Value.ToString();

            x6 = dataGridView3.Rows[e.RowIndex].Cells[1].Value.ToString();

            if (x3 == null)
            {
                x4 = x2;

                /*
                 * create procedure clinic_select_sus(@x nvarchar(20))
                 *     as
                 *     select *  from sub_institution where sub_name=@x;
                 *
                 */

                //cmd = new SqlCommand("clinic_select_sus", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@x", x4);
                // dr = cmd.ExecuteReader();

                //create procedure clinic_select_sus(@x nvarchar(20))
                // as
                //   select *  from tb_Entities_Branches where EB_Aname=@x;

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@x" };
                values     = new string[] { x4 };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_select_sus", name_input, values, types);

                while (dr.Read())
                {
                    x3 = dr["sub_code"].ToString();
                }
            }

            /*create procedure clinic_select_current_date
             *  as
             *  select GETDATE() ;
             *  exec clinic_select_current_date;
             *
             */
            //cmd.Connection = con;
            //con.Open();
            //cmd = new SqlCommand("clinic_select_current_date", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //drr2 = cmd.ExecuteReader();
            //drr2.Read();
            //dt = drr2[0].ToString();
            //drr2.Close();
            con1.OpenConection();

            drr2 = con1.DataReader("clinic_select_current_date");
            drr2.Read();
            dt = drr2[0].ToString();
            drr2.Close();
            تعديل_الفئه_الماليه_للمريض_الخارجى ff6 = new تعديل_الفئه_الماليه_للمريض_الخارجى();

            ff6.Focus();
            this.DialogResult = DialogResult.OK;
            ff6.Focus();
        }
コード例 #20
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();

                /*
                 * create procedure doc_detail1
                 *  as
                 *  select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors s_endo
                 *
                 *
                 */

                //cmd = new SqlCommand("doc_detail1", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("doc_detail1");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text != "" && (textBox2.Text == "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();

                /*
                 * create procedure doc_detail3(@id int)
                 * as
                 * select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors s_endo where Do_id=@id
                 *
                 *
                 */
                //cmd = new SqlCommand("doc_detail3", con);
                //cmd.CommandType = CommandType.StoredProcedure;

                //cmd.Parameters.AddWithValue("@id", Convert.ToInt32(textBox1.Text));
                //dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@id" };
                values     = new string[] { textBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("doc_detail3", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox2.Text != "" && (textBox1.Text == "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();

                /*
                 * create procedure doc_detail(@n nvarchar(50))
                 * as
                 * select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors s_endo where name like N''+@n+'%'
                 *
                 *
                 */

                //cmd = new SqlCommand("doc_detail", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@n", textBox2.Text);
                //dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@n" };
                values     = new string[] { textBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("doc_detail", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox3.Text != "" && (textBox1.Text == "" && (textBox2.Text == "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();
                //                create procedure doc_special(@spec nvarchar(50))
                //as

                //select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors s_endo where speciality like N''+@spec+'%'


                //cmd = new SqlCommand("doc_special", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@spec", textBox3.Text);
                //dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@spec" };
                values     = new string[] { textBox3.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("doc_special", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (comboBox1.Text != "" && (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();

                /*
                 * create procedure doc_jop(@jop nvarchar(50))
                 *  as
                 *  select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors s_endo where jop =@jop
                 *
                 *
                 */
                //cmd = new SqlCommand("doc_jop", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@jop", comboBox1.Text);
                //dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@jop" };
                values     = new string[] { comboBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("doc_jop", name_input, values, types);

                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (comboBox2.Text != "" && (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && comboBox1.Text == ""))))
            {
                con1.OpenConection();

                //create procedure doc_degree(@deg nvarchar(50))
                //as
                //select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors s_endo where degree=@deg

                //cmd = new SqlCommand("doc_degree", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@deg", comboBox2.Text);
                // dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@deg" };
                values     = new string[] { comboBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("doc_degree", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text != "" && (textBox2.Text != "" || (textBox3.Text != "" || (comboBox1.Text != "" || comboBox2.Text != ""))))
            {
                con1.OpenConection();
                //cmd = new SqlCommand("doc_detail3", con);
                //cmd.CommandType = CommandType.StoredProcedure;

                //cmd.Parameters.AddWithValue("@id", Convert.ToInt32(textBox1.Text));
                //dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@id" };
                values     = new string[] { comboBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("doc_detail3", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text != "" && (comboBox1.Text == "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();

                /*
                 * create procedure doc_spe_name(@spec nvarchar(50),@n nvarchar(50))
                 *  as
                 *  select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors s_endo where name=@n and speciality=@spec
                 *
                 *
                 */
                //cmd = new SqlCommand("doc_spe_name, con",con);
                //cmd.CommandType = CommandType.StoredProcedure;

                //cmd.Parameters.AddWithValue("@n",textBox2.Text );
                //cmd.Parameters.AddWithValue("@spec", textBox3.Text);
                //dr = cmd.ExecuteReader();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@n", "@spec" };
                values     = new string[] { textBox2.Text, textBox3.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("doc_spe_name", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text == "" && (comboBox1.Text != "" && comboBox2.Text == ""))))
            {
                //con.Open();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text == "" && (comboBox1.Text == "" && comboBox2.Text != ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox1.Text + "' and degree='" + comboBox2.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox1.Text + "' and degree='" + comboBox2.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text == "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where jop='" + comboBox1.Text + "' and degree='" + comboBox2.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where jop='" + comboBox1.Text + "' and degree='" + comboBox2.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text != "" && (comboBox1.Text == "" && comboBox2.Text != ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where speciality='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where speciality='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text == ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text == "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "' and degree='" + comboBox2.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "' and degree='" + comboBox2.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text == "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && (textBox2.Text != "" && (textBox3.Text != "" && (comboBox1.Text != "" && comboBox2.Text != ""))))
            {
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd.CommandText = "select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'";
                //dr = cmd.ExecuteReader();
                dr = con1.DataReader("select Do_id as 'الكود', name as 'الاسم' , jop as 'نوع العمل' , degree as 'الفئة' , speciality as 'التخصص' from doctors  where name='" + textBox2.Text + "' and jop='" + comboBox1.Text + "' and speciality='" + textBox3.Text + "' and degree='" + comboBox2.Text + "'");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }
        }
コード例 #21
0
        private void Form6_Load(object sender, EventArgs e)
        {
            //create procedure clinic_select_job_ins(@x int)
            //    as
            //    select job from Registeration_patientRegisteration where patient_id=@x ;
            //     select CE_Id ,CE_AName from tb_Contracting_Entities,Registeration_patientRegisteration where tb_Contracting_Entities.CE_Id=Registeration_patientRegisteration.catogrical_code and patient_id=@x;

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int };
            name_input = new string[] { "@x" };
            values     = new string[] { label10.Text };
            SqlDataReader dr = con1.ShowDataInGridViewUsingStoredProcDR("clinic_select_job_ins", name_input, values, types);

            dr.Read();
            label11.Text = dr[0].ToString();
            dr.NextResult(); dr.Read();

            s1 = dr[0].ToString();
            s2 = dr[1].ToString();
            dr.Close();
            con1.CloseConnection();


            // create procedure clinic_select_sub_family(@x int)
            //as

            //select EB_id ,EB_Aname from tab_Entities_Branches,Registeration_patientRegisteration where sub_institution=tb_Entities_Branches. EB_id  and patient_id=@x ;
            //select PC_id ,PC_Aname from tb_Patients_Categories,Registeration_patientRegisteration where family= PC_id and patient_id=@x;

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int };
            name_input = new string[] { "@x" };
            values     = new string[] { label10.Text };
            SqlDataReader ddr2 = con1.ShowDataInGridViewUsingStoredProcDR("clinic_select_sub_family", name_input, values, types);

            ddr2.Read();
            s4 = ddr2[0].ToString();
            s3 = ddr2[1].ToString();
            ddr2.NextResult();
            ddr2.Read(); s6 = ddr2[0].ToString();
            s5 = ddr2[1].ToString();
            ddr2.Close();

            textBox1.Text = s1;
            textBox2.Text = s2;
            textBox3.Text = s3;
            textBox4.Text = s4;
            if (textBox4.Text == "0")
            {
                textBox4.Text = "";
            }
            textBox5.Text   = s5;
            textBox6.Text   = s6;
            label29.Visible = false;
            label30.Visible = false;
            label31.Visible = false;
            label32.Visible = false;
            label33.Visible = false;
            label34.Visible = false;
            label35.Visible = false;
        }
コード例 #22
0
        private void button1_Click(object sender, EventArgs e)
        {
            //MessageBox.Show(code.ToString());
            dataGridView1.Visible = true;
            con1.OpenConection();
            if (textBox1.Text == "" && textBox2.Text == "")
            {
                //create PROCEDURE setescope_search_operation_select_all
                //as
                //select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data ;


                //cmd = new SqlCommand("select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data ;",con);
                //cmd = new SqlCommand("setescope_search_operation_select_all", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                dr = con1.DataReader("setescope_search_operation_select_all");
            }
            else
            {
                if (textBox1.Text != "")
                {
                    // cmd = new SqlCommand("select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data where EndoscopeCode=" + textBox1.Text,con);
                    //cmd = new SqlCommand("setescope_search_operation_select_endosopecode", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@code", Convert.ToInt32(textBox1.Text));
                    //create PROCEDURE setescope_search_operation_select_endosopecode (@code int)
                    //as
                    //select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data where EndoscopeCode=@code ;

                    types      = new SqlDbType[] { SqlDbType.Int };
                    name_input = new string[] { "@code" };
                    values     = new string[] { textBox1.Text };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_search_operation_select_endosopecode", name_input, values, types);
                }
                else if (textBox2.Text != "")
                {
                    //cmd = new SqlCommand("select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data where EndoscopeName='" + textBox2.Text+"'",con);
                    //cmd = new SqlCommand("setescope_search_operation_select_aname", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.Add("@aname", SqlDbType.NVarChar).Value = textBox2.Text;

                    //create PROCEDURE setescope_search_operation_select_aname (@aname nvarchar(30))
                    //as
                    //select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data where EndoscopeName=@aname ;

                    types      = new SqlDbType[] { SqlDbType.NVarChar };
                    name_input = new string[] { "@aname" };
                    values     = new string[] { textBox2.Text };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_search_operation_select_aname", name_input, values, types);
                }
                else
                {
                    //cmd = new SqlCommand("select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data where EndoscopeCode=" + textBox1.Text + "and EndoscopeName=" + textBox2.Text, con);
                    //cmd = new SqlCommand("setescope_search_operation_select_endosopecode_and_aname", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.Add("@aname", SqlDbType.NVarChar).Value = textBox2.Text;
                    //cmd.Parameters.AddWithValue("@code", Convert.ToInt32(textBox1.Text));
                    //create PROCEDURE setescope_search_operation_select_endosopecode_and_aname (@code int,@aname nvarchar(30))
                    //as
                    //select EndoscopeCode as 'كود العمليه',EndoscopeName as 'اسم العمليه عربى',DescriptionLatino as 'اسم العمليه لاتينى' from Endoscope_settings_data where EndoscopeCode=@code and EndoscopeName=@aname ;

                    types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.Int };
                    name_input = new string[] { "@aname", "@code" };
                    values     = new string[] { textBox2.Text, textBox1.Text };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_search_operation_select_endosopecode_and_aname", name_input, values, types);
                }
            }
            dataGridView1.DataSource = null;
            dataGridView1.Rows.Clear();
            dataGridView1.Refresh();

            dt = new DataTable();
            dt.Load(dr);
            dataGridView1.DataSource = dt;
            dr.Close();
            con1.CloseConnection();
        }
コード例 #23
0
        //SqlConnection con;
        //SqlCommand cmd;
        private void حفظ_Click(object sender, EventArgs e)
        {
            DateTime tm1 = dateTimePicker2.Value;
            string   t1  = tm1.Hour.ToString() + ':' + tm1.Minute.ToString();
            //MessageBox.Show(t);
            DateTime dt        = dateTimePicker1.Value;
            string   modifiedd = dt.Date.ToString("yyyy-MM-dd");
            DateTime dnow      = DateTime.Now.Date;
            DateTime tm2       = dateTimePicker3.Value;
            string   t2        = tm2.Hour.ToString() + ':' + tm2.Minute.ToString();

            if (textBox2.Text == "")
            {
                MessageBox.Show("يجب اختيار عملية");
            }
            else if (textBox4.Text == "")
            {
                MessageBox.Show("يجب اختيار طبيب");
            }
            //MessageBox.Show(بحث_عن_عملية_في_تاريخ_معين.id_op.ToString());
            //MessageBox.Show(t);
            else
            {
                if (بحث_عن_عملية_في_تاريخ_معين.id_op != 0)
                {
                    if (dt >= dnow)
                    {
                        string[]    pramname  = new string[3];
                        string[]    pramvalue = new string[3];
                        SqlDbType[] pramtype  = new SqlDbType[3];
                        pramname[0] = "@dt";
                        pramname[1] = "@st";
                        pramname[2] = "@endo";

                        pramvalue[0] = modifiedd;
                        pramvalue[1] = t1;
                        pramvalue[2] = textBox2.Text;

                        pramtype[0] = SqlDbType.NVarChar;
                        pramtype[1] = SqlDbType.NVarChar;
                        pramtype[2] = SqlDbType.NVarChar;

                        con.OpenConection();
                        dr = con.ShowDataInGridViewUsingStoredProcDR("setescope_setescope_operation_select_id", pramname, pramvalue, pramtype);
                        //con.Open();
                        //cmd = new SqlCommand("setescope_setescope_operation_select_id", con);
                        //cmd.CommandType = CommandType.StoredProcedure;
                        //cmd.Parameters.AddWithValue("@dt", modifiedd);
                        //cmd.Parameters.AddWithValue("@st", modifiedt);
                        //cmd.Parameters.AddWithValue("@ endo",textBox2.Text);
                        //dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            int id_op_prev = Convert.ToInt32(dr[0].ToString());
                        }

                        if (tm1 <= tm2)
                        {
                            if (!dr.HasRows)
                            {
                                dr.Close();
                                con.CloseConnection();
                                بحث_عن_عملية_في_تاريخ_معين f = new بحث_عن_عملية_في_تاريخ_معين();
                                con.OpenConection();
                                string[]    pramna = new string[6];
                                string[]    pramv  = new string[6];
                                SqlDbType[] pramt  = new SqlDbType[6];
                                pramna[0] = "@st";
                                pramna[1] = "@et";
                                pramna[2] = "@dt";
                                pramna[3] = "@endc";
                                pramna[4] = "@id_oper";
                                pramna[5] = "@d_id";

                                pramv[0] = t1;
                                pramv[1] = t2;
                                pramv[2] = modifiedd;
                                pramv[3] = textBox2.Text;
                                pramv[4] = بحث_عن_عملية_في_تاريخ_معين.id_op.ToString();
                                pramv[5] = بحث_عن_عملية_في_تاريخ_معين.id_d.ToString();

                                pramt[0] = SqlDbType.NVarChar;
                                pramt[1] = SqlDbType.NVarChar;
                                pramt[2] = SqlDbType.NVarChar;
                                pramt[3] = SqlDbType.NVarChar;
                                pramt[4] = SqlDbType.Int;
                                pramt[5] = SqlDbType.Int;
                                con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("setescope_setescope_operation_update", pramna, pramv, pramt);
                                //cmd = new SqlCommand("setescope_setescope_operation_update", con);
                                //cmd.CommandType = CommandType.StoredProcedure;
                                //cmd.Parameters.AddWithValue("@st", modifiedt);
                                //cmd.Parameters.AddWithValue("@dt", modifiedd);
                                //cmd.Parameters.AddWithValue("@endc", textBox2.Text);
                                //cmd.Parameters.AddWithValue("@id_oper", بحث_عن_عملية_في_تاريخ_معين.id_op);
                                //cmd.Parameters.AddWithValue("@d_id", بحث_عن_عملية_في_تاريخ_معين.id_d);
                                //cmd.ExecuteNonQuery();
                                con.CloseConnection();
                                MessageBox.Show("تمت العملية بنجاح");
                            }
                            else
                            {
                                MessageBox.Show("توجد عملية في هذ الوقت");
                            }
                        }
                        else
                        {
                            MessageBox.Show("يجب اختيار وقت النهاية اكبر من وقت البداية بنصف ساعة");
                        }
                    }
                    else
                    {
                        MessageBox.Show("لا يجب اختيار تاريخ ايام سابقة");
                    }
                }
                else
                {
                    MessageBox.Show("لا يمكن التعديل قبل اختيار عملية  للتعديل");
                }
            }
        }
コード例 #24
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            if (textBox1.Text == "" && textBox2.Text == "")
            {
                /*
                 *
                 *      create procedure clinic_العياده_clinic_select
                 *      as
                 *      begin
                 *      select Clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic
                 *      end
                 * */
                // con.Open();
                // cmd.Connection = con;
                //// class_con.OpenConection();
                // cmd.CommandText = "clinic_العياده_clinic_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // //cmd.CommandText = "select Clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic";
                // dr = cmd.ExecuteReader();
                con1.OpenConection();
                dr = con1.DataReader("clinic_العياده_clinic_select");
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text != "" && textBox2.Text == "")
            {
                /* create procedure clinic_العياده_clinic_code_select(@c nvarchar(50))
                 *  as
                 *  begin
                 *  select clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic where clinic_code=@c
                 *  end
                 *
                 */
                //con.Open();
                //cmd.Connection = con;
                ////class_con.OpenConection();
                //cmd.CommandText = "clinic_العياده_clinic_code_select";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@c", textBox1.Text);
                ////cmd.CommandText = "select clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic where clinic_code='" + textBox1.Text + "'";
                //dr = cmd.ExecuteReader();
                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@c" };
                values     = new string[] { textBox1.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_العياده_clinic_code_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox1.Text == "" && textBox2.Text != "")
            {
                /*
                 *
                 *  create procedure clinic_العياده_clinic_name_select(@arabic nvarchar(50))
                 *                              as
                 *                              begin
                 *
                 *                              select clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic where Arabic_name  like  N'%'+@arabic+'%'
                 *                              end
                 */
                // con.Open();
                // cmd.Connection = con;
                // //class_con.OpenConection();
                // cmd.CommandText = "clinic_العياده_clinic_name_select";
                // cmd.CommandType = CommandType.StoredProcedure;
                // cmd.Parameters.Add("@arabic", SqlDbType.NVarChar).Value = textBox2.Text;
                //// cmd.CommandText = "select clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic where Arabic_name='" + textBox2.Text + "'";
                // dr = cmd.ExecuteReader();

                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@arabic" };
                values     = new string[] { textBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_العياده_clinic_name_select", name_input, values, types);
                DataTable dt = new DataTable();
                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }

            if (textBox2.Text != "" && textBox1.Text != "")
            {
                /*create procedure clinic_العياده_clinic_All_select(@c nvarchar(50),@arabic nvarchar(50))
                 *      as
                 *      begin
                 *      select
                 *      clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic where
                 *      clinic_code=@c and Arabic_name like N'%'+@arabic+'%'
                 *      end
                 *
                 */
                //con.Open();
                //cmd.Connection = con;
                ////class_con.OpenConection();
                //cmd.CommandText = "select clinic_code as 'الكود', Arabic_name as 'الاسم العربى' , english_name as 'الاسم الانجليزى' from clinic where clinic_code='" + textBox1.Text + "' and Arabic_name='" + textBox2.Text + "'";
                //dr = cmd.ExecuteReader();
                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@c", "@arabic" };
                values     = new string[] { textBox1.Text, textBox2.Text };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("clinic_العياده_clinic_All_select", name_input, values, types);
                DataTable dt = new DataTable();

                dt.Load(dr);
                if (dt.Rows.Count > 0)
                {
                    dataGridView2.DataSource = dt;
                }
                else
                {
                    MessageBox.Show("لا توجد نتائج بحث");
                }
                dr.Close();
                con1.CloseConnection();
            }
        }
コード例 #25
0
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (radioButton3.Checked)
            {
                check = "pos";
            }
            if (radioButton4.Checked)
            {
                check = "full";
            }
            if (radioButton5.Checked)
            {
                check = "half";
            }
            con1.OpenConection();


            //create procedure setescope_select_doc_id_doc_name(@op int)
            //as
            //select o.Do_id ,d.name from doctor_operation o,doctors d where o.op_id=@op and o.Do_id=d.doc_ssn and type='Anesthesia'

            //cmd = new SqlCommand("setescope_select_doc_id_doc_name", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.AddWithValue("@op", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
            //da1 = new SqlDataAdapter(cmd);
            types      = new SqlDbType[] { SqlDbType.Int };
            name_input = new string[] { "@op" };
            values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid };
            dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_select_doc_id_doc_name", name_input, values, types);
            //DataSet ds1 = new DataSet();
            DataTable dt = new DataTable();

            dt.Load(dr);
            if (dt.Rows.Count == 0)
            {
                //cmd = new SqlCommand("ins", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@id1", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //cmd.Parameters.AddWithValue("@id2", Convert.ToInt32(textBox4.Text));

                //// cmd.CommandText = "insert into doctor_operation values (" + Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid) + "," + Convert.ToInt32(textBox4.Text) +")";
                //cmd.ExecuteNonQuery();
                //create procedure ins(@id1 int,@id2 int)
                //    as
                //    insert into doctor_operation values(@id1,@id2)
                dr.Close();
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
                name_input = new string[] { "@id1", "@id2" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, textBox4.Text };
                con1.ExecuteNonQueryProcedure("ins", name_input, values, types);

                //cmd = new SqlCommand("setescope_select_doc_name", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@op", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //da3 = new SqlDataAdapter(cmd);
                //                create procedure setescope_select_doc_name(@op int)
                //as
                //select d.name from doctor_operation o,doctors d where o.op_id=@op  and o.Do_id=d.doc_ssn and type='Anesthesia'


                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@op" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_select_doc_name", name_input, values, types);

                //  da3 = new SqlDataAdapter("select d.name from doctor_operation o,doctor d where o.op_id=" + Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid) + " and o.Do_id=d.Do_id and type='Anesthesia';", con);
                DataTable dt2 = new DataTable();
                dt2.Load(dr);
                panel1.Visible = true;
                label9.Text    = dt2.Rows[0][0].ToString();
                label13.Text   = dt2.Rows[0][0].ToString();
                label12.Text   = dateTimePicker1.Value.ToString();
            }
            else
            {
                panel1.Visible = true;
                label9.Text    = dt.Rows[0][1].ToString();

                //cmd = new SqlCommand("setescope_update_doc_id", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@op", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));

                //cmd.Parameters.AddWithValue("@d_id", Convert.ToInt32(textBox4.Text));

                //cmd.Parameters.AddWithValue("@doc", Convert.ToInt32(ds1.Tables[0].Rows[0][0].ToString()));

                ////  cmd.CommandText = "update doctor_operation set Do_id=" + Convert.ToInt32(textBox4.Text) + " where op_id=" + Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid) + " and Do_id=" + Convert.ToInt32(ds1.Tables[0].Rows[0][0].ToString());
                //cmd.ExecuteNonQuery();

                //                create procedure setescope_update_doc_id(@d_id int,@op int ,@doc int)
                //as
                //update doctor_operation set Do_id=@d_id where op_id=@op and Do_id=@doc

                dr.Close();
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.Int };
                name_input = new string[] { "@d_d1", "@op", "@doc" };
                values     = new string[] { textBox4.Text, الصفحه_الرئيسيه_للمنظار.opid, dt.Rows[0][0].ToString() };
                con1.ExecuteNonQueryProcedure("setescope_update_doc_id", name_input, values, types);


                //cmd = new SqlCommand("setescope_select_doc_name", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@op", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //da2 = new SqlDataAdapter(cmd);
                types      = new SqlDbType[] { SqlDbType.NVarChar };
                name_input = new string[] { "@op" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("setescope_select_doc_name", name_input, values, types);

                // da2 = new SqlDataAdapter("select d.name from doctor_operation o,doctor d where o.op_id=" + Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid) + " and o.Do_id=d.Do_id and type='Anesthesia';", con);
                //DataSet ds2 = new DataSet();
                //da2.Fill(ds2);
                DataTable dt3 = new DataTable();
                label13.Text = dt3.Rows[0][0].ToString();
                label12.Text = dateTimePicker1.Value.ToString();
            }
            dr.Close();
            con1.CloseConnection();
        }