コード例 #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());
 }