protected void Page_Load(object sender, EventArgs e) { if (!UserType.Equals("mana")) { modify.Style.Add("display", "none"); } if (!Page.IsPostBack) { #region Get id int id; if (string.IsNullOrEmpty(Request.QueryString["id"])) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } try { id = int.Parse(Request.QueryString["id"]); } catch { throw new Exception("�Բ����������ʵ�ҳ�治����"); } #endregion LabMS.Model.Announcement noticeInfo; ExtendBLL.Announcement notice = new ExtendBLL.Announcement(); noticeInfo = notice.GetModel(id); if (noticeInfo == null) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } NoticeTitle.Text = noticeInfo.AnnouncementTitle; NoticeAttachment.Text = string.IsNullOrEmpty(noticeInfo.AttachmentPath) ? "<label style='color: #ff0000;'>������</label>" : "<a target='_blank' href='" + noticeInfo.AttachmentPath + "' >������ظ���</a>"; NoticeContent.Text = Server.HtmlDecode(noticeInfo.AnnouncementContent); NoticeExpireTime.Text = noticeInfo.ExpireTime.Value.ToString("yyyy��MM��dd��"); NoticeImportance.Text = (noticeInfo.Importance.HasValue && (noticeInfo.Importance.Value == 1)) ? "<label style='color: #ff0000;'>��Ҫ</label>" : "һ��"; NoticePubTime.Text = noticeInfo.PublishTime.Value.ToString("yyyy��MM��dd�� HH:mm"); LabMS.BLL.UserTable staff = new LabMS.BLL.UserTable(); LabMS.Model.UserTable staffInfo = staff.GetModel(noticeInfo.PublisherID.Value); // NoticeRole.Text = "����"; //TBD NoticePublisherName.Text = (staffInfo == null) ? "<del>��ɾ���û�</del>" : staffInfo.UserName; LabMS.BLL.Lab lab = new LabMS.BLL.Lab(); LabMS.Model.Lab labInfo = lab.GetModel(noticeInfo.LabID.Value); NoticeLab.Text = (labInfo == null) ? "ȫ��" : labInfo.Lab_Name; } }
//��ȡStaffID protected int GetStaffIDCodeByUserID(int ID) { LabMS.BLL.UserTable usertable = new LabMS.BLL.UserTable(); LabMS.Model.UserTable usertableModel = new LabMS.Model.UserTable(); LabMS.BLL.Staff staff = new LabMS.BLL.Staff(); List<LabMS.Model.Staff> staffModelList = new List<LabMS.Model.Staff>(); usertableModel = usertable.GetModel(ID); staffModelList = staff.GetModelList("Staff_Code='" + usertableModel.PCode + "'"); if (staffModelList.Count > 0) { return staffModelList[0].ID; } else return 0; }
protected void Page_Load(object sender, EventArgs e) { strPagePrivilege.Add("QBZY"); if (!UserType.Equals("mana")) { modify.Style.Add("display", "none"); } if (!Page.IsPostBack) { try { #region Get id int id; if (string.IsNullOrEmpty(Request.QueryString["id"])) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } try { id = int.Parse(Request.QueryString["id"]); } catch { throw new Exception("�Բ����������ʵ�ҳ�治����"); } #endregion LabMS.Model.Resource resourceInfo; ExtendBLL.Resource resource = new ExtendBLL.Resource(); resourceInfo = resource.GetModel(id); if (resourceInfo == null) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } LabMS.BLL.Lab lab = new LabMS.BLL.Lab(); LabMS.Model.Lab labInfo = lab.GetModel(resourceInfo.LabID.Value); ResourceLab.Text = (labInfo == null) ? "ȫ��" : labInfo.Lab_Name; if (resourceInfo.RecorderType == 0) // ����Ա { BLL.UserTable staff = new LabMS.BLL.UserTable(); LabMS.Model.UserTable staffInfo = staff.GetModel(resourceInfo.ResourceRecorder.HasValue ? resourceInfo.ResourceRecorder.Value : 0); ResourceRecorder.Text = (staffInfo == null) ? "<del>��ɾ���û�</del>" : staffInfo.UserName + " ����Ա"; } else if (resourceInfo.RecorderType == 1) { LabMS.BLL.Teacher teacher = new LabMS.BLL.Teacher(); LabMS.Model.Teacher teacherInfo = teacher.GetModel(resourceInfo.ResourceRecorder.HasValue ? resourceInfo.ResourceRecorder.Value : 0); ResourceRecorder.Text = (teacherInfo == null) ? "<del>��ɾ���û�</del>" : teacherInfo.Teacher_Name + " ��ʦ"; } // ResourceType.Text = resourceInfo.ResourceType.HasValue ? resourceInfo.ResourceType.Value.ToString() : ""; // TBD ResourceTitle.Text = resourceInfo.ResourceTitle; ResourceContent.Text = Server.HtmlDecode(resourceInfo.ResourceContent); ResourceVisitTime.Text = (resourceInfo.ResourceVisitTime.Value + 1).ToString(); ResourceRecordTime.Text = resourceInfo.ResourceRecordTime.Value.ToString("yyyy��MM��dd�� HH:mm"); if (!string.IsNullOrEmpty(resourceInfo.ResourceAttachmentPath)) { ResourceAttachment.Text = "<a target='_blank' href='" + resourceInfo.ResourceAttachmentPath + "' >������ظ���</a>"; } else { ResourceAttachment.Text = "<label style='color: #ff0000;'>������</label>"; } #region Tags DataSet dsTags = resource.GetTags(resourceInfo); System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i = dsTags.Tables[0].Rows.Count - 1; i > -1; i--) { sb.Append(dsTags.Tables[0].Rows[i]["TagName"]); if (i != 0) { sb.Append(","); } } ResourceTags.Text = sb.ToString(); #endregion resourceInfo.ResourceVisitTime += 1; resource.Update(resourceInfo); } catch (Exception ex) { } } }
/// <summary> /// 处理DS /// </summary> /// <param name="ds"></param> /// <returns></returns> protected DataSet HandleData(DataSet ds) { ds.Tables[0].Columns.Add("LabName"); ds.Tables[0].Columns.Add("RecorderName"); ds.Tables[0].Columns.Add("AttatchmentPath"); LabMS.Model.Lab labInfo; LabMS.BLL.Lab lab = new LabMS.BLL.Lab(); for (int i = ds.Tables[0].Rows.Count - 1; i > -1; i--) { int labID = int.Parse(ds.Tables[0].Rows[i]["LabID"].ToString()); labInfo = lab.GetModel(labID); ds.Tables[0].Rows[i]["LabName"] = (labInfo != null) ? labInfo.Lab_Name : "全部"; if (ds.Tables[0].Rows[i]["ResourceRecorderType"].ToString() == "0") // 管理员 { BLL.UserTable ut = new LabMS.BLL.UserTable(); LabMS.Model.UserTable utInfo = ut.GetModel(int.Parse(ds.Tables[0].Rows[i]["ResourceRecorder"].ToString())); ds.Tables[0].Rows[i]["RecorderName"] = (utInfo == null) ? "<del>已删除管理员</del>" : utInfo.UserName + " 管理员"; } else { BLL.Teacher teacher = new LabMS.BLL.Teacher(); LabMS.Model.Teacher teacherInfo = teacher.GetModel(int.Parse(ds.Tables[0].Rows[i]["ResourceRecorder"].ToString())); ds.Tables[0].Rows[i]["RecorderName"] = (teacherInfo == null) ? "<del>已删除老师</del>" : teacherInfo.Teacher_Name + " 老师"; } ds.Tables[0].Rows[i]["AttatchmentPath"] = ds.Tables[0].Rows[i]["ResourceAttachmentPath"]; } return ds; }
/// <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 void Page_Load(object sender, EventArgs e) { strPagePrivilege.Add("FBTZ"); strPagePrivilege.Add("CKTZ"); strPageUserType.Add("mana"); if (!Page.IsPostBack) { #region Get id int id; if (string.IsNullOrEmpty(Request.QueryString["id"])) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } try { id = int.Parse(Request.QueryString["id"]); } catch { throw new Exception("�Բ����������ʵ�ҳ�治����"); } #endregion LabMS.Model.Announcement noticeInfo; ExtendBLL.Announcement notice = new ExtendBLL.Announcement(); noticeInfo = notice.GetModel(id); if (noticeInfo == null) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } NoticeTitle.Text = noticeInfo.AnnouncementTitle; NoticeAttachmentFile.Text = string.IsNullOrEmpty(noticeInfo.AttachmentPath) ? "<label style='color: #ff0000;'>������</label>" : "<a target='_blank' href='" + noticeInfo.AttachmentPath + "' >������ظ���</a>"; NoticeContent.Text = Server.HtmlDecode(noticeInfo.AnnouncementContent); NoticeExpireTime.Text = noticeInfo.ExpireTime.Value.ToString("yyyy-MM-dd"); ImportanceValue.Value = (noticeInfo.Importance.HasValue && (noticeInfo.Importance.Value == 1)) ? "1" : "0"; NoticePubTime.Text = noticeInfo.PublishTime.Value.ToString("yyyy��MM��dd�� HH:mm"); LabMS.BLL.UserTable staff = new LabMS.BLL.UserTable(); LabMS.Model.UserTable staffInfo = staff.GetModel(noticeInfo.PublisherID.Value); NoticePublisherName.Text = (staffInfo == null) ? "<del>��ɾ���û�</del>" : staffInfo.UserName; #region Get Lab LabMS.BLL.Lab lab = new LabMS.BLL.Lab(); DataSet dsLabs = lab.GetList(" Lab_ParentID is null "); LabList.Items.Add(new ListItem("ȫ��", "-1")); foreach (DataRow dr in dsLabs.Tables[0].Rows) { ListItem li = new ListItem(); li.Text = dr["Lab_Name"].ToString(); li.Value = dr["ID"].ToString(); if (noticeInfo.LabID.Equals(int.Parse(li.Value))) { li.Selected = true; } LabList.Items.Add(li); } #endregion } }
protected void Page_Load(object sender, EventArgs e) { strPagePrivilege.Add("QBZY"); strPageUserType.Add("mana"); strPageUserType.Add("teacher"); if (!Page.IsPostBack) { try { #region Get id int id; if (string.IsNullOrEmpty(Request.QueryString["id"])) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } try { id = int.Parse(Request.QueryString["id"]); } catch { throw new Exception("�Բ����������ʵ�ҳ�治����"); } #endregion LabMS.Model.Resource resourceInfo; ExtendBLL.Resource resource = new ExtendBLL.Resource(); resourceInfo = resource.GetModel(id); if (resourceInfo == null) { throw new Exception("�Բ����������ʵ�ҳ�治����"); } #region ��ȡʵ���� LabMS.BLL.Lab lab = new LabMS.BLL.Lab(); DataSet dsLabs = lab.GetList(" Lab_ParentID is null "); ResourceLab.Items.Add(new ListItem("ȫ��", "-1")); foreach (DataRow dr in dsLabs.Tables[0].Rows) { ListItem li = new ListItem(); li.Text = dr["Lab_Name"].ToString(); li.Value = dr["ID"].ToString(); if (resourceInfo.LabID.Equals(int.Parse(li.Value))) { li.Selected = true; } ResourceLab.Items.Add(li); } #endregion if (resourceInfo.RecorderType.Equals(0)) // ����Ա { LabMS.BLL.UserTable staff = new LabMS.BLL.UserTable(); LabMS.Model.UserTable staffInfo = staff.GetModel(resourceInfo.ResourceRecorder.HasValue ? resourceInfo.ResourceRecorder.Value : 0); ResourceRecorder.Text = (staffInfo == null) ? "<del>��ɾ���û�</del>" : staffInfo.UserName + " ����Ա"; } else if (resourceInfo.RecorderType == 1) { LabMS.BLL.Teacher teacher = new LabMS.BLL.Teacher(); LabMS.Model.Teacher teacherInfo = teacher.GetModel(resourceInfo.ResourceRecorder.HasValue ? resourceInfo.ResourceRecorder.Value : 0); ResourceRecorder.Text = (teacherInfo == null) ? "<del>��ɾ���û�</del>" : teacherInfo.Teacher_Name + " ��ʦ"; } // ResourceType.Text = resourceInfo.ResourceType.HasValue ? resourceInfo.ResourceType.Value.ToString() : ""; // TBD ResourceTitle.Text = resourceInfo.ResourceTitle; ResourceContent.Text = Server.HtmlDecode(resourceInfo.ResourceContent); ResourceVisitTime.Text = (resourceInfo.ResourceVisitTime.Value + 1).ToString(); ResourceRecordTime.Text = resourceInfo.ResourceRecordTime.Value.ToString("yyyy��MM��dd�� hh:mm"); if (!string.IsNullOrEmpty(resourceInfo.ResourceAttachmentPath)) { ResourceAttachment.Text = "<a target='_blank' href='" + resourceInfo.ResourceAttachmentPath + "' >������ظ���</a>"; } else { ResourceAttachment.Text = "<label style='color: #ff0000;'>������</label>"; } #region Tags DataSet dsTags = resource.GetTags(resourceInfo); System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i = dsTags.Tables[0].Rows.Count - 1; i > -1; i--) { sb.Append(dsTags.Tables[0].Rows[i]["TagName"]); if (i != 0) { sb.Append(","); } } ResourceTags.Text = sb.ToString(); #endregion } catch (Exception ex) { } } }
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丢失,请退出系统,重新登录后进行修改密码!"); } }