温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:中小企业网站系统前台源码(SmallBusinessStarterKit)
当前文件路径:SmallBusinessStarterKit/App_Code/People/People.cs

1using System; 2
using System.Configuration; 3
using System.Web.Configuration; 4
using System.Collections; 5
using System.Collections.Specialized; 6
using System.Collections.Generic; 7
using System.Web; 8
///<summary> 9
/// class People 10
/// Provides static functions to access 'people' 11
/// and serves as abastraction layer between the web Page and 12
/// actual data providers 13
///</summary> 14
public static class People { 15
16
private static bool _isInitialized = false; 17
private static PeopleProvider _provider; 18
private static SmallBusinessDataProvidersSection _providersSection; 19
20
public static PeopleProvider Provider { 21
get { 22
Initialize(); 23
return _provider; 24
} 25
} 26
27
public static List<Person> GetAllPersons() 28
{ 29
return Provider.GetAllPersons(); 30
} 31
32
33
private static void Initialize() { 34
if (!_isInitialized) { 35
_providersSection = (ConfigurationManager.GetSection("SmallBusinessDataProviders")) as SmallBusinessDataProvidersSection; 36
if (_providersSection == null) 37
{ 38
throw new Exception(Messages.PeopleConfigSectionNotFound); 39
} 40
41
_provider = ProvidersHelper.InstantiateProvider(_providersSection.PeopleProviders[_providersSection.PeopleProviderName], 42
typeof(PeopleProvider)) as PeopleProvider; 43
44
if (_provider == null) { 45
throw new Exception("People default provider could not be instantiated"); 46
} 47
} 48
} 49
50
} 51







}