Exemplo n.º 1
0
        private void DoHoldFreezeCheck()
        {
            var holdMemoryTables = MemoryDataManager.HKHoldMemoryList.GetAll();

            foreach (var holdMemoryTable in holdMemoryTables)
            {
                var hold = holdMemoryTable.Data;
                try
                {
                    int accountHoldId = hold.AccountHoldLogoID;

                    HK_AcccountHoldFreezeDal freezeTableDal = new HK_AcccountHoldFreezeDal();
                    int sum = freezeTableDal.GetAllFreezeAmount(accountHoldId);
                    holdMemoryTable.ReadAndWrite(h =>
                    {
                        if (h.FreezeAmount != sum)
                        {
                            string format =
                                "HKReckonUnitManager.DoHoldFreezeCheck[AccountHoldLogoId={0},FreezeAmount={1},TrueSum={2}]";
                            string desc = string.Format(format, accountHoldId,
                                                        h.FreezeAmount, sum);
                            LogHelper.WriteDebug(desc);

                            h.FreezeAmount = sum;
                        }

                        return(h);
                    });
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError(ex.Message, ex);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取现货对应委托单的持仓冻结对象
        /// </summary>
        /// <param name="entrustNumber">委托单号</param>
        /// <param name="ft">冻结类型</param>
        /// <returns>委托单的持仓冻结实体</returns>
        public static HK_AcccountHoldFreezeInfo GetHoldAccountFreeze(string entrustNumber, Types.FreezeType ft)
        {
            HK_AcccountHoldFreezeDal dal = new HK_AcccountHoldFreezeDal();
            string format = "EntrustNumber='{0}' AND FreezeTypeID={1}";

            string where = string.Format(format, entrustNumber, (int)ft);

            IList <HK_AcccountHoldFreezeInfo> list = null;

            try
            {
                list = dal.GetListArray(where);
            }
            catch (Exception ex)
            {
                LogHelper.WriteError(ex.Message, ex);
            }

            if (list == null)
            {
                return(null);
            }

            if (list.Count == 0)
            {
                return(null);
            }

            return(list[0]);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 港股持仓冻结处理
        /// </summary>
        /// <param name="tm"></param>
        /// <returns></returns>
        private int PO_BuildHoldFreezeRecord(ReckoningTransaction tm)
        {
            LogHelper.WriteDebug("港股持仓冻结处理XHSellOrderLogicFlow.PO_ProcessXhHoldingAccountFreeze");

            HK_AcccountHoldFreezeInfo hahf = new HK_AcccountHoldFreezeInfo();

            hahf.AccountHoldLogo = HoldingAccountId; //港股持仓帐户标识
            hahf.EntrustNumber   = EntrustNumber;    //委托单号
            hahf.FreezeTime      = DateTime.Now;     //冻结时间
            hahf.ThawTime        = DateTime.Now;     //解冻时间

            //decimal unitMultiple = MCService.GetTradeUnitScale(stockorder.Code, stockorder.OrderUnitType);
            decimal orderAmount = Convert.ToDecimal(Request.OrderAmount);                    // *unitMultiple;

            hahf.PrepareFreezeAmount = Convert.ToInt32(orderAmount);                         //冻结数量
            hahf.FreezeTypeID        = (int)Entity.Contants.Types.FreezeType.DelegateFreeze; //冻结类型


            HK_AcccountHoldFreezeDal dal = new HK_AcccountHoldFreezeDal();

            try
            {
                return(dal.Add(hahf, tm.Database, tm.Transaction));
            }
            catch (Exception ex)
            {
                string txt = "AccountHoldLogo={0},EntrustNumber={1},FreezeTime={2},ThawTime={3},PrepareFreezeAmount={4},FreezeTypeID={5}";
                txt = string.Format(txt, hahf.AccountHoldLogo, hahf.EntrustNumber, hahf.FreezeTime, hahf.ThawTime, hahf.PrepareFreezeAmount, hahf.FreezeTypeID);
                LogHelper.WriteDebug("港股持仓冻结处理实体内容" + txt);
                throw ex;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 清除持仓冻结
        /// </summary>
        /// <param name="persistHoldFreezeId"></param>
        /// <param name="db"></param>
        /// <param name="transaction"></param>
        /// <returns></returns>
        public static bool ClearHoldFreeze(int persistHoldFreezeId, Database db, DbTransaction transaction)
        {
            if (persistHoldFreezeId != -1)
            {
                try
                {
                    HK_AcccountHoldFreezeDal hDal = new HK_AcccountHoldFreezeDal();
                    hDal.Clear(persistHoldFreezeId, db, transaction);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError(ex.Message, ex);
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 删除资金冻结记录
        /// </summary>
        /// <param name="persistHoldFreezeId">资金冻结记录id</param>
        /// <returns>是否成功</returns>
        public static bool DeleteHoldFreeze(int persistHoldFreezeId)
        {
            if (persistHoldFreezeId != -1)
            {
                try
                {
                    HK_AcccountHoldFreezeDal hDal = new HK_AcccountHoldFreezeDal();
                    hDal.Delete(persistHoldFreezeId);
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError(ex.Message, ex);
                    return(false);
                }
            }

            return(true);
        }