protected void Calendar1_SelectionChanged(object sender, EventArgs e) { ScsBO sbo = new ScsBO(); int accountID = (int)(Session["accountID"]); string checkrole = (string)(Session["role"]); if (checkrole.Equals("CareStaff")) { DataTable dt = sbo.todayReport(accountID.ToString(), Calendar1.SelectedDate); StringBuilder html = new StringBuilder(); //Table start. html.Append("<table id='example' class='table table-striped table-bordered table-list'>"); //Building the Header row. html.Append("<thead>"); html.Append("<tr>"); foreach (DataColumn column in dt.Columns) { html.Append("<th>"); html.Append(column.ColumnName); html.Append("</th>"); } html.Append("</tr>"); html.Append("</thead>"); //Building the Data rows. html.Append("<tbody>"); foreach (DataRow row in dt.Rows) { html.Append("<tr>"); string url = ""; html.Append("<td align='left' valign='top'><a href=" + url + "Profile.aspx?studentID=" + row[0] + ">" + row[0] + "</a></td>"); for (int i = 1; i < dt.Columns.Count; i++) { List <StatusCheck> stl = new List <StatusCheck>(); stl = sbo.loadCheck(); if (i == 1) { html.Append("<td>"); html.Append(row[i]); foreach (StatusCheck sc in stl) { if (sc.attention == true && sc.studentID.Equals(row[0].ToString())) { html.Append(" <span style='color: red; ' class='glyphicon'></span>"); break; } } html.Append("</td>"); } else { html.Append("<td>"); html.Append(row[i]); html.Append("</td>"); } } html.Append("</tr>"); } //Table end. html.Append("</table>"); html.Append("</tbody"); //Append the HTML string to Placeholder. Panel1.Controls.Add(new Literal { Text = html.ToString() }); } else { DataTable dt = sbo.todayReportForHead(Calendar1.SelectedDate); StringBuilder html = new StringBuilder(); //Table start. html.Append("<table id='example' class='table table-striped table-bordered table-list'>"); //Building the Header row. html.Append("<thead>"); html.Append("<tr class='info'>"); foreach (DataColumn column in dt.Columns) { html.Append("<th>"); html.Append(column.ColumnName); html.Append("</th>"); } html.Append("</tr>"); html.Append("</thead>"); //Building the Data rows. html.Append("<tbody>"); foreach (DataRow row in dt.Rows) { html.Append("<tr>"); string url = ""; html.Append("<td align='left' valign='top'><a href=" + url + "Profile.aspx?studentID=" + row[0] + ">" + row[0] + "</a></td>"); for (int i = 1; i < dt.Columns.Count; i++) { List <StatusCheck> stl = new List <StatusCheck>(); stl = sbo.loadCheck(); if (i == 1) { html.Append("<td>"); html.Append(row[i]); foreach (StatusCheck sc in stl) { if (sc.attention == true && sc.studentID.Equals(row[0].ToString())) { html.Append(" <span style='color: red; ' class='glyphicon'></span>"); break; } } html.Append("</td>"); } else { html.Append("<td>"); html.Append(row[i]); html.Append("</td>"); } } html.Append("</tr>"); } //Table end. html.Append("</table>"); html.Append("</tbody"); //Append the HTML string to Placeholder. Panel1.Controls.Add(new Literal { Text = html.ToString() }); } }
protected void Page_Load(object sender, EventArgs e) { this.redirection_url = Request.Url.GetLeftPart(UriPartial.Authority) + "/UI/Homepage.aspx"; ScsBO sbo = new ScsBO(); StaffDAL stdal = new StaffDAL(); if (!IsPostBack) { if (Request.QueryString["code"] != null) { GetToken(Request.QueryString["code"].ToString()); } } if ((string)(Session["role"]) == null) { Response.Redirect("~/UI/Login.aspx"); } string staffName = (string)(Session["account"]); string usermail = (string)(Session["usermail"]); string checkrole = (string)(Session["role"]); string account = (string)(Session["account"]); if (checkrole == "HeadStaff") { divide.Visible = true; logCare.Visible = true; control.Visible = true; } else { divide.Visible = false; logCare.Visible = false; control.Visible = false; } int accountID = (int)(Session["accountID"]); //DateTime tm; DateTime today = DateTime.Now;/*DateTime.ParseExact("10/06/2018", "dd/MM/yyyy", CultureInfo.InvariantCulture); //Convert.ToDateTime("10/06/2018");*/ //if (!Page.IsPostBack) //{ // for (int td = 0; td < 7; td++) // { // tm = today.AddDays(-td); // DropDownList1.Items.Add(tm.ToString("dd/MM/yyyy")); // } //} if (!IsPostBack) { if (checkrole.Equals("CareStaff")) { DataTable dt = sbo.todayReport(accountID.ToString(), today); StringBuilder html = new StringBuilder(); //Table start. html.Append("<table id='example' class='table table-striped table-bordered table-list'>"); //Building the Header row. html.Append("<thead>"); html.Append("<tr>"); foreach (DataColumn column in dt.Columns) { html.Append("<th>"); html.Append(column.ColumnName); html.Append("</th>"); } html.Append("</tr>"); html.Append("</thead>"); //Building the Data rows. html.Append("<tbody>"); foreach (DataRow row in dt.Rows) { html.Append("<tr>"); string url = ""; html.Append("<td align='left' valign='top'><a href=" + url + "Profile.aspx?studentID=" + row[0] + ">" + row[0] + "</a></td>"); for (int i = 1; i < dt.Columns.Count; i++) { List <StatusCheck> stl = new List <StatusCheck>(); stl = sbo.loadCheck(); if (i == 1) { html.Append("<td>"); html.Append(row[i]); foreach (StatusCheck sc in stl) { if (sc.attention == true && sc.studentID.Equals(row[0].ToString())) { html.Append(" <span style='color: red; ' class='glyphicon'></span>"); break; } } html.Append("</td>"); } else { html.Append("<td>"); html.Append(row[i]); html.Append("</td>"); } } html.Append("</tr>"); } //Table end. html.Append("</table>"); html.Append("</tbody"); //Append the HTML string to Placeholder. Panel1.Controls.Add(new Literal { Text = html.ToString() }); } else { DataTable dt = sbo.todayReportForHead(today); StringBuilder html = new StringBuilder(); //Table start. html.Append("<table id='example' class='table table-striped table-bordered table-list'>"); //Building the Header row. html.Append("<thead>"); html.Append("<tr class='info'>"); foreach (DataColumn column in dt.Columns) { html.Append("<th>"); html.Append(column.ColumnName); html.Append("</th>"); } html.Append("</tr>"); html.Append("</thead>"); //Building the Data rows. html.Append("<tbody>"); foreach (DataRow row in dt.Rows) { html.Append("<tr>"); string url = ""; html.Append("<td align='left' valign='top'><a href=" + url + "Profile.aspx?studentID=" + row[0] + ">" + row[0] + "</a></td>"); for (int i = 1; i < dt.Columns.Count; i++) { List <StatusCheck> stl = new List <StatusCheck>(); stl = sbo.loadCheck(); if (i == 1) { html.Append("<td>"); html.Append(row[i]); foreach (StatusCheck sc in stl) { if (sc.attention == true && sc.studentID.Equals(row[0].ToString())) { html.Append(" <span style='color: red; ' class='glyphicon'></span>"); break; } } html.Append("</td>"); } else { html.Append("<td>"); html.Append(row[i]); html.Append("</td>"); } } html.Append("</tr>"); } //Table end. html.Append("</table>"); html.Append("</tbody"); //Append the HTML string to Placeholder. Panel1.Controls.Add(new Literal { Text = html.ToString() }); } } string name = (string)(Session["account"]); lbUserName.Text = name; }