示例#1
0
        public KPIType GetKPITypesByID(string kpiTypeID, string language)
        {
            if (string.IsNullOrEmpty(language))
            {
                language = Artexacta.App.Utilities.LanguageUtilities.GetLanguageFromContext();
            }

            KPIType theData = null;

            try
            {
                KPITypeDS.KPITypeDetailDataTable theTable = theAdapter.GetKPITypeById(kpiTypeID, language);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    KPITypeDS.KPITypeDetailRow theRow = theTable[0];
                    theData = FillRecord(theRow);
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía un KPIType.", exc);
                throw exc;
            }

            return(theData);
        }
示例#2
0
        public List <KPIType> GetKPITypes(string language)
        {
            if (string.IsNullOrEmpty(language))
            {
                language = Artexacta.App.Utilities.LanguageUtilities.GetLanguageFromContext();
            }

            List <KPIType> theList = new List <KPIType>();
            KPIType        theData = null;

            try
            {
                KPITypeDS.KPITypeDetailDataTable theTable = theAdapter.GetKPITypes(language);

                if (theTable != null && theTable.Rows.Count > 0)
                {
                    foreach (KPITypeDS.KPITypeDetailRow theRow in theTable)
                    {
                        theData = FillRecord(theRow);
                        theList.Add(theData);
                    }
                }
            }
            catch (Exception exc)
            {
                log.Error("Ocurrió un error mientras se obtenía los KPITypes.", exc);
                throw exc;
            }

            return(theList);
        }
示例#3
0
    private void LoadKpiData()
    {
        int kpiId  = Convert.ToInt32(KpiIdHiddenField.Value);
        int userId = UserBLL.GetUserIdByUsername(User.Identity.Name);

        UserIdHiddenField.Value = userId.ToString();

        KPI kpi = KPIBLL.GetKPIById(kpiId);

        KpiNameLiteral.Text = kpi.Name;

        //Inicializo los valores conocidos
        string     lang   = LanguageUtilities.GetLanguageFromContext();
        KPITypeBLL theBll = new KPITypeBLL();
        KPIType    type   = theBll.GetKPITypesByID(kpi.KpiTypeID, lang);

        KpiType.Text = type != null ? type.TypeName : kpi.KpiTypeID;
        //WebServiceId.Text = "<div class='col-md-4 col-sm-4'>Web Service ID:</div><div class='col-md-8 col-sm-8'>SERV-Reliavility</div>";
        ReportingUnit.Text = kpi.ReportingUnitName;
        KpiTarget.Text     = (kpi.TargetPeriod == 0 ? Resources.KpiDetails.NoTargetLabel : kpi.TargetPeriod + " " + kpi.ReportingUnitID);

        //if (caso <= 50)
        //{
        //    StartingDate.Text = "<div class='col-md-4 col-sm-4'>Starting Date:</div><div class='col-md-8 col-sm-8'>01/15/16</div>";
        //    MeanTimeGraphic.Visible = true;
        //    MeanTimeProgress.Visible = true;
        //}
        //else
        //{
        StartingDate.Text = kpi.StartDate != DateTime.MinValue ? kpi.StartDate.ToShortDateString() : "-";
        RevenueCollectionGraphic.Visible = true;
        //RevenueCollectionProgress.Visible = true;
        ChartControl.KpiId               = kpiId;
        ExportControl.KpiId              = kpiId;
        StatsControl.KpiId               = kpiId;
        MeasurementsControl.KpiId        = kpiId;
        MeasurementsControl.Unit         = kpi.UnitID;
        MeasurementsControl.Currency     = kpi.Currency;
        MeasurementsControl.CurrencyUnit = kpi.CurrencyUnitForDisplay;

        UnitIdHiddenField.Value       = kpi.UnitID;
        CurrencyHiddenField.Value     = kpi.Currency;
        CurrencyUnitHiddenField.Value = kpi.CurrencyUnitForDisplay;

        //CurrencyUnitBLL currencyUnitBll = new CurrencyUnitBLL();
        //CurrencyUnit currencyUnit = currencyUnitBll.GetCurrencyUnitsById(lang, ;

        //MeasurementsControl.Currency = kpi.Currency;

        //}

        List <KPICategoyCombination> categories = KPICategoryCombinationBLL.GetCategoryItemsCombinatedByKpiId(kpiId);

        if (categories.Count > 0)
        {
            CategoriesRepeater.DataSource = categories;
            CategoriesRepeater.DataBind();
            CategoriesPanel.Visible = true;
        }
    }
示例#4
0
        private static KPIType FillRecord(KPITypeDS.KPITypeDetailRow row)
        {
            KPIType theNewRecord = new KPIType(
                row.kpiTypeID,
                row.directionID,
                row.strategyID,
                row.unitID,
                row.typeName,
                row.description);

            return(theNewRecord);
        }
        private CAI.COMMANDoptimize.KPI.Models.KPI[] GenerateKPI(string location)
        {
            int factor = (!string.IsNullOrEmpty(location) && !location.Equals("all", StringComparison.InvariantCultureIgnoreCase)) ? 1
                    : (_numlocations > 0 ? _numlocations : 5);

            KPIType[] kpitypes = new KPIType[] {
                new KPIType {
                    Code = "001",
                    Description = "In Service to First Load",
                    Category = "01",
                    Min = 10,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "002",
                    Description = "Waiting On Jobsite to Unload",
                    Category = "01",
                    Min = 10,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "003",
                    Description = "Waiting in Yard for a Load",
                    Category = "01",
                    Min = 10,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "004",
                    Description = "End of Day Yard Time",
                    Category = "01",
                    Min = 10,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "005",
                    Description = "Total Compliance %",
                    Category = "02",
                    Min = 0,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "006",
                    Description = "Locked Loads %",
                    Category = "02",
                    Min = 0,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "007",
                    Description = "Punch In to In Service",
                    Category = "01",
                    Min = 10,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "008",
                    Description = "Print to To Job",
                    Category = "01",
                    Min = 10,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "009",
                    Description = "Wash to Clock Out",
                    Category = "01",
                    Min = 10,
                    Max = factor * 100
                },
                new KPIType {
                    Code = "010",
                    Description = "Status Updates %",
                    Category = "02",
                    Min = 0,
                    Max = factor * 100
                }
            };

            int count = _r.Next(0, _numkpi+1);
            CAI.COMMANDoptimize.KPI.Models.KPI[] kpis = new CAI.COMMANDoptimize.KPI.Models.KPI[count];
            for (int i=0; i<count; i++)
            {
                KPIType kpi = kpitypes[_r.Next(0, kpitypes.Length)];
                kpis[i] = new CAI.COMMANDoptimize.KPI.Models.KPI {
                    Code = kpi.Code,
                    Description = kpi.Description,
                    Category = kpi.Category,
                    Actual = _r.Next(kpi.Min, kpi.Max + 1),
                    Units = _r.Next(kpi.Min, kpi.Max + 1),
                    Target = _r.Next(kpi.Min, kpi.Max + 1),
                    Level1 = _r.Next(kpi.Min, kpi.Max + 1),
                    Level2 = _r.Next(kpi.Min, kpi.Max + 1)
                };
            }
            return kpis;
        }