Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                con1.OpenConection();
                if (textBox1.Text == "")
                {
                    MessageBox.Show(" ادخل اسم الدكتور المسئول عن الالغاء");
                }
                else
                {
                    //create procedure select_doc_details(@d nvarchar(50),@s nvarchar(50),@endo nvarchar(50))
                    //    as
                    //    delete from doctor_operation where op_id in(select id from setescope_operation where start_time=@s  and Datee=@d and EndoscopeCode in(select EndoscopeCode from Endoscope_settings_data where EndoscopeName=@endo))
                    //peration where id_op in(select id from setescope_operation where start_time=@s  and Datee=@d and EndoscopeCode in(select EndoscopeCode from Endoscope_settings_data where EndoscopeName=@endo))


                    //cmd = new SqlCommand("select_doc_details", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@d", الصفحه_الرئيسيه_للمنظار.d);
                    //cmd.Parameters.AddWithValue("@s", الصفحه_الرئيسيه_للمنظار.start);
                    //cmd.Parameters.AddWithValue("@endo", الصفحه_الرئيسيه_للمنظار.endo);
                    //cmd.ExecuteNonQuery();
                    types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                    name_input = new string[] { "@d", "@s", "@endo" };
                    values     = new string[] { الصفحه_الرئيسيه_للمنظار.d, الصفحه_الرئيسيه_للمنظار.start, الصفحه_الرئيسيه_للمنظار.endo };
                    con1.ExecuteNonQueryProcedure("select_doc_details", name_input, values, types);

                    //  create procedure select_delete_setescope(@d nvarchar(50),@s nvarchar(50),@id int)
                    //as

                    //delete from setescope_operation where id=@id and Datee=@d and start_time=@s



                    //cmd = new SqlCommand("select_delete_setescope", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@d", الصفحه_الرئيسيه_للمنظار.d);
                    //cmd.Parameters.AddWithValue("@s", الصفحه_الرئيسيه_للمنظار.start);
                    //cmd.Parameters.AddWithValue("@id", الصفحه_الرئيسيه_للمنظار.opid);
                    //cmd.ExecuteNonQuery();
                    types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int };
                    name_input = new string[] { "@d", "@s", "@id" };
                    values     = new string[] { الصفحه_الرئيسيه_للمنظار.d, الصفحه_الرئيسيه_للمنظار.start, الصفحه_الرئيسيه_للمنظار.opid };
                    con1.ExecuteNonQueryProcedure("select_delete_setescope", name_input, values, types);
                    this.Close();
                    MessageBox.Show("لقد تم الغاء الحجز ");
                }
            }
            catch (Exception c)
            {
                MessageBox.Show(c.Message);
            }
            finally
            {
                con1.CloseConnection();
            }
        }
Beispiel #2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                end = textBox2.Text;
                con1.OpenConection();
                //create procedure setescope_flag_finish(@end nvarchar(50),@d nvarchar(50),@s nvarchar(50),@id int)
                //as
                //update  setescope_operation set flag='finish',end_time=@end where Datee =@d and start_time=@s and id=@id

                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int };
                name_input = new string[] { "@end", "@d", "@s", "@id" };
                values     = new string[] { end, الصفحه_الرئيسيه_للمنظار.d, الصفحه_الرئيسيه_للمنظار.start, الصفحه_الرئيسيه_للمنظار.opid };
                con1.ExecuteNonQueryProcedure("setescope_flag_finish", name_input, values, types);
                الصفحه_الرئيسيه_للمنظار.flag = "finish";
                الصفحه_الرئيسيه_للمنظار ff6 = new الصفحه_الرئيسيه_للمنظار();
                ff6.Focus();
                this.DialogResult = DialogResult.OK;
                ff6.Focus();
            }
            catch (Exception v)
            {
                MessageBox.Show(v.Message);
            }
            finally
            {
                con1.CloseConnection();
            }
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string g_n   = الجهه_الخاص_بالمريض_الخارجى.v1;
            string g_f_n = الجهه_الخاص_بالمريض_الخارجى.x3;


            string f    = الجهه_الخاص_بالمريض_الخارجى.x5;
            int    p_id = int.Parse(محرك_البحث1.xx1);



            // SqlCommand cmd = new SqlCommand("update  patient set Institution='" + g_n + "',sub_Institution='" + g_f_n + "',family='" + f + "' where patient_id=" + p_id + " ", con);
            //SqlCommand cmd = new SqlCommand("clinic_update_p_family", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.AddWithValue("@g_n", g_n);
            //cmd.Parameters.AddWithValue("@g_f_n", g_f_n);
            //cmd.Parameters.AddWithValue("@f", f);
            //cmd.Parameters.AddWithValue("@p_id", p_id);
            //cmd.ExecuteNonQuery();

            //create procedure clinic_update_p_family(@g_n int,@g_f_n int,@f  nvarchar(10),@p_id int)
            //as
            //update  Registeration_patientRegisteration set catogrical_code=@g_n,sub_Institution=@g_f_n,family=@f  where patient_id=@p_id ;

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.Int };
            name_input = new string[] { "@g_n", "@g_f_n", "@f", "@p_id" };
            values     = new string[] { g_n, g_f_n, f, p_id.ToString() };
            con1.ExecuteNonQueryProcedure("clinic_update_p_family", name_input, values, types);
            con1.CloseConnection();

            this.Close();
        }
Beispiel #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            //cmd = new SqlCommand("update patient_visit set service_name="+service+" where num_of_visit=" + count + " and p_id=select patient_id from patient where fname=" + p_name + "and lname= " + p_name2 + "  ", con);
            //con1.ExecuteQueries("update patient_visit set service_name="+service+" where num_of_visit=" + count + " and p_id=select patient_id from patient where fname=" + p_name + "and lname= " + p_name2 );

            //create procedure update_service_to_patient(@ser nvarchar(60),@count int,@name varchar(50))
            //    as
            //    begin
            //    update entranceoffice_visit set service_name=N'%'+@ser+'%' where visit_id=@count and pat_id=(select patient_id from Registeration_patientRegisteration  where patient_name like N'%' + @name +'%')
            //    end
            string f_name = p_name + "" + p_name2;

            con1.OpenConection();
            name_input = new string[] { "@ser", "@count", "@name" };
            types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.VarChar };
            values     = new string[] { service, Convert.ToString(count), f_name };
            con1.ExecuteNonQueryProcedure("update_service_to_patient", name_input, values, types);
            try
            {
                // cmd.ExecuteNonQuery();
                MessageBox.Show("تم اضافه الخدمه ");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                con1.CloseConnection();
            }
        }
