Ejemplo n.º 1
0
        public static EachDayTVSeriesDO GetTVSeries(DateTime effectiveDate, int timeTypeID)
        {
            string            sql  = @"select * from [dbo].[EachDayTVSeries] 
where EffectiveDate=@EffectiveDate
and TimeTypeID=@TimeTypeID";
            EachDayTVSeriesDO tvDO = new EachDayTVSeriesDO();

            SqlParameter[] pars = new SqlParameter[2];
            pars[0] = new SqlParameter("@EffectiveDate", effectiveDate);
            pars[1] = new SqlParameter("@TimeTypeID", timeTypeID);
            return((EachDayTVSeriesDO)baseLogic.Select(tvDO, sql, pars));
        }
Ejemplo n.º 2
0
        private void ReadTVSeries(DateTime reportDate, string filePath)
        {
            try
            {
                DataTable dtChannel = NPOIHelper.ImportExceltoDt(filePath, "交互分析", 1);
                if (dtChannel == null)
                {
                    MessageBox.Show("文件中未找到相关数据");
                    return;
                }
                for (int i = 2; i < dtChannel.Rows.Count; i++)
                {
                    DataRow row  = dtChannel.Rows[i];
                    string  name = row[1].ToString().Trim();
                    if (string.IsNullOrEmpty(name))
                    {
                        continue;
                    }
                    int timeTypeID = 1;
                    if (name.StartsWith("08:30"))
                    {
                        timeTypeID = 1;
                    }
                    else if (name.StartsWith("12:30"))
                    {
                        timeTypeID = 2;
                    }
                    else if (name.StartsWith("19:30"))
                    {
                        timeTypeID = 3;
                    }

                    string  tvRate  = row[3].ToString();
                    decimal _tvRate = 0;
                    decimal.TryParse(tvRate, out _tvRate);

                    EachDayTVSeriesDO tvDO = new EachDayTVSeriesDO();
                    tvDO.StrTime       = name;
                    tvDO.TimeTypeID    = timeTypeID;
                    tvDO.EffectiveDate = reportDate;
                    tvDO.TVRate        = _tvRate;
                    tvDO.EffectiveDate = reportDate;
                    BusinessLogicBase.Default.Insert(tvDO);
                }

                MessageBox.Show("读取成功!");
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 3
0
        public static decimal GetLastSameTVSeriesRate(DateTime effectiveDate, int timeTypeID)
        {
            string            sql  = @"select top 1 TVRate from [dbo].[EachDayTVSeries] 
where EffectiveDate<@EffectiveDate
and EffectiveDate>=dateadd(day,-7,@EffectiveDate)
and TimeTypeID=@TimeTypeID
order by EffectiveDate desc";
            EachDayTVSeriesDO tvDO = new EachDayTVSeriesDO();

            SqlParameter[] pars = new SqlParameter[2];
            pars[0] = new SqlParameter("@EffectiveDate", effectiveDate);
            pars[1] = new SqlParameter("@TimeTypeID", timeTypeID);
            decimal   result = 0;
            DataTable dt     = baseLogic.Select(sql, pars);

            if (dt != null && dt.Rows.Count > 0)
            {
                decimal.TryParse(dt.Rows[0][0].ToString(), out result);
            }
            return(result);
        }