Ejemplo n.º 1
0
        /// <summary>
        /// Saving KPI Details
        /// </summary>
        /// <param name="kpiViewModel"></param>
        /// <returns></returns>
        public bool SaveKPIDetails(KPIViewModel kpiViewModel)
        {
            try
            {
                if (kpiViewModel != null)
                {
                    KPI kpiDTO = new KPI();
                    kpiDTO.KPIID          = kpiViewModel.KPIID;
                    kpiDTO.KPIDescription = kpiViewModel.KPIDescription;

                    kpiDTO.Source = new CheckListType();
                    kpiDTO.Source.CheckListTypeID   = kpiViewModel.Source.CheckListTypeID;
                    kpiDTO.Source.CheckListTypeCode = kpiViewModel.Source.CheckListTypeCode;
                    kpiDTO.Source.CheckListTypeName = kpiViewModel.Source.CheckListTypeName;
                    kpiDTO.Source.RecordStatus      = kpiViewModel.Source.RecordStatus;

                    kpiDTO.Measure             = new Measure();
                    kpiDTO.Measure.MeasureId   = kpiViewModel.Measure.MeasureId;
                    kpiDTO.Measure.MeasureText = kpiViewModel.Measure.MeasureText;

                    kpiDTO.Standard   = kpiViewModel.Standard;
                    kpiDTO.AlertLevel = kpiViewModel.AlertLevel;

                    kpiDTO.KPIMeasure = new KPIMeasure();
                    kpiDTO.KPIMeasure.KpimeasureId    = kpiViewModel.KPIMeasure.KpimeasureId;
                    kpiDTO.KPIMeasure.Measure         = kpiViewModel.KPIMeasure.Measure;
                    kpiDTO.KPIMeasure.CheckListTypeId = kpiViewModel.KPIMeasure.CheckListTypeId;
                    kpiDTO.KPIMeasure.RecordStatus    = kpiViewModel.KPIMeasure.RecordStatus;

                    kpiDTO.IsHeatMapItem = kpiViewModel.IsHeatMapItem;
                    kpiDTO.HeatMapScore  = kpiViewModel.HeatMapScore;
                    kpiDTO.IsUniversal   = kpiViewModel.IsUniversal;
                    kpiDTO.RecordStatus  = kpiViewModel.RecordStatus;

                    kpiDTO.KPIAlert                           = new KPIAlert();
                    kpiDTO.KPIAlert.KPIAlertId                = kpiViewModel.KPIAlertId;
                    kpiDTO.KPIAlert.SendAlert                 = kpiViewModel.SendAlert;
                    kpiDTO.KPIAlert.SendAlertTitle            = kpiViewModel.SendAlertTitle;
                    kpiDTO.KPIAlert.SendToRelationshipManager = kpiViewModel.SendToRelationshipManager;
                    kpiDTO.KPIAlert.SendToBillingManager      = kpiViewModel.SendToBillingManager;
                    kpiDTO.KPIAlert.EscalateAlert             = kpiViewModel.EscalateAlert;
                    kpiDTO.KPIAlert.EscalateAlertTitle        = kpiViewModel.EscalateAlertTitle;
                    kpiDTO.KPIAlert.EscalateTriggerTime       = kpiViewModel.EscalateTriggerTime;
                    kpiDTO.KPIAlert.IncludeKPITarget          = kpiViewModel.IncludeKPITarget;
                    kpiDTO.KPIAlert.IncludeDeviationTarget    = kpiViewModel.IncludeDeviationTarget;
                    kpiDTO.KPIAlert.IsSla                     = kpiViewModel.IsSla;
                    return(_kpiRepository.SaveKPIs(kpiDTO));
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                _logger.Log(ex, LogLevel.Error, ex.Message);
                return(false);
            }
        }
Ejemplo n.º 2
0
        public static KPIViewModel getKpiViewModel(decimal?Value, double?GreenThreshold, double?YellowThreshold)
        {
            ThresholdViewModel threshold = new ThresholdViewModel();

            threshold.green  = GreenThreshold;
            threshold.yellow = YellowThreshold;

            KPIViewModel result = new KPIViewModel();

            result.value     = Value;
            result.threshold = threshold;

            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// mapping domain model to business model.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public static KPIViewModel MappingKPIBusinessToKPIViewModel(KPI item)
        {
            KPIViewModel kpiDTO = new KPIViewModel();

            kpiDTO.KPIID                    = item.KPIID;
            kpiDTO.KPIDescription           = item.KPIDescription;
            kpiDTO.Source                   = new CheckListTypeViewModel();
            kpiDTO.Source.CheckListTypeID   = item.Source.CheckListTypeID;
            kpiDTO.Source.CheckListTypeCode = item.Source.CheckListTypeCode;
            kpiDTO.Source.CheckListTypeName = item.Source.CheckListTypeName;
            kpiDTO.Source.RecordStatus      = item.Source.RecordStatus;

            kpiDTO.Measure             = new MeasureViewModel();
            kpiDTO.Measure.MeasureId   = item.Measure.MeasureId;
            kpiDTO.Measure.MeasureText = item.Measure.MeasureText;
            kpiDTO.Measure.KPIID       = item.KPIID;
            kpiDTO.Measure.Standard    = item.Measure.Standard;
            kpiDTO.Measure.Universal   = item.Measure.Universal;
            kpiDTO.Measure.MeasureCode = item.Measure.MeasureCode;
            kpiDTO.Measure.MeasureUnit = item.Measure.MeasureUnit;

            kpiDTO.Standard   = item.Standard;
            kpiDTO.AlertLevel = item.AlertLevel;

            kpiDTO.KPIMeasure = new KPIMeasureViewModel();
            kpiDTO.KPIMeasure.KpimeasureId    = item.KPIMeasure.KpimeasureId;
            kpiDTO.KPIMeasure.Measure         = item.KPIMeasure.Measure;
            kpiDTO.KPIMeasure.CheckListTypeId = item.KPIMeasure.CheckListTypeId;
            kpiDTO.KPIMeasure.RecordStatus    = item.KPIMeasure.RecordStatus;

            kpiDTO.IsHeatMapItem = item.IsHeatMapItem;
            kpiDTO.HeatMapScore  = item.HeatMapScore;
            kpiDTO.IsUniversal   = item.IsUniversal;
            kpiDTO.RecordStatus  = item.RecordStatus;

            kpiDTO.KPIAlertId                = item.KPIAlert.KPIAlertId;
            kpiDTO.SendAlert                 = item.KPIAlert.SendAlert;
            kpiDTO.SendAlertTitle            = item.KPIAlert.SendAlertTitle;
            kpiDTO.SendToRelationshipManager = item.KPIAlert.SendToRelationshipManager;
            kpiDTO.SendToBillingManager      = item.KPIAlert.SendToBillingManager;
            kpiDTO.EscalateAlert             = item.KPIAlert.EscalateAlert;
            kpiDTO.EscalateAlertTitle        = item.KPIAlert.EscalateAlertTitle;
            kpiDTO.EscalateTriggerTime       = item.KPIAlert.EscalateTriggerTime;
            kpiDTO.IncludeKPITarget          = item.KPIAlert.IncludeKPITarget;
            kpiDTO.IncludeDeviationTarget    = item.KPIAlert.IncludeDeviationTarget;
            kpiDTO.IsSla = item.KPIAlert.IsSla;

            return(kpiDTO);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Getting kpi based on ID
        /// </summary>
        /// <param name="KPIId"></param>
        /// <returns></returns>
        public KPIViewModel GetKPIById(int KPIId)
        {
            KPIViewModel kpi = new KPIViewModel();

            try
            {
                KPI kpiDTO = _kpiRepository.GetKPIById(KPIId);
                return(BusinessMapper.MappingKPIBusinessToKPIViewModel(kpiDTO));;
            }
            catch (Exception ex)
            {
                _logger.Log(ex, LogLevel.Error, ex.Message);
                return(null);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Getting all M3Metrics KPIs
        /// </summary>
        /// <returns></returns>
        public List <KPIViewModel> GetAllM3MetricsKPIs()
        {
            List <KPIViewModel> kpisDTO = new List <KPIViewModel>();

            try
            {
                List <KPI> kpis = _kpiRepository.GetM3MetricsKPIs();
                if (kpisDTO != null)
                {
                    foreach (KPI item in kpis)
                    {
                        KPIViewModel kpiDTO = BusinessMapper.MappingKPIBusinessToKPIViewModel(item);
                        kpisDTO.Add(kpiDTO);
                    }
                }
                return(kpisDTO);
            }
            catch (Exception ex)
            {
                _logger.Log(ex, LogLevel.Error, ex.Message);
                return(null);
            }
        }
Ejemplo n.º 6
0
 public bool SaveKPIDetails([FromBody] KPIViewModel kpiViewModel)
 {
     return(_kpiBusiness.SaveKPIDetails(kpiViewModel));
 }