예제 #1
0
파일: UserDac.cs 프로젝트: RaoLeigf/msyh
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="logid"></param>
        /// <param name="oldpwd"></param>
        /// <param name="newpwd"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public string ChangePwd(string logid, string oldpwd, string newpwd, ref string msg)
        {
            int iret = -1;

            string sql = "select pwd from secuser where logid={0}";


            IDataParameter[] p = new NGDataParameter[1];
            p[0] = new NGDataParameter("logid", logid);

            string pwd = DbHelper.GetString(sql, p);

            //旧密码输入不正确
            if (oldpwd != NGEncode.DecodePassword(pwd, 128))
            {
                msg = "旧密码输入不正确";
                return("-1");
            }

            string endcodepwd = NGEncode.EncodePassword(newpwd, 128);

            sql  = "update secuser set pwd='" + endcodepwd + "',chgpwd_date='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where logid='" + logid + "'";
            iret = DbHelper.ExecuteNonQuery(sql);

            return("1");
        }
예제 #2
0
        public string GetNGSoftPwd(string serverName)
        {
            string where = string.Format("ByName='{0}'", serverName);
            DataRow[] dr  = ds.Tables["Connect"].Select(where);
            string    pwd = NGEncode.DecodePassword(dr[0]["LogPass"].ToString(), 128);

            return(pwd);
        }