Пример #1
0
        private void StartGetFundCode(QueryObject parameter)
        {
            if (Common.Service == null || Common.SessionId == null) return;

            Func<string[]> taskBody = () =>
            {
                if (Common.SynchronizationContext == null) return null;
                Common.SynchronizationContext.Send(m =>
                {
                    Messenger.Default.Send(new LoadingMsg());
                }, null);
                return Common.Service.GetAllFundNo(Common.SessionId, parameter);
            };

            Action<Task<string[]>> taskContinue = ant =>
            {
                Messenger.Default.Send(new LoadingMsg());
                if (ant.Exception != null)
                {
                    _Log.Error(ant.Exception);
                    return;
                }
                PostGetFundNo(ant.Result);
            };

            TaskUtil.TaskHelper.Create<string[]>(taskBody, taskContinue);

        }
 public bool GetUIParametersHelper(out QueryObject parameter,bool isGetFundCode=false)
 {
     parameter = null;
     if (this.BusinessTypeView.CurrentItem == null) return false;
     DateTime fromDt = this.FromTradeDay;
     DateTime toDt = this.ToTradeDay;
     BusinessTypeEnum plType = EnumUtil.ParseString<BusinessTypeEnum>(this.BusinessTypeView.CurrentItem.ToString());
     if (fromDt > toDt)
     {
         MessageBox.Show("FromTradeDay  can't great than ToTradeDay!");
         return false;
     }
     string fundNoStr = string.Empty;
     string accountStr = string.Empty;
     try
     {
         accountStr = GetAccountStr();
         if (isGetFundCode)
         {
             fundNoStr = GetFundCode(plType);
         }
     }
     catch (Exception e)
     {
         DebugHelper.Log(e.ToString());
         return false;
     }
     parameter = new QueryObject();
     parameter.Type = plType;
     parameter.BeginDatetime = fromDt;
     parameter.EndDatetime = toDt;
     parameter.AccountStr = accountStr;
     parameter.DepositQueryStr = fundNoStr;
     return true;
 }
Пример #3
0
 public ExportFileParameters GetExportFileParameters(QueryObject data)
 {
     ExportFileParameters parameters = new ExportFileParameters();
     parameters.QueryInfo = data;
     parameters.IsPL = (int)data.Type > (int)BusinessTypeEnum.Transfer;
     return parameters;
 }
Пример #4
0
 QueryPageCountResult IDepositService.GetDepositPageCount(string sessionID, QueryObject data)
 {
     if (!ClientManager.Default.Contains(sessionID)) return new QueryPageCountResult { Type = ReturnType.Error };
     try
     {
         return DataManager.Default.GetDepositPageCount(sessionID,data);
     }
     catch (Exception e)
     {
         _Log.ErrorFormat("GetDepositData  {0}", e);
         return new QueryPageCountResult { Type = ReturnType.Error };
     }
 }
Пример #5
0
 string[] IDepositService.GetAllFundNo(string sessionID, QueryObject parameter)
 {
     if (!ClientManager.Default.Contains(sessionID)) return null;
     try
     {
         return AccountService.GetAllFundNo(parameter);
     }
     catch (Exception e)
     {
         _Log.ErrorFormat("GetAllFundNo  {0}", e);
         return null;
     }
 }
Пример #6
0
 public int GetPLDataRecordCount(QueryObject parameter)
 {
     PLPrameter plParameter = new PLPrameter()
     {
          FromTradeDay = parameter.BeginDatetime,
          ToTradeDay = parameter.EndDatetime,
          AccountCodeString = parameter.AccountStr,
          Type=parameter.Type,
          IsGetRecordCount=true
     };
     string sql = ProcedureStrFactory.CreateQueryPlSql(plParameter);
     return (int)DataAccess.ExecuteScalar(sql, ConfigHelper.ConnectionString);
 }
 public bool GetAllParameters(out QueryObject target)
 {
     target = null;
     SaveFileDialog dlg = new SaveFileDialog();
     dlg.FileName = "Document";
     dlg.DefaultExt = ".text";
     dlg.Filter = "Text documents (.txt)|*.txt";
     Nullable<bool> isShow = dlg.ShowDialog();
     if (isShow == false) return false;
     bool result = GetUIParametersHelper(out target,true);
     if (result == false) return false;
     target.FilePath = dlg.FileName;
     return true;
 }
