protected void saveButton_Click(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.PatientName = patientNameTextBox.Text; patientInfoInsertDao.MobileNumber = mobileNumberTextBox.Text; patientInfoInsertDao.Gender = genderDDList.SelectedItem.Text; patientInfoInsertDao.Date = dateTextBox.Text; patientInfoInsertDao.Serial = serialTextBox.Text; PatientInfoInsertDal patientInfoInsertDal = new PatientInfoInsertDal(); string save = patientInfoInsertDal.PatientGetInsert(patientInfoInsertDao); if (save == "Success") { saveButton.Text = "Saved"; saveButton.Enabled = false; patientNameTextBox.Text = ""; mobileNumberTextBox.Text = ""; genderDDList.ClearSelection(); dateTextBox.Text = ""; Response.Write("<script>alert('Save Successful.')</script>"); } else { Response.Write("<script>alert('Save Failed!')</script>"); } }
public string PatientSerial(PatientInfoInsertDao patientInfoInsertDao) { string finalCnt = ""; int cnt = 0; ConnectionClass connection = new ConnectionClass(); string query = "select Count(*) cnt from Patient_Info_Insert_T where Date='" + patientInfoInsertDao.Date + "'"; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); int temp = (int)cmd.ExecuteScalar(); cnt = temp + 1; if (cnt <= 5) { finalCnt = cnt.ToString(); } else { finalCnt = "Maximum Number Of Patient."; } } catch (Exception r) { finalCnt = "0"; } finally { connection.GetClose(); } return(finalCnt); }
protected void searchDateTextBox_TextChanged(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.SearchDate = searchDateTextBox.Text; SearchDateDal searchDateDal = new SearchDateDal(); DataTable search = searchDateDal.GetSearchDb(patientInfoInsertDao); if (search.Rows.Count > 0) { patientDDList.Items.Clear(); patientDDList.Items.Add("--Select--"); foreach (DataRow dr in search.Rows) { patientDDList.Items.Add(new ListItem(dr["Patient_Name"].ToString(), dr["Serial_No"].ToString())); } } else { patientDDList.Items.Clear(); patientDDList.Items.Add("--Empty List--"); messageGridView.Visible = false; } }
protected void saveButton_Click(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.PatientName = patientNameLabel.Text; patientInfoInsertDao.Age = patientAgeTextbox.Text; patientInfoInsertDao.Disease = diseaseTextBox.Text; patientInfoInsertDao.Medicine = medicineTextBox.Text; patientInfoInsertDao.Serial = serialNoLabel.Text; patientInfoInsertDao.Date = searchDateTextBox.Text; PatientRecordDBDal patientRecordDBDal = new PatientRecordDBDal(); string insertRecords = patientRecordDBDal.PatientRecordInsertDB(patientInfoInsertDao); if (insertRecords != "") { patientInfoInsertDao.SearchDate = searchDateTextBox.Text; patientInfoInsertDao.PatientName = patientNameLabel.Text; patientInfoInsertDao.Serial = serialNoLabel.Text; ReportPrintingDal reportPrintingDal = new ReportPrintingDal(); DataTable print = reportPrintingDal.GetPrintReportDB(patientInfoInsertDao); if (print.Rows.Count > 0) { ReportDocument rd = new ReportDocument(); rd.Load(Server.MapPath("~/UI/CrystalReport1.rpt")); rd.SetDataSource(print); DAO.ReportClass.rc = rd; Response.Redirect("ReportView.aspx"); } patientDDList.Items.Remove(patientDDList.SelectedItem); serialNoLabel.Text = ""; patientNameLabel.Text = ""; patientAgeTextbox.Text = ""; diseaseTextBox.Text = ""; medicineTextBox.Text = ""; searchDateTextBox.Text = ""; } else { Response.Write("There went something worng!"); } }
public DataTable GetSearchDb(PatientInfoInsertDao patientInfoInsertDao) { DataTable dt = new DataTable(); ConnectionClass connection = new ConnectionClass(); string query = "select *from Patient_Info_Insert_T where Date='" + patientInfoInsertDao.SearchDate + "'"; try { SqlDataAdapter da = new SqlDataAdapter(query, connection.GetOpen()); da.Fill(dt); } catch (Exception r) { dt = null; } finally { connection.GetClose(); } return(dt); }
protected void patientDDList_SelectedIndexChanged(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.PatientName = patientDDList.SelectedItem.Text; patientInfoInsertDao.SearchDate = searchDateTextBox.Text; PatientListDal patientListDal = new PatientListDal(); DataTable patientList = patientListDal.GetPatientList(patientInfoInsertDao); if (patientList.Rows.Count > 0) { messageGridView.Visible = true; messageGridView.DataSource = patientList; messageGridView.DataBind(); } else { Response.Write("<script>alert('No daata found!')</script>"); } }
protected void patientDDList_SelectedIndexChanged(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.Serial = patientDDList.SelectedItem.Text; patientInfoInsertDao.SearchDate = searchDateTextBox.Text; PatientListDDLDal patientListDDldal = new PatientListDDLDal(); DataTable patientList = patientListDDldal.GetPatientListDDl(patientInfoInsertDao); if (patientList.Rows.Count > 0) { serialNoLabel.Text = patientList.Rows[0]["Serial_No"].ToString(); patientNameLabel.Text = patientList.Rows[0]["Patient_Name"].ToString(); } else { serialNoLabel.Text = "No Serial No Found!"; patientNameLabel.Text = "No Patient Name Found!"; } }
protected void printReportButton_Click(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.SearchDate = searchDateTextBox.Text; patientInfoInsertDao.PatientName = patientDDList.SelectedItem.Text; patientInfoInsertDao.Serial = patientDDList.SelectedValue; ReportPrintingDal reportPrintingDal = new ReportPrintingDal(); DataTable print = reportPrintingDal.GetPrintReportDB(patientInfoInsertDao); if (print.Rows.Count > 0) { ReportDocument rd = new ReportDocument(); rd.Load(Server.MapPath("~/UI/CrystalReport1.rpt")); rd.SetDataSource(print); DAO.ReportClass.rc = rd; Response.Redirect("ReportView.aspx"); } }
protected void patientDDList_SelectedIndexChanged(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.PatientName = patientDDList.SelectedItem.Text; patientInfoInsertDao.SearchDate = searchDateTextBox.Text; PatientRecordShowInGridDal patientRecordsShowInGrid = new PatientRecordShowInGridDal(); DataTable patientList = patientRecordsShowInGrid.ShowRecordsInGrid(patientInfoInsertDao); if (patientList.Rows.Count > 0) { patientRecordsGrid.DataSource = patientList; patientRecordsGrid.DataBind(); printReportButton.Visible = true; } else { Response.Write("There are something wrong!"); } }
public DataTable GetPrintReportDB(PatientInfoInsertDao patientInfoInsertDao) { DataTable dt = new DataTable(); ConnectionClass connection = new ConnectionClass(); string query = "Select *from Patient_Records_T Where Date='" + patientInfoInsertDao.SearchDate + "' and Patient_Name='" + patientInfoInsertDao.PatientName + "' and Serial='" + patientInfoInsertDao.Serial + "'"; try { SqlDataAdapter da = new SqlDataAdapter(query, connection.GetOpen()); da.Fill(dt); } catch (Exception r) { dt = null; } finally { connection.GetClose(); } return(dt); }
public string PatientRecordInsertDB(PatientInfoInsertDao patientInfoInsertDao) { string isSuccess = ""; ConnectionClass connection = new ConnectionClass(); string query = "insert into Patient_Records_T values('" + patientInfoInsertDao.PatientName + "','" + patientInfoInsertDao.Age + "','" + patientInfoInsertDao.Disease + "','" + patientInfoInsertDao.Medicine + "','" + patientInfoInsertDao.Date + "','" + patientInfoInsertDao.Serial + "')"; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); cmd.ExecuteNonQuery(); isSuccess = "Save Success."; } catch (Exception r) { isSuccess = "Not Saved"; } finally { connection.GetClose(); } return(isSuccess); }
public string PatientGetInsert(PatientInfoInsertDao patientInfoInsertDao) { string isSuccess = ""; ConnectionClass connection = new ConnectionClass(); string query = "insert into Patient_Info_Insert_T values('" + patientInfoInsertDao.PatientName + "', '" + patientInfoInsertDao.MobileNumber + "', '" + patientInfoInsertDao.Gender + "', '" + patientInfoInsertDao.Date + "', '" + patientInfoInsertDao.Serial + "')"; try { SqlCommand cmd = new SqlCommand(query, connection.GetOpen()); cmd.ExecuteNonQuery(); isSuccess = "Success"; } catch { isSuccess = "Failed!"; } finally { connection.GetClose(); } return(isSuccess); }
protected void dateTextBox_TextChanged(object sender, EventArgs e) { saveButton.Enabled = true; saveButton.Text = "Save"; PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.Date = dateTextBox.Text; PatientGetSerialDal patientGetSerial = new PatientGetSerialDal(); string serial = patientGetSerial.PatientSerial(patientInfoInsertDao); if (serial.Length < 2) { serial = "0" + serial; } else { saveButton.Enabled = false; } string patientSerial = serial; serialTextBox.Text = patientSerial; }
protected void searchDateTextBox_TextChanged(object sender, EventArgs e) { PatientInfoInsertDao patientInfoInsertDao = new PatientInfoInsertDao(); patientInfoInsertDao.SearchDate = searchDateTextBox.Text; PatientRecordsDal patientRecords = new PatientRecordsDal(); DataTable search = patientRecords.GetPatientRecordsDB(patientInfoInsertDao); if (search.Rows.Count > 0) { patientDDList.Items.Clear(); patientDDList.Items.Add("--Select--"); foreach (DataRow dr in search.Rows) { patientDDList.Items.Add(new ListItem(dr["Patient_Name"].ToString(), dr["Serial"].ToString())); } } else { patientDDList.Items.Clear(); patientDDList.Items.Add("--Empty List--"); } }