Beispiel #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                t1 = textBox2.Text;
                t2 = textBox1.Text;
                الصفحه_الرئيسيه_للمنظار f = new الصفحه_الرئيسيه_للمنظار();
                con1.OpenConection();
                //create procedure update_time(@s nvarchar(50),@end nvarchar(50) ,@d nvarchar(50),@ss nvarchar(50),@n nvarchar(50))
                //    as
                //    update setescope_operation set start_time=@s,end_time=@end where Datee=@d and start_time=@ss and EndoscopeCode
                //    in(select EndoscopeCode from Endoscope_settings_data where EndoscopeName=@n );


                //cmd = new SqlCommand("update_time", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@end", t2);
                //cmd.Parameters.AddWithValue("@d", الصفحه_الرئيسيه_للمنظار.d);
                //cmd.Parameters.AddWithValue("@s", t1);
                //cmd.Parameters.AddWithValue("@ss", الصفحه_الرئيسيه_للمنظار.start);
                //cmd.Parameters.AddWithValue("@n", الصفحه_الرئيسيه_للمنظار.endo);
                //cmd.ExecuteNonQuery();
                types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@end", "@d", "@s", "@ss", "@n" };
                values     = new string[] { t2, الصفحه_الرئيسيه_للمنظار.d, t1, الصفحه_الرئيسيه_للمنظار.start, الصفحه_الرئيسيه_للمنظار.endo };
                con1.ExecuteNonQueryProcedure("update_time", name_input, values, types);
                الصفحه_الرئيسيه_للمنظار ff6 = new الصفحه_الرئيسيه_للمنظار();
                ff6.Focus();
                this.DialogResult = DialogResult.OK;
                ff6.Focus();
            }
            catch (Exception v) { MessageBox.Show(v.Message); }
            finally { con1.CloseConnection(); }
        }
Beispiel #6
0
        private void حفظToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                //create PROCEDURE setescope_rooms_update_inventory_and_dep (@code1 int,@code2 int,@roomcode int)
                // as
                // begin
                // update Endoscope_room set code1 =@code1 , code2 =@code2 where RoomCode= @roomcode
                // end
                con1.OpenConection();
                // cmd = new SqlCommand("update Endoscope_room set code1 = " + Convert.ToInt32(textBox6.Text) + ", code2 = " + Convert.ToInt32(textBox8.Text) + " where RoomCode=" + code + ";", con);
                //cmd = new SqlCommand("setescope_rooms_update_inventory_and_dep", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@roomcode", Convert.ToInt32(code));
                //cmd.Parameters.AddWithValue("@code2", Convert.ToInt32(textBox6.Text));
                //cmd.Parameters.AddWithValue("@code1", Convert.ToInt32(textBox8.Text));
                //cmd.ExecuteNonQuery();

                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.Int };
                name_input = new string[] { "@roomcode", "@code2", "@code1" };
                values     = new string[] { Convert.ToString(code), textBox6.Text, textBox8.Text };
                con1.ExecuteNonQueryProcedure("setescope_rooms_update_inventory_and_dep", name_input, values, types);
                MessageBox.Show("تم الحفظ");
                con1.CloseConnection();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #7
0
        //////////////////////////////////save/////////////////////////////
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (dateTimePicker2.Value.Date >= dateTimePicker1.Value.Date)
            {
                if (tableLayoutPanel1.RowCount > 1)
                {
                    l1.Add(t1.Text);
                    l1.Add(dtp1.Value.ToString());
                    l1.Add(dtp2.Value.ToString());
                }

                if (l1.Count == 0)
                {
                    l1.Add(textBox1.Text);
                    l1.Add(dateTimePicker1.Value.ToString());
                    l1.Add(dateTimePicker2.Value.ToString());
                }



                for (int i = 0; i < l1.Count; i += 3)
                {
                    /*
                     *
                     *  create procedure clinic_اعداد_عطلات_العيادات_clinic_rest_insert(@c nvarchar(50),@s_time nvarchar(100),@e_time nvarchar(100))
                     *  as
                     *  begin
                     *  insert into clinic_rest values(@c,@s_time,@e_time)
                     *  end
                     *
                     * */
                    //con.Open();
                    //cmd.Connection = con;
                    ////cmd.CommandText = "insert into clinic_rest values('" + l1[i] + "','" + l1[i + 1] + "','" + l1[i + 2] + "')";
                    //cmd.CommandText = "clinic_اعداد_عطلات_العيادات_clinic_rest_insert";
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@c",l1[i]);
                    //cmd.Parameters.AddWithValue("@s_time", l1[i + 1]);
                    //cmd.Parameters.AddWithValue("e_time",l1[i + 2]);
                    //cmd.ExecuteNonQuery();
                    //con.Close();

                    con1.OpenConection();
                    types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                    name_input = new string[] { "@c", "@s_time", "@e_time" };
                    values     = new string[] { l1[i], l1[i + 1], l1[i + 2] };
                    con1.ExecuteNonQueryProcedure("clinic_اعداد_عطلات_العيادات_clinic_rest_insert", name_input, values, types);
                    con1.CloseConnection();
                }

                MessageBox.Show("تم الحفظ");
                l1.Clear();
            }

            else
            {
                MessageBox.Show("من فضلك قم بتعديل التاريخ");
            }
        }
Beispiel #8
0
        private void label15_Click(object sender, EventArgs e)
        {
            if (flag == "7agz")
            {
                p1.Controls[6].BackColor = Color.Green;
                try
                {
                    con1.OpenConection();

                    //          create procedure updat(@f nvarchar(50),@d nvarchar(50),@s nvarchar(50) ,@n nvarchar(50))
                    //            as

                    //            update  setescope_operation set flag= @f where Datee = @d and start_time=@s and EndoscopeCode in(select EndoscopeCode from Endoscope_settings_data where EndoscopeName=@n );
                    //escope_operation set flag= @f where Datee = @d and start_time=@s and EndoscopeCode in(select EndoscopeCode from Endoscope_settings_data where EndoscopeName=@n );

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

                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@f", "taked");
                    //cmd.Parameters.AddWithValue("@d", d);
                    //cmd.Parameters.AddWithValue("@s",start);
                    //cmd.Parameters.AddWithValue("@n",endo);
                    //cmd.ExecuteNonQuery();
                    types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                    name_input = new string[] { "@f", "@d", "@s", "@n" };
                    values     = new string[] { "taked", d, start, endo };
                    con1.ExecuteNonQueryProcedure("updat", name_input, values, types);
                    flag = "taked";
                }
                catch (Exception v) { MessageBox.Show(v.Message); }
                finally { con1.CloseConnection(); }
            }

            else if (flag == "start")
            {
                MessageBox.Show("لا يمكن  تاكيد الحجز لقد تم بدء العمليه ");
            }
            else if (flag == "finish")
            {
                MessageBox.Show("لا يمكن  تاكيد الحجز لقد تم انهاء العمليه");
            }
            else if (flag == "taked")
            {
                MessageBox.Show("لقد تم التأكيد مسبقا");
            }
        }
