public ActionResult getStulistJsonByClassName(string ClassName)
        {
            List <StudentsExt> stulist = new StudentsManage().queryStudentsbyClassName(ClassName);
            string             stus    = new JavaScriptSerializer().Serialize(stulist);

            return(Json(stus, JsonRequestBehavior.AllowGet));
        }
        public ActionResult StudentShow()
        {
            int         studentId = Convert.ToInt32(Request.Params["StudentId"]);
            StudentsExt stu       = new StudentsManage().queryStudentByStudentId(studentId);

            return(View("StudentUpdate", stu));
        }
        public ActionResult StudentDetail()
        {
            int         studentId = Convert.ToInt32(Request.Params["StudentId"]);
            StudentsExt stu       = new StudentsManage().queryStudentByStudentId(studentId);

            ViewBag.stu = stu;
            return(View());
        }
        public ActionResult StudentManage()
        {
            string             className = Request.Params["ClassName"];
            List <StudentsExt> stulist   = new StudentsManage().queryStudentsbyClassName(className);

            ViewBag.className = className;
            ViewBag.stulist   = stulist;
            return(View());
        }
예제 #5
0
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        StudentsManage sm = new StudentsManage();
        DataTable      dt = sm.SelectByValue(TextBox1.Text.Trim());

        if (dt.Rows.Count != 0)
        {
            Label11.Text = dt.Rows[0]["name"].ToString();
            Label12.Text = dt.Rows[0]["college"].ToString();
            Label13.Text = dt.Rows[0]["subject"].ToString();
        }
    }
 // gridView 中单击按钮事件
 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "reviews")
     {
         StudentsManage sm = new StudentsManage();
         DataTable      dt = sm.SelectByValue(Session["studentId"].ToString());
         Label9.Text     = dt.Rows[0]["name"].ToString();
         reviews.Visible = true;
         Panel1.Visible  = true;
         Label2.Text     = Session["studentId"].ToString();
         GridViewRow row = (e.CommandSource as Control).NamingContainer as GridViewRow;
         TextBox1.Text = GridView1.DataKeys[row.RowIndex].Values[0].ToString();
         TextBox2.Text = GridView1.DataKeys[row.RowIndex].Values[1].ToString();
     }
 }
        public ActionResult StudentUpdate(StudentsExt stu)
        {
            int result = new StudentsManage().UpdateStudent(stu);

            if (result > 0)
            {
                return(Content("<script type='text/javascript'>alert('更新成功!');document.location='" + Url.Action("Index", "Students") + "'</script>"));
            }
            else if (result == 0)
            {
                return(Content("<script type='text/javascript'>alert('更新失败!');document.location='" + Url.Action("Index", "Students") + "'</script>"));
            }
            else
            {
                return(Content("<script type='text/javascript'>alert('系统异常');document.location='" + Url.Action("Index", "Students") + "'</script>"));
            }
        }
예제 #8
0
        static void Main(string[] args)
        {
            StudentsManage _studentList = new StudentsManage();

            Console.WriteLine("1-add; 2-all;3-GroupList;4-exit;");
            int answer = Convert.ToInt32(Console.ReadLine());

            while (answer == 1 || answer == 2 || answer == 3)
            {
                switch (answer)
                {
                case 1:
                    Console.WriteLine("Enter name of new student:");
                    string name_student = Console.ReadLine();
                    Console.WriteLine("Enter group_id  of new student:");
                    string group_id = Console.ReadLine();
                    int    testNum;
                    while (!int.TryParse(group_id, out testNum))
                    {
                        Console.WriteLine("Enter int");
                        group_id = Console.ReadLine();
                    }
                    string prepod_name;
                    switch (group_id)
                    {
                    case "1":
                        prepod_name = "Proffesor";
                        break;

                    case "2":
                        prepod_name = "Lector";
                        break;

                    case "3":
                        prepod_name = "Assistent";
                        break;

                    default:
                        prepod_name = "Proffessor";
                        break;
                    }
                    _studentList.NewStudent(new StudentsDescr(name_student, Convert.ToInt32(group_id), prepod_name));
                    break;

                case 2:
                    foreach (StudentsDescr s in StudentsManage.ViewStudentsList)
                    {
                        Console.Write(string.Format("{{0, -{0}}}|", 10), s.Name);
                        Console.Write(string.Format("{{0, -{0}}}|", 2), s.Group);
                        Console.Write(string.Format("{{0, -{0}}}|", 2), s.Prepod);
                        Console.WriteLine();
                    }

                    Console.ReadKey();
                    break;

                case 3:



                    var GroupList = from student in StudentsManage.ViewStudentsList
                                    group student by student.Prepod into g
                                    select new { Name = g.Key, Count = g.Count() };
                    foreach (var group in GroupList)
                    {
                        Console.WriteLine("{0} : {1}", group.Name, group.Count);
                    }

                    Console.ReadKey();
                    break;
                }
                Console.WriteLine("1-add; 2-all; 3-GroupList; 4-exit;");
                answer = Convert.ToInt32(Console.ReadLine());
                Console.ReadKey();
            }
        }
 protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
 {
     if (DropDownList1.SelectedValue == "admin")
     {
         AdminsManage am  = new AdminsManage();
         bool         n   = am.Login(txtName.Text.Trim(), txtPwd.Text.Trim());
         int          tmp = String.Compare(Request.Cookies["CheckCode"].Value, TextBox1.Text.Trim(), true);
         if (n && tmp == 0)
         {
             Session["adminId"] = txtName.Text.Trim();
             Response.Redirect("admin/adminDefault.aspx");
         }
         else if (tmp != 0)
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,验证码错误!');</script>");
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,用户名或者密码错误!');</script>");
         }
     }
     if (DropDownList1.SelectedValue == "teacher")
     {
         TeachersManage tm  = new TeachersManage();
         bool           n   = tm.Login(txtName.Text.Trim(), txtPwd.Text.Trim());
         int            tmp = String.Compare(Request.Cookies["CheckCode"].Value, TextBox1.Text.Trim(), true);
         if (n && tmp == 0)
         {
             Session["teacherId"] = txtName.Text.Trim();
             Response.Redirect("teacher/teaDefault.aspx");
         }
         else if (tmp != 0)
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,验证码错误!');</script>");
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,用户名或者密码错误!');</script>");
         }
     }
     if (DropDownList1.SelectedValue == "student")
     {
         StudentsManage sm  = new StudentsManage();
         bool           n   = sm.Login(txtName.Text.Trim(), txtPwd.Text.Trim());
         int            tmp = String.Compare(Request.Cookies["CheckCode"].Value, TextBox1.Text.Trim(), true);
         if (n && tmp == 0)
         {
             Session["studentId"] = txtName.Text.Trim();
             Response.Redirect("student/stuDefault.aspx");
         }
         else if (tmp != 0)
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,验证码错误!');</script>");
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('登陆失败,用户名或者密码错误!');</script>");
         }
     }
     this.txtName.Text  = "";
     this.TextBox1.Text = "";
 }