Пример #1
0
        public ActionResult Index()
        {
            QHTEntities            db            = new QHTEntities();
            List <BusinessMdel>    lbusinessMdel = new List <BusinessMdel>();
            List <Models.Business> buslist       = db.Business.ToList();

            buslist.ForEach(a =>
            {
                Logdetail log = db.Logdetail.Where(l => l.busId == a.ID).OrderByDescending(l => l.date).FirstOrDefault();
                Count count   = db.Count.Where(c => c.BusId == a.ID).FirstOrDefault();
                if (log == null)
                {
                    log = new Logdetail()
                    {
                        id          = 0,
                        busId       = a.ID,
                        code        = string.Empty,
                        date        = string.Empty,
                        description = string.Empty,
                        mark        = string.Empty,
                        postData    = string.Empty,
                        postType    = string.Empty,
                        result      = string.Empty,
                        returnData  = string.Empty,
                        url         = string.Empty
                    };
                }
                if (count == null)
                {
                    count = new Count()
                    {
                        id        = 0,
                        BusId     = a.ID,
                        failcount = 0,
                        failsum   = 0,
                        lattime   = null,
                        succount  = 0,
                        sucsum    = 0
                    };
                }
                BusinessMdel businessMdel = new BusinessMdel()
                {
                    business = a,
                    count    = count,
                    log      = log
                };
                lbusinessMdel.Add(businessMdel);
            });
            TimeAPI.Models.BusinessMdellist businessMdellist = new BusinessMdellist();
            businessMdellist.busiMoList = lbusinessMdel;
            return(View(businessMdellist));
        }
Пример #2
0
        /// <summary>
        /// 根据业务ID获取日志
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult GetLog(int?id)
        {
            QHTEntities db = new QHTEntities();

            return(View("Buslog", db.Logdetail.Where(s => s.busId == id).OrderByDescending(a => a.date).ToList()));
        }