private void button2_Click(object sender, EventArgs e) { PatientPage ob = new PatientPage(); ob.Show(); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { string yes = "Yes"; connection sv = new connection(); sv.thisConnection.Open(); if (rel_date == "0") { OracleCommand thisCommand4 = sv.thisConnection.CreateCommand(); thisCommand4.CommandText = "update patient_data set release_date ='" + tday + "',if_release_paid ='" + yes + "'," + "rel_amount='" + textBox1.Text + "' where p_id= '" + p_id.Text + "'"; thisCommand4.Connection = sv.thisConnection; thisCommand4.CommandType = CommandType.Text; //For Insert Data Into Oracle// try { thisCommand4.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); } OracleCommand thisCommand2 = sv.thisConnection.CreateCommand(); // textBox1.Text = ""; thisCommand2.CommandText = "SELECT * FROM ward_allocation where ward_no= '" + wardNo + "'"; OracleDataReader thisReader2 = thisCommand2.ExecuteReader(); while (thisReader2.Read()) { // string ad_cost = thisReader["admit_cost"].ToString(); string tb = thisReader2["total_bed"].ToString(); int totalbed = Convert.ToInt32(tb); bf = thisReader2["bed_free"].ToString(); int bedFre = Convert.ToInt32(bf); if (bedFre <= totalbed) { int bed = (bedFre + 1); bedFree = bed.ToString(); } else if (bedFre > totalbed) { bedFree = tb; } try { // string filePath = thisReader["picture"].ToString(); // this.pb_profilepics.Image = Image.FromFile(filePath); } catch { MessageBox.Show("Failure"); } } OracleCommand thisCommand3 = sv.thisConnection.CreateCommand(); thisCommand3.CommandText = "update ward_allocation set bed_free ='" + bedFree + "' where ward_no= '" + wardNo + "'"; thisCommand3.Connection = sv.thisConnection; thisCommand3.CommandType = CommandType.Text; //For Insert Data Into Oracle// try { thisCommand3.ExecuteNonQuery(); MessageBox.Show("released"); } catch (Exception ex) { Console.WriteLine(ex.Message); } if (bf != "0") { OracleCommand thisCommand5 = sv.thisConnection.CreateCommand(); thisCommand5.CommandText = "update ward_allocation set empty_ward = ward_no where ward_no= '" + wardNo + "'"; OracleDataReader thisReader4 = thisCommand5.ExecuteReader(); } else if (bf == "0") { OracleCommand thisCommand6 = sv.thisConnection.CreateCommand(); thisCommand6.CommandText = "update ward_allocation set empty_ward = 0 where ward_no= '" + wardNo + "'"; OracleDataReader thisReader7 = thisCommand6.ExecuteReader(); } } else { MessageBox.Show("Have been released"); } sv.thisConnection.Close(); PatientPage ob = new PatientPage(); ob.Show(); this.Hide(); }
private void button3_Click(object sender, EventArgs e) { connection CN = new connection(); CN.thisConnection.Open(); if (seri >= 0) { seri = seri - 1; OracleCommand thisCommand3 = CN.thisConnection.CreateCommand(); thisCommand3.CommandText = "update DOCTOR_DATA set doc_visit_lim ='" + seri + "' where DOC_ID= '" + doc_ID + "'"; thisCommand3.Connection = CN.thisConnection; thisCommand3.CommandType = CommandType.Text; //For Insert Data Into Oracle// try { thisCommand3.ExecuteNonQuery(); // MessageBox.Show("Updated"); this.Hide(); } catch (Exception ex) { Console.WriteLine(ex.Message); } button2WasClicked = true; connection sv = new connection(); sv.thisConnection.Open(); OracleDataAdapter thisAdapter = new OracleDataAdapter("SELECT * FROM doctor_appointment", sv.thisConnection); OracleCommandBuilder thisBuilder = new OracleCommandBuilder(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, "doctor_appointment"); DataRow thisRow = thisDataSet.Tables["doctor_appointment"].NewRow(); try { thisRow["patient_name"] = textBox1.Text; thisRow["token_id"] = textBox3.Text; thisRow["p_age"] = textBox2.Text; thisRow["mobile"] = textBox6.Text; thisRow["req_date"] = dateTimePicker1.Value.ToString(); thisRow["doc_name"] = comboBox1.Text; thisRow["department"] = comboBox2.Text; thisRow["visit_status"] = "no comp"; thisDataSet.Tables["doctor_appointment"].Rows.Add(thisRow); int a = thisAdapter.Update(thisDataSet, "doctor_appointment"); if (a == 1) { MessageBox.Show("Successful"); } } catch (Exception ex) { MessageBox.Show(ex.Message); seri = seri + 1; OracleCommand thisCommand4 = CN.thisConnection.CreateCommand(); thisCommand4.CommandText = "update DOCTOR_DATA set doc_visit_lim ='" + seri + "' where DOC_ID= '" + doc_ID + "'"; thisCommand4.Connection = CN.thisConnection; thisCommand4.CommandType = CommandType.Text; //For Insert Data Into Oracle// try { thisCommand4.ExecuteNonQuery(); // MessageBox.Show("Updated"); this.Hide(); } catch (Exception dx) { Console.WriteLine(dx.Message); } } sv.thisConnection.Close(); PatientPage ob = new PatientPage(); ob.Show(); this.Hide(); } else { MessageBox.Show("Doctor visit Limit out!!!!"); } }
private void logincheck() { if (!(String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(textBox2.Text))) { try { connection CN = new connection(); CN.thisConnection.Open(); OracleCommand thisCommand = new OracleCommand(); thisCommand.Connection = CN.thisConnection; thisCommand.CommandText = "SELECT * FROM HOSPITAL_LOGIN WHERE username='******' AND password='******'"; thisReader = thisCommand.ExecuteReader(); if (thisReader.Read()) { if (comboBox1.Text == "Administrator" && thisReader["designation"].ToString() == "admin") { AdminPage oform = new AdminPage(); oform.Show(); this.Hide(); } else if (comboBox1.Text == "Doctor" && thisReader["designation"].ToString() == "doctor") { DoctorPage pat = new DoctorPage(textBox1.Text); pat.Show(); this.Hide(); } else if (comboBox1.Text == "Receptionist" && thisReader["designation"].ToString() == "receptionist") { PatientPage oform = new PatientPage(); oform.Show(); this.Hide(); } else if (comboBox1.Text == "Compounder" && thisReader["designation"].ToString() == "compounder") { compounder oform = new compounder(); oform.Show(); this.Hide(); } else if (comboBox1.Text == "Nurse" && thisReader["designation"].ToString() == "nurse") { nurse_page oform = new nurse_page(); oform.Show(); this.Hide(); } else { MessageBox.Show("select your using position"); } } else { MessageBox.Show("username or password incorrect"); } //this.Close(); CN.thisConnection.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else { MessageBox.Show("Please input username and password!!!!"); } }
private void button2_Click(object sender, EventArgs e) { button2WasClicked = true; connection sv = new connection(); sv.thisConnection.Open(); OracleDataAdapter thisAdapter = new OracleDataAdapter("SELECT * FROM patient_data", sv.thisConnection); OracleCommandBuilder thisBuilder = new OracleCommandBuilder(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, "patient_data"); DataRow thisRow = thisDataSet.Tables["patient_data"].NewRow(); try { thisRow["p_id"] = p_id.Text; thisRow["p_name"] = p_name.Text; thisRow["p_mobile"] = p_mob.Text; thisRow["address"] = p_add.Text; thisRow["refdoctor"] = comboBox1.Text; thisRow["admit_date"] = dateTimePicker1.Value.ToString(); thisRow["ward_no"] = ward_no.Text; thisRow["total_cost"] = textBox1.Text; thisRow["if_paid"] = "Yes"; thisRow["release_date"] = "0"; thisDataSet.Tables["patient_data"].Rows.Add(thisRow); int a = thisAdapter.Update(thisDataSet, "patient_data"); if (a == 1) { MessageBox.Show("Successful"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!String.IsNullOrEmpty(ward_no.Text)) { OracleCommand thisCommand4 = sv.thisConnection.CreateCommand(); thisCommand4.CommandText = "SELECT * FROM ward_allocation where ward_no= '" + ward_no.Text + "'"; OracleDataReader thisReader3 = thisCommand4.ExecuteReader(); // while (thisReader3.Read()) { string cmd2 = thisReader3["bed_free"].ToString(); int cc2 = Convert.ToInt32(cmd2); if (cc2 > 0) { result = (cc2 - 1); res = result.ToString(); } else { res = "0"; } if (cmd2 != "0") { OracleCommand thisCommand5 = sv.thisConnection.CreateCommand(); thisCommand5.CommandText = "update ward_allocation set empty_ward = ward_no where ward_no= '" + ward_no.Text + "'"; OracleDataReader thisReader4 = thisCommand5.ExecuteReader(); } else if (cmd2 == "0") { OracleCommand thisCommand6 = sv.thisConnection.CreateCommand(); thisCommand6.CommandText = "update ward_allocation set empty_ward = 0 where ward_no= '" + ward_no.Text + "'"; OracleDataReader thisReader7 = thisCommand6.ExecuteReader(); } OracleCommand thisCommand3 = sv.thisConnection.CreateCommand(); thisCommand3.CommandText = "update ward_allocation set " + "bed_free='" + res + "' where ward_no= '" + ward_no.Text + "'"; thisCommand3.Connection = sv.thisConnection; thisCommand3.CommandType = CommandType.Text; try { thisCommand3.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } sv.thisConnection.Close(); PatientPage ob = new PatientPage(); ob.Show(); this.Hide(); }