Example #1
0
 public void HDayUpdateTest()
 {
     HDayStatisticalReport hday = new HDayStatisticalReport("");
     for (int i = 0; i < 24; i++)
     {
         int pTimePeriodHour = i;
         DateTime pDt = DateTime.Parse("2014-10-1").AddHours(i);
         hday.Update(pDt, pTimePeriodHour);
     }    
 }
        /// <summary>
        /// 补充数据
        /// </summary>
        /// <param name="dt">统计日期</param>
        private void InsertNull(DateTime dt)
        {
            HDayStatisticalReport pHday = new HDayStatisticalReport("");

            using (DataSubmittedEntities db = new DataSubmittedEntities())
            {
                RP_HDayAADT info = new RP_HDayAADT();

                info.Id        = Guid.NewGuid();
                info.CrtDate   = DateTime.Now;
                info.State     = "0";
                info.CalcuTime = dt;
                //杨村站流量
                info.YC = 0;
                //宜兴埠东站流量
                info.YXBD = 0;
                //宜兴埠西站流量
                info.YXBX = 0;
                //金钟路站流量
                info.JZL = 0;
                //机场站流量
                info.JC = 0;
                //空港经济区站流量
                info.KG = 0;
                //塘沽西站流量
                info.TGX = 0;
                //塘沽西分站流量
                info.TGXF = 0;
                //塘沽北站流量
                info.TGB = 0;
                //表12出口流量
                info.Out = 0;
                //去年同期
                info.SameSum = pHday.GetSameSum(dt);
                using (TransactionScope transac = new TransactionScope())
                {
                    db.RP_HDayAADT.Add(info);
                    db.SaveChanges();
                    transac.Complete();
                }
            }
        }
        /// <summary>
        /// 补充数据
        /// </summary>
        /// <param name="dt">统计日期</param>
        private void InsertNull(DateTime dt)
        {
            HDayStatisticalReport pHday = new HDayStatisticalReport("");
            using (DataSubmittedEntities db = new DataSubmittedEntities())
            {
                RP_HDayAADT info = new RP_HDayAADT();

                info.Id = Guid.NewGuid();
                info.CrtDate = DateTime.Now;
                info.State = "0";
                info.CalcuTime = dt;
                //杨村站流量
                info.YC = 0;
                //宜兴埠东站流量
                info.YXBD = 0;
                //宜兴埠西站流量
                info.YXBX = 0;
                //金钟路站流量
                info.JZL = 0;
                //机场站流量
                info.JC = 0;
                //空港经济区站流量
                info.KG = 0;
                //塘沽西站流量
                info.TGX = 0;
                //塘沽西分站流量
                info.TGXF = 0;
                //塘沽北站流量
                info.TGB = 0;
                //表12出口流量
                info.Out = 0;
                //去年同期
                info.SameSum = pHday.GetSameSum(dt);
                using (TransactionScope transac = new TransactionScope())
                {
                    db.RP_HDayAADT.Add(info);
                    db.SaveChanges();
                    transac.Complete();
                }
            }
        }