protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Eva.BLL.WebUser bllStudent = new BLL.WebUser(); Eva.Model.WebUser teacher = Session["user"] as Model.WebUser; var set = bllStudent.GetMyStudents(teacher.Id); StudentRepeater.DataSource = set; StudentRepeater.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Eva.BLL.Mark markBll = new BLL.Mark(); int id = int.Parse(Request["id"]); var set = markBll.GetListByStudentId(id); MarkRepeater.DataSource = set; MarkRepeater.DataBind(); Eva.BLL.WebUser blluser=new BLL.WebUser(); List<Model.WebUser> list = blluser.GetModelListStudents(id); Label1.Text =list[0].Name; } }
protected void btnlogin_Click(object sender, EventArgs e) { string strErr = ""; if (txtUserName.Text.Trim().Length==0) { strErr += "用户名不能为空!"; } if (txtPaw.Text.Trim().Length==0) { strErr += "密码不能为空!"; } if (strErr!="") { Maticsoft.Common.MessageBox.Show(this, strErr); return; } Eva.BLL.WebUser bllUser = new BLL.WebUser(); Eva.Model.WebUser user = new Model.WebUser(); string loginId = txtUserName.Text; string passWord = txtPaw.Text; user = bllUser.Login(loginId, passWord); if (user != null) { Session["user"] = user; if (user.AuthorityId == 1) { Response.Redirect("Student/ShowMark.aspx"); } if (user.AuthorityId == 2) { Response.Redirect("Teacher/StudentList.aspx"); } if (user.AuthorityId == 3) { Response.Redirect("Admin/ListUser.aspx"); } } else { Maticsoft.Common.MessageBox.Show(this, "密码或用户名错误!"); } }
public static int GetStuIdByName(string stuName) { var list = new BLL.WebUser().GetModelList(" Name= '" + stuName + " '"); return list.Count > 0 ? Convert.ToInt32(list[0].StudentId) : -1; }