Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable ClassList = new DataTable();

            ClassList = da.GetClassList();
            if (ClassList.Rows.Count >= 1)
            {
                string str = "";

                foreach (DataRow row in ClassList.Rows)
                {
                    str += $"<tr>" +
                           $"<td>{row["CLASS_CODE"].ToString()}</td>" +
                           $"<td>{row["ROOM"].ToString()}</td>" +
                           $"<td>{row["NO"].ToString()}</td>" +
                           $"<td><a class='btn btn-primary' onclick='btn_click(\"{row["ID"].ToString()}\",\"{row["CLASS_CODE"].ToString()}\",\"{row["ROOM"].ToString()}\"); return false;' />Go to Class</a></td>" +
                           $"</tr>";
                }

                tblClass.Controls.Add(new LiteralControl(str));
            }
            else
            {
                string str = "<tr><td colspan='4'>None</td></tr>";
                tblClass.Controls.Add(new LiteralControl(str));
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable table = new DataTable();

            if (!IsPostBack)
            {
                if (Session["username"] == null)
                {
                    Response.Write("<script>window.close();");
                }

                string type = Request.QueryString["action"].ToString();
                string id   = Request.QueryString["id"].ToString();

                table = da.GetClassList();
                foreach (DataRow row in table.Rows)
                {
                    txtClassCode.Items.Add(new ListItem(row["CLASS_CODE"].ToString(), row["ID"].ToString()));
                }

                if (type == "Add")
                {
                    btnPerform.Value = "Add New Student";
                }
                else if (type == "Edit")
                {
                    btnPerform.Value     = "Edit";
                    btnDeletee.Visible   = true;
                    txtPassword.Disabled = true;

                    //Get Student by ID
                    table = new DataTable();
                    table = da.GetStudent(id);
                    txtStudentID.Value = table.Rows[0]["STUDENT_ID"].ToString();
                    txtName.Value      = table.Rows[0]["NAME"].ToString();
                    txtUsername.Value  = table.Rows[0]["USERNAME"].ToString();
                    txtClassCode.Items.FindByValue(table.Rows[0]["C_ID"].ToString()).Selected = true;
                }
                else
                {
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Check Session
            if (!IsPostBack)
            {
                if (Session["username"] == null)
                {
                    Response.Redirect("Default.aspx", false);
                }
            }

            DataTable ClassList = new DataTable();

            ClassList = da.GetClassList();
            if (ClassList.Rows.Count >= 1)
            {
                string str = "";

                foreach (DataRow row in ClassList.Rows)
                {
                    str += $"<tr>" +
                           $"<td>{row["CLASS_CODE"].ToString()}</td>" +
                           $"<td>{row["ROOM"].ToString()}</td>" +
                           $"<td>{row["NO"].ToString()}</td>" +
                           $"<td><a class='btn btn-primary' onclick='lol(\"AddClass.aspx?action=Edit&id={row["ID"].ToString()}\"); return false;' />Edit</a></td>" +
                           $"</tr>";
                }

                tblClass.Controls.Add(new LiteralControl(str));
            }
            else
            {
                string str = "<tr><td colspan='4'>None</td></tr>";
                tblClass.Controls.Add(new LiteralControl(str));
            }

            string StudentNo = da.GetStudentNo();
            string TeacherNo = da.GetTeacherNo();

            lblStudent.InnerHtml = StudentNo + " Students";
            lblTeacher.InnerHtml = TeacherNo + " Teachers";
        }