Пример #1
0
        //Returns json with ticket to use in chart labels
        public JsonResult GetIncidentsList()
        {
            int urlID = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"]);

            if (urlID != 0)
            {
                PerformanceEvaluation perfEval = db.PerformanceEvalutions.Find(urlID);

                var incidentsList = (from ticket in db.Tickets
                                     where ticket.Id_Consultant == perfEval.idConsultant &&
                                     ticket.ClosedDate == perfEval.Date
                                     select "Ticket #" + " " + ticket.Id)
                                    .ToList();
                return(Json(incidentsList, JsonRequestBehavior.AllowGet));
            }
            else
            {
                PerformanceEvaluation perfEval = db.PerformanceEvalutions.Find(idPerfEval);

                var incidentsList = (from ticket in db.Tickets
                                     where ticket.Id_Consultant == perfEval.idConsultant &&
                                     ticket.ClosedDate == perfEval.Date
                                     select "Ticket #" + " " + ticket.Id)
                                    .ToList();
                return(Json(incidentsList, JsonRequestBehavior.AllowGet));
            }
        }
        public static PerformanceEvaluation MapPerformanceEvaluationModelToPerformanceEvaluation(this PerformanceEvaluationModel peModel)
        {
            if (peModel == null)
            {
                return(null);
            }

            var performanceEvaluation = new PerformanceEvaluation
            {
                PerformanceEvaluationId = peModel.Id,
                Consultant          = peModel.Consultant.MapApplicationUserModelToApplicationUser(),
                ConsultantId        = peModel.ConsultantId,
                ConsultantFirstName = peModel.ConsultantFirstName,
                ConsultantLastName  = peModel.ConsultantLastName,
                JobTitleId          = peModel.ConsultantJobTitleId,
                JobPositionId       = peModel.ConsultantJobPositionId,
                Reviewer            = peModel.Reviewer.MapApplicationUserModelToApplicationUser(),
                ReviewerId          = peModel.ReviewerId,
                ReviewerFirstName   = peModel.ReviewerFirstName,
                ReviewerLastName    = peModel.ReviewerLastName,
                StartDate           = peModel.StartDate,
                EndDate             = peModel.EndDate,
                IsSubmitted         = peModel.IsSubmited,
                SubmittedDate       = peModel.SubmitedDate,
                TemplateId          = peModel.TemplateId,
                //PerformanceEvaluationSkills = peModel.PerformanceEvaluationSkills
                //                                        .Select(x => x.MapPerformanceEvaluationSkillModelToPerformanceEvaluationSkill())
                //                                        .ToList()
            };

            return(performanceEvaluation);
        }
Пример #3
0
        private PerformanceEvaluation CreateOrRetrievePerformanceEvaluation(ApplicationDbContext context, ApplicationUser consultant, ApplicationUser reviewer, DateTime startDate, DateTime endDate, bool isSubmited, Template template)
        {
            var performaceEvaluation = context.PerformanceEvaluations.Where(x => x.ConsultantId == consultant.Id).FirstOrDefault();

            if (performaceEvaluation == null)
            {
                performaceEvaluation = new PerformanceEvaluation
                {
                    Consultant          = consultant,
                    Reviewer            = reviewer,
                    JobTitle            = consultant.JobTitle,
                    JobPosition         = consultant.JobPosition,
                    StartDate           = startDate,
                    EndDate             = endDate,
                    IsSubmitted         = isSubmited,
                    ConsultantFirstName = consultant.FirstName,
                    ConsultantLastName  = consultant.LastName,
                    ReviewerFirstName   = reviewer.FirstName,
                    ReviewerLastName    = reviewer.LastName,
                    TemplateId          = template.TemplateId
                };
                context.PerformanceEvaluations.Add(performaceEvaluation);
            }

            return(performaceEvaluation);
        }
