public static string CreateQueryPlSql(PLPrameter parameter)
 {
     System.Text.StringBuilder sb = new System.Text.StringBuilder();
     sb.Append("dbo.P_GetMoneyFlowForFlex");
     AppentSqlParameter(sb, parameter.FromTradeDay.ToTradeDayStyle());
     AppentSqlParameter(sb, parameter.ToTradeDay.ToTradeDayStyle());
     AppentSqlParameter(sb, parameter.AccountCodeString);
     int plType = (int)parameter.Type - 3;
     AppentSqlParameter(sb, plType.ToString());
     AppentSqlParameter(sb, parameter.IsGetRecordCount.ToInt32().ToString());
     return sb.ToString(0, sb.Length - 1);
 }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
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;
        }