Beispiel #9
0
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            /*
             * create procedure clinic_خدمات_clinic_service_insert(@c nvarchar(50),@arabic nvarchar(100),@english nvarchar(100),@co nvarchar(50),@degree nvarchar(100))
             * as
             * begin
             * insert into clinic_service values(@c,@arabic,@english,@co,@degree)
             * end
             */

            if (textBox1.Text == "" || textBox4.Text == "" || textBox5.Text == "" || textBox9.Text == "")
            {
                MessageBox.Show("من فضلك قم بادخال البيانات");
            }
            else
            {
                l1.Add(textBox1.Text);
                l1.Add(textBox4.Text);
                l1.Add(textBox5.Text);
                l1.Add(textBox9.Text);
                l1.Add(comboBox2.Text);
                for (int i = 0; i < l1.Count; i += 5)
                {
                    //class_con.OpenConection();
                    //cmd.Connection = con;
                    //cmd.CommandText = "clinic_خدمات_clinic_service_insert";
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@c", l1[i]);
                    //cmd.Parameters.AddWithValue("@arabic", l1[i+1]);
                    //cmd.Parameters.AddWithValue("@english", l1[i+2]);
                    //cmd.Parameters.AddWithValue("@co", l1[i+3]);
                    //cmd.Parameters.AddWithValue("@degree", l1[i+4]);
                    ////cmd.CommandText = "insert into clinic_service values('" + l1[i] + "','" + l1[i + 1] + "','" + l1[i + 2] + "','" + l1[i + 3] + "','" + l1[i + 4] + "')";
                    //cmd.ExecuteNonQuery();
                    //class_con.CloseConnection();
                    ////con.Close();
                    con1.OpenConection();
                    types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                    name_input = new string[] { "@c", "@arabic", "@english", "@co", "@degree" };
                    values     = new string[] { l1[i], l1[i + 1], l1[i + 2], l1[i + 3], l1[i + 4] };
                    con1.ExecuteNonQueryProcedure("clinic_خدمات_clinic_service_insert", name_input, values, types);
                    con1.CloseConnection();
                }
                MessageBox.Show("تم الحفظ");
                textBox1.Text  = "";
                textBox4.Text  = "";
                textBox5.Text  = "";
                textBox9.Text  = "";
                textBox10.Text = "";
                comboBox2.Text = "";
                l1.Clear();
            }
        }
Beispiel #10
0
        //////////////////////////////////save/////////////////////////////
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (tableLayoutPanel1.RowCount > 1)
            {
                l1.Add(t1.Text);
                l1.Add(t2.Text);
                l1.Add(t3.Text);
                l1.Add(t4.Text);
                l1.Add(check.Checked.ToString());
            }
            if (tableLayoutPanel1.RowCount == 1)
            {
                l1.Add(textBox1.Text);
                l1.Add(textBox2.Text);
                l1.Add(textBox3.Text);
                l1.Add(textBox4.Text);
                l1.Add(checkBox1.Checked.ToString());
            }
            for (int i = 0; i < l1.Count; i += 5)
            {
                //texts[i] = l1[i];

                /*create procedure clinic_غرف_العيادات_الخارجية_room_insert(@r int,@arabic nvarchar(100),@english nvarchar(100),@sep nvarchar(100),@main nvarchar(100))
                 *  as
                 *  begin
                 *  insert into room(r_id,arabic_des,english_des,specialty,maintenance) values(@r,@arabic,@english,@sep,@main)
                 *  end
                 */

                //con.Open();
                //cmd.Connection = con;
                ////cmd.CommandText = "insert into room(r_id,arabic_des,english_des,specialty,maintenance) values('" + l1[i] + "','" + l1[i + 1] + "','" + l1[i + 2] + "','" + l1[i + 3] + "','" + l1[i + 4] + "')";
                //cmd.CommandText = "clinic_غرف_العيادات_الخارجية_room_insert";
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.Add("@r", SqlDbType.Int).Value = l1[i];
                //cmd.Parameters.Add("@arabic", SqlDbType.NVarChar).Value = l1[i + 1];
                //cmd.Parameters.Add("@english", SqlDbType.NVarChar).Value = l1[i + 2];
                //cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = l1[i + 3];
                //cmd.Parameters.Add("@main", SqlDbType.NVarChar).Value = l1[i + 4];
                //cmd.ExecuteNonQuery();
                //con.Close();
                con1.OpenConection();
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
                name_input = new string[] { "@r", "@arabic", "@english", "@sep", "@main" };
                values     = new string[] { l1[i], l1[i + 1], l1[i + 2], l1[i + 3], l1[i + 4] };
                con1.ExecuteNonQueryProcedure("clinic_غرف_العيادات_الخارجية_room_insert", name_input, values, types);
                con1.CloseConnection();
            }
            //con.OpenConection();
            //con.ShowDataInGridViewUsingStoredProc("clinic_غرف_العيادات_الخارجية_room_insert", inputs, texts, types);
            MessageBox.Show("تم الحفظ");
            l1.Clear();
        }
Beispiel #11
0
        //For insert the new patient in table of patient
        private void button1_Click(object sender, EventArgs e)
        {
            //create procedure clinic_التسجيل_patient_insert(@id int,@fn nvarchar(50),@sn nvarchar(50),@thn nvarchar(50),
            //@ln nvarchar(50),@gen nvarchar(50),@job nvarchar(50),@ins varchar(50),@ssn int,@date date,@nat nvarchar(50),@ph int,@f_n int,@f_l nvarchar(50))
            //        as
            //        begin
            //insert into patient(patient_id,fname,sname,thname,lname,gender,job,institution,ssn,date_of_birth,nationality,phonenumber,file_number,file_location)
            //values(@id,@fn,@sn,@thn,@ln,@gen,@job,@ins,@ssn,@date,@nat,@ph,@f_n,@f_l)
            //        end



            //create procedure clinic_التسجيل_patient_insert
            //(@fn varchar(50),@gen varchar(50),@job varchar(50),@ins int,@ssn int,@date varchar(30),
            //@nat varchar(50),@address varchar(100),@age int,@emp int,@reg_date varchar(30))
            //as
            //begin

            //insert into Registeration_patientRegisteration
            //(patient_name,gender,job,catogrical_code,identity_type,date_of_birth,nationality,address_of_patient,age,employ_code,date_Regist)
            //values(N''+@fn+'%',N''+@gen+'%',N''+@job+'%',@ins,@ssn,@date,N''+@nat+'%',N''+@address+'%',@age,@emp,@reg_date)
            // end
            DateTime datetime = DateTime.Now;
            string   date     = datetime.ToString("yyyy-MM-dd HH:mm:ss");

            x      = textBox2.Text;
            n      = textBox3.Text + " " + textBox4.Text;
            f_name = textBox2.Text + "" + textBox3.Text + "" + textBox4.Text + "" + textBox5.Text;
            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.VarChar, SqlDbType.VarChar, SqlDbType.VarChar, SqlDbType.Int, SqlDbType.Int, SqlDbType.Date, SqlDbType.VarChar, SqlDbType.VarChar, SqlDbType.Int, SqlDbType.Int, SqlDbType.VarChar };
            name_input = new string[] { "@fn", "@gen", "@job", "@ins", "@ssn", "@date", "@nat", "@address", "@age", "@emp", "@reg_date" };
            values     = new string[] { f_name, textBox6.Text, textBox7.Text, textBox8.Text, textBox9.Text, textBox10.Text, textBox11.Text, textBox1.Text, textBox12.Text, textBox13.Text, date };
            con1.ExecuteNonQueryProcedure("clinic_التسجيل_patient_insert", name_input, values, types);
            MessageBox.Show("تم اضافه المريض ");
            con1.CloseConnection();
        }
