private void ultraBtnPSearch_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); if (ultraComboPSearch.Value.ToString() == "Patient Name") { try { objHospitalDB = new HospitalDB(); Patient objPatient = new Patient(objHospitalDB); SqlCommand cmd = objHospitalDB.CreateCommand("Patient_Search"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@FullName", ultraTextPSearch.Text); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds); ultraGridPatient.DataSource = ds.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message); } } else if (ultraComboPSearch.Value.ToString() == "Date Of Registration") { objHospitalDB = new HospitalDB(); Patient objPatient = new Patient(objHospitalDB); SqlCommand cmd = objHospitalDB.CreateCommand("Patient_SearchByDate"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DOR", ultraDateTimePSearch.Value); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds); ultraGridPatient.DataSource = ds.Tables[0]; } }
private void ultraButtonSearch_Click(object sender, EventArgs e) { try { DataSet ddsPatientList = new DataSet(); objHospDB = new HospitalDB(); SqlCommand cmd = objHospDB.CreateCommand("dbo.PatientInfoSearchAll"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Name", SqlDbType.VarChar).Value = ultraTextEditorPatientName.Text; cmd.Parameters.AddWithValue("@DateOfBirth", SqlDbType.DateTime).Value = DateTime.Parse(uDTEDOR.Text); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(ddsPatientList); ultraGridPatientList.DataSource = ddsPatientList.Tables[0]; ultraGridPatientList.DataBind(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ultraBtnSearch_Click(object sender, EventArgs e) { DataSet ds = new DataSet(); if (ultraComboSearch.Value.ToString() == "Date Of Visit") { objHospitalDB = new HospitalDB(); // Visit objVisit = new Visit(objHospitalDB); // string Name = ultraDateTimeSearch.Text; // DateTime DOB = System.Convert.ToDateTime(ultraDateTimeEditorPatient.Text); Visit objVisit = new Visit(objHospitalDB); SqlCommand cmd = objHospitalDB.CreateCommand("Visit_SearchByDateVisit"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DateOfVisit", ultraDateTimeSearch.Value); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds); //dt = objVisit.GetAllAsDataTable(); ultraGridVisit.DataSource = ds.Tables[0]; /* DataView dvVisit = dtVisit.DefaultView; * dvVisit.RowFilter = "DateOfVisit = #" + Convert.ToDateTime(ultraDateTimeSearch.Value).ToString("MM/dd/yyyy") + "#"; * ultraGridVisit.DataSource = dvVisit.ToTable();*/ } else if (ultraComboSearch.Value.ToString() == "Date Of Discharge") { SqlCommand cmd = objHospitalDB.CreateCommand("Visit_SearchByDateDischarge"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DateOfDischarge", ultraDateTimeSearch.Value); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds); ultraGridVisit.DataSource = ds.Tables[0]; } else if (ultraComboSearch.Value.ToString() == "Patient Name") { objHospitalDB = new HospitalDB(); // Visit objVisit = new Visit(objHospitalDB); string Name = ultraTextSearch.Text; // DateTime DOB = System.Convert.ToDateTime(ultraDateTimeEditorPatient.Text); DataTable dt = new DataTable(); SqlCommand cmd = objHospitalDB.CreateCommand("Visit_SearchByName"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PatientName", Name); //cmd.Parameters.AddWithValue("@DateOfBirth", DOB); SqlDataAdapter sda = new SqlDataAdapter(cmd); sda.Fill(ds); //dt = objVisit.GetAllAsDataTable(); ultraGridVisit.DataSource = ds.Tables[0]; // ultraGridVisit.DataSource= objVisit.Search(objVisitRow); // dvVisit.RowFilter= Convert.ToString(objVisit.//Search(objVisitRow)); // ultraGridVisit.DataSource= dvVisit.ToTable(); /* DataView dvVisit = dtVisit.DefaultView; * dvVisit.RowFilter = "PatientName like '" + ultraTextSearch.Text + "%'"; * ultraGridVisit.DataSource = dvVisit.ToTable();*/ } }
private void ultraButtonRefreshBed_Click(object sender, EventArgs e) { dsBedList = new DataSet(); try { objHospitalDB = new HospitalDB(); SqlCommand cmd = objHospitalDB.CreateCommand("select * from BedInfo ", false); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dsBedList); ultraGridBedList.DataSource = dsBedList.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message); if (objHospitalDB != null) { objHospitalDB.Dispose(); } } //conn.Open(); //ultraGridBedList.Rows.Refresh(Infragistics.Win.UltraWinGrid.RefreshRow.RefreshDisplay); //conn.Close(); }
private void ultraBtnVDelete_Click(object sender, EventArgs e) { objHospitalDB = new HospitalDB(); ultraGridVisit.Rows[this.ultraGridVisit.ActiveRow.Index].Delete(true); SqlCommand query = objHospitalDB.CreateCommand("delete from Visit where VisitorID='" + this.Vis_id + "';", false); int p = query.ExecuteNonQuery(); MessageBox.Show(p + "Deleted"); }
private void frmBedView_Load(object sender, EventArgs e) { objHospitalDB = new HospitalDB(); SqlCommand cmd = objHospitalDB.CreateCommand("SELECT * FROM Bed"); SqlDataAdapter sdab = new SqlDataAdapter(cmd); dtBed = new DataTable(); sdab.Fill(dtBed); ultraGridBed.DataSource = dtBed; }
private void ultraButtonDeleteBed_Click(object sender, EventArgs e) { ultraGridBedList.Rows[this.ultraGridBedList.ActiveRow.Index].Delete(true); //conn.Open(); objHospitalDB = new HospitalDB(); SqlCommand cmd = objHospitalDB.CreateCommand("delete from BedInfo where BedIDD='" + this.id + "';"); int o = cmd.ExecuteNonQuery(); conn.Close(); MessageBox.Show(o + ":deleted"); }
private void ultraButtonSearchPatient_Click(object sender, EventArgs e) { dsPatientList = new DataSet(); // conn.Open(); objHospitalDB = new HospitalDB(); SqlCommand cmd = objHospitalDB.CreateCommand("Select * from PatientInfo where Name like '%" + ultraTextEditorPatientName.Text + "%' AND DateOfBirth ='" + ultraDateTimeEditorPatient.Text + "';"); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dsPatientList); ultraGridPatientList.DataSource = dsPatientList.Tables[0]; conn.Close(); }
private void LoadComboBoxBedId() { objHospDB = new HospitalDB(); SqlCommand cmd = objHospDB.CreateCommand("dbo.LoadBedId"); cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dtPatientVisitBed); comBoxBedID.Items.Add("--select--"); foreach (DataRow Row in dtPatientVisitBed.Rows) { comBoxBedID.Items.Add(Row["BedIDD"].ToString()); } }
private void ultraButtonDelete_Click(object sender, EventArgs e) { ultraGridPatientVisit.Rows[this.ultraGridPatientVisit.ActiveRow.Index].Delete(true); try { //conn.Open(); objHospDB = new HospitalDB(); SqlCommand cmd = objHospDB.CreateCommand("delete from PatientVisitInfo where ID='" + this.id + "';"); int o = cmd.ExecuteNonQuery(); //conn.Close(); MessageBox.Show(o + ":deleted"); //conn.Close(); }catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ultraButtonRefresh_Click(object sender, EventArgs e) { dsDoctorList = new DataSet(); try { objHospitalDB = new HospitalDB(); SqlCommand cmd = objHospitalDB.CreateCommand("select * from DoctorInfo"); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dsDoctorList); ultraGridDoctorList.DataSource = dsDoctorList.Tables[0]; } catch (Exception ex) { MessageBox.Show("Error"); } }
private void ultraBtnBRefresh_Click(object sender, EventArgs e) { try { objHospitalDB = new HospitalDB(); dsBed = new DataSet(); SqlCommand cmd = objHospitalDB.CreateCommand("Select * from [Hospital].[dbo].[Bed]", false); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dsBed); ultraGridBed.DataSource = dsBed.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message); if (objHospitalDB != null) { objHospitalDB.Dispose(); } } }
private void btnRegister_click(object sender, EventArgs e) { if (this.strFormMode == "Edit") { btnRegister.Text = "Update"; objHospDB = new HospitalDB(); SqlCommand cmd = objHospDB.CreateCommand("update PatientVisitInfo set PatientType='" + comBoxPatientType.Text + "',DoctorId='" + comBoxDoctorID.Text + "',BedId='" + comBoxBedID.Text + "',DateofVisit='" + dtDOV.Value.ToString() + "',DateofDischarge='" + dtDOR.Value.ToString() + "',Symptoms='" + tbSymptom.Text + "',Disease='" + tbDiaognasis.Text + "',Treatment='" + tbTreatment.Text + "' where ID= '" + tbID.Text + "'"); int obj = cmd.ExecuteNonQuery(); // conn.Close(); MessageBox.Show(obj + ":updated"); openfrmMain(); } else { // conn.Open(); objHospDB = new HospitalDB(); /* * PatientVisitInfo objpatientVisitInfo = new PatientVisitInfo( objHospDB); * PatientVisitInfoRow objPatientVisitInfoRow = new PatientVisitInfoRow(); * objPatientVisitInfoRow.PatientType = Convert.ToInt32(comBoxPatientType.Text); * objPatientVisitInfoRow.DoctorId = Convert.ToInt32(comBoxDoctorID.Text); * objPatientVisitInfoRow.BedId = Convert.ToInt32(comBoxBedID.Text); * //objPatientVisitInfoRow.DateofVisit = dtDOV.Value.ToString(); * // objPatientVisitInfoRow.DateofDischarge = dtDOR.Value.ToString(); * objPatientVisitInfoRow.Symptoms = tbSymptom.Text; * objPatientVisitInfoRow.Disease = tbDiaognasis.Text; * objPatientVisitInfoRow.Treatment = tbTreatment.Text; * * * objpatientVisitInfo.Insert(objPatientVisitInfoRow);*/ SqlCommand cmd = objHospDB.CreateCommand("insert into PatientVisitInfo values('" + comBoxPatientType.Text + "', '" + comBoxDoctorID.Text + "','" + comBoxBedID.Text + "','" + dtDOV.Value.ToString() + "','" + dtDOR.Value.ToString() + "','" + tbSymptom.Text + "','" + tbDiaognasis.Text + "','" + tbTreatment.Text + "')"); int o = cmd.ExecuteNonQuery(); // conn.Close(); MessageBox.Show(":Registered"); openfrmMain(); } }
private void ultraButtonRefreshPatientVisit_Click(object sender, EventArgs e) { dsPatientVisit = new DataSet(); try { objHospitalDB = new HospitalDB(); SqlCommand cmd = objHospitalDB.CreateCommand("select * from PatientVisitInfo ", false); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dsPatientList); ultraGridBedList.DataSource = dsPatientList.Tables[0]; } catch (Exception ex) { MessageBox.Show(ex.Message); if (objHospitalDB != null) { objHospitalDB.Dispose(); } } }
private void ultraButtonSearch_Click(object sender, EventArgs e) { try { dsPatientVisit = new DataSet(); objHospDB = new HospitalDB(); //SqlCommand cmd = objhospdb.CreateCommand("select Name,DoctorId,BedId, PatientType,DateofVisit,DateofDischarge,Symptoms,Disease,Treatment from PatientInfo p left join PatientVisitInfo o on p.Id = o.Id where Name like '%" + ultraTextEditorName.Text + "%' AND DateofVisit='" + ultraDateTimeEditorDOV.Value.ToString() + "' AND DateofDischarge='" + ultraDateTimeEditorDOA.Value.ToString() + "' ;"); SqlCommand cmd = objHospDB.CreateCommand("dbo.PatientVisitInfoSearchAll"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Name", SqlDbType.VarChar).Value = ultraTextEditorName.Text; cmd.Parameters.AddWithValue("@DateofVisit", SqlDbType.DateTime).Value = DateTime.Parse(ultraDateTimeEditorDOV.Text); // cmd.Parameters.AddWithValue("@DateofDischarge", SqlDbType.DateTime).Value = DateTime.Parse(ultraDateTimeEditorDOA.Text); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(dsPatientVisit); ultraGridPatientVisit.DataSource = dsPatientVisit.Tables[0]; // ultraGridPatientVisit.DataSource = dtPatientVisit; ultraGridPatientVisit.DataBind(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }