Beispiel #1
0
        public IActionResult Index()
        {
            var model = new HomeDashboardModel
            {
                Jobs = new JobManager(Database).GetJobs().Where(a => !a.Completed).OrderByDescending(a => a.SubmissionTime).ToList()
            };

            var assemblies = new AssemblyManager(Database).GetUploadedAssembliesList();

            model.ModelTypes = new List <SelectListItem>();

            foreach (var assembly in assemblies)
            {
                foreach (var predictor in assembly.Predictors)
                {
                    model.ModelTypes.Add(new SelectListItem(predictor, assembly.ID.ToString()));
                }
            }

            model.Workers = new WorkerManager(Database).GetWorkers().OrderBy(a => a.Name).ToList();

            model.AssignWorkers = new List <SelectListItem>
            {
                new SelectListItem(Constants.WORKER_AUTO_ASSIGN, Constants.WORKER_AUTO_ASSIGN)
            };

            model.AssignWorkers.AddRange(model.Workers.Select(a => new SelectListItem(a.Name, a.Name)));

            return(View(model));
        }
Beispiel #2
0
        public IActionResult Dashboard()
        {
            var userHash = _userManager.GetUserId(User);
            var korisnik = _repository.GetZaposlenik(userHash);

            if (_repository.AmIAdmin(userHash))
            {
                var zadaciDanas = _repository.GetAllDanašnjiZadaci();

                var povijestSpremnika = _repository.GetAllPovijestiSpremnika()
                                        .Where(ps => ps.Datum >= DateTime.Today.AddDays(-7))
                                        .ToList();

                var model = new HomeDashboardModel
                {
                    ZadaciDanas         = zadaciDanas,
                    PovijestSTjedanDana = povijestSpremnika
                };

                return(View(model));
            }
            else
            {
                var zadaciDanas = _repository.GetAllMojiZadaci(korisnik);

                var povijestSpremnika = _repository.GetAllPovijestiSpremnika()
                                        .Where(ps => ps.Datum >= DateTime.Today.AddDays(-7))
                                        .ToList();

                var model = new HomeDashboardModel
                {
                    ZadaciDanas         = zadaciDanas,
                    PovijestSTjedanDana = povijestSpremnika
                };

                return(View(model));
            }
        }
        public HomeDashboardModel GetHomeDashboard()
        {
            HomeDashboardModel emp = new HomeDashboardModel();

            try
            {
                DataSet ds = SqlHelper.ExecuteDataset(SqlHelper.DBConn, CommandType.StoredProcedure, "HomeDashboard");
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    DataTable dt = ds.Tables[0];
                    emp.TotalCase    = Convert.ToInt32(dt.Rows[0]["Total"].ToString());
                    emp.PendingCase  = Convert.ToInt32(dt.Rows[0]["pending"].ToString());
                    emp.DisposedCase = Convert.ToInt32(dt.Rows[0]["Disposed"].ToString());
                    emp.MonthTotal   = Convert.ToInt32(dt.Rows[0]["MonthTotal"].ToString());
                    emp.ActiveCourts = Convert.ToInt32(dt.Rows[0]["ActiveCourts"].ToString());
                }
                return(emp);
            }
            catch (Exception ex)
            {
                throw ex;
                //helper.insert_AuditLog("Login", "DashboardCount", loginid, DateTime.Now, myIP, ex.Message.ToString());
            }
        }