private void dataGridView3_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 6) { var dialogResult = MessageBox.Show(" هل تريد حذف الدواء المحدد من حساب المريض ؟", string.Empty, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { try { conn.OpenConection(); query = "DELETE FROM Visit_Medicine_Temp WHERE ID=" + dataGridView3.Rows[e.RowIndex].Cells[0].Value + ""; conn.ExecuteQueries(query); dataGridView3.Rows.RemoveAt(e.RowIndex); calculate(); query = "UPDATE Visit_Bill SET total_medicine=" + label9.Text + ", patient_medicine_amount=" + label2.Text + " WHERE visit_ID=" + VISIT_ID + ""; conn.ExecuteQueries(query); conn.CloseConnection(); MessageBox.Show("تم حذف الدواء المحدد من حساب المريض"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (dialogResult == DialogResult.No) { return; } } } }
private void button3_Click(object sender, EventArgs e) { con.OpenConection(); for (int i = 0; i < listBox3.Items.Count; i++) { string st1 = listBox3.Items[i].ToString(); con.ExecuteQueries("INSERT INTO [dbo].[follow_up_sheet_slected_med] ([med_name])VALUES( '" + st1 + "' )"); } }
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e) { //int x = dataGridView1.Rows[e.RowIndex].Cells[0].EditedFormattedValue; if (e.RowIndex == -1) { return; } DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dataGridView1.Rows[e.RowIndex].Cells[0]; if ((bool)dataGridView1.Rows[e.RowIndex].Cells[0].EditedFormattedValue) { int n = Int32.Parse(dataGridView1[1, e.RowIndex].Value.ToString()); int k = Int32.Parse(dataGridView1[2, e.RowIndex].Value.ToString()); string sql = "update notice set review=true where notice.claim_id =" + n + " and notice.notic_id = " + k; try { con.OpenConection(); //cmd = new sqlCommand(sql, con); //cmd.ExecuteNonQuery(); con.ExecuteQueries(sql); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { con.CloseConnection(); } } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 5) { var dialogResult = MessageBox.Show(" هل تريد حذف الخدمة المحددة من حساب المريض ؟", string.Empty, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { try { conn.OpenConection(); query = "DELETE FROM Visit_Services_Temp WHERE ID=" + dataGridView1.Rows[e.RowIndex].Cells[0].Value + ""; conn.ExecuteQueries(query); dataGridView1.Rows.RemoveAt(e.RowIndex); calculate(); conn.CloseConnection(); MessageBox.Show("تم حذف الخدمة المحددة من حساب المريض"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (dialogResult == DialogResult.No) { return; } } } }
private void ts_btn_save_Click(object sender, EventArgs e) { try { user = new cls_user(); if (this.Name == "add_user") { if (validate()) { if (user.insertdata("insert", txt_user_id.Text, txt_user_name.Text, txt_password.Text, txt_emp_id.Text)) { if (con.ExecuteQueries("insert into tb_priv(priv_screen_id,priv_user_id) select screen_id,'" + txt_user_id.Text + "' from tb_screen;")) { MessageBox.Show("تمت الاضافة بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } } } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_save_Click(object sender, EventArgs e) { bool ch = false; string user_code = frm_user.user_code; for (int i = 0; i < dgv_priv.Rows.Count; i++) { int dis1, add1, edit1, delete1; int screen_num = Convert.ToInt32(dgv_priv.Rows[i].Cells[0].Value); Boolean dis = dgv_priv.Rows[i].Cells[2].Value.Equals(true || false); if (dis == true) { dis1 = 1; } else { dis1 = 0; } Boolean add = dgv_priv.Rows[i].Cells[3].Value.Equals(true || false); if (add == true) { add1 = 1; } else { add1 = 0; } Boolean edit = dgv_priv.Rows[i].Cells[4].Value.Equals(true || false); if (edit == true) { edit1 = 1; } else { edit1 = 0; } Boolean delete = dgv_priv.Rows[i].Cells[5].Value.Equals(true || false); if (delete == true) { delete1 = 1; } else { delete1 = 0; } if (con.ExecuteQueries("update tb_priv set priv_display=" + dis1 + ",priv_add=" + add1 + ",priv_delete=" + delete1 + ",priv_edit=" + edit1 + " where priv_user_id='" + user_code + "' and priv_screen_id=" + screen_num + " ;")) { ch = true; } else { ch = false; break; } } if (ch == true) { MessageBox.Show("تم الحفظ بنجاح"); } }
private void button1_Click(object sender, EventArgs e) { if (VISIT_ID == "" || VISIT_ID == null) { MessageBox.Show("حدد الفاتورة من زر بحث"); return; } if (textBox1.Text == "") { MessageBox.Show("ادخل سبب الالغاء"); return; } try { var dialogResult = MessageBox.Show(" هل تريد الغاء الفاتورة ؟", string.Empty, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { try { conn.OpenConection(); query = @"INSERT INTO Visit_Delete (visit_ID, reason, User_code) VALUES (@visit_ID, @reason, @User_code)"; string[] Parameters = new string[] { "@visit_ID", "@reason", "@User_code" }; string[] Values = new string[] { VISIT_ID, textBox1.Text, User_ID.ToString() }; conn.ExecuteStoredProcQueries(query, Parameters, Values); query = @"DELETE FROM Visit_Bill WHERE visit_ID=" + VISIT_ID + @"; DELETE FROM Visit_Discount WHERE visit_ID=" + VISIT_ID + @"; DELETE FROM Visit_Medicine_Temp WHERE visit_ID=" + VISIT_ID + @"; DELETE FROM Visit_Residence_Temp WHERE visit_ID=" + VISIT_ID + @"; DELETE FROM Visit_Services_Temp WHERE visit_ID=" + VISIT_ID + @"; DELETE FROM Visit_Payment WHERE visit_ID=" + VISIT_ID + ";"; conn.ExecuteQueries(query); conn.CloseConnection(); clear(); MessageBox.Show("تم الغاء الفاتورة بنجاح "); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (dialogResult == DialogResult.No) { return; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 9) { var dialogResult = MessageBox.Show("هل تريد حذف الاقامة المحددة من حساب المريض ؟", string.Empty, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { try { conn.OpenConection(); query = "DELETE FROM Visit_Residence_Temp WHERE ID=" + dataGridView2.Rows[e.RowIndex].Cells[0].Value + ""; conn.ExecuteQueries(query); dataGridView2.Rows.RemoveAt(e.RowIndex); calculate(); query = "UPDATE Visit_Bill SET total_residence=" + label2.Text + ", patient_residence_amount=" + label8.Text + " WHERE visit_ID=" + VISIT_ID + ""; conn.ExecuteQueries(query); conn.CloseConnection(); MessageBox.Show("تم حذف الاقامة المحددة من حساب المريض"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (dialogResult == DialogResult.No) { return; } } } else if (e.ColumnIndex == 10) { var dialogResult = MessageBox.Show("هل تريد اغلاق فترة الاقامة المحددة ؟", string.Empty, MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { try { conn.OpenConection(); string date = DateTime.Now.ToString(); dataGridView2.Rows[e.RowIndex].Cells[5].Value = date; int numofday = NumOfDay(dataGridView2.Rows[e.RowIndex].Cells[4].Value.ToString(), dataGridView2.Rows[e.RowIndex].Cells[5].Value.ToString()); dataGridView2.Rows[e.RowIndex].Cells[6].Value = numofday; query = "UPDATE Visit_Residence_Temp SET number_of_days =" + numofday + " , end_date = GETDATE() WHERE ID=" + dataGridView2.Rows[e.RowIndex].Cells[0].Value + ""; conn.ExecuteQueries(query); calculate(); query = "UPDATE Visit_Bill SET total_residence=" + label2.Text + ", patient_residence_amount=" + label8.Text + " WHERE visit_ID=" + VISIT_ID + ""; conn.ExecuteQueries(query); conn.CloseConnection(); MessageBox.Show("تم اغلاق فترة الاقامة المحددة"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (dialogResult == DialogResult.No) { return; } } } }
private void حفظToolStripMenuItem_Click(object sender, EventArgs e) { //try //{ con1.OpenConection(); //cmd.CommandText = "select EndoscopeCode from Endoscope_settings_data"; //dr = cmd.ExecuteReader(); dr = con1.DataReader("select EndoscopeCode from Endoscope_settings_data"); if (textBox1.Text != "") { while (dr.Read()) { //MessageBox.Show(textBox1.Text); if (int.Parse(dr[0].ToString()) == int.Parse(textBox1.Text)) { Code = int.Parse(dr[0].ToString()); isequal = 1; dr.Close(); //MessageBox.Show(isequal.ToString()); break; } } } //MessageBox.Show(isequal.ToString()); if (isequal == 1) { //cmd.CommandText = "update Endoscope_settings_data set EndoscopeName = '" + textBox4.Text + "' , DescriptionLatino = '" + textBox5.Text + "' , Bill = '" + comboBox2.SelectedItem +"' where EndoscopeCode = " + Code; //cmd.ExecuteNonQuery(); con1.ExecuteQueries("update Endoscope_settings_data set EndoscopeName = '" + textBox4.Text + "' , DescriptionLatino = '" + textBox5.Text + "' , Bill = '" + comboBox2.SelectedItem + "' where EndoscopeCode = " + Code); if (checkBox1.Checked) { //cmd.CommandText = " update Endoscope_settings_data set do_in_hospital = 1 where EndoscopeCode = " + Code; //cmd.ExecuteNonQuery(); con1.ExecuteQueries(" update Endoscope_settings_data set do_in_hospital = 1 where EndoscopeCode = " + Code); } else { //cmd.CommandText = " update Endoscope_settings_data set do_in_hospital = 0 where EndoscopeCode = " + Code; //cmd.ExecuteNonQuery(); con1.ExecuteQueries(" update Endoscope_settings_data set do_in_hospital = 0 where EndoscopeCode = " + Code); } if (radioButton1.Checked) { //cmd.CommandText = " update Endoscope_settings_data set doctor_fees = 1 where EndoscopeCode = " + Code; //cmd.ExecuteNonQuery(); con1.ExecuteQueries(" update Endoscope_settings_data set doctor_fees = 1 where EndoscopeCode = " + Code); } else if (radioButton2.Checked) { //cmd.CommandText = " update Endoscope_settings_data set doctor_fees = 0 where EndoscopeCode = " + Code; //cmd.ExecuteNonQuery(); con1.ExecuteQueries(" update Endoscope_settings_data set doctor_fees = 0 where EndoscopeCode = " + Code); } } else { dr.Close(); if (checkBox1.Checked) { do_in_hospital = 1; } else { do_in_hospital = 0; } if (radioButton1.Checked) { doctor_feed = 1; } else if (radioButton2.Checked) { doctor_feed = 0; } // cmd.CommandText = "insert into Endoscope_settings_data (EndoscopeName, DescriptionLatino, do_in_hospital, doctor_fees, Bill) values ( '" + textBox4.Text + "' , '" + textBox5.Text + "' , " + do_in_hospital + "," + doctor_feed + ",'" + comboBox2.SelectedItem + "')"; //cmd.ExecuteNonQuery(); con1.ExecuteQueries("insert into Endoscope_settings_data (EndoscopeName, DescriptionLatino, do_in_hospital, doctor_fees, Bill) values ( '" + textBox4.Text + "' , '" + textBox5.Text + "' , " + do_in_hospital + "," + doctor_feed + ",'" + comboBox2.SelectedItem); } //MessageBox.Show(اعدادات_المناظير.set_name); con1.CloseConnection(); }
private void button3_Click(object sender, EventArgs e) { if (VISIT_ID == "" || VISIT_ID == null) { return; } try { conn.OpenConection(); string[] Parameters; string[] Values; int c = 0; double temp_price = 0; c = dataGridView1.Rows.Count; for (int i = 0; i < c; i++) { query = @"UPDATE Visit_Services_Temp SET price_before_discount=@price_before_discount, price_after_discount=@price_after_discount WHERE ID=@ID"; temp_price = Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value); Parameters = new string[3]; Values = new string[3]; Parameters[0] = "@price_before_discount"; Values[0] = temp_price.ToString(); Parameters[1] = "@price_after_discount"; Values[1] = (Patient_service_percentage * temp_price / 100).ToString(); Parameters[2] = "@ID"; Values[2] = dataGridView1.Rows[i].Cells[0].Value.ToString(); conn.ExecuteStoredProcQueries(query, Parameters, Values); } c = dataGridView2.Rows.Count; for (int i = 0; i < c; i++) { query = @"UPDATE Visit_Residence_Temp SET number_of_days=@number_of_days,price_before_discount=@price_before_discount, price_after_discount=@price_after_discount WHERE ID=@ID"; temp_price = Convert.ToDouble(dataGridView2.Rows[i].Cells[3].Value); Parameters = new string[4]; Values = new string[4]; Parameters[0] = "@number_of_days"; Values[0] = dataGridView2.Rows[i].Cells[6].Value.ToString(); Parameters[1] = "@price_before_discount"; Values[1] = temp_price.ToString(); Parameters[2] = "@price_after_discount"; Values[2] = (Patient_residence_percentage * temp_price / 100).ToString(); Parameters[3] = "@ID"; Values[3] = dataGridView2.Rows[i].Cells[0].Value.ToString(); conn.ExecuteStoredProcQueries(query, Parameters, Values); } c = dataGridView3.Rows.Count; for (int i = 0; i < c; i++) { query = @"UPDATE Visit_Medicine_Temp SET price_before_discount=@price_before_discount, price_after_discount=@price_after_discount WHERE ID=@ID"; temp_price = Convert.ToDouble(dataGridView3.Rows[i].Cells[3].Value); Parameters = new string[3]; Values = new string[3]; Parameters[0] = "@price_before_discount"; Values[0] = temp_price.ToString(); Parameters[1] = "@price_after_discount"; Values[1] = (Patient_medicine_percentage * temp_price / 100).ToString(); Parameters[2] = "@ID"; Values[2] = dataGridView3.Rows[i].Cells[0].Value.ToString(); conn.ExecuteStoredProcQueries(query, Parameters, Values); } /////////////////////////////////////////// query = @"INSERT INTO Visit_Bill (visit_ID,CE_Id,EB_id,EC_id, total_service, total_residence, total_medicine, patient_service_amount, patient_residence_amount, patient_medicine_amount,value_payment,date, User_code) VALUES (@visit_ID,@CE_Id,@EB_id,@EC_id,@total_service,@total_residence,@total_medicine,@patient_service_amount,@patient_residence_amount,@patient_medicine_amount,@value_payment,@date,@User_code)"; Parameters = new string[] { "@visit_ID", "@CE_Id", "@EB_id", "@EC_id", "@total_service", "@total_residence", "@total_medicine", "@patient_service_amount", "@patient_residence_amount", "@patient_medicine_amount", "@value_payment", "@date", "@User_code" }; Values = new string[] { label6.Text, EntityID, BranchEntityID, GroupID, label11.Text, label2.Text, label9.Text, label27.Text, label24.Text, label30.Text, label18.Text, DateTime.Now.ToString(), User_ID.ToString() }; conn.ExecuteStoredProcQueries(query, Parameters, Values); query = "UPDATE entranceoffice_visit SET state_of_visit =1 WHERE visit_id=" + VISIT_ID + ""; conn.ExecuteQueries(query); ///////////////////////////////////// query = @"SELECT Visit_Bill.ID, Visit_Bill.visit_ID, Registeration_patientRegisteration.patient_name, employee.name, Visit_Bill.date, Visit_Bill.total_service, Visit_Bill.total_residence, Visit_Bill.total_medicine, Visit_Bill.discount_amount, (Visit_Bill.total_service + Visit_Bill.total_residence + Visit_Bill.total_medicine)as total1, Visit_Bill.patient_service_amount, Visit_Bill.patient_residence_amount, Visit_Bill.patient_medicine_amount,(Visit_Bill.patient_service_amount + Visit_Bill.patient_residence_amount + Visit_Bill.patient_medicine_amount) as total2, value_payment, (Visit_Bill.patient_service_amount + Visit_Bill.patient_residence_amount + Visit_Bill.patient_medicine_amount - Visit_Bill.value_payment - Visit_Bill.discount_amount)as value_requested, tb_Contracting_Entities.CE_AName, tb_Entities_Branches.EB_Aname, tb_Entities_Category.EC_Aname,(tb_Contracting_Entities.CE_AName+' - '+ tb_Entities_Branches.EB_Aname +' - '+ tb_Entities_Category.EC_Aname)as full_name FROM employee INNER JOIN Users ON employee.emp_id = Users.emp_id INNER JOIN Visit_Bill ON Users.User_Code = Visit_Bill.User_code INNER JOIN Registeration_patientRegisteration INNER JOIN entranceoffice_visit ON Registeration_patientRegisteration.patient_id = entranceoffice_visit.pat_id INNER JOIN tb_Entities_Branches INNER JOIN tb_Contracting_Entities ON tb_Entities_Branches.EB_CE_id = tb_Contracting_Entities.CE_Id INNER JOIN tb_Entities_Category ON tb_Entities_Branches.EB_id = tb_Entities_Category.EC_EB_id ON entranceoffice_visit.EC_id = tb_Entities_Category.EC_id ON Visit_Bill.visit_ID = entranceoffice_visit.visit_id AND Visit_Bill.EB_id = tb_Entities_Branches.EB_id AND Visit_Bill.EB_id = tb_Entities_Branches.EB_id AND Visit_Bill.CE_Id = tb_Contracting_Entities.CE_Id AND Visit_Bill.visit_ID=" + VISIT_ID + ""; dt.Clear(); dt = (DataTable)conn.ShowDataInGridView(query); c = dt.Rows.Count; conn.CloseConnection(); if (c == 0) { MessageBox.Show("error"); } clear(); Run(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ts_btn_save_Click(object sender, EventArgs e) { string[] pramname = new string[27]; string[] pramvalue = new string[27]; SqlDbType[] pramtype = new SqlDbType[27]; pramname[0] = "@Compain_duration"; pramname[1] = "@L_Menstural_History"; pramname[2] = "@M_reliability"; pramname[3] = "@G"; pramname[4] = "@FTP"; pramname[5] = "@PTD"; pramname[6] = "@Abortion"; pramname[7] = "@abnormal_deliveries"; pramname[8] = "@number_of_cs"; pramname[9] = "@last_delivery"; pramname[10] = "@last_abortion"; pramname[11] = "@N_l_male"; pramname[12] = "@N_l_female"; pramname[13] = "@Contaceptive_Methods"; pramname[14] = "@duration"; pramname[15] = "@cause_discontiution"; pramname[16] = "@Medical_Disorders"; pramname[17] = "@Previous_Operations"; pramname[18] = "@Family_History"; pramname[19] = "@Drug_History"; pramname[20] = "@Chronic_Medical_Diseases"; pramname[21] = "@Blood_Transform_indication"; pramname[22] = "@Allegies"; pramname[23] = "@Obsterical_Gynecological"; pramname[24] = "@Others"; pramname[25] = "@F_History"; pramname[26] = "@visit_id"; pramvalue[0] = txt_complain_duration.Text; pramvalue[1] = dtp_L_menstural_History.Value.ToString(); pramvalue[2] = m_reliable.ToString(); pramvalue[3] = num_G.Value.ToString(); pramvalue[4] = num_ftd.Value.ToString(); pramvalue[5] = num_ptd.Value.ToString(); pramvalue[6] = num_abortion.Value.ToString(); pramvalue[7] = abnormal_delivers.ToString(); pramvalue[8] = num_css.Value.ToString(); pramvalue[9] = num_LastDelivery_since.Value.ToString(); pramvalue[10] = num_Last_abortion_since.Value.ToString(); pramvalue[11] = num_male.Value.ToString(); pramvalue[12] = num_famel.Value.ToString(); pramvalue[13] = Contaceptive_Method.ToString(); pramvalue[14] = txt_duration1.Text + "/" + txt_duration2.Text; pramvalue[15] = cause_of_destination1.Text + "/" + cause_of_destination2.Text; pramvalue[16] = Medical_Disorders.ToString(); pramvalue[17] = Previous_Operations.ToString(); pramvalue[18] = Family_History.ToString(); pramvalue[19] = drug_history.Text; pramvalue[20] = txt_CMD.Text; pramvalue[21] = txt_BTI.Text; pramvalue[22] = txt_allegries.Text; pramvalue[23] = txt_Obsterical_Gynecological.Text; pramvalue[24] = txt_others.Text; pramvalue[25] = f_history.Text; pramvalue[26] = visit_id; pramtype[0] = SqlDbType.NVarChar; pramtype[1] = SqlDbType.Date; pramtype[2] = SqlDbType.Bit; pramtype[3] = SqlDbType.Int; pramtype[4] = SqlDbType.Int; pramtype[5] = SqlDbType.Int; pramtype[6] = SqlDbType.Int; pramtype[7] = SqlDbType.Bit; pramtype[8] = SqlDbType.Int; pramtype[9] = SqlDbType.VarChar; pramtype[10] = SqlDbType.VarChar; pramtype[11] = SqlDbType.Int; pramtype[12] = SqlDbType.Int; pramtype[13] = SqlDbType.Bit; pramtype[14] = SqlDbType.NVarChar; pramtype[15] = SqlDbType.NVarChar; pramtype[16] = SqlDbType.Bit; pramtype[17] = SqlDbType.Bit; pramtype[18] = SqlDbType.Bit; pramtype[19] = SqlDbType.NVarChar; pramtype[20] = SqlDbType.NVarChar; pramtype[21] = SqlDbType.NVarChar; pramtype[22] = SqlDbType.NVarChar; pramtype[23] = SqlDbType.NVarChar; pramtype[24] = SqlDbType.NVarChar; pramtype[25] = SqlDbType.NVarChar; pramtype[26] = SqlDbType.NVarChar; int i; if (con.ExecuteInsertOrUpdateOrDeleteUsingStoredProc("Add_OBSTATRIC_HISTORY", pramname, pramvalue, pramtype)) { for (i = 0; i < indicationValue.Count; i++) { con.ExecuteQueries("insert into has_indications values ( " + indicationValue[i] + ",'" + visit_id + "')"); } for (i = 0; i < Abnormal_deliveries.Count; i++) { con.ExecuteQueries("insert into has_indications values ( " + Abnormal_deliveries[i] + ",'" + visit_id + "')"); } con.ExecuteQueries("insert into has_Contaceptive_methods values (" + cmb_conceptive_methods1.SelectedValue.ToString() + ",'" + visit_id + "');" + "insert into has_Contaceptive_methods values (" + cmb_conceptive_methods2.SelectedValue.ToString() + ",'" + visit_id + "');"); MessageBox.Show("تمت الاضافة بنجاح ", "تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } }