/// <summary>
        /// 解冻帐号
        /// </summary>
        /// <param name="DealerAccount">帐号表</param>
        /// <param name="ThawReason">解冻原因</param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public bool ThawAccount(UM_DealerAccount DealerAccount, UM_ThawReason ThawReason, out string mess)
        {
            mess = string.Empty;
            CT_Counter T = GetCounterByUserID((int)DealerAccount.UserID);
            List <FindAccountEntity> l = new List <FindAccountEntity>();

            if (T == null)
            {
                mess = "GL-0227:交易员对应的柜台不存在!"; //写调试信息
                LogHelper.WriteDebug(mess);
                return(false);
            }
            try
            {
                FindAccountEntity FindAccountEntity = new FindAccountEntity();
                FindAccountEntity.AccountType = (int)DealerAccount.AccountTypeID;
                FindAccountEntity.UserID      = DealerAccount.UserID.ToString();
                l.Add(FindAccountEntity);
                if (!ServiceIn.AccountManageServiceProxy.GetInstance().ThawAccount(T, l, out mess))
                {
                    mess = "GL-0228:调用柜台解冻帐号方法ThawAccount()失败!" + mess; //写调试信息
                    LogHelper.WriteDebug(mess);
                    return(false);
                }
            }
            catch (VTException Ex)
            {
                mess = Ex.ToString();
                //写错误日志
                return(false);
            }
            try
            {
                StaticDalClass.DealerAccountDAL.Update(DealerAccount);
                StaticDalClass.ThawReasonDAL.Add(ThawReason);
            }
            catch (Exception ex)
            {
                ServiceIn.AccountManageServiceProxy.GetInstance().FreezeAccount(T, l, out mess);
                string      errCode = "GL-0229";
                string      errMsg  = "冻结帐号方法FreezeAccount()异常!" + ex.Message;
                VTException vte     = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(vte.ToString(), vte.InnerException);
                mess = vte.ToString();
                return(false);
            }
            return(true);
        }
示例#2
0
        /// <summary>
        /// 根据查询实体查询相关账号信息,这里的条件只包括用户ID,账号类别,账号类型三种
        /// </summary>
        /// <param name="filter">要查询的过滤实体,这里包括用户ID,账号类别,账号类型三种为""|null忽略</param>
        /// <returns></returns>
        public List <AccountFindResultEntity> GetUserAccountByFindFilter(FindAccountEntity filter)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("select u.UserAccountDistributeLogo,u.UserID,u.AccountTypeLogo,a.AccountTypeName ");
            sb.Append(",WhetherAvailable=case u.WhetherAvailable when 1 then '可用' when 0 then '已冻结'");
            sb.Append(" end,c.ATCName ");
            sb.Append("  FROM  UA_UserAccountAllocationTable as u ");
            string whereStr = " 1=1 ";

            sb.Append("  inner join BD_AccountType as a on a.AccountTypeLogo=u.AccountTypeLogo ");
            if (filter.AccountType != 0)
            {
                whereStr += " And a.AccountTypeLogo='" + filter.AccountType + "'";
            }
            sb.Append(" inner join DB_AccountTypeClass as c on c.ATCId=a.ATCId ");
            if (filter.AccountAttributionType != 0)
            {
                whereStr += " And c.ATCId='" + filter.AccountAttributionType + "'";
            }
            if (!string.IsNullOrEmpty(filter.UserID))
            {
                whereStr += " And u.UserID='" + filter.UserID.Trim() + "'";
            }
            sb.Append(" where " + whereStr);
            Database db = DatabaseFactory.CreateDatabase();

            List <AccountFindResultEntity> list = new List <AccountFindResultEntity>();

            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, sb.ToString()))
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderDataBind(dataReader));
                }
            }
            return(list);
        }
        /// <summary>
        /// 自动解冻
        /// </summary>
        public void AutoUnFreeze()
        {
            try
            {
                //每天凌晨一点启动服务
                UM_DealerAccount DealerAccount;

                DateTime dt1    = DateTime.Parse(System.DateTime.Now.ToShortDateString());
                DateTime dt2    = DateTime.Parse(System.DateTime.Now.AddDays(1).ToShortDateString());
                int      IsAuto = (int)Types.IsAutoUnFreezeEnum.Auto;
                List <UM_FreezeReason> list_FreezeReason =
                    StaticDalClass.FreezeReasonDAL.GetListArray(
                        string.Format("ThawReasonTime>='{0}' AND ThawReasonTime<='{1}' AND IsAuto={2}", dt1, dt2, IsAuto));

                if (list_FreezeReason != null && list_FreezeReason.Count > 0)
                {
                    foreach (UM_FreezeReason FreezeReason in list_FreezeReason)
                    {
                        DealerAccount = StaticDalClass.DealerAccountDAL.GetModel(FreezeReason.DealerAccoutID);
                        if (DealerAccount != null)
                        {
                            DealerAccount.IsDo = true;

                            //调用柜台服务
                            try
                            {
                                List <FindAccountEntity> l      = new List <FindAccountEntity>();
                                FindAccountEntity        Entity = new FindAccountEntity();
                                Entity.AccountType = (int)DealerAccount.AccountTypeID;
                                Entity.UserID      = DealerAccount.UserID.ToString();
                                l.Add(Entity);
                                string s;
                                if (
                                    AccountManageServiceProxy.GetInstance().ThawAccount(
                                        GetCounterByUserID(DealerAccount.UserID), l, out s))
                                {
                                    //本地修改
                                    StaticDalClass.DealerAccountDAL.Update(DealerAccount);
                                }
                                else
                                {
                                    string mess = "GL-0230:调用柜台解冻帐号方法ThawAccount()失败!" + s; //写调试信息
                                }
                            }
                            catch (VTException ex)
                            {
                                //写错误日志
                                string mess = ex.ToString();
                            }
                        }
                    }
                }
                else
                {
                    LogHelper.WriteDebug("资金冻结表数据为空");
                }
            }
            catch (Exception ex)
            {
                string      errCode = "GL-0231";
                string      errMsg  = "调用AutoUnFreeze()方法异常!";
                VTException vte     = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(vte.ToString(), vte.InnerException);
                return;
            }
        }