Exemplo n.º 1
0
        public void testPreviousSemesterEmpty()
        {
            ScsBO  sbo    = new ScsBO();
            string result = sbo.previousTerm("");;

            Assert.AreEqual("Fall2017", result);
        }
Exemplo n.º 2
0
        public void testPreviousSemesterInputNumberNagative()
        {
            ScsBO  sbo    = new ScsBO();
            string result = sbo.previousTerm("-9");;

            Assert.AreEqual("Fall2017", result);
        }
Exemplo n.º 3
0
        public void testPreviousSemesterMisstakeSemester()
        {
            ScsBO  sbo    = new ScsBO();
            string result = sbo.previousTerm("Spr2018");;

            Assert.AreEqual("Fall2017", result);
        }
Exemplo n.º 4
0
        public void testPreviousSemesterIsNull()
        {
            ScsBO  sbo    = new ScsBO();
            string result = sbo.previousTerm(null);;

            Assert.IsNull(result);
        }
Exemplo n.º 5
0
        public void testPreviousSemesterOneYear()
        {
            ScsBO  sbo    = new ScsBO();
            string result = sbo.previousTerm("Fall2018");;

            Assert.AreEqual("Summer2018", result);
        }
Exemplo n.º 6
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            ScsBO     sbo = new ScsBO();
            DataTable dt  = new DataTable();

            dt = sbo.Search(tbSearch.Text);
            GridView1.DataSourceID = null;
            GridView1.DataSource   = dt;
            GridView1.DataBind();
            lbResult.Text = dt.Rows.Count + " " + "Kết Quả Tìm Kiếm";
        }
Exemplo n.º 7
0
        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            ScsBO     sbo = new ScsBO();
            DataTable dt  = new DataTable();

            dt = sbo.Search(tbSearch.Text);
            GridView1.DataSourceID = null;
            GridView1.DataSource   = dt;
            GridView1.PageIndex    = e.NewPageIndex;
            int page    = e.NewPageIndex;
            int numLine = GridView1.PageSize;

            stt = page * numLine + 1;
            GridView1.DataBind();
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if ((Session["account"]) == null)
                {
                    Response.Redirect("~/UI/Login.aspx");
                }
                string checkrole = (string)(Session["role"]);
                string account   = (string)(Session["account"]);
                lbUserName.Text = account;

                if (checkrole == "HeadStaff")
                {
                    divide.Visible  = true;
                    logCare.Visible = true;
                    control.Visible = true;
                }
                else
                {
                    divide.Visible  = false;
                    logCare.Visible = false;
                    control.Visible = false;
                }

                string search = Request.QueryString["result"];
                if (!IsPostBack)
                {
                    if (search != null)
                    {
                        ScsBO     sbo = new ScsBO();
                        DataTable dt  = new DataTable();
                        dt = sbo.Search(search);
                        GridView1.DataSourceID = null;
                        GridView1.DataSource   = dt;
                        GridView1.DataBind();
                        tbSearch.Text = search;

                        lbResult.Text = dt.Rows.Count + " " + "Kết Quả Tìm Kiếm";
                    }
                }
            }catch (Exception ee)
            {
                Response.Redirect("~/UI/Error.aspx");
            }
        }
Exemplo n.º 9
0
        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'>&#xe086;</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'>&#xe086;</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()
                });
            }
        }
Exemplo n.º 10
0
        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'>&#xe086;</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'>&#xe086;</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;
        }