Esempio n. 1
0
        /// <summary>
        /// 更新用户信息
        /// </summary>
        /// <param name="usercid">所属部门</param>
        /// <param name="department">所属部门</param>
        /// <param name="name">真实姓名</param>
        /// <param name="phone">联系电话</param>
        /// <param name="weixin">微信号</param>
        /// <returns>返回类</returns>
        public SpRequestMsg UpdateUser(string department, string name, string phone, string weixin, string usercid)
        {
            //TODO
            SpRequestMsg pSpRequestMsg = new SpRequestMsg();

            pSpRequestMsg.data = "";
            ISPService service = SpServiceFactory.CreateServiceBase();

            try
            {
                string Uname   = "UPDATE p_user SET xm = '" + name + "' WHERE cid = " + usercid + "";
                string Uphone  = "UPDATE p_user SET dh = " + phone + " WHERE cid = " + usercid + "";
                string Uweixin = "UPDATE p_user SET wx = " + weixin + " WHERE cid = " + usercid + "";
                ApplicationManager.DefaultConnection.ExcuteData(Uname);
                ApplicationManager.DefaultConnection.ExcuteData(Uphone);
                ApplicationManager.DefaultConnection.ExcuteData(Uweixin);
                pSpRequestMsg.success = true;
                pSpRequestMsg.message = "信息修改成功!";
            }
            catch (Exception ex)
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "信息修改请求异常,详情" + ex.Message;
            }



            return(pSpRequestMsg);
        }
Esempio n. 2
0
        /// <summary>
        /// 密码修改
        /// </summary>
        /// <param name="cid">用户唯一编号</param>
        /// <param name="userName">用户名</param>
        /// <param name="oldPassword">旧密码</param>
        /// <param name="newPassword">新密码</param>
        /// <param name="rePassword">重复密码</param>
        /// <returns></returns>
        public SpRequestMsg UpdatePassword(string cid, string userName, string oldPassword, string newPassword, string rePassword)
        {
            SpRequestMsg pSpRequestMsg = new SpRequestMsg();

            pSpRequestMsg.data = "";
            ISPService service = SpServiceFactory.CreateServiceBase();

            try {
                string           oldPwd     = Sp.BaseFrame.Common.Util.AESEncryptionUtils.Encrypt(oldPassword);
                MySqlParameter[] parameters = { new MySqlParameter("?mm", oldPwd) };
                //判断是否存在
                DataTable dtExist = ApplicationManager.DefaultConnection.QueryData("select mm from p_user where mm=?mm", parameters, 0).Tables[0];
                if (dtExist.Rows.Count > 0)
                {
                    pSpRequestMsg.success = true;
                    pSpRequestMsg.message = "密码匹配正确!";


                    if (newPassword != rePassword)
                    {
                        pSpRequestMsg.success = false;
                        pSpRequestMsg.message = "前后密码输入不一致!";
                    }
                    else
                    {
                        string NewPwd = Sp.BaseFrame.Common.Util.AESEncryptionUtils.Encrypt(newPassword);//加密新添加密码
                        string updata = "UPDATE p_user SET mm = '" + NewPwd + "' WHERE cid = " + cid + " ";
                        ApplicationManager.DefaultConnection.ExcuteData(updata);
                        pSpRequestMsg.message = "密码修改成功!";
                    }
                }
            }
            catch (Exception ex)
            {
                pSpRequestMsg.success = false;
                pSpRequestMsg.message = "密码修改请求异常,详情" + ex.Message;
            }

            return(pSpRequestMsg);
        }