Пример #4
0
        public ActionResult viewDetails(int id)
        {
            ViewBag.getIncidentsList = GetIncidentsList();
            ViewBag.getIncidentsData = GetIncidentsSLAData();

            idPerfEval = id;
            PerformanceEvaluation perfEval = db.PerformanceEvalutions.Find(id);

            var technologyList = (from ticket in db.Tickets
                                  join performance in db.PerformanceEvalutions
                                  on ticket.Id_Consultant equals performance.idConsultant
                                  join tecnology in db.Technologies
                                  on ticket.Id_Technology equals tecnology.ID
                                  where ticket.AssignmentDate == perfEval.Date ||
                                  ticket.ClosedDate == perfEval.Date &&
                                  ticket.Id_Consultant == perfEval.idConsultant
                                  select tecnology)
                                 .AsNoTracking()
                                 .Distinct();

            var escalatedCount = (from performance in db.PerformanceEvalutions
                                  join ticket in db.Tickets
                                  on performance.idConsultant equals ticket.Id_Consultant
                                  where ticket.Status == "Escalated" &&
                                  ticket.EscalationDate == perfEval.Date &&
                                  ticket.Id_Consultant == perfEval.idConsultant
                                  select ticket)
                                 .AsNoTracking()
                                 .Count();

            ViewBag.Techdata     = technologyList.ToList();
            ViewBag.EscalateData = escalatedCount;
            ViewBag.datePerf     = perfEval.Date.Date;
            return(View());
        }
 private void ValidatePerformanceEvaluationModel(PerformanceEvaluation performanceEvaluation)
 {
     if (_performanceEvaluationService.IsNameDuplicated(performanceEvaluation.Name, performanceEvaluation.Company_Id))
     {
         ModelState.AddModelError(ViewRes.Controllers.Shared.Name, ViewRes.Controllers.Shared.NameText);
     }
     if (_performanceEvaluationService.IsLevelDuplicated(performanceEvaluation.Company_Id, performanceEvaluation.Level.Value))
     {
         ModelState.AddModelError(ViewRes.Controllers.Shared.Level, ViewRes.Controllers.Shared.LevelText);
     }
 }
        private void InitializeViews(int?performanceEvaluation_id)
        {
            PerformanceEvaluation performanceEvaluation;

            if (performanceEvaluation_id != null)
            {
                performanceEvaluation = _performanceEvaluationService.GetById((int)performanceEvaluation_id);
            }
            else
            {
                performanceEvaluation = new PerformanceEvaluation();
            }
            _performanceEvaluationViewModel = new PerformanceEvaluationViewModel(performanceEvaluation);
        }
 public ActionResult Create(PerformanceEvaluation performanceEvaluation)
 {
     performanceEvaluation.Company_Id = (int)new UsersServices().GetByUserName(User.Identity.Name.ToString()).Company_Id;
     ValidatePerformanceEvaluationModel(performanceEvaluation);
     if (ModelState.IsValid)
     {
         if (_performanceEvaluationService.Add(performanceEvaluation))
         {
             return(RedirectToAction("Index"));
         }
     }
     InitializeViews(null);
     return(View(_performanceEvaluationViewModel));
 }
Пример #8
0
 public ActionResult Edit(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add update logic here
         var model = PerformanceEvaluation.GetById(id);
         TryUpdateModel(model);
         model.SaveOrUpDate();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Пример #9
0
        private void btnEvaluation_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog dlg = new FolderBrowserDialog();

            dlg.SelectedPath = Application.StartupPath;
            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            String robotPath = dlg.SelectedPath;
            String mazePath  = Application.StartupPath + @"\maze";
            PerformanceEvaluation performanceEvaluation = new PerformanceEvaluation();

            performanceEvaluation.Execute(robotPath, mazePath, new NWSELib.EventHandler(EventHandler), 3000);
        }