Пример #8
0
 public static string[] GetAllFundNo(QueryObject queryObj)
 {
     QueryDepositCodeParameter parameter = new QueryDepositCodeParameter
     {
          FromTradeDay=queryObj.BeginDatetime,
          ToTradeDay=queryObj.EndDatetime,
          AccountCodeStr= queryObj.AccountStr,
          PaymentType= queryObj.Type
     };
     string sql = ProcedureStrFactory.CreateQueryDepositCodeSql(parameter);
    _Log.InfoFormat("GetAllFundNo sql:{0}", sql);
     DataSet ds = DataAccess.GetData(sql, ConfigHelper.ConnectionString);
    _Log.InfoFormat("GetAllFundNo count:{0}", ds.Tables[0].Rows.Count);
     List<string> list = new List<string>();
     foreach (DataRow dr in ds.Tables[0].Rows)
     {
         list.Add((string)dr["Code"]);
     }
     return list.ToArray();
 }
Пример #9
0
 private void InitWhenLoadFundNo(bool isReconnect)
 {
     Common.SynchronizationContext.Send(m =>
     {
         if (!isReconnect) this.MessengerInstance.Send(new ProgressMessage("Loading FundNo", 70));
     }, null);
     QueryObject parameter = new QueryObject();
     parameter.BeginDatetime = QueryStringManager.Default.FromTradeDay;
     parameter.EndDatetime = QueryStringManager.Default.ToTradeDay;
     parameter.AccountStr = string.Empty;
     var data = Common.Service.GetAllFundNo(Common.SessionId, parameter);
     Common.SynchronizationContext.Post(m =>
     {
         FundManager.Default.DataCol.Clear();
         FundManager.Default.PostGetFundNo(data);
     }, null);
 }
Пример #10
0
 public int GetPLDataRecordCount(QueryObject parameter)
 {
     return this._PLService.GetPLDataRecordCount(parameter);
 }
Пример #11
0
 public QueryPageCountResult GetPLDataPageCount(string sessionID, QueryObject parameter)
 {
     return this._PLService.GetPLDataPageCount(sessionID, parameter);
 }
Пример #12
0
 int IPLService.GetPLDataRecordCount(string sessionID,QueryObject parameter)
 {
     if (!ClientManager.Default.Contains(sessionID)) return 0;
     try
     {
         return DataManager.Default.GetPLDataRecordCount(parameter);
     }
     catch (Exception ex)
     {
         _Log.ErrorFormat("GetPLDataRecordCount  {0}", ex);
         return 0;
     }
 }
Пример #13
0
 public QueryPageCountResult GetDepositPageCount(string sessionID, QueryObject data)
 {
     return _DepositService.GetDepositPageCount(sessionID,data);
 }
Пример #14
0
        public QueryPageCountResult GetDepositPageCount(string sessionID, QueryObject parameter)
        {
            QueryPageCountResult result = new QueryPageCountResult();
            QueryDepositRecordParameter depositParameter = new QueryDepositRecordParameter
            {
                 FromTradeDay= parameter.BeginDatetime,
                 ToTradeDay=parameter.EndDatetime,
                 AccountCodeStr=parameter.AccountStr,
                 DepositCodeStr=parameter.DepositQueryStr,
                 PaymentType=parameter.Type,
                 IsGetRecordCount=false
            };
            string sql = ProcedureStrFactory.CreateQueryDepositRecordSql(depositParameter);
            _Log.Warn(string.Format("GetDepositData {0}", sql));
            DataSet ds = DataAccess.GetData(sql, ConfigHelper.ConnectionString, TimeSpan.FromMinutes(10));
            _Log.Warn(string.Format("GetDepositData End Count: {0}", ds.Tables[0].Rows.Count));
            Guid? accountingBaseCurrencyId = CurrencyRepository.GetAccountingBaseCurrency();
            if (accountingBaseCurrencyId == null)
            {
                result.Type = ReturnType.DataNotComplete;
                return result;
            }
            string baseCurrencyName = CurrencyRepository.GetCurrencyName(accountingBaseCurrencyId.Value);
            List<DepositData> list = new List<DepositData>();
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                try
                {
                    var data = Fill(dr, baseCurrencyName, parameter.Type);
                    if (data == null)
                    {
                        result.Type = ReturnType.DataNotComplete;
                        return result;
                    }
                    if (parameter.Type != BusinessTypeEnum.Transfer) FlexInterface.Helper.DepositInnerService.AddDesc(parameter.Type, data);
                    list.Add(data);
                }
                catch (Exception ex)
                {
                    _Log.ErrorFormat("GetDepositData  {0}", ex);
                    result.Type = ReturnType.Error;
                    return result;
                }
            }

            int count = list.Count;
            if (parameter.Type == BusinessTypeEnum.Transfer)
            {
                count = count / 2;
                List<DepositData> transferList = new List<DepositData>();
                foreach (var item in list.GroupBy(m => m.MarginReference).ToDictionary(m => m.Key, m => m.OrderBy(x => x.SourceAmount).ToList()))
                {
                    if (item.Value.Count != 2)
                    {
                        result.Type = ReturnType.Error;
                        return result;
                    }
                    var target = item.Value[1];
                    target.Transfer = item.Value[0];
                    FlexInterface.Helper.DepositInnerService.AddDesc(BusinessTypeEnum.Transfer, target);
                    transferList.Add(target);
                }
                lock (this._SycBlock)
                {
                    this._Dict[sessionID] = transferList;
                }

            }
            else
            {
                lock (this._SycBlock)
                {
                    this._Dict[sessionID] = list;
                }
            }
            _Log.Warn(string.Format("GetDepositData Complete Count: {0}", count));
            result.Type = ReturnType.Normal;
            result.PageCount = this._CommonService.GetPageCount(count);
            return result;
        }