Beispiel #12
0
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //con.Open();
            //string date = dateTimePicker1.Value.ToString("yyyy-MM-dd");
            //cmd = new SqlCommand("assigne_to_thetable", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //cmd.Parameters.AddWithValue("@x", textBox1.Text);
            //cmd.Parameters.AddWithValue("@y", textBox5.Text);
            //cmd.Parameters.AddWithValue("@z", textBox3.Text);
            //cmd.Parameters.AddWithValue("@f",date);
            /////////////////pro
            //cmd.ExecuteNonQuery();
            // SqlDataReader dr = cmd.ExecuteReader();


            //create procedure assigne_to_thetable(@x int,@y int,@z varchar(80) ,@f  varchar(40))
            //as
            //insert into user_patient values
            //(@x,@y,@z,@f);


            //create procedure insert_user_patient(@x int,@y int,@z datetime,@i varchar(80))
            //as
            //begin
            //            insert into user_patient values(@x,@y,@z,@i)
            //end

            string date = dateTimePicker1.Value.ToString("yyyy-MM-dd");

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.DateTime, SqlDbType.DateTime };
            name_input = new string[] { "@x", "@y", "@z", "@i" };
            values     = new string[] { textBox1.Text, textBox5.Text, textBox3.Text, date };
            con1.ExecuteNonQueryProcedure("insert_user_patient", name_input, values, types);
            con1.CloseConnection();


            MessageBox.Show("تم الحفظ");
            textBox1.Text = "";
            textBox2.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";
            textBox5.Text = "";
            l1.Clear();
        }
Beispiel #13
0
 private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     l1.Add(textBox1.Text);
     l1.Add(textBox4.Text);
     l1.Add(textBox5.Text);
     l1.Add(textBox9.Text);
     l1.Add(comboBox2.Text);
     for (int i = 0; i < l1.Count; i += 5)
     {
         /*
          *  create procedure clinic_اضافه_عياده_clinic_insert(@c nvarchar(50),@sep nvarchar(100),@arabic nvarchar(100),@english nvarchar(50),@d nvarchar(50))
          *  as
          *  begin
          *  insert into clinic values(@c,@sep,@arabic,@english,@d)
          *  end
          * */
         //con.Open();
         //cmd.Connection = con;
         ////cmd.CommandText = "insert into clinic values('" + l1[i] + "','" + l1[i + 4] + "','" + l1[i + 1] + "','" + l1[i + 2] + "','" + l1[i + 3] + "')";
         //cmd.CommandText = "clinic_اضافه_عياده_clinic_insert";
         //cmd.CommandType = CommandType.StoredProcedure;
         //cmd.Parameters.Add("@c", SqlDbType.NVarChar).Value = l1[i];
         //cmd.Parameters.Add("@sep", SqlDbType.NVarChar).Value = l1[i + 4];
         //cmd.Parameters.Add("@arabic", SqlDbType.NVarChar).Value = l1[i + 1];
         //cmd.Parameters.Add("@english", SqlDbType.NVarChar).Value = l1[i + 2];
         //cmd.Parameters.Add("@d", SqlDbType.NVarChar).Value = l1[i + 3];
         //cmd.ExecuteNonQuery();
         //con.Close();
         con1.OpenConection();
         types      = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
         name_input = new string[] { "@c", "@sep", "@arabic", "@english", "@d" };
         values     = new string[] { l1[i], l1[i + 4], l1[i + 1], l1[i + 2], l1[i + 3] };
         con1.ExecuteNonQueryProcedure("clinic_اضافه_عياده_clinic_insert", name_input, values, types);
         con1.CloseConnection();
     }
     MessageBox.Show("تم الحفظ");
     textBox1.Text  = "";
     textBox4.Text  = "";
     textBox5.Text  = "";
     textBox9.Text  = "";
     textBox10.Text = "";
     comboBox2.Text = "";
     l1.Clear();
 }
Beispiel #14
0
        private void تأكيدToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //create PROCEDURE setescope_receive_request_select_end_time
            //as
            //begin
            //select end_time from setescope_operation where id = ( select max(id) from setescope_operation )
            //end


            con1.OpenConection();
            DataTable ddt = new DataTable();

            //cmd = new SqlCommand("setescope_receive_request_select_end_time", con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //dr = cmd.ExecuteReader();


            dr = con1.DataReader("setescope_receive_request_select_end_time");
            ddt.Load(dr);
            string end_time = ddt.Rows[0][0].ToString();

            DateTime d   = DateTime.Today;
            string   s   = d.ToShortDateString() + " " + end_time;
            DateTime dtt = Convert.ToDateTime(s);

            con1.CloseConnection();


            //create PROCEDURE setescope_confirm_operation_insert_update (@start_time time ,@Datee date ,@end_time time ,@flag varchar(30),@EndoscopeCode int,@patient_id int,@req_id int)
            //as
            //begin
            //insert into setescope_operation (start_time,Datee,end_time,flag,EndoscopeCode,patient_id)  values
            //(@start_time,@Datee,@end_time,@flag,@EndoscopeCode,@patient_id) ;
            //update receive_request set flag = 'confirm' where req_id = @req_id ;
            //end
            con1.OpenConection();

            types      = new SqlDbType[] { SqlDbType.Time, SqlDbType.Date, SqlDbType.Time, SqlDbType.VarChar, SqlDbType.Int, SqlDbType.Int, SqlDbType.Int };
            name_input = new string[] { "@start_time", "@Datee", "@end_time", "@flag", "@EndoscopeCode", "@patient_id", "@req_id" };
            values     = new string[] { end_time, d.ToShortDateString(), Convert.ToString(dtt.AddMinutes(30)), "no", Convert.ToString(endo_id), Convert.ToString(p_id), Convert.ToString(request_id) };
            con1.ExecuteNonQueryProcedure("setescope_confirm_operation_insert_update", name_input, values, types);
            MessageBox.Show("تم تأكيد العمليه");
            con1.CloseConnection();
        }
