Пример #1
0
        // Conditional data loading for ObjectDataSource
        private void DashboardConfigurator_DataLoading(object sender, DataLoadingWebEventArgs e)
        {
            var userName = contextAccessor.HttpContext.Session.GetString("CurrentUser");

            if (e.DataId == "odsSales")
            {
                if (userName == "Admin")
                {
                    e.Data = SalesData.GetSalesData();
                }
                else if (userName == "User")
                {
                    e.Data = SalesData.GetSalesDataLimited();
                }
            }
        }
Пример #2
0
 public static List <SalesData> GetSalesDataLimited()
 {
     return(SalesData.GetSalesData().Where(sd => sd.Country == "United States").ToList());
 }