Пример #10
0
 public ActionResult Create(FormCollection collection)
 {
     try
     {
         // TODO: Add insert logic here
         var model = new PerformanceEvaluation();
         TryUpdateModel(model);
         model.CreatedAt = DateTime.Now;
         model.CreatedBy = SessionItems.CurrentUser.UserID;
         model.Insert();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Пример #11
0
        public static PerformanceEvaluation MapPerformanceEvaluationInfoModelToPerformanceEvaluation(this PerformanceEvaluationInfoModel peInfoModel, bool mapTemplate = true, bool mapJobTitle = true, bool mapJobPosition = true)
        {
            if (peInfoModel == null)
            {
                return(null);
            }

            PerformanceEvaluation pe = new PerformanceEvaluation
            {
                PerformanceEvaluationId = peInfoModel.Id,

                ConsultantId        = peInfoModel.ConsultantId,
                ConsultantFirstName = peInfoModel.ConsultantFirstName,
                ConsultantLastName  = peInfoModel.ConsultantLastName,
                JobTitleId          = peInfoModel.ConsultantJobTitleId,
                JobPositionId       = peInfoModel.ConsultantJobPositionId,
                ReviewerId          = peInfoModel.ReviewerId,
                ReviewerFirstName   = peInfoModel.ReviewerFirstName,
                ReviewerLastName    = peInfoModel.ReviewerLastName,
                StartDate           = peInfoModel.StartDate,
                EndDate             = peInfoModel.DueDate,
                TemplateId          = peInfoModel.TemplateId
            };

            if (mapTemplate)
            {
                pe.Template = peInfoModel.Template.MapTemplateModelToTemplate();
            }

            if (mapJobTitle)
            {
                pe.JobTitle = peInfoModel.ConsultantJobTitle.MapJobTitleModelToJobTitle();
            }

            if (mapJobPosition)
            {
                pe.JobPosition = peInfoModel.ConsultantJobPosition.MapJobPositionModelToJobPosition();
            }

            return(pe);
        }
 public ActionResult Edit(int id, FormCollection collection)
 {
     if (GetAuthorization(_performanceEvaluationService.GetById(id)))
     {
         try
         {
             PerformanceEvaluation performanceEvaluation = _performanceEvaluationService.GetById(id);
             UpdateModel(performanceEvaluation, "PerformanceEvaluation");
             _performanceEvaluationService.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch
         {
             InitializeViews(id);
             return(View(_performanceEvaluationViewModel));
         }
     }
     else
     {
         return(RedirectToLogOn());
     }
 }
        public static PerformanceEvaluationModel MapPerformanceEvaluationToPerformanceEvaluationModel(this PerformanceEvaluation performanceEvaluation, bool mapConsultant, bool mapJobTitle = true, bool mapJobPosition = true, bool mapTemplate = true)
        {
            if (performanceEvaluation == null)
            {
                return(null);
            }

            var performanceEvaluationModel = new PerformanceEvaluationModel
            {
                Id                      = performanceEvaluation.PerformanceEvaluationId,
                ConsultantId            = performanceEvaluation.ConsultantId,
                ConsultantFirstName     = performanceEvaluation.ConsultantFirstName,
                ConsultantLastName      = performanceEvaluation.ConsultantLastName,
                ConsultantJobTitleId    = performanceEvaluation.JobTitleId,
                ConsultantJobPositionId = performanceEvaluation.JobPositionId,
                ReviewerId              = performanceEvaluation.ReviewerId,
                ReviewerFirstName       = performanceEvaluation.ReviewerFirstName,
                ReviewerLastName        = performanceEvaluation.ReviewerLastName,
                StartDate               = performanceEvaluation.StartDate,
                EndDate                 = performanceEvaluation.EndDate,
                IsSubmited              = performanceEvaluation.IsSubmitted,
                SubmitedDate            = performanceEvaluation.SubmittedDate,
                ConsultantComment       = performanceEvaluation.ConsultantComment,
                SignedOnDate            = performanceEvaluation.SignedOnDateByConsultant,
                TemplateId              = performanceEvaluation.TemplateId
            };

            if (mapJobPosition)
            {
                performanceEvaluationModel.ConsultantJobPosition = performanceEvaluation.JobPosition.MapJobPositionToJobPositionModel();
            }

            if (mapJobTitle)
            {
                performanceEvaluationModel.ConsultantJobTitle = performanceEvaluation.JobTitle.MapJobTitleToJobTitleModel();
            }

            if (mapTemplate)
            {
                performanceEvaluationModel.Template = performanceEvaluation.Template.MapTemplateToTemplateModel(true);
            }

            if (performanceEvaluation.PerformanceEvaluationSkills != null)
            {
                performanceEvaluationModel.PerformanceEvaluationSkills = performanceEvaluation.PerformanceEvaluationSkills
                                                                         .Select(x => x.MapPerformanceEvaluationSkillToPerformanceEvaluationSkillModel()).ToList();
            }

            if (mapConsultant)
            {
                performanceEvaluationModel.Consultant = performanceEvaluation.Consultant.MapApplicationUserToApplicationUserModel();
            }

            return(performanceEvaluationModel);
        }
Пример #14
0
 public PerformanceEvaluationViewModel(PerformanceEvaluation performanceEvaluation)
 {
     this.performanceEvaluation = performanceEvaluation;
 }
Пример #15
0
 // GET: PerformanceEvaluation/Edit/5
 public ActionResult Edit(int id)
 {
     return(View(PerformanceEvaluation.GetById(id)));
 }
        public static PerformanceEvaluationHistoryModel MapPerformanceEvaluationToPerformanceEvaluationHistoryInfoModel(this PerformanceEvaluation performanceEvaluation)
        {
            if (performanceEvaluation == null)
            {
                return(null);
            }

            var performanceEvaluationHistoryInfoModel = new PerformanceEvaluationHistoryModel
            {
                Id = performanceEvaluation.PerformanceEvaluationId,
                ConsultantFirstName   = performanceEvaluation.ConsultantFirstName,
                ConsultantLastName    = performanceEvaluation.ConsultantLastName,
                ConsultantJobTitle    = performanceEvaluation.JobTitle.Name,
                ConsultantJobPosition = performanceEvaluation.JobPosition.PositionName,
                ReviewerFirstName     = performanceEvaluation.ReviewerFirstName,
                ReviewerLastName      = performanceEvaluation.ReviewerLastName,
                DateSubmited          = performanceEvaluation.SubmittedDate
            };

            return(performanceEvaluationHistoryInfoModel);
        }
Пример #17
0
 // GET: PerformanceEvaluation
 public ActionResult Index()
 {
     return(View(PerformanceEvaluation.GetAll()));
 }
Пример #18
0
        public void Execute(IJobExecutionContext context)
        {
            try
            {
                DateTime today     = DateTime.Now;
                var      shortDate = today.Date;

                var getConsultants = db.Consultants.Where(x => !x.ID.Equals(1)); // Get consultants

                foreach (var i in getConsultants)                                // Run a loop to extract id for every consultant
                {
                    var totalResolvedTickets = db.Tickets.Where(x => x.Id_Consultant == i.ID && x.ClosedDate == shortDate && x.Status == "Closed").Count();

                    var totalAssignedTickets = db.Tickets.Where(x => x.AssignmentDate == shortDate && x.Id_Consultant == i.ID).Count();

                    var techWeightAvg = (from x in db.Tickets
                                         join y in db.Technologies
                                         on x.Id_Technology equals y.ID
                                         where x.AssignmentDate == shortDate && x.Id_Consultant == i.ID
                                         select(int?) y.Weight).Sum() ?? 0;
                    if (techWeightAvg == 0)
                    {
                        techWeightAvg = 0;
                    }
                    else
                    {
                        techWeightAvg = techWeightAvg / totalAssignedTickets;
                    }

                    double?totalHoursTaken = db.Tickets.Where(x => x.ClosedDate == shortDate && x.Id_Consultant == i.ID).Select(x => x.TotalResolutionHours).Sum();

                    double?perfAvg = totalResolvedTickets + totalAssignedTickets + techWeightAvg + totalHoursTaken;

                    if (totalHoursTaken == null)
                    {
                        totalHoursTaken = 0;
                    }
                    if (perfAvg == null)
                    {
                        perfAvg = 0;
                    }

                    try
                    {
                        var performanceEvalDetails = new PerformanceEvaluation
                        {
                            Date                   = shortDate,
                            idConsultant           = i.ID,
                            TotalResolvedIncidents = totalResolvedTickets,
                            TotalAssignedIncidents = totalAssignedTickets,
                            TechWeightAverage      = techWeightAvg,
                            TotalHoursTaken        = Math.Round(totalHoursTaken.Value, 2),
                            PerformanceAverage     = Math.Round(perfAvg.Value, 2)
                        };

                        using (var x = new PlusBContext())
                        {
                            x.PerformanceEvalutions.Add(performanceEvalDetails);
                            x.SaveChanges();
                        }
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
            }
        }
Пример #19
0
        public static PerformanceEvaluationSkillModel MapSkillModelToPerformanceEvaluationSkillModel(this SkillModel skillModel, PerformanceEvaluation pe)
        {
            if (skillModel == null)
            {
                return(null);
            }

            var performanceEvaluationSkillModel = new PerformanceEvaluationSkillModel
            {
                PerformanceEvaluationId = pe.PerformanceEvaluationId,
                Skill   = skillModel,
                SkillId = skillModel.Id,
            };

            return(performanceEvaluationSkillModel);
        }
Пример #20
0
        private PerformanceEvaluationSkill CreateOrRetrievePerformanceEvaluationSkill(ApplicationDbContext context, PerformanceEvaluation pe, Skill skill, string grade, string comment = null)
        {
            var performanceEvaluationSkill = context.PerformanceEvaluationsSkills.Where(x => x.PerformanceEvaluationId == pe.PerformanceEvaluationId).FirstOrDefault();

            if (performanceEvaluationSkill == null)
            {
                performanceEvaluationSkill = new PerformanceEvaluationSkill
                {
                    PerformanceEvaluation = pe,
                    Skill          = skill,
                    Grade          = grade,
                    PESkillComment = comment
                };
                context.PerformanceEvaluationsSkills.Add(performanceEvaluationSkill);
            }

            return(performanceEvaluationSkill);
        }
Пример #21
0
        public static void writePerformanceEvaluation(ApplicationUser reviewer)
        {
            Database.SetInitializer(new NullDatabaseInitializer <ApplicationDbContext>());
            using (ApplicationDbContext context = new ApplicationDbContext())
            {
                // mustDoPEs are not-submitted performance evaluations with end date 10 days before today
                var allOfMyPEs      = context.PerformanceEvaluations.Where(x => x.ReviewerId == reviewer.Id).ToList();
                var notSubmittedPEs = allOfMyPEs.Where(x => x.IsSubmitted == false).ToList();
                var mustDoPEs       = notSubmittedPEs.Where(x => x.EndDate.AddDays(-10) < DateTime.Now).ToList();

                if (mustDoPEs.Count != 0)
                {
                    Console.WriteLine("\n---------------------------------------------------------------------------------------------------");
                    Console.WriteLine("  id  |   First name   |   Last name   |         Start date          |        End date         ");
                    Console.WriteLine("---------------------------------------------------------------------------------------------------");
                    int id = 1;
                    foreach (var pe in mustDoPEs)
                    {
                        Console.WriteLine(id + "     |     " + pe.ConsultantFirstName + "     |     " + pe.ConsultantLastName + "     |     " + pe.StartDate + "     |     " + pe.EndDate);
                        id++;
                    }
                    Console.WriteLine("---------------------------------------------------------------------------------------------------");

                    int  option = 0;
                    bool isUserOrdinalNumberCorrect = false;

                    do
                    {
                        try
                        {
                            Console.Write("\nChoose the ordinal number of user you want to review (or type 0 to go back): ");
                            option = int.Parse(Console.ReadLine());
                            if (option >= 0 && option <= id)
                            {
                                isUserOrdinalNumberCorrect = true;
                            }
                        }
                        catch (Exception)
                        {
                            // if someone types a char that is not a number
                            Console.WriteLine("\nError! Type the correct ordinal number.");
                        }
                    } while (!isUserOrdinalNumberCorrect);

                    if (option == 0)
                    {
                        MenuOptions(reviewer);
                    }

                    // Get consultant's id from pe object and put it in the chosenPEUserId variable for further usage
                    string chosenPEConsultantId = mustDoPEs[option - 1].ConsultantId.ToString();
                    var    chosenConsultant     = context.Users.Include(x => x.JobTitle)
                                                  .Include(x => x.JobPosition)
                                                  .Include(x => x.Reviewer)
                                                  .Include("Template.TemplateDuration")
                                                  .Include("Template.Skills")
                                                  .Where(x => x.Id == chosenPEConsultantId).FirstOrDefault();

                    Console.WriteLine("\nEmployee Name: " + chosenConsultant.FirstName + " " + chosenConsultant.LastName);
                    Console.WriteLine("Job Title: " + chosenConsultant.JobTitle.Name);
                    Console.WriteLine("Review period: " + chosenConsultant.Template.TemplateDuration.Duration + " months");
                    Console.WriteLine("Reviewer Name: " + chosenConsultant.Reviewer.FirstName + " " + chosenConsultant.Reviewer.LastName);


                    var chosenPE = mustDoPEs[option - 1];
                    // Insert new, not submitted, performance evaluation for the same user with updated
                    // start and end dates
                    PerformanceEvaluation newPerformanceEvaluation = new PerformanceEvaluation
                    {
                        ConsultantId        = chosenConsultant.Id,
                        ConsultantFirstName = chosenConsultant.FirstName,
                        ConsultantLastName  = chosenConsultant.LastName,
                        ReviewerId          = chosenConsultant.Reviewer.Id,
                        ReviewerFirstName   = chosenConsultant.Reviewer.FirstName,
                        ReviewerLastName    = chosenConsultant.Reviewer.LastName,
                        JobTitle            = chosenConsultant.JobTitle,
                        JobPosition         = chosenConsultant.JobPosition,
                        StartDate           = chosenPE.EndDate,
                        EndDate             = chosenPE.EndDate.AddMonths(Convert.ToInt32(chosenConsultant.Template.TemplateDuration.Duration)),
                        IsSubmitted         = false,
                    };
                    context.PerformanceEvaluations.Add(newPerformanceEvaluation);
                    context.SaveChanges();


                    chosenPE.IsSubmitted   = true;
                    chosenPE.SubmittedDate = DateTime.Now;
                    context.SaveChanges();

                    if (chosenConsultant.Template.Skills != null)
                    {
                        foreach (var skill in chosenConsultant.Template.Skills)
                        {
                            bool   isCorrectGrade = false;
                            string grade          = "";
                            do
                            {
                                Console.WriteLine("\n" + skill.SkillName);
                                Console.Write("Type grade for the skill (E - Exceeds Expectations, M - Meets Expectations, N - Needs Improvement):");
                                grade = Console.ReadLine();
                                if (grade.ToUpper() == "E" || grade.ToUpper() == "M" || grade.ToUpper() == "N")
                                {
                                    isCorrectGrade = true;
                                }
                            } while (!isCorrectGrade);

                            PerformanceEvaluationSkill newPeSkill = new PerformanceEvaluationSkill()
                            {
                                PerformanceEvaluation = chosenPE,
                                Grade = grade,
                                Skill = skill
                            };

                            context.PerformanceEvaluationsSkills.Add(newPeSkill);
                            context.SaveChanges();
                        }
                    }

                    exitToMenuWithMessage(reviewer);
                }
                else
                {
                    exitToMenuWithMessage(reviewer, "\nNo active reviews!");
                }
            }
        }
Пример #22
0
        public JsonResult GetIncidentsSLAData()
        {
            int urlID = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"]);

            if (urlID != 0)
            {
                PerformanceEvaluation perfEval = db.PerformanceEvalutions.Find(urlID);

                var incidentsData = (from ticket in db.Tickets
                                     join customer in db.Customers
                                     on ticket.Id_Customer equals customer.Id
                                     join custSLA in db.CustomerSLAS
                                     on customer.Id equals custSLA.IdCustomer
                                     join sla in db.SLAS
                                     on custSLA.IdSLA equals sla.ID
                                     where ticket.Id_Consultant == perfEval.idConsultant &&
                                     ticket.ClosedDate == perfEval.Date
                                     select
                                         (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) > 0 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 1 ? 95 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 1 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 2 ? 84 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 2 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 5 ? 76 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 5 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 10 ? 57 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 10 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 20 ? 39 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 20 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 30 ? 26 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) > 30 ? 7
                                                 : 0
                                     ).ToList();;
                return(Json(incidentsData, JsonRequestBehavior.AllowGet));
            }
            else
            {
                PerformanceEvaluation perfEval = db.PerformanceEvalutions.Find(idPerfEval);

                var incidentsData = (from ticket in db.Tickets
                                     join customer in db.Customers
                                     on ticket.Id_Customer equals customer.Id
                                     join custSLA in db.CustomerSLAS
                                     on customer.Id equals custSLA.IdCustomer
                                     join sla in db.SLAS
                                     on custSLA.IdSLA equals sla.ID
                                     where ticket.Id_Consultant == perfEval.idConsultant &&
                                     ticket.ClosedDate == perfEval.Date
                                     select
                                         (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) > 0 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 1 ? 95 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 1 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 2 ? 84 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 2 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 5 ? 76 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 5 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 10 ? 57 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 10 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 20 ? 39 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) >= 20 &&
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) < 30 ? 26 :
                                     (ticket.TotalResolutionHours / sla.ResolutionTimeAverage) > 30 ? 7
                                                : 0
                                     ).ToList();
                return(Json(incidentsData, JsonRequestBehavior.AllowGet));
            }
        }
Пример #23
0
        public static PerformanceEvaluationInfoModel MapPerformanceEvaluationToPerformanceEvaluationInfoModel(this PerformanceEvaluation performanceEvaluation)
        {
            var performanceEvaluationInfoModel = new PerformanceEvaluationInfoModel
            {
                Id                      = performanceEvaluation.PerformanceEvaluationId,
                ConsultantId            = performanceEvaluation.ConsultantId,
                ConsultantFirstName     = performanceEvaluation.Consultant.FirstName,
                ConsultantLastName      = performanceEvaluation.Consultant.LastName,
                ConsultantJobTitleId    = performanceEvaluation.Consultant.JobTitleId,
                ConsultantJobTitle      = performanceEvaluation.Consultant.JobTitle.MapJobTitleToJobTitleModel(),
                ConsultantJobPositionId = performanceEvaluation.Consultant.JobPositionId,
                ConsultantJobPosition   = performanceEvaluation.Consultant.JobPosition.MapJobPositionToJobPositionModel(),
                ReviewerId              = performanceEvaluation.ReviewerId,
                ReviewerFirstName       = performanceEvaluation.Reviewer.FirstName,
                ReviewerLastName        = performanceEvaluation.Reviewer.LastName,
                TemplateId              = performanceEvaluation.TemplateId,
                Template                = performanceEvaluation.Template.MapTemplateToTemplateModel(true),
                StartDate               = performanceEvaluation.StartDate,
                DueDate                 = performanceEvaluation.EndDate
            };

            return(performanceEvaluationInfoModel);
        }
 private bool GetAuthorization(PerformanceEvaluation performance)
 {
     return(new SharedAdminAuthorization(new UsersServices().GetByUserName(User.Identity.Name),
                                         new CompaniesServices().GetById(performance.Company_Id)).isAuthorizated());
 }