Beispiel #15
0
        private void حفظToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int f;

            if (int.TryParse(textBox3.Text, out f))
            {
                MessageBox.Show("يجب ادخال نص مناسب");
            }
            else
            {
                if (textBox3.Text == "" || textBox2.Text == "")
                {
                    MessageBox.Show("يجب ادخال البيانات الناقصة");
                }
                else
                {
                    /*create procedure clinic_patient_visit_update_cancel_date(@c_date date,@s int, @s1 int)
                     *  as
                     *  begin
                     *   update patient_visit set cancel_date =@c_date,cancel_type ='canceled' where P_id =@s and num_of_visit =@s1;
                     *  end
                     *
                     */
                    //con.Open();
                    //cmd = new SqlCommand();
                    //cmd.Connection = con;
                    ////cmd.CommandText = "update patient_visit set cancel_date = ' " + datet.ToString("yyyy-MM-dd") + " ' where P_id = " + s + " and num_of_visit = " + s1;
                    //cmd.CommandText = "clinic_patient_visit_update_cancel_date";
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@s", s);
                    //cmd.Parameters.AddWithValue("@s1", s1);
                    //cmd.Parameters.AddWithValue("@c_date", datet.ToString("yyyy-MM-dd"));
                    //cmd.ExecuteNonQuery();
                    //con.Close();
                    con1.OpenConection();
                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.Date };
                    name_input = new string[] { "@s", "@s1", "@c_date" };
                    values     = new string[] { s.ToString(), s1.ToString(), datet.ToString("yyyy-MM-dd") };
                    con1.ExecuteNonQueryProcedure("clinic_entranceoffice_visit_update_cancel_date", name_input, values, types);
                    con1.CloseConnection();
                    MessageBox.Show(" تم عملية الحفظ بنجاح ");
                }
            }
        }
Beispiel #16
0
        //////////////////////////////save////////////////////////////////
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (selected == "تخدير")
            {
                if (tableLayoutPanel1.RowCount > l1.Count)
                {
                    if (tableLayoutPanel1.RowCount == 1)
                    {
                        l1.Add(textBox1.Text);
                    }
                    else
                    {
                        l1.Add(t1.Text);
                    }
                }
                con1.OpenConection();

                //create procedure dele(@p_id int, @type nvarchar(30))
                //as
                //delete from doctor_operation where id_op=@p_id and Do_id in (select d.Do_id from doctors d,doctor_operation o where d.Do_id = o.Do_id and jop=@type)

                //cmd = new SqlCommand("dele", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@p_id", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //cmd.Parameters.AddWithValue("@type", "Anesthesia");
                //cmd.ExecuteNonQuery();
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar };
                name_input = new string[] { "@p_id", "@type" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, "Anesthesia" };
                con1.ExecuteNonQueryProcedure("dele", name_input, values, types);
                for (int i = 0; i < l1.Count; i++)
                {
                    // create procedure ins(@id1 int,@id2 int)
                    //as
                    //insert into doctor_operation values(@id1,@id2)
                    //cmd = new SqlCommand("ins", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@id1", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                    //cmd.Parameters.AddWithValue("@id2", Convert.ToInt32(l1[i]));
                    //cmd.ExecuteNonQuery();
                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@id1", "@id2" };
                    values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, l1[i] };
                    con1.ExecuteNonQueryProcedure("ins", name_input, values, types);
                }
                con1.CloseConnection();
                MessageBox.Show("تم الحفظ");
            }

            if (selected == "جراح مساعد")
            {
                if (tableLayoutPanel1.RowCount > l2.Count)
                {
                    if (tableLayoutPanel1.RowCount == 1)
                    {
                        l2.Add(textBox1.Text);
                    }
                    else
                    {
                        l2.Add(t1.Text);
                    }
                }
                con1.OpenConection();

                /*
                 *
                 *      create procedure  procedurselect_doc_details(@id int)
                 *      as
                 *      select
                 *      o.Do_id from doctors d,doctor_operation o where o.id_op=@id and d.Do_id =o.Do_id and jop='surgeon' ORDER BY o.id_op  DESC ;
                 *
                 *
                 *
                 *
                 */
                //cmd = new SqlCommand("procedurselect_doc_details",con);
                //cmd.Parameters.AddWithValue("@id", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //da2 = new SqlDataAdapter(cmd);
                types      = new SqlDbType[] { SqlDbType.Int };
                name_input = new string[] { "@id" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid };
                dr         = con1.ShowDataInGridViewUsingStoredProcDR("procedurselect_doc_details", name_input, values, types);

                DataTable dt2 = new DataTable();
                dt2.Load(dr);


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

                for (int i = 0; i < l2.Count; i++)
                {
                    //cmd = new SqlCommand("ins", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@id1", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                    //cmd.Parameters.AddWithValue("@id2", Convert.ToInt32(l2[i]));
                    //cmd.ExecuteNonQuery();
                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@id1", "@id2" };
                    values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, l2[i] };
                    con1.ExecuteNonQueryProcedure("ins", name_input, values, types);
                }
                dr.Close();
                con1.CloseConnection();
                MessageBox.Show("تم الحفظ");
            }
            if (selected == "تمريض")
            {
                if (tableLayoutPanel1.RowCount > l3.Count)
                {
                    if (tableLayoutPanel1.RowCount == 1)
                    {
                        l3.Add(textBox1.Text);
                    }
                    else
                    {
                        l3.Add(t1.Text);
                    }
                }
                con1.OpenConection();
                //cmd.Connection = con;
                //cmd = new SqlCommand("dele", con);
                //cmd.CommandType = CommandType.StoredProcedure;
                //cmd.Parameters.AddWithValue("@p_id", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                //cmd.Parameters.AddWithValue("@type", "Nursing");
                //cmd.ExecuteNonQuery();
                types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.NVarChar };
                name_input = new string[] { "@p_id", "@type" };
                values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, "Nursing" };
                con1.ExecuteNonQueryProcedure("dele", name_input, values, types);
                for (int i = 0; i < l3.Count; i++)
                {
                    //cmd = new SqlCommand("ins", con);
                    //cmd.CommandType = CommandType.StoredProcedure;
                    //cmd.Parameters.AddWithValue("@id1", Convert.ToInt32(الصفحه_الرئيسيه_للمنظار.opid));
                    //cmd.Parameters.AddWithValue("@id2", Convert.ToInt32(l3[i]));
                    //cmd.ExecuteNonQuery();
                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@id1", "@id2" };
                    values     = new string[] { الصفحه_الرئيسيه_للمنظار.opid, l3[i] };
                    con1.ExecuteNonQueryProcedure("ins", name_input, values, types);
                }
                dr.Close();
                con1.CloseConnection();
                MessageBox.Show("تم الحفظ");
            }
        }
