Ejemplo n.º 1
0
        /// <summary>
        /// 当点击修改密码时触发事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_submit_onclick(object sender, EventArgs e)
        {
            try
            {
                COMMON.common commons = new Dianda.COMMON.common();
                //获取到登陆人员的基本信息
                Model.USER_Users user_model = (Model.USER_Users)Session["USER_Users"];

                BLL.USER_Users user_bll = new Dianda.BLL.USER_Users();

                //登陆用户的原始密码(即登陆密码)
                string oldpwd = user_model.PASSWORD.ToString();
                //用户输入的旧密码
                string pwd1 = commons.GetMD5(TB_OLDPWD.Text.ToString().Trim());
                //用户输入的新密码
                string newpwd = commons.GetMD5(TB_NEWPWD1.Text.ToString().Trim());

                //如果旧密码输入的是正确的,则修改密码
                if (pwd1.Equals(oldpwd))
                {
                    user_model.PASSWORD = newpwd;

                    user_bll.Update(user_model);


                    string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"密码修改成功! \");window.close();</script>";

                    Response.Write(coutws);

                    //添加操作日志
                    Dianda.BLL.SYS_LogsExt bsyslog = new Dianda.BLL.SYS_LogsExt();
                    bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "修改密码", user_model.REALNAME + "(" + user_model.USERNAME + ")" + "密码修改成功");
                    //添加操作日志
                }
                else
                {
                    Label_tag.Text = "对不起,您的旧密码输入不正确! 请重新输入";
                    TB_OLDPWD.Text = "";
                    TB_OLDPWD.Focus();
                }
            }
            catch
            {
                Label_tag.Text = "对不起,密码修改过程中发生错误!请稍后再试";
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 点击新增按钮触发的事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_reset_Click(object sender, EventArgs e)
        {
            string ID = Request["ID"];//获取到当前要修改的人员的ID

            //获取到人员的详细信息
            users_Model = users_Bll.GetModel(ID);

            //将用户的密码重新置成最初始的密码
            users_Model.PASSWORD = commons.GetMD5("123456");

            users_Bll.Update(users_Model);

            tag.Text = "重置成功!密码被重置成原始密码!";
        }
Ejemplo n.º 3
0
        public DataSet checkUser(string username, string pwd, string keys)
        {
            DataSet ds = new DataSet();

            try
            {
                username = commons.RequestSafeString(username, 50);
                pwd      = commons.RequestSafeString(pwd, 50);
                pwd      = commons.GetMD5(pwd);//加密
                string timenow = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + " 00:00:00";
                string month   = DateTime.Now.Month.ToString();
                if (month.Length == 1)
                {
                    month = "0" + month;
                }
                string days = DateTime.Now.Day.ToString();
                if (days.Length == 1)
                {
                    days = "0" + days;
                }
                string decryptTime = DateTime.Now.Year.ToString() + month + days;
                string keysnow     = commons.Encrypt(timenow, decryptTime);

                //string keysnow = keys;

                if (keys == keysnow)
                {
                    ds = usersBll.GetList("USERNAME='******' and PASSWORD='******' and DELFLAG=0");
                }
                else
                {
                    ds = null;
                }
            }
            catch
            {
                ds = null;
            }
            return(ds);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 确定添加新用户组
        /// 1.添加新人员前要检测该用户组的名称是否已经在系统中注册,如果注册过了,则提醒用户重复,要求用户重新命名
        /// 2.添加该用户进数据库
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button_queding_Click(object sender, EventArgs e)
        {
            try
            {
                string username = TB_USERNAME.Text.ToString();//获取到用户名

                //检查该名称是否有了
                if (username != "")
                {
                    //检查是否有该用户组名称
                    bool checkName = pageControl.Exists_Name("USER_Users", "USERNAME", username, "ID", "");

                    if (checkName)
                    {
                        tag.Text = "该用户名已经存在,请修改!";
                    }
                    else
                    {
                        //部门ID
                        string DepartMentID = "";
                        //部门名称
                        string DepartMentName = "";
                        foreach (ListItem item in CheckBox_DEPARTMENT.Items)
                        {
                            if (item.Selected == true)
                            {
                                DepartMentID   += item.Value + ",";
                                DepartMentName += item.Text + ",";
                            }
                        }
                        if (DepartMentID != null && DepartMentID != "")
                        {
                            users_Model.ID = commons.GetGUID();//获取到GUID作为ID
                            //用户名
                            users_Model.USERNAME = TB_USERNAME.Text.ToString();
                            //密码
                            users_Model.PASSWORD = commons.GetMD5(TB_PASSWORD.Text.Trim());
                            //真实姓名
                            users_Model.REALNAME = TB_REALNAME.Text;
                            //性别
                            users_Model.SEX = RadioButtonList_SEX.SelectedValue.ToString();
                            //是否为项目经理
                            users_Model.IsManager = int.Parse(RadioButtonList_IsManager.SelectedValue.ToString());
                            //部门
                            users_Model.DepartMentID = DepartMentID.Remove(DepartMentID.LastIndexOf(","));
                            //部门名称
                            users_Model.DepartMentName = DepartMentName.Remove(DepartMentName.LastIndexOf(","));
                            //岗位
                            users_Model.StationID = DDL_Station.SelectedValue.ToString();
                            //联系电话
                            users_Model.TEL = TB_TEL.Text;
                            //移动电话
                            users_Model.TEMP1 = TextBox_TEMP1.Text;
                            //邮箱
                            users_Model.EMAIL = TB_EMAIL.Text;
                            //在职状态
                            users_Model.WorkStats = DDL_WorkStats.SelectedValue.ToString();
                            //入职时间
                            if (null == TB_DatesEmployed.Value || TB_DatesEmployed.Value.ToString().Equals(""))
                            {
                                users_Model.DatesEmployed = null;
                            }
                            else
                            {
                                users_Model.DatesEmployed = Convert.ToDateTime(TB_DatesEmployed.Value.ToString());
                            }

                            //离职时间
                            if (null == TB_LeaveDates.Value || TB_LeaveDates.Value.ToString().Equals(""))
                            {
                                users_Model.LeaveDates = null;
                            }
                            else
                            {
                                //离职时间
                                users_Model.LeaveDates = Convert.ToDateTime(TB_LeaveDates.Value.ToString());
                            }
                            //生日
                            if (TB_BIRTHDAY.Value == null || TB_BIRTHDAY.Value.ToString().Equals(""))
                            {
                                users_Model.BIRTHDAY = "";
                            }
                            else
                            {
                                users_Model.BIRTHDAY = TB_BIRTHDAY.Value.ToString();
                            }

                            //籍贯
                            users_Model.NativePlace = TB_NativePlace.Text;
                            //学历
                            users_Model.EducationLevel = DDL_EducationLevel.SelectedValue.ToString();
                            //住址
                            users_Model.ADDRESS = TB_ADDRESS.Text.ToString();
                            //毕业学校
                            users_Model.GraduateSchool = TB_GraduateSchool.Text;
                            //专业
                            users_Model.Major = TB_Major.Text;
                            //工作履历
                            users_Model.TrackRecord = TB_TrackRecord.Text;
                            //时间
                            users_Model.DATETIME = Convert.ToDateTime(DateTime.Now.ToShortDateString().ToString());
                            //工作组
                            string    sql_groups = "SELECT ID FROM USER_Groups WHERE (ISMOREN = '1') AND (TAGS = '普通组')";
                            DataTable dt         = pageControl.doSql(sql_groups).Tables[0];

                            users_Model.GROUPS = dt.Rows[0]["ID"].ToString();

                            //头像
                            users_Model.IMAGES = "";
                            //删除标记
                            users_Model.DELFLAG = 0;

                            users_Bll.Add(users_Model);
                            new ajax().UpdateUserRemoteInfoWithJAVAWebService(users_Model, EnumRemoteOperation.Import);
                            //人员信息添加成功以后,要向Document_Folder中添加一个当前用户的顶级档案目录

                            int docfolderid = docfolder_bll.GetMaxId();

                            docfolder_model.ID = docfolderid;
                            //目录名称
                            docfolder_model.FolderName = users_Model.USERNAME + "_" + users_Model.REALNAME;
                            //上级目录
                            docfolder_model.UpID = -1;
                            //文件夹的属性
                            docfolder_model.Types = "private";
                            //所属人ID
                            docfolder_model.UserID = users_Model.ID;
                            //是否共享
                            docfolder_model.IsShare = 0;
                            //删除标记
                            docfolder_model.DELFLAG = 0;
                            //当前时间
                            docfolder_model.DATETIME = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                            //栏目的路径记录(用/来隔开)
                            docfolder_model.COLUMNSPATH = "-1/" + docfolder_model.ID;
                            //栏目显示的顺序
                            docfolder_model.SHUNXU = 0;
                            //栏目的路径名称
                            docfolder_model.PNAMES = "我的文档";
                            //当前文件夹中文件的大小
                            docfolder_model.SizeOf = "0";

                            docfolder_bll.Add(docfolder_model);


                            //人员信息添加成功以后,要向Document_Folder中默认添加一个收藏夹

                            docfolder_model.ID = docfolder_bll.GetMaxId();
                            //目录名称
                            docfolder_model.FolderName = "收藏夹";
                            //上级目录
                            docfolder_model.UpID = docfolderid;
                            //文件夹的属性
                            docfolder_model.Types = "private";
                            //所属人ID
                            docfolder_model.UserID = users_Model.ID;
                            //是否共享
                            docfolder_model.IsShare = 0;
                            //删除标记
                            docfolder_model.DELFLAG = 0;
                            //当前时间
                            docfolder_model.DATETIME = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                            //栏目的路径记录(用/来隔开)
                            docfolder_model.COLUMNSPATH = "-1/" + docfolder_model.UpID + "/" + docfolder_model.ID;
                            //栏目显示的顺序
                            docfolder_model.SHUNXU = 0;
                            //栏目的路径名称
                            docfolder_model.PNAMES = "我的档案>收藏夹";
                            //当前文件夹中文件的大小
                            docfolder_model.SizeOf = "0";

                            docfolder_bll.Add(docfolder_model);


                            tag.Text = "操作成功!";

                            string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"操作成功!现在进入列表页面\"); location.href = \"manage.aspx" + "\";</script>";


                            Response.Write(coutws);

                            //添加操作日志

                            Dianda.BLL.SYS_LogsExt bsyslog    = new Dianda.BLL.SYS_LogsExt();
                            Model.USER_Users       user_model = (Model.USER_Users)Session["USER_Users"];
                            bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "添加人员信息", "添加" + users_Model.REALNAME + "(" + user_model.USERNAME + ")" + "成功");
                            //添加操作日志
                        }
                        else
                        {
                            this.Page.ClientScript.RegisterClientScriptBlock(GetType(), "key", "alert('请选择部门!')", true);
                        }
                    }
                }
            }
            catch
            {
                tag.Text = "操作失败,请重试!";
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 确定添加新建项目负责人
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                string username = TextBox_UserName.Text.ToString();//获取到用户名

                //检查该名称是否有了
                if (username != "")
                {
                    //检查是否有该用户组名称
                    bool checkName = pageControl.Exists_Name("USER_Users", "USERNAME", username, "ID", "");

                    if (checkName)
                    {
                        tag.Text = "该用户名已经存在,请修改!";
                    }
                    else
                    {
                        users_Model.ID          = commons.GetGUID();//获取到GUID作为ID
                        Session["new_leaderid"] = users_Model.ID;
                        //用户名
                        users_Model.USERNAME = TextBox_UserName.Text.ToString();
                        //密码
                        users_Model.PASSWORD = commons.GetMD5(TextBox_Pwd.Text.Trim());
                        //真实姓名
                        users_Model.REALNAME = TextBox_Rlname.Text;
                        //性别
                        users_Model.SEX = RadioButtonList_Sex.SelectedValue.ToString();
                        //是否为项目经理
                        users_Model.IsManager = 9;
                        //部门
                        users_Model.DepartMentID = ConfigurationManager.AppSettings["departmentid_temp"];
                        //部门名称
                        string    sql_groups = "SELECT ID,name FROM USER_Groups WHERE id='" + ConfigurationManager.AppSettings["departmentid_temp"] + "'";
                        DataTable dt         = pageControl.doSql(sql_groups).Tables[0];
                        users_Model.DepartMentName = dt.Rows[0]["name"].ToString();
                        //岗位
                        users_Model.StationID = ConfigurationManager.AppSettings["positionid_temp"];
                        //联系电话
                        users_Model.TEL = "";
                        //移动电话
                        users_Model.TEMP1 = "";
                        //邮箱
                        users_Model.EMAIL = "*****@*****.**";
                        //在职状态
                        users_Model.WorkStats = "1";
                        //籍贯
                        users_Model.NativePlace = "上海";
                        //学历
                        users_Model.EducationLevel = "4";
                        //时间
                        users_Model.DATETIME = Convert.ToDateTime(DateTime.Now.ToShortDateString().ToString());
                        //工作组
                        users_Model.GROUPS = ConfigurationManager.AppSettings["manageid_temp"];
                        //删除标记
                        users_Model.DELFLAG = 0;
                        users_Bll.Add(users_Model);
                        tag.Text = "操作成功!";

                        //添加操作日志
                        Dianda.BLL.SYS_LogsExt bsyslog    = new Dianda.BLL.SYS_LogsExt();
                        Model.USER_Users       user_model = (Model.USER_Users)Session["USER_Users"];
                        bsyslog.addlogs(user_model.REALNAME + "(" + user_model.USERNAME + ")", "添加人员信息", "添加" + users_Model.REALNAME + "(" + user_model.USERNAME + ")" + "成功");

                        Label la = (Label)this.Parent.Parent.FindControl("Label_NewLeader");
                        la.Text = "--[" + TextBox_Rlname.Text + "(" + TextBox_UserName.Text + ")]";
                    }
                }
            }
            catch
            {
                tag.Text = "操作失败,请重试!";
            }
        }
Ejemplo n.º 6
0
        //点击进入登陆
        protected void ImageButton_login_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                Session["isDepartment"] = "个人";

                string        TextBox_username_1 = TextBox_username.Text.ToString();
                string        TextBox_pwd_1      = TextBox_pwd.Text.ToString();
                COMMON.common commonse           = new Dianda.COMMON.common();

                string username = commonse.SafeString(TextBox_username_1);
                string pwd      = commonse.SafeString(TextBox_pwd_1);

                List <Model.USER_Users> muserlist = bUser.GetModelList(" USERNAME='******' and PASSWORD='******' and DELFLAG=0");
                if (muserlist.Count > 0)
                {
                    //说明登录成功
                    mUser = muserlist[0];
                    //设置Session["USER_Users"]中的TEMP4为用户的当前默认部门(为了在部门首页上做部门的切换使用)。
                    string departments = mUser.DepartMentID.ToString();
                    if (departments.Contains(","))
                    {
                        string[] dearray = departments.Split(',');
                        mUser.TEMP4 = dearray[0].ToString();
                    }
                    else
                    {
                        mUser.TEMP4 = departments;
                    }
                    Session["USER_Users"] = mUser;
                    Session["LoginID"]    = mUser.ID.ToString();

                    //*************************如果登陆成功,需要获取该登陆者负责或参与的项目,    modify by wangjh on 2010-11-02 begin
                    Web.Admin.personalProjectManage.MakeProjectSession makeprojectsession = new Dianda.Web.Admin.personalProjectManage.MakeProjectSession();
                    makeprojectsession.getMyProjectList(this);

                    // //负责的项目
                    // //string sql1 = " SELECT ID,NAMES FROM vProject_Projects WHERE LeaderID='" + mUser.ID + "' and DELFLAG=0  and (Status=1 or Status=3 or Status=5) ";
                    // string sql1 = " SELECT ID,NAMES,DELFLAG,Status FROM vProject_Projects WHERE LeaderID='" + mUser.ID + "' and (Status=1 or Status=3 or Status=5) ";
                    // //由于在我的项目中需要添加一个已删除的项目,所以在加载项目时也需要将删除的显示出来,故作以上修改(and DELFLAG=0 删除了)

                    // DataTable dt1 = pageControl.doSql(sql1).Tables[0];

                    // //参与的项目
                    //// string sql2 = " SELECT  ID,NAMES FROM  vProject_Projects WHERE  DELFLAG=0 and id in(select Projectid from Project_UserList where userid='" + mUser.ID + "' and status='1') ";
                    // string sql2 = " SELECT  ID,NAMES,DELFLAG,Status  FROM  vProject_Projects WHERE id in(select Projectid from Project_UserList where userid='" + mUser.ID + "' and status='1') ";
                    // //由于在我的项目中需要添加一个已删除的项目,所以在加载项目时也需要将删除的显示出来,故作以上修改(DELFLAG=0 and 删除了)

                    // DataTable dt2 = pageControl.doSql(sql2).Tables[0];

                    // //合并两个相同结构的DATATABLE
                    // DataTable Newdt = common.CombineTheSameDatatable(dt1,dt2);
                    // //将一个DATATABLE中的重复项去除掉
                    // if (null != Newdt)
                    // {
                    //     Newdt = common.makeDistinceTable(Newdt, "ID");

                    //     Session["Project_Projects"] = Newdt;
                    // }


                    //*************************如果登陆成功,需要获取该登陆者负责或参与的项目,   modify by wangjh on 2010-11-02 end

                    //写日志
                    BLL.SYS_LogsExt bslog = new Dianda.BLL.SYS_LogsExt();
                    bslog.addlogs(mUser.REALNAME.ToString() + "(" + mUser.USERNAME.ToString() + ")", "登录系统", "登录系统:成功");
                    //写日志
                    //根据用户的用户组来生成用户的权限数据

                    ///构造用户的全部权限
                    DataTable sessionData = sessionPower(mUser.ID.ToString());
                    string[]  arrays      = getPowerSession(sessionData, mUser.ID.ToString());
                    mUserPower.specialRole   = arrays[3].ToString();
                    mUserPower.buttomID      = arrays[2].ToString();
                    mUserPower.menuRole      = arrays[1].ToString();
                    mUserPower.pageurl       = arrays[0].ToString();
                    mUserPower.userid        = mUser.ID.ToString();
                    mUserPower.isYinLeader   = arrays[4].ToString(); //"0";//表示该用户是用印管理的领导(根据特定的权限点来判断该用户是否是领导)
                    Session["Session_Power"] = mUserPower;
                    //付全文    2013-4-16   消息权限
                    string    strSql = "select roles from user_role where name='消息-取消通知公告' and Types='菜单权限' and delflag =0";
                    DataTable dt     = pageControl.doSql(strSql).Tables[0];
                    string    roles  = null;
                    foreach (DataRow row in dt.Rows)
                    {
                        roles = row["roles"].ToString();
                    }
                    Session["Session_Role"] = roles;
                    ///构造用户的全部权限


                    string url    = "/Admin/person_Index.aspx";
                    string coutws = "<script language=\"javascript\" type=\"text/javascript\">location.href='" + url + "';</script>";
                    Response.Write(coutws);
                }
                else
                {
                    //登录失败
                    Session["USER_Users"] = "";
                    string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"登录失败,请核实您的用户名和密码\");location.href='login.aspx';</script>";
                    Response.Write(coutws);
                }
            }
            catch
            {
                //登录失败
                Session["USER_Users"] = "";
                string coutws = "<script language=\"javascript\" type=\"text/javascript\">alert(\"登录失败,请核实您的用户名和密码\");location.href='login.aspx';</script>";
                Response.Write(coutws);
            }
        }