コード例 #1
0
ファイル: UserDefault.aspx.cs プロジェクト: dalinhuang/labms
 /// <summary>
 /// 新增
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 //protected void addUser_Click(object sender, EventArgs e)
 //{
 //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>window.open('Add.aspx','','top=200,left=250,height=400,width=500');</script>");
 //}
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void cancleUser_Click(object sender, EventArgs e)
 {
     CheckBox chk;
     bool success = false;
     LabMS.BLL.UserTable BuserTable = new LabMS.BLL.UserTable();
     for (int i = 0; i < gvuser.Rows.Count; i++)
     {
         chk = (CheckBox)gvuser.Rows[i].FindControl("chkchoose");
         if (chk.Checked)
         {
             int UserId = int.Parse(gvuser.DataKeys[i].Value.ToString());
             try
             {
                 BuserTable.Delete(UserId);
                 success = true;
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         }
     }
     if (success == true)
     {
         Common.JShelper.JSAlert(this.Page, "", "删除用户信息成功!");
         Bind();
     }
     else
     {
         Common.JShelper.JSAlert(this.Page, "", "删除用户信息失败!");
     }
 }
コード例 #2
0
ファイル: UserRole.cs プロジェクト: dalinhuang/labms
        /// <summary>
        /// 根据RoleId查找出所有拥有该角色的用户
        /// </summary>
        /// <param name="RoleId"></param>
        /// <returns></returns>
        public DataSet GetUserInfoByRoleID(int RoleId)
        {
            LabMS.BLL.UserRole BUR = new LabMS.BLL.UserRole();
            List<LabMS.Model.UserRole> list = new List<LabMS.Model.UserRole>();
            string str = "RoleID=" + RoleId;
            list = BUR.GetModelList(str);

            LabMS.BLL.UserTable BUserTable = new LabMS.BLL.UserTable();
            DataSet ds = new DataSet();
            int UserID;
            string strsql = "";
            if (list.Count > 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    UserID = int.Parse(list[i].UserID.Value.ToString());
                    if (i == list.Count - 1)
                    {
                        strsql += " UserID=" + UserID;
                    }
                    else
                    {
                        strsql += " UserID=" + UserID + " or ";
                    }
                }
            }
            else
            {
                throw(new Exception("2"));//没有用户拥有该角色
            }
            ds=BUserTable.GetList(strsql);
            return ds;
        }
コード例 #3
0
ファイル: Detail.aspx.cs プロジェクト: dalinhuang/labms
        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;
            }
        }
コード例 #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string psw = context.Request.Params["Password"].ToString();
            string usercode = context.Request.Params["UserCode"].ToString();
            string usertype = context.Request.Params["UserType"].ToString();
            string returnvalue="";
            if (usertype == "mana")
            {
                LabMS.BLL.UserTable userTable = new LabMS.BLL.UserTable();
                List<LabMS.Model.UserTable> userTableModelList = new List<LabMS.Model.UserTable>();

                userTableModelList = userTable.GetModelList("Password='******' and PCode='" + usercode + "'");
                if (userTableModelList.Count == 1)
                {
                    returnvalue = "\"" + psw + "\",true";
                }
                else
                {
                    returnvalue = "\"" + psw + "\",false";
                }
            }
            else if (usertype == "student")
            {
                LabMS.BLL.Student userTable = new LabMS.BLL.Student();
                List<LabMS.Model.Student> userTableModelList = new List<LabMS.Model.Student>();

                userTableModelList = userTable.GetModelList("Student_Pass='******' and Student_Code='" + usercode + "'");
                if (userTableModelList.Count == 1)
                {
                    returnvalue = "\"" + psw + "\",true";
                }
                else
                {
                    returnvalue = "\"" + psw + "\",false";
                }
            }
            if (usertype == "teacher")
            {
                LabMS.BLL.Teacher userTable = new LabMS.BLL.Teacher();
                List<LabMS.Model.Teacher> userTableModelList = new List<LabMS.Model.Teacher>();

                userTableModelList = userTable.GetModelList("Password='******' and Teacher_Code='" + usercode + "'");
                if (userTableModelList.Count == 1)
                {
                    returnvalue = "\"" + psw + "\",true";
                }
                else
                {
                    returnvalue = "\"" + psw + "\",false";
                }
            }

            context.Response.Write(returnvalue);
        }