Beispiel #17
0
        private void button3_Click(object sender, EventArgs e)
        {
            //    create procedure clinic_محرك_البحث_للحجز_patient_visit_insert(@pid int,@ordere int,@type nvarchar(50),@type2 nvarchar(50),@date nvarchar(100))
            //as
            //begin
            //declare @i int
            //set @i=(select count(visit_id)+1  from entranceoffice_visit where pat_id=@pid)
            //insert into entranceoffice_visit(visit_id,pat_id,ordere,type_of_visit,type_status,entrance_date) values(@i,@pid,@ordere,@type,  @type2 , @date)
            //end



            //create procedure clinic_محرك_البحث_للحجز_treat_patient_insert(@pid int,@c nvarchar(30))
            //as
            //begin
            //insert into Treat_Patient(pid,c_code) values(@pid,@c)
            //end


            //    create procedure clinic_محرك_البحث_للحجز_patient_visit_insert(@pid int,@ordere int,@type nvarchar(50),@type2 nvarchar(50),@date nvarchar(100))
            //as
            //begin
            //declare @i int
            //set @i=(select count(visit_id)+1  from entranceoffice_visit where pat_id=@pid)
            //insert into entranceoffice_visit(visit_id,pat_id,ordere,type_of_visit,Finish_Type,entrance_date) values(@i,@pid,@ordere,@type,  @type2 , @date)
            //endd



            int      order = 1000;
            string   type = "خارجي", type2 = "open";
            DateTime dt   = DateTime.Now;
            String   date = dt.ToString("yyyy-MM-dd hh:mm:ss");

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar };
            name_input = new string[] { "@pid", "@ordere", "@type", "@type2", "@date" };
            values     = new string[] { x1, order.ToString(), type, type2, date };
            con1.ExecuteNonQueryProcedure("clinic_محرك_البحث_للحجز_patient_visit_insert", name_input, values, types);
            con1.CloseConnection();

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.VarChar };
            name_input = new string[] { "@pid", "@c" };
            values     = new string[] { x1, code.ToString() };
            con1.ExecuteNonQueryProcedure("clinic_محرك_البحث_للحجز_treat_patient_insert1", name_input, values, types);
            con1.CloseConnection();
            //create procedure clinic_محرك_البحث_للحجز_patient_select1(@pid int)
            //as
            //begin
            //select patient_name, catogrical_code from Registeration_patientRegisteration where patient_id=@pid
            //end

            con1.OpenConection();
            types      = new SqlDbType[] { SqlDbType.Int };
            name_input = new string[] { "@pid" };
            values     = new string[] { x1 };
            SqlDataReader dr = con1.ShowDataInGridViewUsingStoredProcDR("clinic_محرك_البحث_للحجز_patient_select1", name_input, values, types);

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

            name1 = dr[0].ToString() + " " + dr[1].ToString();
            //name2 = dr[2].ToString();
            f.Focus();
            this.DialogResult = DialogResult.OK;

            f.Focus();
            con1.CloseConnection();

            //insert_into_patient_visit();
            //cmd = new SqlCommand("insert into pat_clinic(patient_id,code_clinic) values(" + int.Parse(x1) + "," + code + ");", con);
            //try
            //{

            //    MessageBox.Show("لفد تم الادخال بنجاح");
            //    cmd = new SqlCommand("select fname,sname,institution from patient where patient_id=" + int.Parse(x1) + "", con);
            //     dr = cmd.ExecuteReader();
            //    dr.Read();

            //    حجز_العياده f = new حجز_العياده();

            //   name1 = dr[0].ToString() +" "+ dr[1].ToString();
            //    name2 = dr[2].ToString();
            //    f.Focus();
            //    this.DialogResult = DialogResult.OK;

            //    f.Focus();
        }
Beispiel #18
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);
            }
        }
Beispiel #19
0
        //////////////////////////////////save/////////////////////////////
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (dateTimePicker2.Value.Date >= dateTimePicker1.Value.Date)
            {
                if (tableLayoutPanel1.RowCount == 1)
                {
                    l1.Add(textBox3.Text);
                }
                if (tableLayoutPanel2.RowCount == 1)
                {
                    l2.Add(dateTimePicker1.Value.ToString());
                    l2.Add(dateTimePicker2.Value.ToString());
                }
                if (tableLayoutPanel1.RowCount > 1)
                {
                    l1.Add(t1.Text);
                }
                if (tableLayoutPanel2.RowCount > 1)
                {
                    l2.Add(dtp1.Value.ToString());
                    l2.Add(dtp2.Value.ToString());
                }

                for (int i = 0; i < l1.Count; i++)
                {
                    /*
                     *  create procedure clinic_عطلات_الاطباء_doc_rest_insert
                     *  (@code int,@s_time datetime,@e_time datetime)
                     *   as
                     *   begin
                     *   insert into doc_rest values(@code,@s_time,@e_time)
                     *   end
                     */
                    for (int j = 0; j < l2.Count; j += 2)
                    {
                        //con.Open();
                        //cmd.Connection = con;
                        //cmd.CommandText = "clinic_عطلات_الاطباء_doc_rest_insert";
                        //cmd.CommandType = CommandType.StoredProcedure;
                        //cmd.Parameters.AddWithValue("@code", l1[i]);
                        //cmd.Parameters.AddWithValue("@s_time", l2[j]);
                        //cmd.Parameters.AddWithValue("@e_time", l2[j+1]);
                        ////cmd.CommandText = "insert into doc_rest values('" + l1[i] + "','" + l2[j] + "','" + l2[j + 1] + "')";
                        //cmd.ExecuteNonQuery();
                        //con.Close();
                        con1.OpenConection();
                        types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.DateTime, SqlDbType.DateTime };
                        name_input = new string[] { "@code", "@s_time", "@e_time" };
                        values     = new string[] { l1[i], l2[j], l2[j + 1] };
                        con1.ExecuteNonQueryProcedure("clinic_عطلات_الاطباء_doc_rest_insert", name_input, values, types);
                        con1.CloseConnection();
                    }
                }
                MessageBox.Show("تم الحفظ");
                l1.Clear();
                l2.Clear();
            }
            else
            {
                MessageBox.Show("من فضلك قم بتعدل التاريخ");
            }
        }
Beispiel #20
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();
        }
