Beispiel #1
0
        public string Delete(HttpContext context)
        {
            string pcode = context.Request.QueryString["pcode"];
            List <Sys_UserInfo>   userList = bllUser.GetList(p => p.UserInfo_DepCode == pcode).ToList();                               //FindWhere(" UserInfo_DepCode='" + pcode + "'");
            List <Sys_Department> list     = bll.GetList(p => p.Department_ParentCode == pcode && p.Department_IsDel == "0").ToList(); //FindWhere(" Department_ParentCode='" + pcode + "' AND Department_IsDel=0");

            if (userList.Count > 0)
            {
                return("2");
            }
            else
            {
                if (list.Count > 0)
                {
                    return("0");
                }
                else
                {
                    Sys_Department Department = bll.Get(p => p.Department_Code == pcode);
                    Department.Department_IsDel = "1";

                    //bool rtn = bll.DeleteWhere("Department_Code='" + pcode + "'");
                    bool rtn = bll.Update(Department);
                    if (rtn)
                    {
                        return("1");
                    }
                    else
                    {
                        return("0");
                    }
                }
            }
        }
Beispiel #2
0
        public void ModifyPassWord(HttpContext context)
        {
            string ypwd = DESEncrypt.Encrypt(HttpUtility.UrlDecode(context.Request.QueryString["ypwd"].ToString()));

            string pwd = HttpUtility.UrlDecode(context.Request.QueryString["pwd"].ToString());

            SessionUserModel currUserInfo = context.Session["UserInfo"] as SessionUserModel;

            Sys_UserInfoBLL     bllUserInfo   = new Sys_UserInfoBLL();
            List <Sys_UserInfo> userModelList = bllUserInfo.GetList(p => p.UserInfo_LoginUserName == currUserInfo.LoginUserName && p.UserInfo_LoginUserPwd == ypwd).ToList();

            if (userModelList.Count > 0)
            {
                userModelList[0].UserInfo_LoginUserPwd = DESEncrypt.Encrypt(pwd);
                string msg = string.Empty;
                if (bllUserInfo.Update(userModelList[0]))
                {
                    context.Response.Write("success");
                }
                else
                {
                    context.Response.Write("error_pwd");
                }
            }
            else
            {
                context.Response.Write("error_pwd");
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public string BatchDelInfo(string id)
        {
            if (id.Length > 0)
            {
                string        sql    = "";
                List <string> listId = new List <string>();
                listId = id.Split(',').ToList();
                //foreach (var item in listId)
                //{
                //    sql += "'" + item.ToString()+ "',";
                //}
                //if(sql.Length>0)
                //{
                //    sql = sql.Substring(0,sql.Length-1);
                //}
                Sys_UserInfoBLL     userBll  = new Sys_UserInfoBLL();
                List <Sys_UserInfo> userList = userBll.GetList(p => listId.Contains(p.UserInfoID)).ToList();//(" UserInfoID in (" + sql + ") ");
                List <Sys_UserInfo> newList  = new List <Sys_UserInfo>();
                foreach (var users in userList)
                {
                    users.UserInfo_IsDelete = true;
                    newList.Add(users);
                }
                bool b = userBll.Update(newList);
                if (b)
                {
                    //删除待办事项
                    //new RoleConfig().DeleteBatchMatterTasks(sql);
                    //string rtnUrl = Request.RawUrl;
                    //Sys_Menu MenuModel = bllMenu.FindByURL(rtnUrl);
                    //if (MenuModel != null)
                    //{
                    //    if (!string.IsNullOrEmpty(MenuModel.Menu_Name))
                    //    {
                    //        pg.AddLog(MenuModel.Menu_Name, "", "批量删除成功", "批量删除通过:" + listId, bg.CurrUserInfo().UserID, bg.CurrUserInfo().DepartmentCode);


                    //    }
                    //}
                    return("1");
                }
                else
                {
                    return("0");
                }
            }
            else
            {
                return("0");
            }
        }
Beispiel #4
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btntijiao_Click(object sender, ImageClickEventArgs e)
        {
            string userid = CurrUserInfo().UserID;

            modelUser = bllUser.Get(p => p.UserInfoID == userid);
            FormModel.GetForm <Sys_UserInfo>(this, modelUser, "t_");
            if (modelUser != null)
            {
                modelUser.UserInfo_LoginUserPwd = DESEncrypt.Encrypt(t_UserInfo_LoginUserPwd.Text.ToString().Trim());
            }
            //if (t_UserInfo_IdentityCred.Text != "")
            //{
            //    modelUser.UserInfo_Age = Convert.ToInt32(t_UserInfo_Age.Text);
            //    modelUser.UserInfo_DateBirth = Convert.ToDateTime(t_UserInfo_DateBirth.Text);
            //}
            if (txt_Yhxx_DTcsrq.Value != "")
            {
                modelUser.UserInfo_DateBirth = Convert.ToDateTime(Convert.ToDateTime(txt_Yhxx_DTcsrq.Value).ToString("yyyy年MM月dd日"));
            }
            if (txt_Yhxx_Iage.Value != "")
            {
                modelUser.UserInfo_Age = Convert.ToInt32(txt_Yhxx_Iage.Value);
            }
            string UserInfo_PhoneNumber = this.t_UserInfo_PhoneNumber.Text.Trim().ToString();
            //List<Sys_UserInfo> bu = bllUser.FindWhere("UserInfo_PhoneNumber='" + this.t_UserInfo_PhoneNumber.Text.Trim().ToString() + "'and UserInfoID not in('"+CurrUserInfo().UserID+"')");
            List <Sys_UserInfo> bu = bllUser.GetList(p => p.UserInfo_PhoneNumber == UserInfo_PhoneNumber && p.UserInfoID != userid).ToList();

            if (bu.Count > 0)
            {
                this.t_UserInfo_PhoneNumber.Text = "";
                MessageBox.Show(this, "手机号码已存在,请重新输入!");
            }
            else
            {
                if (bllUser.Update(modelUser))
                {
                    new Common_BLL().AddLog("系统管理>>个人信息维护", "", "修改", "修改个人信息维护", CurrUserInfo().UserID, CurrUserInfo().DepartmentCode);

                    MessageBox.ShowAndRedirect(this, "修改成功", "UserInfoModify.aspx?rn=" + new Random().Next());
                    //    //更新此人对应的岗位自查表模块表
                    //(new DAL.PositionChange()).UpdateGwfxwx(model.ManID, "1", model.Position);
                }
                else
                {
                    MessageBox.Show(this, "修改错误");
                }
            }
        }
        /// <summary>
        /// 保存修改信息
        /// </summary>
        private void UpdateUserInfo()
        {
            string id = RequstStr("id");
            //Sys_UserInfo account = bllUserInfo.Find(RequstStr("id"));
            Sys_UserInfo account     = bllUserInfo.Get(p => p.UserInfoID == id);
            string       oldDepid    = account.UserInfo_DepCode;
            string       oldState    = account.UserInfo_Status;
            string       newDepid    = "";
            string       newState    = "";
            bool         changeState = false;

            string strWhere = "1<>1";

            if (ddlStatus.SelectedValue.Equals("0301"))
            {
                strWhere = "UserInfo_LoginUserName ='******' and UserInfoID != '" + RequstStr("id") + "' and UserInfo_Status='0301'";
            }
            //if (bllUserInfo.GetList(strWhere).Count > 0)
            if (bllUserInfo.GetList(p => p.UserInfo_LoginUserName == txtLoginName.Text && p.UserInfoID == RequstStr("id") && p.UserInfo_Status == "0301").ToList().Count > 0)
            {
                MessageBox.Show(this, "您输入的用户帐号已经存在,请重新输入!");
                // txtLoginName.Text = "";
                return;
            }

            if (this.t_UserInfo_PhoneNumber.Text.Trim() != "")//手机号码
            {
                List <Sys_UserInfo> bu = bllUser.GetList(p => p.UserInfo_PhoneNumber == this.t_UserInfo_PhoneNumber.Text.Trim().ToString() && p.UserInfoID != id).ToList();
                if (bu.Count > 0)
                {
                    MessageBox.Show(this, "手机号码已存在,请重新输入!");
                    return;
                }
            }
            account.UserInfo_LoginUserName = this.txtLoginName.Text;
            account.UserInfo_FullName      = this.txtManName.Text.Trim();
            if (this.ddlDepart.SelectedItem != null)
            {
                account.UserInfo_DepCode = this.ddlDepart.SelectedValue;
                newDepid = this.ddlDepart.SelectedValue;
            }
            string pwd = this.txtLoginPwd.Text.Trim();

            account.UserInfo_LoginUserPwd = DESEncrypt.Encrypt(pwd);
            account.UserInfo_Sequence     = Convert.ToInt32(txtPx.Text.Trim());
            string strRole = this.GetChecked(ckbxlist, ",");

            if (!strRole.Equals(""))
            {
                strRole = strRole.Substring(0, strRole.LastIndexOf(','));
            }
            account.UserInfo_RoleID = strRole;
            account.UserInfo_Type   = ddlUserType.SelectedValue;
            string strGwxx = GetChecked(chbGwList, ",");

            if (!strGwxx.Equals(""))
            {
                strGwxx = strGwxx.Substring(0, strGwxx.LastIndexOf(','));
            }
            account.UserInfo_Post   = strGwxx;
            account.UserInfo_Status = ddlStatus.SelectedValue;
            newState = ddlStatus.SelectedValue;
            // account.UserInfo_LoginUserPwd = t_UserInfo_LoginUserPwd.Text;
            account.UserInfo_PhoneNumber  = t_UserInfo_PhoneNumber.Text;
            account.UserInfo_Nation       = t_UserInfo_Nation.SelectedValue;
            account.UserInfo_Sex          = t_UserInfo_Sex.SelectedValue;
            account.UserInfo_IdentityCred = t_UserInfo_IdentityCred.Text;
            if (t_UserInfo_Age.Text != "")
            {
                account.UserInfo_Age = Convert.ToInt32(t_UserInfo_Age.Text.Trim());
            }
            if (t_UserInfo_DateBirth.Text != "")
            {
                account.UserInfo_DateBirth = Convert.ToDateTime(t_UserInfo_DateBirth.Text.Trim());
            }
            //modelUser.UserInfo_Status = t_UserInfo_StatusName.Text;
            //modelUser. = t_Department_Name.Text;
            //modelUser.UserInfo_Post = t_UserInfo_PostName.Text;
            account.UserInfo_Hometown           = t_UserInfo_Hometown.Text;
            account.UserInfo_Address            = t_UserInfo_Address.Text;
            account.UserInfo_PoliticalLandscape = t_UserInfo_PoliticalLandscape.Text;
            account.UserInfo_EducationalLevel   = t_UserInfo_EducationalLevel.Text;
            account.UserInfo_Schools            = t_UserInfo_Schools.Text;
            account.UserInfo_Specialty          = t_UserInfo_Specialty.Text;
            if (t_UserInfo_StartWorkDate.Text != "")
            {
                account.UserInfo_StartWorkDate = Convert.ToDateTime(t_UserInfo_StartWorkDate.Text);
            }
            if (t_UserInfo_JoinPartyDate.Text != "")
            {
                account.UserInfo_JoinPartyDate = Convert.ToDateTime(t_UserInfo_JoinPartyDate.Text);
            }
            if (t_UserInfo_EnlistTime.Text != "")
            {
                account.UserInfo_NowHoldPostTime = Convert.ToDateTime(t_UserInfo_EnlistTime.Text);
            }
            account.UserInfo_Badge         = t_UserInfo_Badge.Text;
            account.UserInfo_EduBackground = t_UserInfo_EnlistPlace.Text;

            account.UserInfo_Position = t_UserInfo_Position.Text;


            account.UserInfo_PositionLevel = t_UserInfo_PositionLevel.Text;
            if (t_UserInfo_NowHoldPostTime.Text != "")
            {
                account.UserInfo_NowHoldPostTime = Convert.ToDateTime(t_UserInfo_NowHoldPostTime.Text);
            }
            account.UserInfo_OccupTitle = t_UserInfo_OccupTitle.Text;

            // account.UserInfo_LoginUserPwd = DESEncrypt.Encrypt(t_UserInfo_LoginUserPwd.Text.ToString().Trim());

            if (txt_Yhxx_DTcsrq.Value != "")
            {
                account.UserInfo_DateBirth = Convert.ToDateTime(txt_Yhxx_DTcsrq.Value);
            }
            if (txt_Yhxx_Iage.Value != "")
            {
                account.UserInfo_Age = Convert.ToInt32(txt_Yhxx_Iage.Value);
            }
            bool i = new Sys_UserInfoBLL().Update(account);

            if (i)
            {
                new Common_BLL().AddLog("用户管理", account.UserInfoID, "修改", "", base.CurrUserInfo().UserID, base.CurrUserInfo().DepartmentCode);

                if (changeState)
                {
                    MessageBox.ShowAndRedirect(this, "修改用户信息成功,该用户具有分管范围,为了避免影响系统的正常使用,请及时调整领导的分管范围,以免有所遗漏!", "UserInfoList.aspx?depCode=" + this.hid_Dep.Value);
                }
                else
                {
                    MessageBox.ShowAndRedirect(this, "修改用户信息成功", "UserInfoList.aspx?depCode=" + this.hid_Dep.Value);
                }
            }
            else
            {
                MessageBox.ShowAndRedirect(this, "保存出现问题,请重试", "UserInfoList.aspx?depCode=" + this.hid_Dep.Value);
            }
        }