本文整理汇总了C#中PersonalizationScope类的典型用法代码示例。如果您正苦于以下问题:C# PersonalizationScope类的具体用法?C# PersonalizationScope怎么用?C# PersonalizationScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PersonalizationScope类属于命名空间,在下文中一共展示了PersonalizationScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindState
public override PersonalizationStateInfoCollection FindState(PersonalizationScope scope,
PersonalizationStateQuery query,
int pageIndex,
int pageSize,
out int totalRecords)
{
PersonalizationProviderHelper.CheckPersonalizationScope(scope);
PersonalizationProviderHelper.CheckPageIndexAndSize(pageIndex, pageSize);
if (scope == PersonalizationScope.Shared)
{
string pathToMatch = null;
if (query != null)
{
pathToMatch = PersonalizationProviderHelper.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, MaxStringLength);
}
return FindSharedState(pathToMatch, pageIndex, pageSize, out totalRecords);
}
else
{
string pathToMatch = null;
DateTime inactiveSinceDate = DateTime.MinValue;
string usernameToMatch = null;
if (query != null)
{
pathToMatch = PersonalizationProviderHelper.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, MaxStringLength);
inactiveSinceDate = query.UserInactiveSinceDate;
usernameToMatch = PersonalizationProviderHelper.CheckAndTrimString(
query.UsernameToMatch, "query.UsernameToMatch", false, MaxStringLength);
}
return FindUserState(pathToMatch, inactiveSinceDate, usernameToMatch,
pageIndex, pageSize, out totalRecords);
}
}
示例2: FindState
public override PersonalizationStateInfoCollection FindState(PersonalizationScope scope, PersonalizationStateQuery query, int pageIndex, int pageSize, out int totalRecords)
{
PersonalizationProviderHelper.CheckPersonalizationScope(scope);
PersonalizationProviderHelper.CheckPageIndexAndSize(pageIndex, pageSize);
if (scope == PersonalizationScope.Shared)
{
string str = null;
if (query != null)
str = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, 0x100);
return this.FindSharedState(str, pageIndex, pageSize, out totalRecords);
}
string path = null;
DateTime defaultInactiveSinceDate = DateTime.MaxValue;
string username = null;
if (query != null)
{
path = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, 0x100);
defaultInactiveSinceDate = query.UserInactiveSinceDate;
username = StringUtil.CheckAndTrimString(query.UsernameToMatch, "query.UsernameToMatch", false, 0x100);
}
return this.FindUserState(path, defaultInactiveSinceDate, username, pageIndex, pageSize, out totalRecords);
}
示例3: WebPartChrome
public WebPartChrome(WebPartZoneBase zone, System.Web.UI.WebControls.WebParts.WebPartManager manager)
{
if (zone == null)
{
throw new ArgumentNullException("zone");
}
this._zone = zone;
this._page = zone.Page;
this._designMode = zone.DesignMode;
this._manager = manager;
if (this._designMode)
{
this._personalizationEnabled = true;
}
else
{
this._personalizationEnabled = (manager != null) && manager.Personalization.IsModifiable;
}
if (manager != null)
{
this._personalizationScope = manager.Personalization.Scope;
}
else
{
this._personalizationScope = PersonalizationScope.Shared;
}
}
示例4: GetCountOfState
public static int GetCountOfState(
SiteSettings siteSettings,
PersonalizationScope scope,
PersonalizationStateQuery query)
{
int result = 0;
if (siteSettings != null)
{
Guid userGuid = Guid.Empty;
if ((query.UsernameToMatch != null) && (query.UsernameToMatch.Length > 0))
{
SiteUser siteUser = new SiteUser(siteSettings, query.UsernameToMatch);
if (siteUser.UserId > 0)
{
userGuid = siteUser.UserGuid;
}
}
bool allUsersScope = (scope == PersonalizationScope.Shared);
result = SitePersonalization.GetCountOfState(
siteSettings.SiteId,
query.PathToMatch,
allUsersScope,
userGuid,
query.UserInactiveSinceDate);
}
return result;
}
示例5: PersonalizationEntry
public PersonalizationEntry(object value, PersonalizationScope scope, bool isSensitive)
{
PersonalizationProviderHelper.CheckPersonalizationScope(scope);
this._value = value;
this._scope = scope;
this._isSensitive = isSensitive;
}
示例6: WebPartChrome
public WebPartChrome(WebPartZoneBase zone, WebPartManager manager) {
if (zone == null) {
throw new ArgumentNullException("zone");
}
_zone = zone;
_page = zone.Page;
_designMode = zone.DesignMode;
_manager = manager;
if (_designMode) {
// Consider personalization to be enabled at design-time
_personalizationEnabled = true;
}
else {
_personalizationEnabled = (manager != null && manager.Personalization.IsModifiable);
}
if (manager != null) {
_personalizationScope = manager.Personalization.Scope;
}
else {
// Consider scope to be shared at design-time
_personalizationScope = PersonalizationScope.Shared;
}
}
示例7: FindState
/// <summary>
/// Finds state matching given parameters
/// </summary>
/// <param name="scope">Scope to search</param>
/// <param name="query">Query to action</param>
/// <param name="pageIndex">Index of page to retrieve</param>
/// <param name="pageSize">Size of page to retrieve</param>
/// <returns>Matching state</returns>
public FindStateResult FindState(PersonalizationScope scope, PersonalizationStateQuery query, int pageIndex, int pageSize)
{
int totalRecords = 0;
PersonalizationStateInfoCollection collection = Provider.FindState(scope, query, pageIndex, pageSize, out totalRecords);
FindStateResult result = new FindStateResult();
result.TotalRecords = totalRecords;
result.StateInfoCollection = collection;
return result;
}
示例8: ChangeScope
protected virtual void ChangeScope(PersonalizationScope scope)
{
PersonalizationProviderHelper.CheckPersonalizationScope(scope);
if (scope != this._currentScope)
{
if ((scope == PersonalizationScope.Shared) && !this.CanEnterSharedScope)
{
throw new InvalidOperationException(System.Web.SR.GetString("WebPartPersonalization_CannotEnterSharedScope"));
}
this._currentScope = scope;
this._scopeToggled = true;
}
}
示例9: ResetAllState
private int ResetAllState(PersonalizationScope scope) {
SqlConnectionHolder connectionHolder = null;
SqlConnection connection = null;
int count = 0;
// Extra try-catch block to prevent elevation of privilege attack via exception filter
try {
try {
connectionHolder = GetConnectionHolder();
connection = connectionHolder.Connection;
Debug.Assert(connection != null);
CheckSchemaVersion( connection );
SqlCommand command = new SqlCommand("dbo.aspnet_PersonalizationAdministration_DeleteAllState", connection);
SetCommandTypeAndTimeout(command);
SqlParameterCollection parameters = command.Parameters;
SqlParameter parameter = parameters.Add(new SqlParameter("AllUsersScope", SqlDbType.Bit));
parameter.Value = (scope == PersonalizationScope.Shared);
parameters.AddWithValue("ApplicationName", ApplicationName);
parameter = parameters.Add(new SqlParameter("Count", SqlDbType.Int));
parameter.Direction = ParameterDirection.Output;
command.ExecuteNonQuery();
parameter = command.Parameters[2];
if (parameter != null && parameter.Value != null && parameter.Value is Int32) {
count = (Int32) parameter.Value;
}
}
finally {
if (connectionHolder != null) {
connectionHolder.Close();
connectionHolder = null;
}
}
}
catch {
throw;
}
return count;
}
示例10: ResetState
public override int ResetState(PersonalizationScope scope, string[] paths, string[] usernames)
{
return default(int);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:4,代码来源:System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.cs
示例11: GetCountOfState
public override int GetCountOfState(PersonalizationScope scope, PersonalizationStateQuery query) {
PersonalizationProviderHelper.CheckPersonalizationScope(scope);
if (scope == PersonalizationScope.Shared) {
string pathToMatch = null;
if (query != null) {
pathToMatch = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, maxStringLength);
}
return GetCountOfSharedState(pathToMatch);
}
else {
string pathToMatch = null;
DateTime userInactiveSinceDate = PersonalizationAdministration.DefaultInactiveSinceDate;
string usernameToMatch = null;
if (query != null) {
pathToMatch = StringUtil.CheckAndTrimString(query.PathToMatch, "query.PathToMatch", false, maxStringLength);
userInactiveSinceDate = query.UserInactiveSinceDate;
usernameToMatch = StringUtil.CheckAndTrimString(query.UsernameToMatch, "query.UsernameToMatch", false, maxStringLength);
}
return GetCountOfUserState(pathToMatch, userInactiveSinceDate, usernameToMatch);
}
}
示例12: FindState
public override PersonalizationStateInfoCollection FindState(PersonalizationScope scope, PersonalizationStateQuery query, int pageIndex, int pageSize, out int totalRecords)
{
totalRecords = default(int);
return default(PersonalizationStateInfoCollection);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:6,代码来源:System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.cs
示例13: GetCountOfState
public override int GetCountOfState(PersonalizationScope scope, PersonalizationStateQuery query)
{
return default(int);
}
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:4,代码来源:System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider.cs
示例14: GetPersonalizedProperties
/// <devdoc>
/// Does the work of retrieving personalized properties. If the scope is User, the shared
/// personalizable properties are not retrieved. If a non-null defaultPropertyState is
/// handed in, only the properties that are different from the default values are retrieved.
/// </devdoc>
private static IDictionary GetPersonalizedProperties(Control control,
IDictionary personalizableProperties,
IDictionary defaultPropertyState,
IDictionary initialPropertyState,
PersonalizationScope scope) {
Debug.Assert(control != null);
if (personalizableProperties.Count == 0) {
return null;
}
bool ignoreSharedProperties = (scope == PersonalizationScope.User);
IDictionary properties = null;
foreach (DictionaryEntry entry in personalizableProperties) {
PersonalizablePropertyEntry property = (PersonalizablePropertyEntry)entry.Value;
if (ignoreSharedProperties && (property.Scope == PersonalizationScope.Shared)) {
continue;
}
PropertyInfo pi = property.PropertyInfo;
Debug.Assert(pi != null);
//
string name = (string)entry.Key;
object value = FastPropertyAccessor.GetProperty(control, name, control.DesignMode);
bool saveProperty = true;
// Only compare to default value if there is no initial value.
if ((initialPropertyState == null || !initialPropertyState.Contains(name)) && defaultPropertyState != null) {
object defaultValue = defaultPropertyState[name];
if (Object.Equals(value, defaultValue)) {
saveProperty = false;
}
}
if (saveProperty) {
if (properties == null) {
properties = new HybridDictionary(personalizableProperties.Count, /* caseInsensitive */ false);
}
properties[name] = value;
}
}
return properties;
}
示例15: ResetState
public override int ResetState(PersonalizationScope scope, string[] paths, string[] usernames)
{
throw new NotImplementedException();
}