Beispiel #21
0
        private void حفظToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                con1.OpenConection();

                dr = con1.DataReader("setscope_EndoscopeCode_select");


                if (textBox1.Text != "")
                {
                    while (dr.Read())
                    {
                        if (int.Parse(dr[0].ToString()) == int.Parse(textBox1.Text))
                        {
                            Code    = int.Parse(dr[0].ToString());
                            isequal = 1;
                            dr.Close();

                            break;
                        }
                    }
                }


                if (isequal == 1)
                {
                    dr.Close();

                    types      = new SqlDbType[] { SqlDbType.Text, SqlDbType.Text, SqlDbType.Text, SqlDbType.Int };
                    name_input = new string[] { "@sett_name", "@latin_name", "@bill", "@code" };
                    values     = new string[] { textBox4.Text, textBox5.Text, Convert.ToString(comboBox2.SelectedItem), Convert.ToString(Code) };
                    con1.ExecuteNonQueryProcedure("setscope_Endoscope_settings_data_Update1", name_input, values, types);


                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@do_in_hospital", "@code" };
                    values     = new string[] { Convert.ToString(do_in_hospital), Convert.ToString(Code) };
                    con1.ExecuteNonQueryProcedure("setscope_Endoscope_settings_data_Update2", name_input, values, types);


                    types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int };
                    name_input = new string[] { "@doctor_feed", "@code" };
                    values     = new string[] { Convert.ToString(doctor_feed), Convert.ToString(Code) };
                    con1.ExecuteNonQueryProcedure("setscope_Endoscope_settings_data_Update3", name_input, values, types);

                    ///////
                    if (can_delete_ == 1)
                    {
                        types      = new SqlDbType[] { SqlDbType.Int };
                        name_input = new string[] { "@code" };
                        values     = new string[] { Convert.ToString(Code) };
                        con1.ExecuteNonQueryProcedure("setscope_Instruments_setescope_delete", name_input, values, types);
                    }
                    for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                    {
                        string Code_dev    = this.dataGridView1.Rows[i].Cells[1].Value.ToString();
                        string Type        = this.dataGridView1.Rows[i].Cells[5].Value.ToString();
                        double time_use    = double.Parse(this.dataGridView1.Rows[i].Cells[3].Value.ToString());
                        int    Time_salhea = int.Parse(this.dataGridView1.Rows[i].Cells[4].Value.ToString());


                        types      = new SqlDbType[] { SqlDbType.VarChar, SqlDbType.Decimal, SqlDbType.VarChar, SqlDbType.Int, SqlDbType.Int };
                        name_input = new string[] { "@Code_dev", "@time_use", "@Type", "@Time_salhea", "@Code_" };
                        values     = new string[] { Code_dev, Convert.ToString(time_use), Type, Convert.ToString(Time_salhea), Convert.ToString(Code) };
                        con1.ExecuteNonQueryProcedure("setscope_", name_input, values, types);
                    }



                    if (can_delete == 1)
                    {
                        types      = new SqlDbType[] { SqlDbType.Int };
                        name_input = new string[] { "@code" };
                        values     = new string[] { Convert.ToString(Code) };
                        con1.ExecuteNonQueryProcedure("setscope_Mostlzmat_operation_delete", name_input, values, types);
                    }
                    for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
                    {
                        int    Mostlzmat_code = int.Parse(this.dataGridView2.Rows[i].Cells[1].Value.ToString());
                        string Mostlzmat_name = this.dataGridView2.Rows[i].Cells[2].Value.ToString();
                        int    amount         = int.Parse(this.dataGridView2.Rows[i].Cells[3].Value.ToString());


                        types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.Int };
                        name_input = new string[] { "@amount", "@Mostlzmat_code", "@Code" };
                        values     = new string[] { Convert.ToString(amount), Convert.ToString(Mostlzmat_code), Convert.ToString(Code) };
                        con1.ExecuteNonQueryProcedure("setscope_Mostlzmat", name_input, values, types);
                    }
                }
                else
                {
                    dr.Close();

                    MessageBox.Show(do_in_hospital + "        " + doctor_feed);



                    types      = new SqlDbType[] { SqlDbType.Text, SqlDbType.Text, SqlDbType.Int, SqlDbType.Int, SqlDbType.Text };
                    name_input = new string[] { "@sett_name", "@latin_name", "@do_in_hospital", "@doctor_feed", "@bill" };
                    values     = new string[] { textBox4.Text, textBox5.Text, Convert.ToString(do_in_hospital), Convert.ToString(doctor_feed), Convert.ToString(comboBox2.SelectedItem) };
                    con1.ExecuteNonQueryProcedure("setscope_Endoscope_settings_data_insert", name_input, values, types);



                    int max_EndoscopeCode;
                    types      = new SqlDbType[] { SqlDbType.Int };
                    name_input = new string[] { "@max_EndoscopeCode" };
                    values     = new string[] { "" };
                    dr         = con1.ShowDataInGridViewUsingStoredProcDR("setscope_Endoscope_settings_data_select_SET_code", name_input, values, types);
                    DataTable dt = new DataTable();
                    dt.Load(dr);
                    max_EndoscopeCode = Convert.ToInt32(dt);
                    // int max_EndoscopeCode = int.Parse(cmd.ExecuteScalar().ToString());

                    ////////////////////////////////////////////////////////////////
                    for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
                    {
                        string Code_dev    = this.dataGridView1.Rows[i].Cells[1].Value.ToString();
                        string Ttype       = this.dataGridView1.Rows[i].Cells[5].Value.ToString();
                        double timee_use   = double.Parse(this.dataGridView1.Rows[i].Cells[3].Value.ToString());
                        int    Time_salhea = int.Parse(this.dataGridView1.Rows[i].Cells[4].Value.ToString());


                        types      = new SqlDbType[] { SqlDbType.VarChar, SqlDbType.Int, SqlDbType.Int, SqlDbType.Decimal, SqlDbType.VarChar };
                        name_input = new string[] { "@Code_dev", "@timee_use", "@max_EndoscopeCode", "@Time_salhea", "@Ttype" };
                        values     = new string[] { Code_dev, Convert.ToString(timee_use), Convert.ToString(max_EndoscopeCode), Convert.ToString(Time_salhea), Ttype };
                        con1.ExecuteNonQueryProcedure("setscope_Instruments_setescope_insert", name_input, values, types);
                    }

                    for (int i = 0; i < dataGridView2.Rows.Count - 1; i++)
                    {
                        int    Mount_used   = int.Parse(this.dataGridView2.Rows[i].Cells[3].Value.ToString());
                        string Moztlzm_name = this.dataGridView2.Rows[i].Cells[2].Value.ToString();
                        int    Code_Moz     = int.Parse(this.dataGridView2.Rows[i].Cells[1].Value.ToString());


                        types      = new SqlDbType[] { SqlDbType.VarChar, SqlDbType.Int, SqlDbType.Int };
                        name_input = new string[] { "@max_EndoscopeCode", "@Code_Moz", "@Mount_used" };
                        values     = new string[] { Convert.ToString(max_EndoscopeCode), Convert.ToString(Code_Moz), Convert.ToString(Mount_used) };
                        con1.ExecuteNonQueryProcedure("setscope_Mostlzmat_operation_insert", name_input, values, types);
                    }
                }

                MessageBox.Show(اعدادات_المناظير.set_name);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "  error");
            }
        }
