public Metrices PopulateMetrices(int companyDepartmentJobRoleId, bool isStaffAppraised, bool isSupervisor, long appraisalHeaderId, int periodId, string staffId) { try { Metrices metrices = new Metrices(); if (isStaffAppraised) { metrices = LoadCustomer(metrices, 1, companyDepartmentJobRoleId, appraisalHeaderId, periodId, staffId); metrices = LoadFinancial(metrices, 2, companyDepartmentJobRoleId, appraisalHeaderId, periodId); metrices = LoadPeople(metrices, 3, companyDepartmentJobRoleId, isSupervisor, appraisalHeaderId, periodId, staffId); metrices = LoadProcess(metrices, 4, companyDepartmentJobRoleId, isSupervisor, appraisalHeaderId, periodId); metrices = LoadRisk(metrices, 5, companyDepartmentJobRoleId, appraisalHeaderId, periodId); } else { metrices = LoadDefaultCustomer(metrices, 1, companyDepartmentJobRoleId, periodId, staffId); metrices = LoadDefaultFinancial(metrices, 2, companyDepartmentJobRoleId, periodId); metrices = LoadDefaultPeople(metrices, 3, companyDepartmentJobRoleId, isSupervisor, periodId, staffId); metrices = LoadDefaultProcess(metrices, 4, companyDepartmentJobRoleId, isSupervisor, periodId); metrices = LoadDefaultRisk(metrices, 5, companyDepartmentJobRoleId, periodId); } return(metrices); } catch (Exception ex) { throw ex; } }
private Metrices LoadCustomer(Metrices metrices, int metricPerspectiveId, int companyDepartmentJobRoleId, long appraisalHeaderId, int periodId, string staffId) { try { List <Customer> metrics = new List <Customer>(); metrices.CustomerTarget = "CUSTOMER (" + 0 + "%)"; if (periodId < 6) { DataSet ds = metricDb.SelectMetricByMetricPerspectiveIDAndCompanyDepartmentJobRoleIDAndAppraisalHeaderId(metricPerspectiveId, companyDepartmentJobRoleId, appraisalHeaderId); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { metrices.CustomerTargetValue = 0; metrices.CustomerActualScoreTotal = 0; metricRatingDbFacade = new MetricRatingDbFacade(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //decimal target = 0; Customer metric = new Customer(); metric.StaffMetricId = ds.Tables[0].Rows[i][metricDb.FIELD_STAFF_METRIC_ID] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i][metricDb.FIELD_STAFF_METRIC_ID]); metric.Id = ds.Tables[0].Rows[i][metricDb.FIELD_METRIC_ID] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i][metricDb.FIELD_METRIC_ID]); metric.Kpi = ds.Tables[0].Rows[i][metricDb.FIELD_KPI] == DBNull.Value ? null : Convert.ToString(ds.Tables[0].Rows[i][metricDb.FIELD_KPI]); metric.Measure = ds.Tables[0].Rows[i][metricDb.FIELD_MEASURE] == DBNull.Value ? null : Convert.ToString(ds.Tables[0].Rows[i][metricDb.FIELD_MEASURE]); metric.Target = ds.Tables[0].Rows[i][metricDb.FIELD_TARGET] == DBNull.Value ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i][metricDb.FIELD_TARGET]); metric.Score = ds.Tables[0].Rows[i][metricDb.FIELD_SCORE] == DBNull.Value ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i][metricDb.FIELD_SCORE]); metric.Rating = ds.Tables[0].Rows[i][metricDb.FIELD_RATING] == DBNull.Value ? 0 : Convert.ToByte(ds.Tables[0].Rows[i][metricDb.FIELD_RATING]); if (metric.Rating > 0) { metric.Period = new Period() { Id = periodId }; metrices.CustomerActualScoreTotal += Math.Round((Convert.ToDecimal(metric.Rating) / Convert.ToDecimal(metricRatingDbFacade.GetBy(metric))) * metric.Target, 2); } metrices.CustomerTargetValue += metric.Target; metrices.CustomerTarget = "CUSTOMER (" + metrices.CustomerTargetValue + "%)"; metrices.CustomerSumTotal += metric.Score; metrices.Customers.Add(metric); } } } } else { metrices = GetStaffInps(metrices, periodId, staffId); } return(metrices); } catch (Exception ex) { throw ex; } }
private Metrices LoadDefaultProcess(Metrices metrices, int metricPerspectiveId, int companyDepartmentJobRoleId, bool isSupervisor, int periodId) { try { List <Process> metrics = new List <Process>(); metrices.ProcessTarget = "PROCESS (" + 0 + "%)"; //DataSet ds = metricDb.SelectDefaultMetricByMetricPerspectiveIDAndCompanyDepartmentJobRoleID(metricPerspectiveId, companyDepartmentJobRoleId); DataSet ds = metricDb.SelectDefaultMetricByMetricPerspectiveIDAndCompanyDepartmentJobRoleIDAndPeriodID(metricPerspectiveId, companyDepartmentJobRoleId, periodId); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { metrices.ProcessTargetValue = 0; metricRatingDbFacade = new MetricRatingDbFacade(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //decimal target = 0; Process metric = new Process(); metric.Id = ds.Tables[0].Rows[i][metricDb.FIELD_METRIC_ID] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i][metricDb.FIELD_METRIC_ID]); metric.Kpi = ds.Tables[0].Rows[i][metricDb.FIELD_KPI] == DBNull.Value ? null : Convert.ToString(ds.Tables[0].Rows[i][metricDb.FIELD_KPI]); metric.Measure = ds.Tables[0].Rows[i][metricDb.FIELD_MEASURE] == DBNull.Value ? null : Convert.ToString(ds.Tables[0].Rows[i][metricDb.FIELD_MEASURE]); metric.Target = ds.Tables[0].Rows[i][metricDb.FIELD_TARGET] == DBNull.Value ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i][metricDb.FIELD_TARGET]); metric.Score = ds.Tables[0].Rows[i][metricDb.FIELD_SCORE] == DBNull.Value ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i][metricDb.FIELD_SCORE]); metric.Rating = ds.Tables[0].Rows[i][metricDb.FIELD_RATING] == DBNull.Value ? 0 : Convert.ToByte(ds.Tables[0].Rows[i][metricDb.FIELD_RATING]); metric.IsSupervisor = isSupervisor; if (metric.Rating > 0) { //metrices.ProcessActualScoreTotal += Math.Round((Convert.ToDecimal(metric.Rating) / Convert.ToDecimal(5)) * metric.Target, 2); metric.Period = new Period() { Id = periodId }; metrices.ProcessActualScoreTotal += Math.Round((Convert.ToDecimal(metric.Rating) / Convert.ToDecimal(metricRatingDbFacade.GetBy(metric))) * metric.Target, 2); } //metric.Kpi = UtilityLogic.JumbbleText(metric.Kpi); //metric.Measure = UtilityLogic.JumbbleText(metric.Kpi); metrices.ProcessTargetValue += metric.Target; metrices.ProcessTarget = "PROCESS (" + metrices.ProcessTargetValue + "%)"; metrices.ProcessSumTotal += metric.Score; metric.MetricRatings = GetMetricRating(metric.Id, metricPerspectiveId, companyDepartmentJobRoleId, periodId); metrices.Processes.Add(metric); } } } return(metrices); } catch (Exception ex) { throw ex; } }
private Metrices GetStaffInps(Metrices metrices, int periodId, string staffId) { try { DataSet npsDs = npsDb.SelectDefaultInpsByStaffIDAndPeriodID(staffId, periodId); if (npsDs != null) { if (npsDs.Tables[0].Rows.Count > 0) { npsRatingLogic = new InpsRatingLogic(); for (int i = 0; i < npsDs.Tables[0].Rows.Count; i++) { Customer nps = new Customer(); nps.Id = npsDs.Tables[0].Rows[i][npsDb.FIELD_INPS_ID] == DBNull.Value ? 0 : Convert.ToInt32(npsDs.Tables[0].Rows[i][npsDb.FIELD_INPS_ID]); nps.Kpi = npsDs.Tables[0].Rows[i][npsDb.FIELD_KPI] == DBNull.Value ? null : Convert.ToString(npsDs.Tables[0].Rows[i][npsDb.FIELD_KPI]); nps.Measure = npsDs.Tables[0].Rows[i][npsDb.FIELD_MEASURE] == DBNull.Value ? null : Convert.ToString(npsDs.Tables[0].Rows[i][npsDb.FIELD_MEASURE]); nps.Target = npsDs.Tables[0].Rows[i][npsDb.FIELD_TARGET] == DBNull.Value ? 0 : Convert.ToDecimal(npsDs.Tables[0].Rows[i][npsDb.FIELD_TARGET]); nps.Score = npsDs.Tables[0].Rows[i][npsDb.FIELD_SCORE] == DBNull.Value ? 0 : Convert.ToDecimal(npsDs.Tables[0].Rows[i][npsDb.FIELD_SCORE]); nps.Rating = npsDs.Tables[0].Rows[i][npsDb.FIELD_RATING] == DBNull.Value ? 0 : Convert.ToByte(npsDs.Tables[0].Rows[i][npsDb.FIELD_RATING]); //nps.Kpi = UtilityLogic.JumbbleText(nps.Kpi); //nps.Measure = UtilityLogic.JumbbleText(nps.Kpi); if (nps.Rating > 0) { nps.Period = new Period() { Id = periodId }; metrices.CustomerActualScoreTotal += Math.Round((Convert.ToDecimal(nps.Rating) / Convert.ToDecimal(npsRatingLogic.GetBy(nps.Period))) * nps.Target, 2); } metrices.CustomerTargetValue += nps.Target; metrices.CustomerTarget = "CUSTOMER (" + metrices.CustomerTargetValue + "%)"; metrices.CustomerSumTotal += nps.Score; metrices.Customers.Add(nps); } } } return(metrices); } catch (Exception) { throw; } }
private Metrices LoadPeople(Metrices metrices, int metricPerspectiveId, int companyDepartmentJobRoleId, bool isSupervisor, long appraisalHeaderId, int periodId, string staffId) { try { List <People> metrics = new List <People>(); metrices.PeopleTarget = "PEOPLE (" + 0 + "%)"; DataSet ds = metricDb.SelectMetricByMetricPerspectiveIDAndCompanyDepartmentJobRoleIDAndAppraisalHeaderId(metricPerspectiveId, companyDepartmentJobRoleId, appraisalHeaderId); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { //get learning and growth for this staff decimal learningScore = 0; Learning learning = learningDbFacade.GetByStaffAndPeriod(staffId, periodId); if (learning != null) { learningScore = learning.PercentageScore; } metrices.PeopleTargetValue = 0; metricRatingDbFacade = new MetricRatingDbFacade(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { //decimal target = 0; People metric = new People(); metric.StaffMetricId = ds.Tables[0].Rows[i][metricDb.FIELD_STAFF_METRIC_ID] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i][metricDb.FIELD_STAFF_METRIC_ID]); metric.Id = ds.Tables[0].Rows[i][metricDb.FIELD_METRIC_ID] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[i][metricDb.FIELD_METRIC_ID]); metric.Kpi = ds.Tables[0].Rows[i][metricDb.FIELD_KPI] == DBNull.Value ? null : Convert.ToString(ds.Tables[0].Rows[i][metricDb.FIELD_KPI]); metric.Measure = ds.Tables[0].Rows[i][metricDb.FIELD_MEASURE] == DBNull.Value ? null : Convert.ToString(ds.Tables[0].Rows[i][metricDb.FIELD_MEASURE]); metric.Target = ds.Tables[0].Rows[i][metricDb.FIELD_TARGET] == DBNull.Value ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i][metricDb.FIELD_TARGET]); metric.Score = learningScore; //metric.Score = ds.Tables[0].Rows[i]["Metric_Score"] == DBNull.Value ? 0 : Convert.ToDecimal(ds.Tables[0].Rows[i]["Metric_Score"]); metric.Rating = ds.Tables[0].Rows[i][metricDb.FIELD_RATING] == DBNull.Value ? 0 : Convert.ToByte(ds.Tables[0].Rows[i][metricDb.FIELD_RATING]); metric.IsSupervisor = isSupervisor; metric.MetricRatings = GetMetricRating(metric.Id, metricPerspectiveId, companyDepartmentJobRoleId, periodId); if (metric.Rating > 0) { metric.Period = new Period() { Id = periodId }; //metrices.PeopleActualScoreTotal += Math.Round((Convert.ToDecimal(metric.Rating) / Convert.ToDecimal(5)) * metric.Target, 2); metrices.PeopleActualScoreTotal += Math.Round((Convert.ToDecimal(metric.Rating) / Convert.ToDecimal(metricRatingDbFacade.GetBy(metric))) * metric.Target, 2); } metrices.PeopleTargetValue += metric.Target; metrices.PeopleTarget = "PEOPLE (" + metrices.PeopleTargetValue + "%)"; metrices.PeopleSumTotal += metric.Score; metrices.Peoples.Add(metric); } } } return(metrices); } catch (Exception ex) { throw ex; } }
public void AppraiseStaff(Infrastructure.MangoService.Appraisal appraisal, ObservableCollection <Pace> paces, Metrices metrices, Comment comment, Staff staff, Staff supervisor, Period period, ObservableCollection <StaffAssessment> staffAssessments, bool sendMail) { svc = new ServiceClient(); svc.AppraiseStaffCompleted += new EventHandler <AppraiseStaffCompletedEventArgs>(svc_AppraiseStaffCompleted); svc.AppraiseStaffAsync(appraisal, paces, metrices, comment, staff, supervisor, period, staffAssessments, sendMail); svc.CloseAsync(); }