public static string VerifyKPIMeasurements(int kpiId, DateTime date, string detalle, string categories) { if (kpiId <= 0) { throw new ArgumentException("El ID del KPI no puede ser cero."); } string listIds = ""; try { KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter localAdapter = new KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter(); KpiMeasurementDS.KpiMeasurementDataTable theTable = localAdapter.VerifyKpiMeasurements(kpiId, date, detalle, categories); if (theTable != null && theTable.Rows.Count > 0) { foreach (KpiMeasurementDS.KpiMeasurementRow theRow in theTable) { listIds = string.IsNullOrEmpty(listIds) ? theRow.measurmentID.ToString() : (listIds + ";" + theRow.measurmentID.ToString()); } } } catch (Exception exc) { log.Error("Error en VerifyKPIMeasurements para kpiId: " + kpiId + ", date: " + date.ToString() + ", detalle: " + detalle + " y categories: " + categories, exc); throw exc; } return(listIds); }
public static List <KPIMeasurements> GetKPIMeasurementCategoriesTimeByKpiId(int kpiId, string categoryId, string categoryItemId) { if (kpiId <= 0) { throw new ArgumentException(Resources.ImportData.ZeroKpiId); } List <KPIMeasurements> theList = new List <KPIMeasurements>(); KPIMeasurements theData = null; try { KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter localAdapter = new KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter(); KpiMeasurementDS.KpiMeasurementDataTable theTable = localAdapter.GetKpiMeasurementCategoriesByKpiId(kpiId, categoryId, categoryItemId); if (theTable != null && theTable.Rows.Count > 0) { foreach (KpiMeasurementDS.KpiMeasurementRow theRow in theTable) { theData = new KPIMeasurements(theRow.measurmentID, theRow.kpiID, theRow.date, theRow.measurement); theData.Detalle = theRow.IsdetalleNull() ? "" : theRow.detalle; theData.DataTime = KPIDataTimeBLL.GetKPIDataTimeFromValue(theData.Measurement); theList.Add(theData); } } } catch (Exception exc) { log.Error("Error en GetKPIMeasurementCategoriesByKpiId para kpiId: " + kpiId, exc); throw new ArgumentException(Resources.ImportData.GetKPIMeasurements); } return(theList); }
public static List <KPIMeasurement> GetKpiMeasurementsByKpiOwner(int ownerId, string ownerType, string userName, ref decimal maxValue, ref decimal minValue) { if (ownerId <= 0) { throw new ArgumentException("ownerId cannot be equals or less than zero"); } if (string.IsNullOrEmpty(ownerType)) { throw new ArgumentException("ownerType cannot be null or empty"); } if (string.IsNullOrEmpty(userName)) { throw new ArgumentException("userName cannot be null or empty"); } decimal?max = 0; decimal?min = 0; KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter adapter = new KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter(); KpiMeasurementDS.KpiMeasurementDataTable table = adapter.GetKpiMeasurementsByKpiOwner(ownerId, ownerType, userName, ref min, ref max); maxValue = max == null ? 0 : max.Value; minValue = min == null ? 0 : min.Value; List <KPIMeasurement> list = new List <KPIMeasurement>(); foreach (var row in table) { list.Add(new KPIMeasurement() { KPIID = row.kpiID, Date = row.date, Measurement = row.measurement }); } return(list); }
public static List <KPIMeasurement> GetKpiMeasurementsByKpiId(int kpiId, string categoryId, string categoryItemId, string unit) { if (kpiId <= 0) { throw new ArgumentException("KpiId cannot be equals or less than zero"); } KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter adapter = new KpiMeasurementDSTableAdapters.KpiMeasurementTableAdapter(); KpiMeasurementDS.KpiMeasurementDataTable table = adapter.GetKpiMeasurements(kpiId, categoryId, categoryItemId); List <KPIMeasurement> list = new List <KPIMeasurement>(); foreach (var row in table) { list.Add(new KPIMeasurement() { KPIID = row.kpiID, Date = row.date, Measurement = row.measurement }); } return(list); }