Beispiel #22
0
        private void حفظToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //con = new SqlConnection("server=localhost;database=graduationDB;pwd=root;uid=root");
            //cmd = new SqlCommand();
            //cmd.Connection = con;
            //con.Open();
            int      pid   = 0;
            string   query = "";
            DateTime dt    = DateTime.Now;
            String   date  = dt.ToString("yyyy/MM/dd");


            for (int i = 0; i < dataGridView1.Rows.Count; ++i)
            {
                //cmd = new SqlCommand();
                //cmd.Connection = con;
                DataGridViewRow row = dataGridView1.Rows[i];
                try
                {
                    if ((bool)row.Cells[0].EditedFormattedValue == true)
                    {
                        /*
                         *
                         *
                         *  create procedure clinic_patient_visit_update(@pid int, @visit_num int, @e_date date)
                         *  as
                         *  begin
                         *  update Patient_visit set Type2 = 'close', End_date = @e_date where p_id = @pid and num_Of_visit = @visit_num;
                         *  end
                         *
                         *
                         */


                        visit_num = int.Parse(row.Cells[3].Value.ToString());
                        pid       = int.Parse(row.Cells[1].Value.ToString());
                        // query = "update Patient_visit set Type2 = 'close' where p_id = " + pid + " and num_Of_visit = " + visit_num;

                        //cmd.CommandText = "clinic_patient_visit_update";
                        //cmd.CommandType = CommandType.StoredProcedure;
                        //cmd.Parameters.AddWithValue("@pid", pid);
                        //cmd.Parameters.AddWithValue("@visit_num", visit_num);
                        //cmd.Parameters.AddWithValue("@e_date", date);
                        //cmd.ExecuteNonQuery();


                        con1.OpenConection();
                        types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.Date };
                        name_input = new string[] { "@pid", "@visit_num", "@e_date" };
                        values     = new string[] { pid.ToString(), visit_num.ToString(), date };
                        con1.ExecuteNonQueryProcedure("clinic_entranceoffice_visit_update", name_input, values, types);
                        con1.CloseConnection();



                        if (row.Cells[6].Value.ToString() != "")
                        {
                            /*create procedure clinic_patient_visit_update_visit_Result(@pid_ int, @visit_num_ int, @result_visit varchar(50))
                             *  as
                             *  begin
                             *   update Patient_visit set visit_Result = @result_visit where p_id = @pid_ and num_Of_visit = @visit_num_;
                             *  end
                             *
                             *
                             */
                            result_visit = row.Cells[6].Value.ToString();
                            // update_ = "update Patient_visit set visit_Result  ='" + result_visit + "' where p_id = " + pid + " and num_Of_visit = " + visit_num;
                            //cmd.CommandText = "clinic_patient_visit_update_visit_Result";
                            //cmd.CommandType = CommandType.StoredProcedure;
                            //cmd.Parameters.AddWithValue("@pid_", pid);
                            //cmd.Parameters.AddWithValue("@visit_num_", visit_num);
                            //cmd.Parameters.AddWithValue("@result_visit", result_visit);
                            //cmd.ExecuteNonQuery();
                            con1.OpenConection();
                            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.VarChar };
                            name_input = new string[] { "@pid_", "@visit_num_", "@result_visit" };
                            values     = new string[] { pid.ToString(), visit_num.ToString(), result_visit };
                            con1.ExecuteNonQueryProcedure("clinic_entranceoffice_visit_update_visit_Result", name_input, values, types);
                            con1.CloseConnection();
                        }
                        // result_visit = row.Cells[6].Value.ToString();
                        if (row.Cells[8].Value.ToString() != "")
                        {
                            /*
                             * create procedure clinic_patient_visit_update_type_status(@_pid int, @_visit_num int, @status_type varchar(50))
                             *  as
                             *  begin
                             *   update Patient_visit set type_status = @status_type  where p_id = @_pid  and num_Of_visit =@_visit_num;
                             *  end
                             *
                             */
                            status_type = row.Cells[8].Value.ToString();
                            //update_ = "update Patient_visit set type_status   ='" + status_type + "' where p_id = " + pid + " and num_Of_visit = " + visit_num;
                            //cmd.CommandText = update_;
                            //cmd.CommandText = "clinic_patient_visit_update_type_status";
                            //cmd.CommandType = CommandType.StoredProcedure;
                            //cmd.Parameters.AddWithValue("@_pid", pid);
                            //cmd.Parameters.AddWithValue("@_visit_num", visit_num);
                            //cmd.Parameters.AddWithValue("@status_type", status_type);
                            //cmd.ExecuteNonQuery();
                            con1.OpenConection();
                            types      = new SqlDbType[] { SqlDbType.Int, SqlDbType.Int, SqlDbType.VarChar };
                            name_input = new string[] { "@_pid", "@_visit_num", "@status_type" };
                            values     = new string[] { pid.ToString(), visit_num.ToString(), status_type };
                            con1.ExecuteNonQueryProcedure("clinic_entranceoffice_visit_update_type_status", name_input, values, types);
                            con1.CloseConnection();
                        }

                        //if (row.Cells[11].Value.ToString() != "")
                        //{
                        //    /*create procedure clinic_patient_visit_update_file_location(@_pid_ int, @File_Location nvarchar(50))
                        //        as
                        //        begin
                        //        update Patient set file_location = @File_Location where patient_id = @_pid_;
                        //        end

                        //     *
                        //     */


                        //    File_Location = row.Cells[11].Value.ToString();

                        //    //cmd.CommandText = "clinic_patient_visit_update_file_location";
                        //    //cmd.CommandType = CommandType.StoredProcedure;
                        //    //cmd.Parameters.AddWithValue("@_pid_", pid);

                        //    //cmd.Parameters.AddWithValue("@File_Location", File_Location);
                        //    ////cmd.CommandText = update_;
                        //    //cmd.ExecuteNonQuery();
                        //    con1.OpenConection();
                        //    types = new SqlDbType[] {SqlDbType.Int, SqlDbType.NVarChar };
                        //    name_input = new string[] { "@_pid_", "@File_Location"};
                        //    values = new string[] { pid.ToString(), File_Location };
                        //    con1.ExecuteNonQueryProcedure("clinic_patient_visit_update_file_location", name_input, values, types);
                        //    con1.CloseConnection();



                        //}
                    }
                }
                catch (Exception exp)
                { }
            }


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