Beispiel #1
0
        public static List <KpiDashboard> GetKpiDashboard(int dashboardId, int userId)
        {
            if (dashboardId < 0)
            {
                throw new ArgumentException("dashboardId cannot be less than zero");
            }

            if (userId <= 0)
            {
                throw new ArgumentException("userId cannot be equals or less than zero");
            }

            DashboardDSTableAdapters.KpiDashboardTableAdapter adapter = new DashboardDSTableAdapters.KpiDashboardTableAdapter();
            DashboardDS.KpiDashboardDataTable table = adapter.GetKpisFromDashboard(dashboardId, userId);

            List <KpiDashboard> list = new List <KpiDashboard>();

            foreach (var row in table)
            {
                list.Add(new KpiDashboard()
                {
                    KpiDashboardId = row.kpiDashboardId,
                    KpiId          = row.kpiId,
                    DashboardId    = row.IsdashboardIdNull() ? 0 : row.dashboardId,
                    OwnerUserId    = row.ownerUserId,
                    KpiName        = row.name
                });
            }
            return(list);
        }
Beispiel #2
0
        public static void DeleteKpiDashboard(int dashboardId, int userId, int kpiId)
        {
            if (kpiId <= 0)
            {
                throw new ArgumentException("KpiId cannot be equals or less than zero");
            }

            if (dashboardId < 0)
            {
                throw new ArgumentException("dashboardId cannot be less than zero");
            }

            if (userId <= 0)
            {
                throw new ArgumentException("userId cannot be equals or less than zero");
            }

            DashboardDSTableAdapters.KpiDashboardTableAdapter adapter = new DashboardDSTableAdapters.KpiDashboardTableAdapter();
            adapter.DeleteKpiDashboard(kpiId, userId, dashboardId);
        }