Exemple #1
0
        //ToanTXSE
        //Get box List by location ID
        public static List <Models.AndroidBoxVM> GetBoxIdByBrandId()
        {
            IBoxService      boxService      = DependencyUtils.Resolve <IBoxService>();
            ILocationService locationService = DependencyUtils.Resolve <ILocationService>();
            var           AndroidBoxVM       = new List <Models.AndroidBoxVM>();
            IBrandService brandService       = DependencyUtils.Resolve <IBrandService>();
            var           user    = Helper.GetCurrentUser();
            var           boxList = boxService.GetBoxIdByBrandId(user.BrandID);

            foreach (var item in boxList)
            {
                var location       = locationService.Get(item.LocationID);
                var locationString = location.Address + ", Quận " + location.District + ", TP." + location.Province;
                var m = new Models.AndroidBoxVM
                {
                    Name        = item.BoxName,
                    Description = item.Description,
                    BoxId       = item.BoxID,
                    LocationId  = item.LocationID,
                    Location    = locationString,
                };
                AndroidBoxVM.Add(m);
            }
            return(AndroidBoxVM);
        }
Exemple #2
0
        public ActionResult Index()
        {
            var user = System.Web.HttpContext.Current.User;

            ViewBag.Title       = "Digital Signage System";
            ViewBag.FullName    = user.Identity.Name;
            Session["username"] = user.Identity.Name;
            Session["userID"]   = user.Identity.GetUserId(); //GetUserId() only can be used when using Microsoft.AspNet.Identity;

            //Get Size Account
            IAspNetUserService aspNetUserService = DependencyUtils.Resolve <IAspNetUserService>();
            var users       = Helper.GetCurrentUser();
            var accountList = aspNetUserService.GetAccountsByBrandId(users.BrandID);
            var size        = accountList.Count;

            ViewBag.accountList = size;

            //ScreenList
            IScreenService screenSevice = DependencyUtils.Resolve <IScreenService>();
            var            screenList   = screenSevice.GetScreenIdByBrandId(users.BrandID);
            var            screenSize   = screenList.Count;

            ViewBag.screenList = screenSize;

            //BoxList
            IBoxService boxService = DependencyUtils.Resolve <IBoxService>();
            var         boxList    = boxService.GetBoxIdByBrandId(users.BrandID);
            var         boxSize    = boxList.Count;

            ViewBag.boxList = boxSize;

            //DeviceList
            IDeviceService deviceService = DependencyUtils.Resolve <IDeviceService>();
            var            deviceList    = deviceService.GetDeviceByBrandId(users.BrandID);
            var            deviceSize    = deviceList.Count;

            ViewBag.deviceList = deviceSize;

            //LocationList
            ILocationService locationService = DependencyUtils.Resolve <ILocationService>();
            var locationList = locationService.GetLocationIdByBrandId(users.BrandID);
            var locationSize = locationList.Count;

            ViewBag.locationList = locationSize;

            //MediaSrcList
            IMediaSrcService mediaSrcService = DependencyUtils.Resolve <IMediaSrcService>();
            var mediasrcList = mediaSrcService.GetMediaSrcByBrand(users.BrandID);
            var mediasrcSize = mediasrcList.Count;

            ViewBag.mediarsList = mediasrcSize;

            //PlaylistList
            IPlaylistService playlistService = DependencyUtils.Resolve <IPlaylistService>();
            var playlistList = playlistService.GetPlaylistIdByBrandId(users.BrandID);
            var playlistSize = playlistList.Count;

            ViewBag.playlistList = playlistSize;


            //ScenarioList
            IScenarioService scenarioService = DependencyUtils.Resolve <IScenarioService>();
            var scenarioList = scenarioService.GetScenarioIdByBrandId(users.BrandID);
            var scenarioSize = scenarioList.Count;

            ViewBag.scenarioList = scenarioSize;

            //ScheduleList
            IScheduleService scheduleService = DependencyUtils.Resolve <IScheduleService>();
            var scheduleList = scheduleService.GetScheduleIdByBrandId(users.BrandID);
            var scheduleSize = scheduleList.Count;

            ViewBag.scheduleList = scheduleSize;
            return(View());
        }