예제 #1
0
        internal ICollection <IDailyReg> LoadDailyRegs(IInstrument i)
        {
            List <IDailyReg> lst = new List <IDailyReg>();

            DailyRegMapper        drm        = new DailyRegMapper(mapperHelper.context);
            List <IDataParameter> parameters = new List <IDataParameter>();

            parameters.Add(new SqlParameter("@id", i.isin));
            using (IDataReader rd = mapperHelper.ExecuteReader("select isin,minval ,openingval, maxval,closingval, dailydate from DailyReg where isin=@id", parameters))
            {
                while (rd.Read())
                {
                    DailyReg dr = new DailyReg
                    {
                        isin                   = rd.IsDBNull(0) ? default : rd.GetString(0),
                                        minval = rd.IsDBNull(1) ? default : rd.GetDecimal(1),
                                                 openingval                   = rd.IsDBNull(2) ? default : rd.GetDecimal(2),
                                                                       maxval = rd.IsDBNull(3) ? default : rd.GetDecimal(3),
                                                                                closingval                         = rd.IsDBNull(4) ? default : rd.GetDecimal(4),
                                                                                                         dailydate = rd.IsDBNull(5) ? default : rd.GetDateTime(5),
                                                                                                                     instrument = i
                    };

                    lst.Add(dr);
                }
            }
            return(lst);
        }
예제 #2
0
 public DailyRegRepository(IContext ctx)
 {
     context = ctx;
     mapper  = new DailyRegMapper(context);
 }