private void تاكيدالحجزالمستقبليToolStripMenuItem_Click(object sender, EventArgs e) { بحث_عن_عملية_في_تاريخ_معين f = new بحث_عن_عملية_في_تاريخ_معين(); f.MdiParent = this; f.Show(); }
private void cellclick(object sender, DataGridViewCellEventArgs e) { y = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); x = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString(); بحث_عن_عملية_في_تاريخ_معين f = new بحث_عن_عملية_في_تاريخ_معين(); f.Focus(); this.DialogResult = DialogResult.OK; }
//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("لا يمكن التعديل قبل اختيار عملية للتعديل"); } } }