-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add files
- Loading branch information
Showing
70 changed files
with
4,583 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Appointments.aspx.cs" Inherits="SmartCare.Appointments" %> | ||
|
||
<!DOCTYPE html> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head runat="server"> | ||
<title>JKL Healthcare</title> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css" /> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" /> | ||
<link rel="stylesheet" type="text/css" href="/styles/style_general.css" /> | ||
</head> | ||
<body> | ||
<form id="form1" runat="server"> | ||
|
||
<header class="w3-container w3-center w3-padding-32 w3-dark-gray"> | ||
<h1><b><i class="fa fa-users"></i> Caregiver and Patient Appointments</b></h1> | ||
</header> | ||
|
||
<div class="w3-panel w3-yellow w3-border" runat="server" id="divMessage"> | ||
<h3>System Mesage</h3> | ||
<p> <asp:Label ID="lblMessage" runat="server" ></asp:Label> </p> | ||
</div> | ||
|
||
<div class="w3-container w3-center w3-padding-16" runat="server" id="divAppointment"> | ||
<div class="w3-row w3-padding-16"> | ||
|
||
<div class="w3-third"> | ||
<label>Patient</label> | ||
<select id="selPatient" runat="server" class="w3-select w3-border w3-round-large w3-margin" required="required"></select> | ||
</div> | ||
<div class="w3-third"> | ||
<label>Date</label> | ||
<input type="date" id="txtDate" runat="server" class="w3-input w3-border w3-round-large w3-margin" required="required" /> | ||
</div> | ||
<div class="w3-third"> | ||
<label>Time Slot</label> | ||
<select id="selTimeSlot" runat="server" class="w3-input w3-select w3-border w3-round-large w3-margin" required="required"> | ||
<option value="">Select Time</option> | ||
<option value="12:00am-03:00am">12:00am-03:00am</option> | ||
<option value="03:00am-06:00am">03:00am-06:00am</option> | ||
<option value="06:00am-09:00am">06:00am-09:00am</option> | ||
<option value="09:00am-12:00pm">09:00am-12:00pm</option> | ||
<option value="12:00pm-03:00pm">12:00pm-03:00pm</option> | ||
<option value="03:00pm-06:00pm">03:00pm-06:00pm</option> | ||
<option value="06:00pm-09:00pm">06:00pm-09:00pm</option> | ||
<option value="09:00pm-12:00am">09:00pm-12:00am</option> | ||
</select> | ||
|
||
</div> | ||
|
||
|
||
</div> | ||
|
||
<div class="w3-row"> | ||
<asp:Button ID="btnMakeAppointment" runat="server" CssClass="w3-button w3-blue w3-block w3-large w3-hover-green w3-round-large w3-padding-16 w3-margin" Text="Make Appointment" OnClick="btnMakeAppointment_Click" /> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="w3-container w3-center w3-padding-32"> | ||
<label>My Appointments</label> | ||
<asp:GridView ID="gvAppointments" runat="server" CssClass="w3-table w3-striped w3-bordered w3-hoverable w3-white" AutoGenerateColumns="true" OnRowDeleting="gvAppointments_RowDeleting"> | ||
<Columns> | ||
<asp:CommandField ShowDeleteButton="True" DeleteText="Delete" /> | ||
</Columns> | ||
</asp:GridView> | ||
</div> | ||
|
||
|
||
|
||
<div class="w3-container w3-center w3-padding-16 w3-bottombar"> | ||
|
||
<asp:Button ID="btnBack" runat="server" Text="Back" CssClass="w3-button w3-block w3-large w3-hover-green w3-round-large w3-padding-16 w3-margin" OnClick="btnBack_Click" /> | ||
|
||
<a href="user_login.aspx" class="w3-button w3-block w3-large w3-hover-red w3-round-large w3-padding-16 w3-margin"> | ||
<i class="fa fa-sign-out"></i> Logout | ||
</a> | ||
</div> | ||
|
||
|
||
</form> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
using SmartCare.SystemCore; | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Web; | ||
using System.Web.UI; | ||
using System.Web.UI.WebControls; | ||
|
||
namespace SmartCare | ||
{ | ||
public partial class Appointments : System.Web.UI.Page | ||
{ | ||
string allowedRole = ""; | ||
|
||
|
||
protected void Page_Load(object sender, EventArgs e) | ||
{ | ||
//SECURE: Check RBAC | ||
if (Session["role"].ToString() == "") | ||
{ | ||
Session["SystemMessage"] = "You are not authorized to access this page"; | ||
Response.Redirect("SystemMessage.aspx"); | ||
} | ||
|
||
|
||
//Initiate UI | ||
divMessage.Visible = false; | ||
|
||
//Initiate Data access | ||
DataAccessLayer.DataAccess dataAccess = new DataAccessLayer.DataAccess(); | ||
|
||
if (!IsPostBack) | ||
{ | ||
//Initiate Data | ||
selPatient.DataSource = dataAccess.assignmentsPatientReadByCaregiverIdActive(Session["userId"].ToString()); | ||
selPatient.DataTextField = "name"; | ||
selPatient.DataValueField = "userId"; | ||
selPatient.DataBind(); | ||
selPatient.Items.Insert(0, new ListItem("Select Patient", "")); | ||
|
||
displayAppointmentsData(); | ||
} | ||
} | ||
|
||
protected void btnMakeAppointment_Click(object sender, EventArgs e) | ||
{ | ||
//Initiate Data access | ||
DataAccessLayer.DataAccess dataAccess = new DataAccessLayer.DataAccess(); | ||
|
||
|
||
//SECURE: Validate user inputs | ||
if (selPatient.Value == "" || txtDate.Value == "" || selTimeSlot.Value == "") | ||
{ | ||
divMessage.Visible = true; | ||
lblMessage.Text = "Please, choose Patient, Date and Time."; | ||
return; | ||
} | ||
|
||
|
||
//DATA: Check duplicates | ||
DataTable dbRecords1 = dataAccess.appointmentsReadByCaregiverUserIdPatientUserIdDateTimeActive(Session["userId"].ToString(), selPatient.Value, txtDate.Value, selTimeSlot.Value); | ||
if (dbRecords1 != null && dbRecords1.Rows.Count != 0) | ||
{ | ||
divMessage.Visible = true; | ||
lblMessage.Text = "Duplicate Appointment: " + txtDate.Value + " at " + selTimeSlot.Value; | ||
return; | ||
} | ||
|
||
//DATA: Create Database records | ||
string dbRecords2 = dataAccess.appointmentsInsert(Session["userId"].ToString(), selPatient.Value,txtDate.Value, selTimeSlot.Value, "", Session["userId"].ToString()); | ||
if (dbRecords2 == null || dbRecords2.Length == 0) | ||
{ | ||
divMessage.Visible = true; | ||
lblMessage.Text = "Appointment creation failed"; | ||
return; | ||
} | ||
|
||
//Display message to user | ||
divMessage.Visible = true; | ||
lblMessage.Text = "Appointment creation successful"; | ||
|
||
//Send email to users | ||
string toEmail = dataAccess.userRecordsEmailReadByUserId(Session["userId"].ToString()); | ||
string emailResult = ServiceCore.SendEmail("JKL Healthcare - Appointment", "Your account registered for an Appointment successfully, login for details.", toEmail); | ||
toEmail = dataAccess.userRecordsEmailReadByUserId(selPatient.Value); | ||
emailResult = ServiceCore.SendEmail("JKL Healthcare - Appointment", "Your account registered for an Appointment successfully, login for details.", toEmail); | ||
|
||
//Display assignments data | ||
displayAppointmentsData(); | ||
|
||
//Reset UI | ||
selPatient.SelectedIndex = 0; | ||
txtDate.Value = ""; | ||
selTimeSlot.SelectedIndex = 0; | ||
|
||
} | ||
|
||
protected void gvAppointments_RowDeleting(object sender, GridViewDeleteEventArgs e) | ||
{ | ||
//DATA: Read appointmentId | ||
string appointmentId = gvAppointments.DataKeys[e.RowIndex].Value.ToString(); | ||
|
||
//DATA: Delete Database record | ||
DataAccessLayer.DataAccess dataAccess = new DataAccessLayer.DataAccess(); | ||
string dbRecords = dataAccess.appointmentsDeleteByAppointmentId(appointmentId); | ||
|
||
if (dbRecords == null || dbRecords.Length == 0) | ||
{ | ||
divMessage.Visible = true; | ||
lblMessage.Text = "Appointment deletion failed"; | ||
return; | ||
} | ||
|
||
//Display message to user | ||
divMessage.Visible = true; | ||
lblMessage.Text = "Appointment deletion successful"; | ||
|
||
//Display appointments data | ||
displayAppointmentsData(); | ||
|
||
e.Cancel = false; | ||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
private string displayAppointmentsData() | ||
{ | ||
//Initiate Data access | ||
DataAccessLayer.DataAccess dataAccess = new DataAccessLayer.DataAccess(); | ||
|
||
if (Session["userId"] == null) return ""; | ||
|
||
//Display list of assignments | ||
gvAppointments.DataSource = dataAccess.appointmentsReadByUserIdActive( Session["userId"].ToString() ); | ||
gvAppointments.DataKeyNames = new string[] { "appointmentId" }; //DataKeyNames="appointmentId" | ||
gvAppointments.DataBind(); | ||
|
||
return ""; | ||
} | ||
|
||
|
||
|
||
|
||
protected void btnBack_Click(object sender, EventArgs e) | ||
{ | ||
Response.Redirect(UserData.getCurrentUserDashboard(Session["role"].ToString())); | ||
} | ||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.