Ejemplo n.º 1
0
        /// <summary>
        /// 手动提交清算
        /// </summary>
        /// <param name="list">结算价列表</param>
        /// <param name="errorMsg">异常信息</param>
        /// <returns></returns>
        public bool DoManualReckoning(List <QH_TodaySettlementPriceInfoEx> list, out string errorMsg)
        {
            errorMsg = "结算价列表为Null!";
            if (list == null)
            {
                return(false);
            }

            List <QH_TodaySettlementPriceInfo> listInfo = new List <QH_TodaySettlementPriceInfo>();

            foreach (QH_TodaySettlementPriceInfoEx item in list)
            {
                QH_TodaySettlementPriceInfo info = new QH_TodaySettlementPriceInfo();
                info.CommodityCode   = item.CommodityCode;
                info.TradingDate     = item.TradingDate;
                info.SettlementPrice = item.SettlementPrice;
                listInfo.Add(info);
            }

            List <CT_Counter> listcounter = StaticDalClass.CounterDAL.GetListArray(string.Empty);
            bool rtn = true;

            foreach (CT_Counter T in listcounter)
            {
                bool b = AccountManageServiceProxy.GetInstance().DoManualReckoning(T, listInfo, out errorMsg);
                if (!b)
                {
                    rtn = false;
                }
            }
            return(rtn);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 对管理员用户名和密码进行验证,并个性化设置操作
        /// </summary>
        /// <param name="pec">个性化资金实体类</param>
        /// <param name="LoginName">管理员用户名</param>
        /// <param name="PassWord">密码</param>
        /// <param name="message">返回的信息</param>
        /// <returns>格式化资金是否成功</returns>
        public bool PersonalizationCapital(PersonalizationCapital pec, string LoginName, string PassWord, out string message)
        {
            //验证管理员用户名和密码是否通过验证
            bool lastly = true;
            Out_TransactionManage outTran = new Out_TransactionManage();
            bool login = outTran.AdminLoginConfirmation(LoginName, PassWord, out message);

            if (login == true)
            {
                #region 对获取的数据通过柜台进行分组,并根据分组后柜台调用柜台服务接口
                Dictionary <string, CapitalPersonalization> list = outTran.CounterGrouping(pec);
                //循环list中键值,并分别通过键值获取柜台信息和通过键值获取个性化资金信息再调用柜台的个性化资金接口
                foreach (string key in list.Keys)
                {
                    string     CID       = key;
                    int        CounterID = int.Parse(CID);
                    CT_Counter T         = StaticDalClass.CounterDAL.GetModel((int)CounterID);;
                    //调用柜台的个性化资金接口
                    bool state = AccountManageServiceProxy.GetInstance().PersonalizationCapital(T, list[key], out message);
                    if (state == false)
                    {
                        lastly = false;
                    }
                }
                return(lastly);

                #endregion 对获取的数据通过柜台进行分组,并根据分组后柜台调用柜台服务接口
            }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 查看指定的时间柜台是否完成清算
        /// </summary>
        /// <param name="doneDate">指定日期时间</param>
        /// <returns></returns>
        public bool IsReckoningDone(DateTime doneDate)
        {
            List <CT_Counter> listcounter = StaticDalClass.CounterDAL.GetListArray(string.Empty);
            bool rtn = true;

            foreach (CT_Counter T in listcounter)
            {
                bool b = AccountManageServiceProxy.GetInstance().IsReckoningDone(T, doneDate);
                if (!b)
                {
                    rtn = false;
                    break;
                }
            }
            return(rtn);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取当前所有持仓中要提供当日结算价清算的代码
        /// </summary>
        /// <param name="errMsg"></param>
        /// <returns></returns>
        public List <QH_TodaySettlementPriceInfoEx> GetReckoningHoldCodeList(out string errMsg)
        {
            errMsg = string.Empty;
            string msg = string.Empty;
            Dictionary <string, QH_TodaySettlementPriceInfoEx> dict = new Dictionary <string, QH_TodaySettlementPriceInfoEx>();
            List <QH_TodaySettlementPriceInfoEx> list = null;
            List <CT_Counter> listcounter             = StaticDalClass.CounterDAL.GetListArray(string.Empty);

            foreach (CT_Counter T in listcounter)
            {
                List <QH_TodaySettlementPriceInfo> holdCodeList = AccountManageServiceProxy.GetInstance().GetReckoningHoldCodeList(T, out errMsg);
                if (!string.IsNullOrEmpty(errMsg))
                {
                    msg = errMsg;
                }
                if (holdCodeList != null)
                {
                    if (list == null)
                    {
                        list = new List <QH_TodaySettlementPriceInfoEx>();
                    }
                    foreach (QH_TodaySettlementPriceInfo item in holdCodeList)
                    {
                        //消除重复的代码
                        if (!dict.ContainsKey(item.CommodityCode))
                        {
                            QH_TodaySettlementPriceInfoEx info = new QH_TodaySettlementPriceInfoEx();
                            info.CommodityCode   = item.CommodityCode;
                            info.TradingDate     = item.TradingDate;
                            info.SettlementPrice = item.SettlementPrice;
                            dict.Add(item.CommodityCode, info);
                        }
                    }
                }
            }
            foreach (KeyValuePair <string, QH_TodaySettlementPriceInfoEx> item in dict)
            {
                list.Add(item.Value);
            }
            errMsg = msg;
            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;
            }
        }
        /// <summary>
        /// 删除交易员根据ID
        /// </summary>
        /// <param name="UserID">用户ID</param>
        /// <param name="mess"></param>
        /// <returns></returns>
        public bool DelTransaction(int UserID, out string mess)
        {
            //更新本地状态  只要状态更新成功,如果本次删除失败会通过定时服务再次去删除
            //try
            //{
            //    StaticDalClass.UserInfoDAL.UpdateDelState(UserID, null, null);
            //}
            //catch (Exception Ex)
            //{
            //    string errCode = "GL-0211";
            //    string errMsg = "交易员更新为删除状态失败";
            //    VTException vte = new VTException(errCode, errMsg, Ex);
            //    mess = vte.ToString();
            //    return false;
            //}
            //调用柜台销户方法
            try
            {
                CT_Counter T = GetCounterByUserID(UserID);
                if (T == null)
                {
                    mess = "GL-0212:交易员获取相应柜台失败"; //写调试信息
                    LogHelper.WriteDebug(mess);
                    return(false);
                }
                if (!AccountManageServiceProxy.GetInstance().DeleteSingleTraderAccount(T, UserID.ToString(), out mess))
                {
                    mess = "GL-0213:调用柜台柜台销户方法DeleteSingleTraderAccount失败!" + mess; //写调试信息
                    LogHelper.WriteDebug(mess);
                    return(false);
                }
            }
            catch (VTException Ex)
            {
                mess = Ex.ToString();
                //写错误日志
                return(false);
            }
            try
            {
                Database     db   = DatabaseFactory.CreateDatabase();
                DbConnection Conn = db.CreateConnection();
                if (Conn.State != ConnectionState.Open)
                {
                    Conn.Open();
                }
                DbTransaction Tran = Conn.BeginTransaction();
                try
                {
                    StaticDalClass.ThawReasonDAL.DeleteByUserID(UserID, Tran, db);

                    StaticDalClass.FreezeReasonDAL.DeleteByUserID(UserID, Tran, db);

                    StaticDalClass.OriginationFundDAL.DeleteByUserID(UserID, Tran, db);

                    StaticDalClass.DealerAccountDAL.DeleteByUserID(UserID, Tran, db);

                    StaticDalClass.DealerTradeBreedClassDAL.DeleteByUserID(UserID, Tran, db);

                    StaticDalClass.UserInfoDAL.Delete(UserID, Tran, db);
                    Tran.Commit();
                    mess = "GL-0214:交易员删除成功!";
                    return(true);
                }
                catch (Exception ex)
                {
                    Tran.Rollback();
                    string      errCode = "GL-0215";
                    string      errMsg  = "删除交易员方法失败!";
                    VTException vte     = new VTException(errCode, errMsg, ex);
                    LogHelper.WriteError(vte.ToString(), vte.InnerException);
                    mess = vte.ToString();
                    return(false);
                }
                finally
                {
                    if (Conn.State == ConnectionState.Open)
                    {
                        Conn.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                string      errCode = "GL-0216";
                string      errMsg  = "连接数据库失败!";
                VTException vte     = new VTException(errCode, errMsg, ex);
                LogHelper.WriteError(vte.ToString(), vte.InnerException);
                mess = vte.ToString();
                return(false);
            }
        }