Beispiel #1
0
 /// <summary>
 /// 写异常日志
 /// </summary>
 /// <param name="ex">异常</param>
 public static void WriteErr(Exception ex)
 {
     //log4net.ILog log = log4net.LogManager.GetLogger("Exception");
     //log.Error(ex.Message, ex);
     LogNet4.WriteErr(ex);
 }
Beispiel #2
0
 public static void WriteErr(string message)
 {
     //log4net.ILog log = log4net.LogManager.GetLogger("Exception");
     //log.Error(message);
     LogNet4.WriteMsg(message);
 }
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="LoginID">用户登陆标识ID</param>
        /// <param name="PwdType">0表示修改登陆密码,1表示修改资金密码</param>
        /// <param name="oldpwd">旧密码</param>
        /// <param name="newpwd">新密码</param>
        /// <returns></returns>
        public ResultDesc ModifyUserPassword(string LoginID, int PwdType, string oldpwd, string newpwd)
        {
            ResultDesc rsdc = new ResultDesc();

            try
            {
                TradeUser tdUser = new TradeUser();

                List <string> sqlList = new List <string>();


                if (!ComFunction.ExistUserLoginID(LoginID, ref tdUser))
                {
                    rsdc.Result     = false;
                    rsdc.ReturnCode = ResCode.UL003;
                    rsdc.Desc       = ResCode.UL003Desc;
                    return(rsdc);
                }
                //密码转换
                oldpwd = Des3.Des3EncodeCBC(oldpwd);
                newpwd = Des3.Des3EncodeCBC(newpwd);

                string sql1 = string.Empty;
                if (PwdType == 0)//登陆密码
                {
                    if (tdUser.LoginPwd == oldpwd)
                    {
                        sql1 = string.Format("UPDATE Base_User  SET  LoginPwd='{0}'  WHERE userid='{1}' AND LoginPwd='{2}'", newpwd, tdUser.UserID, oldpwd);
                        sqlList.Add(sql1);
                    }
                    else
                    {
                        rsdc.Result = false;
                        rsdc.Desc   = "登陆密码不一致,修改失败";
                        return(rsdc);
                    }
                }
                else//资金密码
                {
                    if (tdUser.CashPwd == oldpwd)
                    {
                        sql1 = string.Format("UPDATE Base_User  SET  CashPwd='{0}'  WHERE userid='{1}' AND CashPwd='{2}'", newpwd, tdUser.UserID, oldpwd);
                        sqlList.Add(sql1);
                    }
                    else
                    {
                        rsdc.Result = false;
                        rsdc.Desc   = "资金密码不一致,修改失败";
                        return(rsdc);
                    }
                }
                if (!ComFunction.SqlTransaction(sqlList))
                {
                    LogNet4.WriteMsg(string.Format("修改密码失败,SQL语句执行失败,SQL语句是:{0}", sql1));
                    rsdc.Result = false;
                    rsdc.Desc   = "用户密码不对,修改密码失败";
                    return(rsdc);
                }
                rsdc.Result = true;
                rsdc.Desc   = "修改密码,成功";
            }
            catch (Exception ex)
            {
                ComFunction.WriteErr(ex);
                rsdc.Result = false;
                rsdc.Desc   = "修改密码,失败";
            }
            return(rsdc);
        }