public static void GetKpiStats(int kpiId, string categoryId, string categoryItemId, int firstDayOfWeek, ref decimal currentValue, ref decimal lowestValue, ref decimal maxValue, ref decimal avgValue, ref decimal progress, ref decimal trend) { if (kpiId <= 0) { throw new ArgumentException(Resources.Kpi.MessageKpiIDZero); } if (firstDayOfWeek <= 0 || firstDayOfWeek > 7) { throw new ArgumentException("firstDayOfWeek value must be through 1 to 7"); } decimal?paramCurrentValue = 0; decimal?paramLowestValue = 0; decimal?paramMaxValue = 0; decimal?paramAvgValue = 0; decimal?paramProgress = 0; decimal?paramTrend = 0; KPIDSTableAdapters.KPITableAdapter adapter = new KPITableAdapter(); adapter.GetKpiStats(kpiId, categoryId, categoryItemId, firstDayOfWeek, ref paramCurrentValue, ref paramLowestValue, ref paramMaxValue, ref paramAvgValue, ref paramProgress, ref paramTrend); currentValue = paramCurrentValue == null ? decimal.MinValue : paramCurrentValue.Value; lowestValue = paramLowestValue == null ? decimal.MinValue : paramLowestValue.Value; maxValue = paramMaxValue == null ? decimal.MinValue : paramMaxValue.Value; avgValue = paramAvgValue == null ? decimal.MinValue : paramAvgValue.Value; progress = paramProgress == null ? decimal.MinValue : paramProgress.Value; trend = paramTrend == null ? decimal.MinValue : paramTrend.Value; }
public static KPI GetKPIById(int kpiId) { if (kpiId <= 0) { throw new ArgumentException(Resources.Organization.MessageZeroAreaId); } KPI theData = null; try { KPITableAdapter localAdapter = new KPITableAdapter(); KPIDS.KPIDataTable theTable = localAdapter.GetKPIById(kpiId); if (theTable != null && theTable.Rows.Count > 0) { KPIDS.KPIRow theRow = theTable[0]; theData = FillRecord(theRow); } } catch (Exception exc) { log.Error(Resources.Kpi.MessageErrorKpiInformation + " KpiId: " + kpiId, exc); throw new Exception(Resources.Kpi.MessageErrorKpiInformation); } return(theData); }
public static void DeletePermanentlyKPI(int kpiId) { KPIDSTableAdapters.KPITableAdapter adapter = new KPITableAdapter(); try { adapter.DeletePermanentlyKPI(kpiId); } catch (Exception ex) { log.Error(Resources.Kpi.MessageErrorDelete, ex); throw new Exception(Resources.Kpi.MessageErrorDelete); } }
public static void DeleteKPI(int kpiId) { KPIDSTableAdapters.KPITableAdapter adapter = new KPITableAdapter(); string username = HttpContext.Current.User.Identity.Name; try { adapter.DeleteKPI(kpiId, username); } catch (Exception ex) { log.Error(Resources.Kpi.MessageErrorDelete, ex); throw new Exception(Resources.Kpi.MessageErrorDelete); } }
public static decimal GetKpiProgress(int kpiId, string categoryId, string categoryItemId, int firstDayOfWeek, ref bool hasTarget, ref decimal currentValue) { if (kpiId <= 0) { throw new ArgumentException(Resources.Kpi.MessageKpiIDZero); } bool? paramHasTarget = false; decimal?paramCurrentValue = 0; decimal?progress = 0; KPIDSTableAdapters.KPITableAdapter adapter = new KPITableAdapter(); adapter.GetKpiProgress(kpiId, categoryId, categoryItemId, firstDayOfWeek, ref paramHasTarget, ref paramCurrentValue, ref progress); hasTarget = paramHasTarget == null ? false : paramHasTarget.Value; currentValue = paramCurrentValue == null ? 0 : paramCurrentValue.Value; return(progress.Value); }