コード例 #1
0
        public ActionResult ClientReports()
        {
            ClientHomeModel clientHomeModel = new ClientHomeModel();

            ModelsLayer.User cu = GetUserID();

            //if (cu != null)
            //{
            //    Guid UserID = cu.UserId;

            //    ModelsLayer.ClaimsEntities claimsModel =
            //        new ModelsLayer.ClaimsEntities();

            //    var countyCounter =
            //     from claims in claimsModel.Claims
            //     where claims.UserID == UserID
            //     group claims by new { country = claims.Country.Name, status = claims.ClaimStatu.Name } into grp
            //     let counter = grp.Count()
            //     select new CountyCounter() { Country = grp.Key.country, Counter = counter, Status = grp.Key.status };



            //    var c =
            //        claimsModel.Claims
            //        .GroupBy(n => n.ClaimStatu.Name)
            //        .Select(n => new ClaimStatusAggregate
            //        {
            //            Status = n.Key,
            //            Counter = n.Count()
            //        }
            //        )
            //        .OrderBy(n => n.Status);

            //    clientHomeModel.ClaimStatusList = c.ToList();
            //    clientHomeModel.CountryCounterList = countyCounter.ToList();



            //    return View(clientHomeModel);
            //}
            //else

            return(View());
        }
コード例 #2
0
        public ActionResult GoogleDonutChart(String StatusName)
        {
            ModelsLayer.User clientUser = GetUserID();

            ModelsLayer.ClaimsEntities ClaimsEntities = new ModelsLayer.ClaimsEntities();

            var c =
                ClaimsEntities.Claims
                .GroupBy(n => n.ClaimStatu.Name)
                .Select(n => new ClaimStatusAggregate
            {
                Status  = n.Key,
                Counter = n.Count()
            }
                        )
                .OrderBy(n => n.Status);


            return(View(c.ToList()));
        }
コード例 #3
0
        public ModelsLayer.User GetUserID()
        {
            ModelsLayer.User clientUser = null;

            if (HttpContext.User != null && HttpContext.User.Identity != null &&
                !String.IsNullOrEmpty(HttpContext.User.Identity.Name))
            {
                string clientUsername = HttpContext.User.Identity.Name;

                ClaimsEntities ClaimsEntities = new ClaimsEntities();
                var            clientUser2    =
                    from clientUsers in ClaimsEntities.Users
                    where clientUsers.UserName == clientUsername
                    select clientUsers;

                if (clientUser2 != null && clientUser2.Count() > 0)
                {
                    clientUser = clientUser2.Single <ModelsLayer.User>();
                }
            }

            return(clientUser);
        }