protected void EmailButton_Click(object sender, EventArgs e) { try { string emailInfo = DataProvider.ChangePassword.getEmailPassword(EmailBox.Text.Trim().ToUpper()); //get user's email DataTable dt = HospitalClass.getDataTable(emailInfo); if (dt.Rows.Count > 0) { string firstName = HospitalClass.PascalCasing(dt.Rows[0][0].ToString()); string userId = dt.Rows[0][1].ToString(); string password = HospitalClass.Decrypt(dt.Rows[0][2].ToString()); string message = string.Format("Good day user {0}.\r\n\r\nYour user Id is: {1}\r\nYour password is: {2}", firstName, userId, password); MailMessage myMessage = new MailMessage(); myMessage.Body = message; //myMessage.From = new MailAddress(EmailBox.Text, UsernameBox.Text); //Unneccesary, set at web.config myMessage.To.Add(new MailAddress(EmailBox.Text.Trim())); SmtpClient mySender = new SmtpClient(); mySender.Send(myMessage); //uses config file settings to send message string updaterId = "", updateCode = "PWD_SND"; if (Session["SuperUser"] != null) { updaterId = (string)Session["SuperUser"]; } else if (Session["Admin"] != null) { updaterId = (string)Session["Admin"]; } else { updaterId = (string)Session["User"]; } List <string> values = new List <string>(); values.Add(HospitalClass.getTransactionId()); values.Add(updateCode); values.Add(updaterId); values.Add((string)Session["User"]); int status = DataConsumer.executeProcedure("audit_trail_proc", values); EmailLabel.CssClass = "success normal"; EmailLabel.Text = "Successful.<br/>Check your E-mail box for details."; } else { EmailLabel.CssClass = "error paraNormal"; if (EmailBox.Text.Length == 0) { EmailLabel.Text = "Please enter an email"; } else { EmailLabel.Text = "Email does not exist"; } } } catch (Exception ex) { EmailLabel.CssClass = "error paraNormal"; EmailLabel.Text = "Error: " + ex.Message; } }
public void completeAction() { System.Data.DataTable nameDt = HospitalClass.getDataTable(DataProvider.Patients.getName(SearchBox.Text.Trim().ToUpper())); SearchNameLabel.Text = "Name: " + HospitalClass.PascalCasing(nameDt.Rows[0][0].ToString()) + ", " + HospitalClass.PascalCasing(nameDt.Rows[0][1].ToString()); if (!DBNull.Value.Equals(nameDt.Rows[0][2])) { SearchNameLabel.Text += " " + HospitalClass.PascalCasing(nameDt.Rows[0][2].ToString()); } SearchNameLabel.Text += "<br/>User Id: "; SearchUserIdLabel.Text = SearchBox.Text.Trim().ToUpper(); SearchStatusLabel.CssClass = "success"; SearchStatusLabel.Text = "Found"; }
protected void SubmitButton_Click(object sender, EventArgs e) { string checkTopicExist = DataProvider.AddInformationPage.checkTopic(TopicBox.Text.Trim()); DataTable dt = HospitalClass.getDataTable(checkTopicExist); if ((UserIdBox.Text.Length >= 3 && UserIdBox.Text.Length <= 32) && (TopicBox.Text.Trim().Length >= 2 && TopicBox.Text.Length <= 32) && (InfoBox.Text.Length >= 4 && InfoBox.Text.Length <= 256) && RecipientList.SelectedIndex != 0 && dt.Rows.Count == 0) { List <string> values = new List <string>(); values.Add(InfoBox.Text); values.Add(RecipientList.SelectedItem.Value); values.Add(HospitalClass.PascalCasing(TopicBox.Text.Trim())); values.Add(HospitalClass.getTransactionId()); values.Add("INFO_ADD"); values.Add(UpdaterId()); values.Add(UserIdBox.Text); values.Add(""); values.Add("insert"); int status = DataConsumer.executeProcedure("info_proc", values); StatusLabel.CssClass = "success"; StatusLabel.Text = "Successful.<br/>Updater: " + UpdaterId() + "."; } else { StatusLabel.CssClass = "error"; if (dt.Rows.Count != 0) { StatusLabel.Text = "This topic already exists. Choose another topic name"; } else if (RecipientList.SelectedIndex == 0) { StatusLabel.Text = "Please select a recipient classification"; } else if (!(UserIdBox.Text.Length >= 3 && UserIdBox.Text.Length <= 32)) { StatusLabel.Text = "Please enter a valid user Id.<br/>Between 6 and 32 characters"; } else if ((TopicBox.Text.Length >= 2 && TopicBox.Text.Length <= 32)) { StatusLabel.Text = "Please enter a valid topic.<br/>Between 2 and 32 characters"; } else { StatusLabel.Text = "Please enter valid information.<br/>Between 4 and 256 characters"; } } }
public void completeAction() { System.Data.DataTable nameDt; if (RoleList.SelectedIndex == 0) { nameDt = HospitalClass.getDataTable(DataProvider.DoctorStaffHistory.getNameDoc(SearchBox.Text.Trim().ToUpper())); } else { nameDt = HospitalClass.getDataTable(DataProvider.DoctorStaffHistory.getNameStf(SearchBox.Text.Trim().ToUpper())); } SearchNameLabel.Text = "Name: " + HospitalClass.PascalCasing(nameDt.Rows[0][0].ToString()) + ", " + HospitalClass.PascalCasing(nameDt.Rows[0][1].ToString()); if (!DBNull.Value.Equals(nameDt.Rows[0][2])) { SearchNameLabel.Text += " " + HospitalClass.PascalCasing(nameDt.Rows[0][2].ToString()); } SearchNameLabel.Text += "<br/>User Id: "; SearchUserIdLabel.Text = SearchBox.Text.Trim().ToUpper(); SearchStatusLabel.CssClass = "success"; SearchStatusLabel.Text = "Found"; }
protected void Page_Load(object sender, EventArgs e) { string docQuery = DataProvider.GeneralClass.getDoctorsInfo(); DataTable dt = HospitalClass.getDataTable(docQuery); //populate doctors table for (int i = 0; i < dt.Rows.Count; i++) { TableRow row = new TableRow(); TableCell cell = new TableCell(); cell.Text = i + 1 + ""; row.Cells.Add(cell); Image img = new Image(); img.Width = (System.Web.UI.WebControls.Unit) 150; img.Height = (System.Web.UI.WebControls.Unit) 150; img.ID = "docImage" + (i + 1); if (!DBNull.Value.Equals(dt.Rows[i]["IMG_ADR"])) { img.ImageUrl = dt.Rows[i]["IMG_ADR"].ToString(); } else { img.ImageUrl = "~//images//UploadProfilePicture.png"; } cell = new TableCell(); cell.Height = (System.Web.UI.WebControls.Unit) 200; cell.Controls.Add(img); row.Cells.Add(cell); cell = new TableCell(); cell.Text = "Name: " + HospitalClass.PascalCasing(dt.Rows[i]["LAST_NAME"].ToString()) + " " + HospitalClass.PascalCasing(dt.Rows[i]["FIRST_NAME"].ToString()) + ".<br/>" + "Mobile: " + dt.Rows[i]["PHONE_NO"].ToString() + ".<br/>E-mail: " + dt.Rows[i]["EMAIL"].ToString() + "."; row.Cells.Add(cell); cell = new TableCell(); cell.Text = dt.Rows[i]["OTHER_INFO"].ToString(); row.Cells.Add(cell); DocTable.Rows.Add(row); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["SuperUser"] == null && Session["Admin"] == null && Session["User"] == null) { Response.Redirect("~/Login.aspx"); } if (Session["SuperUser"] != null || Session["Admin"] != null) { SuDiv.Visible = true; } UserIdBox.Text = Session["User"].ToString(); UserIdBox.ReadOnly = true; if (!IsPostBack) { DataTable dt = HospitalClass.getDataTable(DataProvider.ChangePassword.getEmail(Session["User"].ToString())); //get user email EmailBox.Text = HospitalClass.PascalCasing(dt.Rows[0][0].ToString()); } EmailBox.ReadOnly = true; if (Session["SuperUser"] != null || Session["Admin"] != null) { EmailBox.ReadOnly = false; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null && Session["Admin"] == null && Session["SuperUser"] == null) { Response.Redirect("~/Login.aspx"); //not logged in } Session["Unsubscribe"] = "Unsubscribe"; //set session to display unsubscribe link only on profile page WelcomeLabel.Text = "Welcome " + HospitalClass.PascalCasing((string)Session["FirstName"]); string regStatus = ""; if (Session["RegStatus"] != null) { regStatus = (string)Session["RegStatus"]; //registration status of user } if (regStatus.ToUpper() != "VALIDATED") { HistLabel.CssClass = "error"; HistLabel.Text = "Incomplete Registration".ToUpper(); InfoLabel.Visible = false; HistoryDiv.Visible = false; ActivitiesDiv.Visible = false; } try { //get profile picture string getPicAdr = DataProvider.LoggedInPage.getPicAddress((string)Session["User"]); DataTable picDt = HospitalClass.getDataTable(getPicAdr); if (picDt.Rows.Count > 0) { ProfilePic.ImageUrl = picDt.Rows[0][0].ToString(); } else { ProfilePic.ImageUrl = @"~\Images\UploadProfilePicture.PNG"; } //get user history information string histInfoQuery = DataProvider.LoggedInPage.getHistoryInfo((string)Session["User"]); DataTable histDt = HospitalClass.getDataTable(histInfoQuery); //populate user history table if (histDt.Rows.Count > 0) { for (int i = 0; i < histDt.Rows.Count; i++) { TableRow row = new TableRow(); for (int j = 0; j <= histDt.Columns.Count; j++) { TableCell cell = new TableCell(); if (j == 0) { cell.Text = (i + 1).ToString(); } else { if (!DBNull.Value.Equals(histDt.Rows[i][j - 1])) { cell.Text = histDt.Rows[i][j - 1].ToString(); } else { cell.Text = ""; } } row.Cells.Add(cell); } HistoryTable.Rows.Add(row); } } //get general information pertaining to user string userSubstring = ""; if (Session["User"].ToString().StartsWith("SUP") || Session["User"].ToString().StartsWith("ADM")) { userSubstring = ""; //gets all information } else { userSubstring = ((string)Session["User"]).Substring(0, 2); //gets related information } string generalInfoQuery = DataProvider.LoggedInPage.getGeneralInfo(userSubstring); DataTable genInfoDt = HospitalClass.getDataTable(generalInfoQuery); //populate information table if (genInfoDt.Rows.Count > 0) { for (int i = 0; i < genInfoDt.Rows.Count; i++) { TableRow row = new TableRow(); for (int j = 0; j <= genInfoDt.Columns.Count; j++) { TableCell cell = new TableCell(); if (j == 0) { cell.Text = (i + 1).ToString(); } else { if (!DBNull.Value.Equals(genInfoDt.Rows[i][j - 1])) { cell.Text = genInfoDt.Rows[i][j - 1].ToString(); } else { cell.Text = ""; } } row.Cells.Add(cell); } InformationTable.Rows.Add(row); } } } catch (Exception ex) { WelcomeLabel.CssClass = "error"; WelcomeLabel.Text += " (An error has occured)"; HospitalClass.Log(ex); } }
protected void DivModifyButton_Click(object sender, EventArgs e) { try { addDelDiv.Visible = true; //check for changes bool check = DivNameBox.Text.ToUpper() == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("DeptNameLabel")).Text.ToUpper(); check = check && DivIdBox.Text.ToUpper() == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("DeptIdLabel")).Text.ToUpper(); check = check && DivDescBox.Text == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("DeptDescLabel")).Text; //check for existence string checkDeptIdName = DataProvider.Departments.deptIdName(DivIdBox.Text.Trim().ToUpper(), HospitalClass.PascalCasing(DivNameBox.Text.Trim())); DataTable dt = HospitalClass.getDataTable(checkDeptIdName); //check fo acceptance of change bool check2 = DivNameBox.Text.ToUpper() != ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("DeptNameLabel")).Text.ToUpper(); check2 = check2 && DivIdBox.Text.ToUpper() != ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("DeptIdLabel")).Text.ToUpper(); if (DivNameBox.Text.Trim().Length >= 2 && DivDescBox.Text.Length >= 3 && DivIdBox.Text.Trim().Length >= 1 && !check && ((check2 && dt.Rows.Count == 0) || (!check2 && dt.Rows.Count == 1))) { string updaterId = "", updateCode = "DEPT_UPD"; if (Session["SuperUser"] != null) { updaterId = (string)Session["SuperUser"]; } else { updaterId = (string)Session["Admin"]; } List <string> values = new List <string>(); values.Add(DivIdBox.Text.Trim().ToUpper()); values.Add(HospitalClass.PascalCasing(DivNameBox.Text.Trim())); values.Add(((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("DeptNameLabel")).Text); values.Add(DivDescBox.Text); values.Add(HospitalClass.getTransactionId()); values.Add(updateCode); values.Add(updaterId); values.Add("update"); int status = DataConsumer.executeProcedure("dept_proc", values); StatusLabel.CssClass = "success normal"; StatusLabel.Text = "Successful ward modification.<br/>Department ID: " + DivIdBox.Text.Trim().ToUpper() + "<br/>Department Name:" + HospitalClass.PascalCasing(DivNameBox.Text.Trim()) + "."; addDelDiv.Visible = false; SortButton_Click(new object(), new EventArgs()); ListView1.SelectedIndex = -1; } else { StatusLabel.CssClass = "error paraNormal"; StatusLabel.Text = "User input error below"; DivStatusLabel.CssClass = "error normal"; if (DivNameBox.Text.Trim().Length < 2) { DivStatusLabel.Text = "Enter a valid department name"; } else if (DivDescBox.Text.Length < 3) { DivStatusLabel.Text = "Enter a valid department description"; } else if (DivIdBox.Text.Trim().Length < 1) { DivStatusLabel.Text = "Enter a department ID"; } else if (check) { DivStatusLabel.Text = "No change made"; } else { DivStatusLabel.Text = "Department ID/name already exists for another department"; } } } catch (Exception ex) { StatusLabel.CssClass = "error paraNormal"; StatusLabel.Text = "Error: " + ex.Message; HospitalClass.Log(ex); } }
protected void DivAddButton_Click(object sender, EventArgs e) { try { addDelDiv.Visible = true; if (DivNameBox.Text.Trim().Length >= 2 && DivDescBox.Text.Length >= 3 && DivIdBox.Text.Trim().Length >= 1) { //check for existence string checkDeptIdName = DataProvider.Departments.deptIdName(DivIdBox.Text.Trim().ToUpper(), HospitalClass.PascalCasing(DivNameBox.Text.Trim())); DataTable dt = HospitalClass.getDataTable(checkDeptIdName); if (dt.Rows.Count == 0) { string updaterId = "", updateCode = "DEPT_ADD"; if (Session["SuperUser"] != null) { updaterId = (string)Session["SuperUser"]; } else { updaterId = (string)Session["Admin"]; } List <string> values = new List <string>(); values.Add(DivIdBox.Text.Trim().ToUpper()); values.Add(HospitalClass.PascalCasing(DivNameBox.Text.Trim())); values.Add(""); values.Add(DivDescBox.Text); values.Add(HospitalClass.getTransactionId()); values.Add(updateCode); values.Add(updaterId); values.Add("insert"); int status = DataConsumer.executeProcedure("dept_proc", values); DivStatusLabel.CssClass = "success normal"; DivStatusLabel.Text = "Successful ward addition. <br/>Department ID: " + DivIdBox.Text.Trim().ToUpper() + "<br/>Department Name:" + HospitalClass.PascalCasing(DivNameBox.Text.Trim()) + "."; StatusLabel.CssClass = "success paraNormal"; StatusLabel.Text = "Done"; SortButton_Click(new object(), new EventArgs()); } else { StatusLabel.CssClass = "error paraNormal"; StatusLabel.Text = "User input error below"; DivStatusLabel.CssClass = "error normal"; if (dt.Rows[0][0].ToString() == DivIdBox.Text.Trim().ToUpper()) { DivStatusLabel.Text = "Department ID already exists"; } else { DivStatusLabel.Text = "Department name already exists"; } } } else { StatusLabel.CssClass = "error paraNormal"; StatusLabel.Text = "User input error below"; DivStatusLabel.CssClass = "error normal"; if (DivIdBox.Text.Trim().Length < 1) { DivStatusLabel.Text = "Enter a valid department id"; } else if (DivNameBox.Text.Length < 2) { DivStatusLabel.Text = "Enter a valid department name"; } else { DivStatusLabel.Text = "Enter a valid department description"; } } ListView1.SelectedIndex = -1; } catch (Exception ex) { StatusLabel.CssClass = "error paraNormal"; StatusLabel.Text = "Error: " + ex.Message; HospitalClass.Log(ex); } }
protected void DivModifyButton_Click(object sender, EventArgs e) { addDelDiv.Visible = true; //check for changes bool check = DivTopicBox.Text.ToUpper() == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("TopicLabel")).Text.ToUpper(); check = check && DivIdBox.Text.ToUpper() == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("SenderLabel")).Text.ToUpper(); check = check && DivDescBox.Text == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("InformationLabel")).Text; check = check && RecipientList.SelectedItem.Text == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("RecipientLabel")).Text; //check for existence string checkTopic = DataProvider.DeleteInformationPage.checkTopic(HospitalClass.PascalCasing(DivTopicBox.Text.Trim())); DataTable dt = HospitalClass.getDataTable(checkTopic); //check for acceptance of change bool check2 = DivTopicBox.Text.ToUpper() == ((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("TopicLabel")).Text.ToUpper(); if (DivTopicBox.Text.Trim().Length >= 2 && DivDescBox.Text.Length >= 3 && DivIdBox.Text.Trim().Length >= 1 && RecipientList.SelectedIndex != 0 && !check && ((!check2 && dt.Rows.Count == 0) || (check2 && dt.Rows.Count == 1))) { string updaterId = "", updateCode = "INFO_UPD"; if (Session["SuperUser"] != null) { updaterId = (string)Session["SuperUser"]; } else { updaterId = (string)Session["Admin"]; } List <string> values = new List <string>(); values.Add(DivDescBox.Text); values.Add(RecipientList.SelectedItem.Value); values.Add(HospitalClass.PascalCasing(DivTopicBox.Text.Trim())); values.Add(HospitalClass.getTransactionId()); values.Add(updateCode); values.Add(updaterId); values.Add(DivIdBox.Text); values.Add(((Label)ListView1.Items[ListView1.SelectedIndex].FindControl("TopicLabel")).Text); values.Add("update"); int status = DataConsumer.executeProcedure("info_proc", values); TopicDelLabel.CssClass = "success normal"; TopicDelLabel.Text = "Successful information modification.<br/> Updater: " + updaterId; addDelDiv.Visible = false; SortButton_Click(new object(), new EventArgs()); ListView1.SelectedIndex = -1; } else { TopicDelLabel.CssClass = "error paraNormal"; TopicDelLabel.Text = "User input error below"; DivStatusLabel.CssClass = "error paraNormal"; if (DivIdBox.Text.Trim().Length < 1) { DivStatusLabel.Text = "Enter a valid ID"; } else if (DivTopicBox.Text.Trim().Length < 2) { DivStatusLabel.Text = "Enter a valid topic name"; } else if (DivDescBox.Text.Length < 3) { DivStatusLabel.Text = "Enter valid information"; } else if (RecipientList.SelectedIndex == 0) { DivStatusLabel.Text = "Please select a recipient"; } else if (check) { DivStatusLabel.Text = "No change made"; } else { DivStatusLabel.Text = "The topic already exists"; } } }