Ejemplo n.º 1
0
        /// <summary>
        /// 获取会员卡信息 0:数据库操作失败, 1:成功, 2:会员卡号或者密码错误
        /// </summary>
        public int GetVIPCard(string cardNo, string password, out VIPCard card)
        {
            int result = 0;

            try
            {
                _daoManager.OpenConnection();
                //加密的密码
                string str            = string.Empty;
                string saltedPassword = _vipCardDao.GetCardPassword(cardNo);
                if (!string.IsNullOrEmpty(saltedPassword))
                {
                    int    index = saltedPassword.IndexOf(Delim);
                    string salt  = saltedPassword.Substring(0, index);
                    str = salt + Delim + PasswordCryptographer.SaltPassword(password, salt);
                }
                card   = _vipCardDao.GetVIPCard(cardNo, str);
                result = card == null ? 2 : 1;
            }
            catch (Exception exception)
            {
                card = null;
                LogHelper.GetInstance().Error(string.Format("[GetVIPCard]参数:cardNo_{0}", cardNo), exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(result);
        }
Ejemplo n.º 2
0
        public Int32 UpdateVIPCardStatus(string cardNo, string password, int status)
        {
            int result = 0;

            try
            {
                _daoManager.OpenConnection();
                //加密的密码
                string str = string.Empty;
                if (status == 1)
                {
                    str = PasswordCryptographer.GenerateSaltedPassword(password);
                }
                else
                {
                    string saltedPassword = _vipCardDao.GetCardPassword(cardNo);
                    if (!string.IsNullOrEmpty(saltedPassword))
                    {
                        int    index = saltedPassword.IndexOf(Delim);
                        string salt  = saltedPassword.Substring(0, index);
                        str = salt + Delim + PasswordCryptographer.SaltPassword(password, salt);
                    }
                }
                result = _vipCardDao.UpdateVIPCardStatus(cardNo, str, status);
            }
            catch (Exception exception)
            {
                LogHelper.GetInstance().Error(string.Format("[UpdateVIPCardStatus]参数:cardNo_{0},status_{1}", cardNo, status), exception);
            }
            finally
            {
                _daoManager.CloseConnection();
            }
            return(result);
        }