public async Task TestItemQuantityPerMenu()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var itemRepository   = new EfRepository <Item>(new ApplicationDbContext(options.Options));
            var orderRepository  = new EfDeletableEntityRepository <Order>(new ApplicationDbContext(options.Options));
            var dashboardService = new DashboardService(itemRepository, orderRepository);

            await itemRepository.AddAsync(new Item { Name = "Eggs", Quantity = 0, MenuId = 1 });

            itemRepository.SaveChangesAsync().GetAwaiter().GetResult();

            await itemRepository.AddAsync(new Item { Name = "Eggs", Quantity = 0, MenuId = 2 });

            itemRepository.SaveChangesAsync().GetAwaiter().GetResult();

            await itemRepository.AddAsync(new Item { Name = "Pizza", Quantity = 0, MenuId = 2 });

            itemRepository.SaveChangesAsync().GetAwaiter().GetResult();


            int countMenu1 = dashboardService.ItemQuantityPerMenu(1);
            int countMenu2 = dashboardService.ItemQuantityPerMenu(2);
            int countMenu3 = dashboardService.ItemQuantityPerMenu(3);

            Assert.Equal(1, countMenu1);
            Assert.Equal(2, countMenu2);
            Assert.Equal(0, countMenu3);
        }
Esempio n. 2
0
        public JsonResult Data([Bind(Include = "PartNr,DateFrom,DateTo,Type,Top")] DashboardSearchModel searchModel)
        {
            IDashboardService ds = new DashboardService(Properties.Settings.Default.db);

            Dictionary <string, List <DashboardItem> > data = new Dictionary <string, List <DashboardItem> >();

            // List<DashboardItem> items = new List<DashboardItem>();
            switch (searchModel.Type)
            {
            case 100:
                data = ds.GetPartStockDash(searchModel);
                break;

            case 200:
                data = ds.GetPartCompleteRateDash(searchModel);
                break;

            case 300:
                searchModel.DateFrom = DateTime.Now.Date.AddDays(-8);
                searchModel.DateTo   = DateTime.Now.Date.AddDays(-1);
                data = ds.GetPartTopRateDash(searchModel);
                break;

            default:
                break;
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
        public ActionResult TicketLog()
        {
            TicketModel objModel = new TicketModel();

            QuotationService    objCompUSerService = new QuotationService();
            List <CompanyModel> objCompList        = new List <CompanyModel>();

            objCompList       = objCompUSerService.getActiveComp();
            objModel.ListComp = new List <CompanyModel>();
            objModel.ListComp.AddRange(objCompList);

            List <UserModel> objUserList = new List <UserModel>();

            objUserList       = objCompUSerService.getActiveUser();
            objModel.UserList = new List <UserModel>();
            objModel.UserList.AddRange(objUserList);

            DashboardService objService   = new DashboardService();
            List <UserModel> objUserList1 = new List <UserModel>();

            objUserList1       = objService.getActiveStaff();
            objModel.StaffList = new List <UserModel>();
            objModel.StaffList.AddRange(objUserList1);
            return(View(objModel));
        }
Esempio n. 4
0
        public void QtdePacientesCadastrados()
        {
            var _serviceDashboard = new DashboardService(new DashboardRepository(new UnitOfWork <ClinicasContext>(new ClinicasContext())));

            using (var db = new ClinicasContext())
            {
                try
                {
                    int qtd = _serviceDashboard.QtdePacientes(1, 1);

                    Assert.IsNotNull(qtd);
                }
                catch (DbEntityValidationException ex)
                {
                    // Retrieve the error messages as a list of strings.
                    var errorMessages = ex.EntityValidationErrors
                                        .SelectMany(x => x.ValidationErrors)
                                        .Select(x => x.ErrorMessage);

                    // Join the list to a single string.
                    var fullErrorMessage = string.Join("; ", errorMessages);

                    // Combine the original exception message with the new one.
                    var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);

                    // Throw a new DbEntityValidationException with the improved exception message.
                    throw new DbEntityValidationException(exceptionMessage, ex.EntityValidationErrors);
                }
            }
        }
Esempio n. 5
0
        public ActionResult Index()
        {
            DashboardService service = new DashboardService();

            SessionHelper.SelectedLanguageResource = service.GetResourceList(SessionHelper.getCurrentLanguageCookiesValues());
            return(View(ViewHelper.ContactUs));
        }
        public JsonResult UploadPictures()
        {
            JsonResult result = new JsonResult();

            var picList = new List <Picture>();

            var imgFiles = Request.Files;

            var dashboradService = new DashboardService();

            for (int i = 0; i < imgFiles.Count; i++)
            {
                var picture = imgFiles[i];

                var fileName = Guid.NewGuid() + Path.GetExtension(picture.FileName);

                var filePath = Server.MapPath("~/Images/site/") + fileName;

                picture.SaveAs(filePath);

                var newPicture = new Picture();

                newPicture.URL = fileName;


                if (dashboradService.SavePicture(newPicture))
                {
                    picList.Add(newPicture);
                }
            }

            result.Data = picList;

            return(result);
        }
Esempio n. 7
0
 protected bool LoginStatus()
 {
     try
     {
         admin                        = GetAdminSession();
         this.adminService            = new AdminService(token);
         this.dashboardService        = new DashboardService(token);
         this.countryService          = new CountryService(token);
         this.timezoneService         = new TimezoneService(token);
         this.membershipService       = new MembershipService(token);
         this.businessCategoryService = new BusinessCategoryService(token);
         //if (string.IsNullOrEmpty(accessToken))
         //    return false;
         if (admin != null)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch
     {
         return(false);
     }
 }
Esempio n. 8
0
        public async Task <JsonResult> GetWcImprovementStatus()
        {
            IDashboardService dashboardService = new DashboardService();
            var wmsdsResponse = await dashboardService.GetWcImprovementStatus();

            return(Json(wmsdsResponse.Collections, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
        public ActionResult GetTop5Products()
        {
            DashboardService ds = new DashboardService();
            var topproducts     = ds.GetTopProducts();

            return(Json(topproducts, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
        // GET: Management/Dashboard
        public ActionResult Index()
        {
            DashboardService service = new DashboardService();

            ViewBag.yearlist = service.YearJson();
            return(View(service.GetallData()));
        }
        public async Task <UrlForVisitModel> GetURLForVisit(UrlForVisitModel Model)
        {
            return(await ExceptionHandler.CallMethod(async() =>
            {
                var DashboardService = new DashboardService();
                UrlForVisitModel result = null;
                if (DashboardService.CheckUrlVisit(Model, User.Identity.GetUserId()))
                {
                    if (Model.URLAddress != null)
                    {
                        DashboardService.AddUrlVisit(Model, User.Identity.GetUserId());
                    }

                    var role = ((ClaimsIdentity)User.Identity).Claims
                               .Where(c => c.Type == ClaimTypes.Role)
                               .Select(c => c.Value)
                               .FirstOrDefault();

                    if (role == "Admin")
                    {
                        result = DashboardService.GetAdminURLForVisit(User.Identity.GetUserId(), Model.Duration, Model.Count, Model.Mobile);
                    }
                    else
                    {
                        result = DashboardService.GetURLForVisit(User.Identity.GetUserId(), Model.Duration, Model.Count, Model.Mobile);
                    }
                }
                return result;
            }));
        }
Esempio n. 12
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                DashboardService = ScopedServices.GetRequiredService <IDashboardService>();

                await BreadcrumbsService.SetDashboard();

                ServerdCard = await DashboardService.GetServerCardAsync();

                ServerdCard.RightAction = ShowHardwareVaultTaskAsync;
                if (ServerdCard.Notifications.FirstOrDefault(x => x.Page == "long-pending-tasks") != null)
                {
                    ServerdCard.Notifications.FirstOrDefault(x => x.Page == "long-pending-tasks").Action = ShowHardwareVaultTaskAsync;
                }
                EmployeesCard = await DashboardService.GetEmployeesCardAsync();

                HardwareVaultsCard = await DashboardService.GetHardwareVaultsCardAsync();

                WorkstationsCard = await DashboardService.GetWorkstationsCardAsync();

                SetInitialized();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                SetLoadFailed(ex.Message);
            }
        }
Esempio n. 13
0
        public ActionResult GetData([FromUri] string type = "Instance")
        {
            DashboardService service = new DashboardService();
            var data = service.GetDahsboardData(type);

            return(Json(new { data = data }, JsonRequestBehavior.AllowGet));
        }
Esempio n. 14
0
        public void GetDashboard()
        {
            var expTimeEntry = TimeEntryService.Add(new TimeEntry()
            {
                IsBillable  = true,
                CreatedWith = "TimeEntryTestAdd",
                Description = "Test",
                Duration    = 900,
                Start       = DateTime.Now.ToIsoDateStr(),
                Stop        = DateTime.Now.AddMinutes(20).ToIsoDateStr(),
                ProjectId   = DefaultProjectId,
                WorkspaceId = DefaultWorkspaceId,
                TagNames    = new List <string> {
                    Guid.NewGuid().ToString(), Guid.NewGuid().ToString()
                }
            });

            Assert.IsNotNull(expTimeEntry);

            var currentUser = UserService.GetCurrent();

            Assert.IsNotNull(currentUser);
            Assert.IsNotNull(currentUser.DefaultWorkspaceId);

            var result = DashboardService.Get((int)currentUser.DefaultWorkspaceId);

            Assert.IsNotNull(result);
        }
        private async void GetDashboard()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                var response = await DashboardService.GetDashboard();

                var content = await response.Content.ReadAsStringAsync();

                var message = JsonConvert.DeserializeObject <DashboardModel>(content);
                DashboardModel = message;
            }
            catch (Exception ex)
            {
                MessagingCenter.Send(new ErrorMessageModel
                {
                    Title   = "Error",
                    Message = "Unable to load items.",
                    Cancel  = "OK"
                }, "message");
            }
            finally
            {
                IsBusy = false;
            }
        }
Esempio n. 16
0
        //GetDistrictWiseOverview
        public async Task <JsonResult> GetDistrictWiseOverview(int districtId)
        {
            IDashboardService dashboardService = new DashboardService();
            var wmsdsResponse = await dashboardService.GetDistrictWiseOverview(districtId);

            return(Json(wmsdsResponse.DataObject, JsonRequestBehavior.AllowGet));
        }
Esempio n. 17
0
        public void SetUp()
        {
            _mockEngagementRepository        = new Mock <IEngagementRepository>();
            _mockHostRepository              = new Mock <IHostRepository>();
            _mockHostMapper                  = new Mock <IHostMapper>();
            _mockVulnerabilityRepository     = new Mock <IVulnerabilityRepository>();
            _mockVulnerabilityMapper         = new Mock <IVulnerabilityMapper>();
            _mockRiskRepository              = new Mock <IRiskRepository>();
            _mockCustomerRepository          = new Mock <ICustomerRepository>();
            _mockGovernanceControlRepository = new Mock <IGovernanceControlRepository>();
            _mockPhaseRepository             = new Mock <IPhaseRepository>();
            _mockComplianceRepository        = new Mock <IComplianceRepository>();
            _mockComplianceSchemeRepository  = new Mock <IComplianceSchemeRepository>();
            _mockImportRepository            = new Mock <IImportRepository>();
            _mockCryptographyService         = MockCyptographyService();
            _dashboardService                = new DashboardService(
                _mockEngagementRepository.Object,
                _mockHostRepository.Object,
                _mockHostMapper.Object,
                _mockVulnerabilityRepository.Object,
                _mockVulnerabilityMapper.Object,
                _mockRiskRepository.Object,
                _mockCustomerRepository.Object,
                _mockGovernanceControlRepository.Object,
                _mockPhaseRepository.Object,
                _mockComplianceRepository.Object,
                _mockComplianceSchemeRepository.Object,
                _mockImportRepository.Object,
                _mockCryptographyService.Object);

            SetUpMocks();
        }
Esempio n. 18
0
        //GetYearWiseWcImprStatus
        public async Task <JsonResult> GetYearWiseWcImprStatus()
        {
            IDashboardService dashboardService = new DashboardService();
            var wmsdsResponse = await dashboardService.GetYearWiseWcImprStatus();

            return(Json(wmsdsResponse.DataObject, JsonRequestBehavior.AllowGet));
        }
Esempio n. 19
0
        public async Task <JsonResult> GetImplicationFinancial()
        {
            IDashboardService dashboardService = new DashboardService();
            var wmsdsResponse = await dashboardService.GetImplicationFinancial();

            return(Json(wmsdsResponse.DataObject, JsonRequestBehavior.AllowGet));
        }
Esempio n. 20
0
        public async Task <JsonResult> GetLengthOfImprovedWc()
        {
            IDashboardService dashboardService = new DashboardService();
            var wmsdsResponse = await dashboardService.GetLengthOfImprovedWc();

            return(Json(wmsdsResponse.DataObject, JsonRequestBehavior.AllowGet));
        }
Esempio n. 21
0
        public ActionResult DashboardYakovGetInsuranceCosts(DateTime period, string insuranceName, int insuranceID)
        {
            var model = DashboardService.Insurance2CostsListItems(period, insuranceID);

            //model = service.InsuranceCostsListItems(period, insuranceName);
            return(PartialView("DashboardYakovInsCostList", model));
        }
Esempio n. 22
0
 public HomeController(IIdentityServerInteractionService interaction, IUserRepository userRepository, IClientRepository clientRepository)
 {
     this.interaction      = interaction;
     this.userRepository   = userRepository;
     this.clientRepository = clientRepository;
     this.dashboardService = new DashboardService(this.userRepository, this.clientRepository);
 }
Esempio n. 23
0
 public DashboardController()
 {
     if (_dashboardService == null)
     {
         _dashboardService = new DashboardService();
     }
 }
Esempio n. 24
0
        public async Task GetApplicationsTest()
        {
            // Create DetailService instance
            DashboardService service = new DashboardService();

            var range = new TimestampRange()
            {
                End = Timestamp.FromDateTimeOffset(offsetEnd), Start = Timestamp.FromDateTimeOffset(offsetStart)
            };

            FakeServerStreamWriter <ApplicationResponse> fakeServerStreamWriter = new FakeServerStreamWriter <ApplicationResponse>();
            var totalTimesForTest = new Dictionary <int, int>(totalTimes);

            fakeServerStreamWriter.Received += applicationResponse =>
            {
                Assert.AreEqual(totalTimesForTest[applicationResponse.Application.Id], applicationResponse.TotalTime.Seconds);
                totalTimesForTest.Remove(applicationResponse.Application.Id);
            };

            await service.GetApplications(new ApplicationRequest()
            {
                Range = range
            }, fakeServerStreamWriter, null);

            Assert.IsEmpty(totalTimesForTest);
        }
        public void GetOverviewProject(IdentifierBase <Guid> identifierModel)
        {
            var contextHelper = new DbContextHelper();

            using (var dbContext = new ProSManContext(contextHelper.CreateNewContextOptions()))
            {
                contextHelper.FillData(dbContext, identifierModel.Id, true, new ExtraEntitiesModel
                {
                    Count = 2
                });

                var dashboardService = new DashboardService(dbContext);

                var overviewProject = dashboardService.GetOverviewProject(identifierModel.Id);

                Assert.True(overviewProject != null);
                Assert.True(overviewProject.AverageTasksInSprint > 0);
                Assert.True(overviewProject.TotalBacklogTasks > 0);
                Assert.True(overviewProject.TotalNonSprintTasks > 0);
                Assert.True(overviewProject.TotalSprints > 0);
                Assert.True(overviewProject.AverageHoursInSprint > 0);

                // check round to two digits after comma
                Assert.Equal(overviewProject.AverageTasksInSprint, Math.Round(overviewProject.AverageTasksInSprint, 2));
                Assert.Equal(overviewProject.AverageHoursInSprint, Math.Round(overviewProject.AverageHoursInSprint, 2));
            }
        }
Esempio n. 26
0
        public JsonResult UploadPictures()
        {
            JsonResult result = new JsonResult();

            var dashboardService = new DashboardService();
            var picturesList     = new List <Picture>();

            // For saving pictures in folder
            var files = Request.Files;

            for (int i = 0; i < files.Count; i++)
            {
                var picture = files[i];

                var fileName = Guid.NewGuid() + Path.GetExtension(picture.FileName);
                var filePath = Server.MapPath("~/images/site/") + fileName;

                picture.SaveAs(filePath);

                var dbPicture = new Picture();
                dbPicture.Url = fileName;


                if (dashboardService.SavePicture(dbPicture))
                {
                    picturesList.Add(dbPicture);
                }
            }

            result.Data = picturesList;

            return(result);
        }
Esempio n. 27
0
        public ActionResult GetInstanceData([FromUri] string type = "Department", [FromUri] string subdomain = "")
        {
            DashboardService service = new DashboardService();
            var data = service.GetInstanceData(type, subdomain);

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Esempio n. 28
0
        // GET: Dashboard
        public ActionResult GetSalesRevenue()
        {
            DashboardService ds = new DashboardService();
            var Revenue         = ds.GetSalesRevenue();

            return(Json(Revenue, JsonRequestBehavior.AllowGet));
        }
Esempio n. 29
0
        public JsonResult UploadPictures()
        {
            var            files      = Request.Files;
            JsonResult     jsonResult = new JsonResult();
            List <Picture> listPics   = new List <Picture>();

            for (int i = 0; i < files.Count; i++)
            {
                var picture            = files[i];
                var pathToImagesFolder = Server.MapPath("~/Images/Course/");
                var fileName           = Guid.NewGuid() + Path.GetExtension(picture.FileName);
                var filePath           = pathToImagesFolder + fileName;
                picture.SaveAs(filePath);
                Picture dbPicture = new Picture
                {
                    URL        = fileName,
                    UserID     = UserHelperInfo.GetUserId(),
                    IP         = UserInfo.IP(),
                    Agent      = UserInfo.Agent(),
                    Location   = UserInfo.Location(),
                    ModifiedOn = DateTime.Now
                };
                DashboardService dashboardService = new DashboardService();
                if (dashboardService.SavePicture(dbPicture))
                {
                    listPics.Add(dbPicture);
                }
            }
            jsonResult.Data = listPics;
            return(jsonResult);
        }
Esempio n. 30
0
        public ActionResult GetTitleData()
        {
            DashboardService ds = new DashboardService();
            var titledata       = ds.GetTitleData();

            return(Json(titledata, JsonRequestBehavior.AllowGet));
        }
 public DashboardServiceTests()
 {
     _service = new DashboardService();
     _service.AdminRole = "Admin";
     _service.Sections.AddRange(new List<Menu>()
     {
         new Menu("System", isRolesEnabled: true, roles: "Admin") { Items = new List<MenuNode> {
                 new MenuNode("Summary",     navigateUrl: "/admin/console/getinfo?name=System"),
                 new MenuNode("Startup",     navigateUrl: "/admin/console/getinfo?name=Startup"),
                 new MenuNode("Widgets",     navigateUrl: "/admin/console/getinfo?name=Widgets"),
                 new MenuNode("Cache",       navigateUrl: "/admin/cache/index"),
                 new MenuNode("Logs",        navigateUrl: "/admin/log/index"),
                 new MenuNode("Users",       navigateUrl: "/admin/user/manage"),
                 new MenuNode("Diagnostics", navigateUrl: "/admin/diagnostics/index"),
                 new MenuNode("Email",       navigateUrl: "/admin/console/email"),
                 new MenuNode("Queues",      navigateUrl: "/admin/queue/index"),
                 new MenuNode("Tasks",       navigateUrl: "/admin/task/index"),
                 new MenuNode("Flags",       navigateUrl: "/flag/manage")
             }
         },
         new Menu("Settings", isRolesEnabled: true, roles: "Admin"),
         new Menu("Appearence", isRolesEnabled: true, roles: "Admin" ) { Items = new List<MenuNode>{
                 new MenuNode("Themes",      navigateUrl: "/theme/manage"),
                 new MenuNode("Layouts",     navigateUrl: "/theme/layouts"),
                 new MenuNode("Css",         navigateUrl: "/theme/EditCss"),
                 new MenuNode("Widgets",     navigateUrl: "/widget/manage")
             }
         },
         new Menu("Media", isRolesEnabled: true, roles: "Admin" ) { Items = new List<MenuNode> {
                 new MenuNode("Manage",      navigateUrl: "/mediafolder/manage"),
             }
         },
         new Menu("Location", isRolesEnabled: true, roles: "Admin") { Items = new List<MenuNode> {
                 new MenuNode("City",        navigateUrl:  "/admin/city/manage"),
                 new MenuNode("State",       navigateUrl:  "/admin/state/manage"),
                 new MenuNode("Country",     navigateUrl:  "/admin/country/manage")
             }
         },
         new Menu("Misc", isRolesEnabled: true, roles: "*") { Items = new List<MenuNode> {
                 new MenuNode("Favorites",   isRolesEnabled: true, roles: "*",     navigateUrl: "/favorite/manage"),
                 new MenuNode("Feedback",    isRolesEnabled: true, roles: "Admin", navigateUrl: "/feedback/manage"),
                 new MenuNode("Comments",    isRolesEnabled: true, roles: "*",     navigateUrl: "/comment/manage")
             }
         },
         new Menu("Tools", isRolesEnabled: true, roles: "*") { Items = new List<MenuNode> {
                 new MenuNode("Import",      navigateUrl: "/tools/import"),
                 new MenuNode("Export",      navigateUrl: "/tools/export")
             }
         }
     });
 }
        public ActionResult Dashboard()
        {
            DashboardViewModel dashboad = new DashboardViewModel();

            string userId = User.Identity.GetUserId();

            DashboardService dashboardService = new DashboardService(User.Identity.Name);
            IList<TwoColumnChartData> fourMonthExpiryData = dashboardService.AssetsByExpiry4Months();
            dashboad.AssetExpiryData = JArray.FromObject(fourMonthExpiryData);

            IList<TwoColumnChartData> pieChartData = dashboardService.AssetsByCategoryPieChart();
            dashboad.AssetsByCategory = JArray.FromObject(pieChartData);

            IList<TwoColumnChartData> warrantyExpiryData = dashboardService.AssetsWarrantyExpiry4Months();
            dashboad.WarrantyExpiryData = JArray.FromObject(warrantyExpiryData);

            int[] wishListStatus = dashboardService.WishListSummary();
            dashboad.TotalWishlistPending = wishListStatus[0];
            dashboad.TotalWishlistProcessing = wishListStatus[1];
            dashboad.TotalWishlistSupplied = wishListStatus[2];
            dashboad.TotalWishlistComplete = wishListStatus[3];
            dashboad.TotalWishlist = wishListStatus[0] + wishListStatus[1] + wishListStatus[2] + wishListStatus[3];

            var dashboardCollection = dashboardService.DisplayPanels(userId);
            dashboad.DisplayButtonsPanel = bool.Parse(dashboardCollection[EnumHelper.ApplicationSettingKeys.DashboardButtonsPanel.ToString()]);
            dashboad.DisplayNotificationsPanel = bool.Parse(dashboardCollection[EnumHelper.ApplicationSettingKeys.DashboardNotificationsPanel.ToString()]);
            dashboad.DisplayAssetPieChartPanel = bool.Parse(dashboardCollection[EnumHelper.ApplicationSettingKeys.DashboardAssetsPieChartPanel.ToString()]);
            dashboad.DisplayAssetObsoletePanel = bool.Parse(dashboardCollection[EnumHelper.ApplicationSettingKeys.DashboardAssetsObsoleteChartPanel.ToString()]);
            dashboad.DisplayAssetWarrantyPanel= bool.Parse(dashboardCollection[EnumHelper.ApplicationSettingKeys.DashboardAssetsWarrantyExpiryChartPanel.ToString()]);
            dashboad.DisplayWatchlistStatsPanel = bool.Parse(dashboardCollection[EnumHelper.ApplicationSettingKeys.DashboardAssetsWishlistStatsPanel.ToString()]);

            return View(dashboad);
        }