Пример #15
0
 public int GetDepositRecordCount(QueryObject parameter)
 {
     QueryDepositRecordParameter depositParameter = new QueryDepositRecordParameter()
     {
         FromTradeDay=parameter.BeginDatetime,
         ToTradeDay=parameter.EndDatetime,
         AccountCodeStr=parameter.AccountStr,
         DepositCodeStr=parameter.DepositQueryStr,
         PaymentType=parameter.Type,
         IsGetRecordCount=true
     };
     string sql = ProcedureStrFactory.CreateQueryDepositRecordSql(depositParameter);
     _Log.Warn(string.Format("GetDepositData {0}", sql));
     return (int)DataAccess.ExecuteScalar(sql, ConfigHelper.ConnectionString);
 }
Пример #16
0
 QueryPageCountResult IPLService.GetPLDataPageCount(string sessionID, QueryObject parameter)
 {
     if (!ClientManager.Default.Contains(sessionID)) return new QueryPageCountResult { Type = ReturnType.Error };
     try
     {
         return DataManager.Default.GetPLDataPageCount(sessionID,parameter);
     }
     catch (Exception e)
     {
         _Log.ErrorFormat("GetPLData  {0}", e);
         return new QueryPageCountResult { Type = ReturnType.Error };
     }
 }
Пример #17
0
        public QueryPageCountResult GetPLDataPageCount(string sessionID, QueryObject parameter)
        {
            PLPrameter plParameter = new PLPrameter()
            {
                FromTradeDay = parameter.BeginDatetime,
                ToTradeDay = parameter.EndDatetime,
                AccountCodeString = parameter.AccountStr,
                Type = parameter.Type,
                IsGetRecordCount = false
            };
            string sql = ProcedureStrFactory.CreateQueryPlSql(plParameter);
            QueryPageCountResult result = new QueryPageCountResult();
            List<PLData> plList = new List<PLData>();
            _Log.WarnFormat(" GET PL DATA, sql:   {0} ", sql);
            DataSet ds = DataAccess.GetData(sql, ConfigHelper.ConnectionString, TimeSpan.FromMinutes(10));
            _Log.Warn(string.Format("GET PL DATA End.  Result Count:{0}", ds.Tables[0].Rows.Count));
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                try
                {
                    PLData plData = Fill(dr, parameter.Type);
                    if (plData == null)
                    {
                        result.Type = ReturnType.DataNotComplete;
                        return result;
                    }
                    plData.FromTradeDay = parameter.BeginDatetime;
                    plData.ToTradeDay = parameter.EndDatetime;
                    if (plData is FloatingPLData)
                    {
                        FloatingPLData data = (FloatingPLData)plData;
                        DateTime targetDate = data.FromTradeDay.AddDays(-1);
                        data.LastFloatingPLData.FromTradeDay = targetDate;
                        data.LastFloatingPLData.ToTradeDay =data.ToTradeDay;
                    }

                    if (plData.OriginAmount == 0) continue;
                    plList.Add(plData);
                }
                catch (ArgumentNullException ane)
                {
                    _Log.Error(ane);
                    result.Type = ReturnType.DataNotComplete;
                    return result;
                }
                catch (Exception ex)
                {
                    _Log.Error(ex);
                    result.Type = ReturnType.Error;
                    return result;
                }
                
            }
            int count = plList.Count;
            _Log.InfoFormat("Final Data quantity: {0}", count);
            if (count == 0)
            {
                result.Type = ReturnType.NoData;
            }
            else
            {
                result.Type = ReturnType.Normal;
            }
            result.PageCount = count / ConfigHelper.PageSize + (count % ConfigHelper.PageSize == 0 ? 0 : 1);
            lock (this._SycBlock)
            {
                this._Dict[sessionID] = plList;
            }
            return result;
        }
Пример #18
0
 public int GetDepositRecordCount(QueryObject parameter)
 {
     return _DepositService.GetDepositRecordCount(parameter);
 }