protected void Page_Load(object sender, EventArgs e) { strPagePrivilege.Add("BJKB"); strPageUserType.Add("student"); if (!Page.IsPostBack) { if (!string.IsNullOrEmpty(UserID) && !string.IsNullOrEmpty(UserName)) { YearBind(); lb_Year.Text = ddl_Year.SelectedValue; if (ddl_Term.SelectedValue == "1") { lb_Term.Text = "��ѧ��"; } else { lb_Term.Text = "��ѧ��"; } int TempID = 0; if (int.TryParse(UserID,out TempID)) { if (TempID > 0) { LabMS.BLL.Student Student = new LabMS.BLL.Student(); LabMS.Model.Student model = Student.GetModel(TempID); if (model != null) { if (model.ClassID.HasValue) { LabMS.BLL.Class Class = new LabMS.BLL.Class(); LabMS.Model.Class classmodel = Class.GetModel(model.ClassID.Value); if (classmodel != null) { lb_ClassName.Text = classmodel.Class_Name; } } } } } DataBinds(); } else { LabMS.Common.JShelper.JSAlert(this, "error", "ϵͳ��������ϵ����Ա"); } } }
/// <summary> /// ���ݷ����������ҵ���ʵ�������������� /// </summary> /// <param name="posterID">�����߱�ʶ</param> /// <param name="PosterType">���������(0Ϊ����Ա,1Ϊ��ʦ,2Ϊѧ��)</param> /// <returns></returns> public string GetAuthorName(int posterID, string posterType) { string name = String.Empty; switch (posterType) { case "0": // ����Ա LabMS.BLL.UserTable ut = new LabMS.BLL.UserTable(); LabMS.Model.UserTable utInfo = ut.GetModel(posterID); if (utInfo != null) name = utInfo.UserName; break; case "1": //��ʦ LabMS.BLL.Teacher bTeacher = new LabMS.BLL.Teacher(); LabMS.Model.Teacher teacher = bTeacher.GetModel(posterID); if (teacher != null) name = teacher.Teacher_Name; break; case "2"://ѧ�� LabMS.BLL.Student bStudent = new LabMS.BLL.Student(); LabMS.Model.Student student = bStudent.GetModel(posterID); if (student != null) name = student.Student_Name; break; } return name; }
protected string CombineStr(int row, int column) { string strWhere = "1=1"; if (!string.IsNullOrEmpty(ddl_Year.SelectedValue)) { strWhere += " and Year='" + ddl_Year.SelectedValue + "'"; } if (!string.IsNullOrEmpty(ddl_Term.SelectedValue)) { strWhere += " and ScoreTerm ='" + ddl_Term.SelectedValue + "'"; } bool correct = false; int TempID=0; if(int.TryParse(UserID,out TempID)) { if (TempID > 0) { LabMS.BLL.Student Student = new LabMS.BLL.Student(); LabMS.Model.Student stundentmodel = Student.GetModel(TempID); if (stundentmodel != null) { if (stundentmodel.ClassID.HasValue) { strWhere += " and ClassID=" + stundentmodel.ClassID.Value; correct = true; } } } } if (!correct) { lb_Error.Text = "���ݴ�������ϵ����Ա"; } strWhere += " and "; strWhere += " WeekDay =" + row; strWhere += " and "; strWhere += " lession =" + column; int Start = 0; int End = 0; if (!string.IsNullOrEmpty(tb_StartWeek.Text)) { if (int.TryParse(tb_StartWeek.Text, out Start)) { strWhere += " and Week>=" + Start; } } if (!string.IsNullOrEmpty(tb_EndWeek.Text)) { if (int.TryParse(tb_EndWeek.Text, out End)) { strWhere += " and Week <=" + End; } } return strWhere; }
protected void Save_OnClick(object sender, EventArgs e) { #region if (String.IsNullOrEmpty(UserPasswordTBX.Text.Trim())) { Common.JShelper.JSAlert(Page, "script", "请输入旧密码!"); return; } if (UserPasswordTBX.Text.Length > 50) { Common.JShelper.JSAlert(Page, "script", "旧密码长度输入过长!"); return; } if (String.IsNullOrEmpty(NewPasswordTBX.Text.Trim())) { Common.JShelper.JSAlert(Page, "script", "请输入新密码密码!"); return; } if (NewPasswordTBX.Text.Length > 50) { Common.JShelper.JSAlert(Page, "script", "新密码长度输入过长!"); return; } if (!Regex.IsMatch(NewPasswordTBX.Text.Trim(), @"^\w+$")) { Common.JShelper.JSAlert(Page, "script", "新密码输入不合法(只能为数字、英文或下划线的组合)!"); return; } //if (String.IsNullOrEmpty(RePasswordTBX.Text.Trim())) //{ // Common.JShelper.JSAlert(Page, "script", "请重复输入新密码!"); //} //if (RePasswordTBX.Text.Length > 50) //{ // Common.JShelper.JSAlert(Page, "script", "重复新密码长度输入过长!"); //} //if (!Regex.IsMatch(RePasswordTBX.Text.Trim(), @"^\w+$")) //{ // Common.JShelper.JSAlert(Page, "script", "重复新密码输入不合法(只能为数字、英文或下划线的组合)!"); //} if (String.Compare(RePasswordTBX.Text, NewPasswordTBX.Text) != 0) { Common.JShelper.JSAlert(Page, "script", "两次新密码输入不一致!"); return; } //验证用户名和密码输入是否正确 if (!IsUserNameAndPassword()) { Common.JShelper.JSAlert(Page, "script", "用户名和密码输入不匹配!"); return; } #endregion if (!String.IsNullOrEmpty(UserID)) { int ID; if (int.TryParse(UserID, out ID)) { if (UserType == "mana") { LabMS.BLL.UserTable userTable = new LabMS.BLL.UserTable(); LabMS.Model.UserTable userTableModel = new LabMS.Model.UserTable(); userTableModel = userTable.GetModel(ID); userTableModel.Password = NewPasswordTBX.Text.Trim(); try { userTable.Update(userTableModel); Common.JShelper.JsAlertAndClose(Page, "script", "密码修改成功!"); } catch { Common.JShelper.JsAlertAndClose(Page, "script", "密码修改失败!"); } } else if (UserType == "teacher") { LabMS.BLL.Teacher userTable = new LabMS.BLL.Teacher(); LabMS.Model.Teacher userTableModel = new LabMS.Model.Teacher(); userTableModel = userTable.GetModel(ID); userTableModel.Password = NewPasswordTBX.Text.Trim(); try { userTable.Update(userTableModel); Common.JShelper.JsAlertAndClose(Page, "script", "密码修改成功!"); } catch { Common.JShelper.JsAlertAndClose(Page, "script", "密码修改失败!"); } } else { LabMS.BLL.Student userTable = new LabMS.BLL.Student(); LabMS.Model.Student userTableModel = new LabMS.Model.Student(); userTableModel = userTable.GetModel(ID); userTableModel.Student_Pass = NewPasswordTBX.Text.Trim(); try { userTable.Update(userTableModel); Common.JShelper.JsAlertAndClose(Page, "script", "密码修改成功!"); } catch { Common.JShelper.JsAlertAndClose(Page, "script", "密码修改失败!"); } } } else { Common.JShelper.JsAlertAndClose(Page, "script", "用户ID存储不合法,请退出系统,重新登录后进行修改密码!"); } } else { Common.JShelper.JsAlertAndClose(Page, "script", "用户Session丢失,请退出系统,重新登录后进行修改密码!"); } }