public static List <EmployeePointDetails> QuarterBestEmployees(out string quarterName)
        {
            DateTime today = DateTimeHelper.Today();
            DateTime startDate;
            DateTime endDate;
            int      quarter = DateTimeHelper.GetQuarter(today);

            switch (quarter)
            {
            case 1:
                startDate   = new DateTime(today.Year, 1, 1);
                endDate     = new DateTime(today.Year, 3, 31);
                quarterName = "1st";
                break;

            case 2:
                startDate   = new DateTime(today.Year, 4, 1);
                endDate     = new DateTime(today.Year, 6, 30);
                quarterName = "2nd";
                break;

            case 3:
                startDate   = new DateTime(today.Year, 7, 1);
                endDate     = new DateTime(today.Year, 9, 30);
                quarterName = "3rd";
                break;

            default:
                startDate   = new DateTime(today.Year, 10, 1);
                endDate     = new DateTime(today.Year, 12, 31);
                quarterName = "4th";
                break;
            }
            return(EmployeePointsRepositories.BestEmployeesOfQuarterList(startDate.AddDays(-1), endDate.AddDays(1)));
        }
        public static List <EmployeePointDetails> MonthAndQuarterBestEmployees()
        {
            List <EmployeePointDetails> bestEmployeeOfMonthAndQuarter = new List <EmployeePointDetails>();
            DateTime today = DateTimeHelper.Today();

            EmployeePointDetails bestEmployeeOfTheMonth = EmployeePointsRepositories.BestEmployeeOfMonth(today);

            if (bestEmployeeOfTheMonth == null)
            {
                bestEmployeeOfTheMonth = new EmployeePointDetails();
            }

            bestEmployeeOfTheMonth.MonthName = today.ToString("MMMM");
            bestEmployeeOfMonthAndQuarter.Add(bestEmployeeOfTheMonth);

            DateTime startDate;
            DateTime endDate;
            string   quarterName;
            int      quarter = DateTimeHelper.GetQuarter(today);

            switch (quarter)
            {
            case 1:
                startDate   = new DateTime(today.Year, 1, 1);
                endDate     = new DateTime(today.Year, 3, 31);
                quarterName = "1st";
                break;

            case 2:
                startDate   = new DateTime(today.Year, 4, 1);
                endDate     = new DateTime(today.Year, 6, 30);
                quarterName = "2nd";
                break;

            case 3:
                startDate   = new DateTime(today.Year, 7, 1);
                endDate     = new DateTime(today.Year, 9, 30);
                quarterName = "3rd";
                break;

            default:
                startDate   = new DateTime(today.Year, 10, 1);
                endDate     = new DateTime(today.Year, 12, 31);
                quarterName = "4th";
                break;
            }
            EmployeePointDetails bestEmployeeOfTheQuarter = EmployeePointsRepositories.BestEmployeeOfQuarter(startDate.AddDays(-1), endDate.AddDays(1));

            if (bestEmployeeOfTheQuarter == null)
            {
                bestEmployeeOfTheQuarter = new EmployeePointDetails();
            }

            bestEmployeeOfTheQuarter.QuarterName = quarterName;
            bestEmployeeOfMonthAndQuarter.Add(bestEmployeeOfTheQuarter);

            return(bestEmployeeOfMonthAndQuarter);
        }
        public static void EvaluateStandUpMeeting(StandUpMeetingDetails standUpMeetingDetails)
        {
            ActionRate    actionRateStandUp    = ActionRatesRepositories.GetActionRateByName("Stand Up Meeting");
            EmployeePoint standUpEmployeePoint = new EmployeePoint
            {
                ActionRateId = actionRateStandUp.Id,
                Date         = DateTimeHelper.Today(),
                UserId       = standUpMeetingDetails.UserId,
                Rate         = standUpMeetingDetails.TotalDegree
            };

            if (standUpMeetingDetails.StandUpEmployeePointId > 0)
            {
                standUpEmployeePoint.Id = standUpMeetingDetails.StandUpEmployeePointId;
                EmployeePointsRepositories.UpdateEmployeePoint(standUpEmployeePoint);
            }
            else
            {
                EmployeePointsRepositories.InsertNewEmployeePoint(standUpEmployeePoint);
                standUpMeetingDetails.StandUpEmployeePointId = standUpEmployeePoint.Id;
            }

            ActionRate    actionRateSuggestion    = ActionRatesRepositories.GetActionRateByName("Suggestion Bonus");
            EmployeePoint suggestionEmployeePoint = new EmployeePoint
            {
                ActionRateId = actionRateSuggestion.Id,
                Date         = DateTimeHelper.Today(),
                UserId       = standUpMeetingDetails.UserId,
                Rate         = standUpMeetingDetails.SuggestionDegree
            };

            if (standUpMeetingDetails.SuggestionEmployeePointId > 0)
            {
                suggestionEmployeePoint.Id = standUpMeetingDetails.SuggestionEmployeePointId;
                EmployeePointsRepositories.UpdateEmployeePoint(suggestionEmployeePoint);
            }
            else
            {
                EmployeePointsRepositories.InsertNewEmployeePoint(suggestionEmployeePoint);
                standUpMeetingDetails.SuggestionEmployeePointId = suggestionEmployeePoint.Id;
            }
            StandUpMeetingRepository.EvaluateStandUpMeeting(standUpMeetingDetails);
        }
 public static List <EmployeePointDetails> MonthBestEmployees()
 {
     return(EmployeePointsRepositories.BestEmployeesOfMonthList(DateTimeHelper.Today()));
 }
 public static void InsertNewEmployeePoint(EmployeePoint employeePoint)
 {
     EmployeePointsRepositories.InsertNewEmployeePoint(employeePoint);
 }