コード例 #5
0
ファイル: Index.aspx.cs プロジェクト: dalinhuang/labms
        //��ȡ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;
        }
コード例 #6
0
ファイル: ShowUser.aspx.cs プロジェクト: dalinhuang/labms
 /// <summary>
 /// 搜索
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnserach_Click(object sender, EventArgs e)
 {
     if(string.IsNullOrEmpty(tbUserName.Text.Trim()))
     {
         //Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"","<script type='text/javascript'>alert('请输入要搜索的用户名');</script>");
         Common.JShelper.JSAlert(this.Page, "", "请输入要搜索的用户名!");
         tbUserName.Focus();
     }
     else
     {
         string str = "UserName like '%" + tbUserName.Text.Trim() + "%'";
         LabMS.BLL.UserTable BUT = new LabMS.BLL.UserTable();
         DataSet ds = BUT.GetList(str);
         ds = HandleDataSet(ds);
         gvRole.DataSource = ds.Tables[0].DefaultView;
         gvRole.DataBind();
     }
 }
コード例 #7
0
ファイル: UserTable.cs プロジェクト: dalinhuang/labms
 /// <summary>
 /// 根据用户ID获得用户列表信息
 /// </summary>
 /// <param name="Userid"></param>
 /// <returns></returns>
 public List<LabMS.Model.UserTable> GetUserTableByUserID(int Userid)
 {
     LabMS.BLL.UserTable But = new LabMS.BLL.UserTable();
     return But.GetModelList("UserID="+Userid);
 }
コード例 #8
0
ファイル: Detail.aspx.cs プロジェクト: dalinhuang/labms
        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)
                {
                }
            }
        }
コード例 #9
0
ファイル: Add.aspx.cs プロジェクト: dalinhuang/labms
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tbUserName.Text.Trim()))
            {
                Common.JShelper.JSAlert(this.Page, "", "用户名不能为空!");
                tbUserName.Focus();
                return;
            }
            else if (string.IsNullOrEmpty(tbRealName.Text.Trim()))
            {
                Common.JShelper.JSAlert(this.Page, "", "真实姓名不能为空!");
                tbRealName.Focus();
                return;
            }
            else if (string.IsNullOrEmpty(tbPassword.Text.Trim()))
            {
                Common.JShelper.JSAlert(this.Page, "", "密码不能为空!");
                tbPassword.Focus();
                return;
            }
            else
            {
                if (!EBut.IsExistUserName(tbUserName.Text.Trim()))//用户名已经存在,不能注册
                {
                    Common.JShelper.JSAlert(this.Page, "", "用户名已经存在!");
                    tbUserName.Text = "";
                    tbUserName.Focus();
                    return;
                }
                else
                {
                    //往用户表里添加信息
                    LabMS.Model.UserTable Mut = new LabMS.Model.UserTable();
                    DataSet ds = new DataSet();
                    Mut.CreateTime = DateTime.Now;

                    Mut.UserName = tbUserName.Text.Trim();
                    Mut.Password = tbPassword.Text.Trim();
                    Mut.PCode = tb.Text.Trim();
                    ds = EBut.GetTeacherByPCode(tb.Text.Trim());
                    //Mut.Email = ds.Tables[0].Rows[0]["Email"].ToString();
                    //Mut.Tel = ds.Tables[0].Rows[0]["Tel"].ToString();
                    if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0]["Staff_Birth"].ToString()))
                    {
                        DateTime d1 = DateTime.Parse(ds.Tables[0].Rows[0]["Staff_Birth"].ToString());
                        DateTime d2 = DateTime.Now;
                        Mut.Age = d2.Year - d1.Year;
                    }

                    Mut.SexCode = ds.Tables[0].Rows[0]["Staff_Sex"].ToString();

                    LabMS.BLL.UserTable But = new LabMS.BLL.UserTable();
                    hiddenAddUserID.Value=But.Add(Mut).ToString();
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('新增用户成功!');window.location.href='UserDefault.aspx';</script>");
                    AddRole.Visible = true;//显示“添加角色按钮”
                    PanRole.Visible = true;
                }
            }
        }
コード例 #10
0
ファイル: Favorite.aspx.cs プロジェクト: dalinhuang/labms
        /// <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;
        }
コード例 #11
0
        private bool IsUserNameAndPassword()
        {
            if (UserType == "mana")
            {
                LabMS.BLL.UserTable userTable = new LabMS.BLL.UserTable();
                List<LabMS.Model.UserTable> userTableModelList = new List<LabMS.Model.UserTable>();

                userTableModelList = userTable.GetModelList("Password='******' and PCode='" + UserCodeTBX.Text + "'");
                if (userTableModelList.Count == 1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else if (UserType == "teacher")
            {
                LabMS.BLL.Teacher userTable = new LabMS.BLL.Teacher();
                List<LabMS.Model.Teacher> userTableModelList = new List<LabMS.Model.Teacher>();

                userTableModelList = userTable.GetModelList("Password='******' and Teacher_Code='" + UserCodeTBX.Text + "'");
                if (userTableModelList.Count == 1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                LabMS.BLL.Student userTable = new LabMS.BLL.Student();
                List<LabMS.Model.Student> userTableModelList = new List<LabMS.Model.Student>();

                userTableModelList = userTable.GetModelList("Student_Pass='******' and Student_Code='" + UserCodeTBX.Text + "'");
                if (userTableModelList.Count == 1)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
        }
コード例 #12
0
ファイル: UserRole.cs プロジェクト: dalinhuang/labms
        /// <summary>
        /// 根据UserID找出已经赋给此用户的角色信息
        /// </summary>
        /// <param name="UserID"></param>
        /// <returns></returns>
        public List<LabMS.Model.RoleTable> GetUserRoleByUserID(int UserID)
        {
            LabMS.BLL.UserRole BUR = new LabMS.BLL.UserRole();
            List<LabMS.Model.UserRole> listMUR = new List<LabMS.Model.UserRole>();

            #region 用户是否存在
            string str1 = "UserID="+UserID;
            LabMS.BLL.UserTable BUT = new LabMS.BLL.UserTable();
            List<LabMS.Model.UserTable> list = new List<LabMS.Model.UserTable>();
            list = BUT.GetModelList(str1);
            if (list.Count == 0)
            {
                throw(new Exception("1"));//用户不存在
            }
            #endregion

            #region 用户是否有角色
            string str = "UserID="+UserID;
            listMUR=BUR.GetModelList(str);//在UserRole表中找出RoleID

            if (listMUR.Count == 0)
            {
                throw(new Exception("2"));//用户没有对应角色
            }
            #endregion

            LabMS.BLL.RoleTable BRT = new LabMS.BLL.RoleTable();
            List<LabMS.Model.RoleTable> listMRT = new List<LabMS.Model.RoleTable>();

            int RoleID;
            string sqlstr = "";
            for (int i = 0; i < listMUR.Count; i++)
            {
                RoleID =int.Parse(listMUR[i].RoleID.Value.ToString());
                if (i == listMUR.Count - 1)
                {
                    sqlstr += " RoleId=" + RoleID;
                }
                else
                {
                    sqlstr += " RoleId="+RoleID+" or ";
                }
            }
            listMRT = BRT.GetModelList(sqlstr);
            return listMRT;
        }
コード例 #13
0
ファイル: Post.cs プロジェクト: dalinhuang/labms
        /// <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;
        }
コード例 #14
0
ファイル: UserTable.cs プロジェクト: dalinhuang/labms
 public bool IsExistUserName(string UserName)
 {
     string str = "UserName='******'";
     int count;
     bool success = false;
     LabMS.BLL.UserTable BUT = new LabMS.BLL.UserTable();
     count=BUT.GetModelList(str).Count;
     if (count > 0)
     {
         //已经存在
         success = false;
     }
     else
     {
         //不存在,可以注册
         success = true;
     }
     return success;
 }
コード例 #15
0
        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丢失,请退出系统,重新登录后进行修改密码!");
                }
        }
コード例 #16
0
ファイル: Modify.aspx.cs プロジェクト: dalinhuang/labms
        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)
                {
                }
            }
        }
コード例 #17
0
ファイル: Modify.aspx.cs プロジェクト: dalinhuang/labms
        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
            }
        }