• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Csla类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Csla的典型用法代码示例。如果您正苦于以下问题:C# Csla类的具体用法?C# Csla怎么用?C# Csla使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Csla类属于命名空间,在下文中一共展示了Csla类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Execute

        protected override void Execute(Csla.Rules.AuthorizationContext context)
        {
            if (context.Target is User)
            {
                var businessIdentity = (IBusinessIdentity)Csla.ApplicationContext.User.Identity;

                if (businessIdentity.UserId == ((User)context.Target).UserId)
                {
                    context.HasPermission = true;

                    return;
                }
            }

            if (context.Target is UserPassword)
            {
                var identity = (IBusinessIdentity)Csla.ApplicationContext.User.Identity;

                if (identity.UserId == ((UserPassword)context.Target).UserId)
                {
                    context.HasPermission = true;

                    return;
                }
            }

            context.HasPermission = false;
        }
开发者ID:mattruma,项目名称:epiworx-csla,代码行数:28,代码来源:IsInUser.cs


示例2: PropertyHasChanged

        protected override void PropertyHasChanged(Csla.Core.IPropertyInfo property)
        {
            base.PropertyHasChanged(property);

            switch (property.Name)
            {
                case "AssignedTo":
                    this.OnAssignedToChanged();
                    break;
                case "CategoryId":
                    this.OnCategoryIdChanged();
                    break;
                case "EstimatedCompletedDate":
                    this.OnEstimatedCompletedDateChanged();
                    break;
                case "ProjectId":
                    this.OnProjectIdChanged();
                    break;
                case "StatusId":
                    this.OnStatusIdChanged();
                    break;
                default:
                    break;
            }
        }
开发者ID:WhiteIsland,项目名称:epiworx,代码行数:25,代码来源:Task.Methods.cs


示例3: DateTimeRequired

 public DateTimeRequired(Csla.Core.IPropertyInfo primaryProperty, DateTime minValue, DateTime maxValue)
     : base(primaryProperty)
 {
     this.MinValue = minValue.Date;
     this.MaxValue = maxValue.Date;
     this.InputProperties = new List<Csla.Core.IPropertyInfo> { primaryProperty };
 }
开发者ID:mattruma,项目名称:epiworx-csla,代码行数:7,代码来源:DateTimeRequired.cs


示例4: OnSetState

 protected override void OnSetState(Csla.Serialization.Mobile.SerializationInfo info, Csla.Core.StateMode mode)
 {
   base.OnSetState(info, mode);
   Name = info.GetValue<string>("SilverlightPrincipal.Criteria.Name");
   Password = info.GetValue<string>("SilverlightPrincipal.Criteria.Password");
   ProviderType = info.GetValue<string>("SilverlightPrincipal.Criteria.ProviderType");
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:7,代码来源:SilverlightPrincipal.cs


示例5: CorrectToIncrementSize

        /* This method rectifies to the closes possible muiltiplier */
        public static bool CorrectToIncrementSize(Csla.PropertyInfo<UnitValue> propertyName)
        {
            PropertyManager _propertyManager = PropertyManager.Instance;
            Factor propertyFactor = _propertyManager.GetFactor(propertyName);

            decimal[] increments = propertyFactor.IncrementSizes;
            if (increments.Length == 0) return false;

            decimal currentValue = _propertyManager.GetValue(propertyName);

            bool allowIncrementStepping = _propertyManager.GetFactor(propertyName).IncrementStepping;

            if (currentValue == 0) return false;

            decimal newValue = 0;
            List<int> foundIndices = new List<int>();

            if (!allowIncrementStepping)
                newValue = MathExt.GetNearestValueByIncrements(currentValue, increments.ToArray(), out foundIndices);
            else
                newValue = MathExt.GetNearestMultiplierByIncrements(currentValue, increments.ToArray(), out foundIndices);

            if ((double)newValue != (double)currentValue)
            {
                _propertyManager.SetValue(propertyName, newValue);
                return true;
            }

            return false;
        }
开发者ID:halcwb,项目名称:GenPres_Old,代码行数:31,代码来源:PropertyValueCorrect.cs


示例6: OnGetState

 protected override void OnGetState(Csla.Serialization.Mobile.SerializationInfo info, Csla.Core.StateMode mode)
 {
   info.AddValue("SilverlightPrincipal.Criteria.Name", Name);
   info.AddValue("SilverlightPrincipal.Criteria.Password", Password);
   info.AddValue("SilverlightPrincipal.Criteria.ProviderType", ProviderType);
   base.OnGetState(info, mode);
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:7,代码来源:SilverlightPrincipal.cs


示例7: Fetch

 public CustomIdentity Fetch(Csla.Security.UsernameCriteria criteria)
 {
   if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["CslaIsInRoleProvider"]))
     return DoFetch(criteria);
   else
     return PermissionFetch(criteria);
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:7,代码来源:CustomIdentityFactory.cs


示例8: PermissionFetch

 private CustomIdentity PermissionFetch(Csla.Security.UsernameCriteria criteria)
 {
   CustomIdentity obj;
   using (var ctx = Csla.Data.ObjectContextManager<SecurityEntities>.GetManager("SecurityEntities"))
   {
     var q = (from r in ctx.ObjectContext.Users
              where r.Username == criteria.Username
              select r).FirstOrDefault();
     if (q != null)
     {
       q.Roles.Load();
       var roles = new List<string>();
       var permissions = new List<string>();
       foreach (var r in q.Roles)
       {
         roles.Add(r.Name);
         r.Permissions.Load();
         foreach (var p in r.Permissions)
           if (!permissions.Contains(p.Name))
             permissions.Add(p.Name);
       }
       obj = new CustomIdentity(q.Username, roles, permissions);
     }
     else
     {
       obj = new CustomIdentity();
     }
   }
   return obj;
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:30,代码来源:CustomIdentityFactory.cs


示例9: OnSetState

 protected override void OnSetState(Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
 {
   _username = (string)info.Values["_username"].Value;
   _password = (string)info.Values["_password"].Value;
   _roles = (string)info.Values["_roles"].Value;
   base.OnSetState(info, mode);
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:7,代码来源:CredentialsCriteria.cs


示例10: MapBrokenRules

 public static void MapBrokenRules(ModelStateDictionary modelState, Csla.Core.BusinessBase businessObject)
 {
     foreach (var brokenRule in businessObject.BrokenRulesCollection)
     {
         modelState.AddModelError(brokenRule.Property, brokenRule.Description);
     }
 }
开发者ID:mattruma,项目名称:epiworx-csla,代码行数:7,代码来源:ModelHelper.cs


示例11: OnGetState

 protected override void OnGetState(Csla.Serialization.Mobile.SerializationInfo info, StateMode mode)
 {
   info.AddValue("_username", _username);
   info.AddValue("_password", _password);
   info.AddValue("_roles", _roles);
   base.OnGetState(info, mode);
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:7,代码来源:CredentialsCriteria.cs


示例12: Execute

        protected override void Execute(Csla.Rules.AuthorizationContext context)
        {
            if (context == null)
            {
                throw new ArgumentException("Context cannot be null.");
            }

            var entryType = context.Target as IHaveEntryType;
            context.HasPermission = false;

            if (entryType == null)
            {
                context.HasPermission = true;
            }
            else
            {
                if (entryType.EntryType == ActivityEntryType.Any)
                {
                    context.HasPermission = true;
                }
                else
                {
                    var role = entryType.EntryType.ToString();
                    if (entryType.EntryType != ActivityEntryType.Unset)
                    {
                        context.HasPermission = ApplicationContext.User.IsInRole(role);
                    }
                }
            }

            if (ApplicationContext.User.IsInRole(PermissionType.Administrator.ToString()))
            {
                context.HasPermission = true;
            }
        }
开发者ID:Bowman74,项目名称:Badge-Application,代码行数:35,代码来源:CanCreateSubmission.cs


示例13: UserDataSource_UpdateObject

    protected void UserDataSource_UpdateObject( object sender, Csla.Web.UpdateObjectArgs e )
    {
        User obj = GetUser( User.ID );
        Csla.Data.DataMapper.Map( e.Values, obj );

        e.RowsAffected = SaveDetails( obj );
    }
开发者ID:TertiumQuid,项目名称:Aphelion-Trigger,代码行数:7,代码来源:UserProfile.aspx.cs


示例14: SetPrincipal

 private static void SetPrincipal(Csla.Security.CslaIdentity identity)
 {
   if (identity != null && identity.IsAuthenticated)
     Csla.ApplicationContext.User = new SLPrincipal(identity);
   else
     Csla.ApplicationContext.User = new Csla.Security.UnauthenticatedPrincipal();
 }
开发者ID:nschonni,项目名称:csla-svn,代码行数:7,代码来源:SLPrincipal.cs


示例15: ContainsRule

 public static bool ContainsRule(Csla.Core.BusinessBase obj, DbType type, string propertyName)
 {
     switch (type)
     {
         case DbType.Int16:
         case DbType.Int32:
         case DbType.Int64:
             return obj.BrokenRulesCollection.Any(
                  brokenRule => brokenRule.RuleName == string.Format("rule://epiworx.core.validation.integerrequired/{0}", propertyName))
                     || obj.BrokenRulesCollection.Any(
                         brokenRule => brokenRule.RuleName == string.Format("rule://csla.rules.commonrules.dataannotation/{0}?a=Epiworx.Core.Validation.IntegerRequiredAttribute", propertyName));
         case DbType.Decimal:
             return obj.BrokenRulesCollection.Any(
                 brokenRule => brokenRule.RuleName == string.Format("rule://epiworx.core.validation.decimalrequired/{0}", propertyName));
         case DbType.Date:
             return obj.BrokenRulesCollection.Any(
               brokenRule => brokenRule.RuleName == string.Format("rule://epiworx.core.validation.daterequired/{0}", propertyName));
         case DbType.DateTime:
             return obj.BrokenRulesCollection.Any(
               brokenRule => brokenRule.RuleName == string.Format("rule://epiworx.core.validation.datetimerequired/{0}", propertyName));
         case DbType.String:
         case DbType.StringFixedLength:
             return obj.BrokenRulesCollection.Any(
              brokenRule => brokenRule.RuleName == string.Format("rule://epiworx.core.validation.stringrequired/{0}", propertyName));
         default:
             throw new NotSupportedException();
     }
 }
开发者ID:mattruma,项目名称:epiworx-csla,代码行数:28,代码来源:ValidationHelper.cs


示例16: DependencyFrom

 /// <summary>
 /// Creates an instance of the rule.
 /// </summary>
 /// <param name="primaryProperty">Primary property for the rule.</param>
 /// <param name="dependencyProperties">Dependent property.</param>
 /// <remarks>
 /// When rules are run for one of the dependency properties the rules for primary property i rerun.
 /// </remarks>
 public DependencyFrom(Csla.Core.IPropertyInfo primaryProperty, params Csla.Core.IPropertyInfo[] dependencyProperties)
   : base(primaryProperty)
 {
   if (InputProperties == null) 
     InputProperties = new List<IPropertyInfo>();
   InputProperties.AddRange(dependencyProperties);
 }
开发者ID:GavinHwa,项目名称:csla,代码行数:15,代码来源:DependencyFrom.cs


示例17: HtmlContentCache_FetchHtmlContentCompleted

 private void HtmlContentCache_FetchHtmlContentCompleted(object sender, Csla.DataPortalResult<HtmlContent> e)
 {
     if (e.Object.HtmlContentEnum != ContentEnum)
         return;
     DataContext = e.Object;
     Title = MetaDataHelper.CreateContentPageTitle(e.Object.Name);
 }
开发者ID:saggett,项目名称:ReligionsTree,代码行数:7,代码来源:HtmlContentPage.xaml.cs


示例18: ForumPostDataSource_SelectObject

    protected void ForumPostDataSource_SelectObject( object sender, Csla.Web.SelectObjectArgs e )
    {
        if (MainGrid.SelectedIndex < 0) return;
        int id = Convert.ToInt32( MainGrid.SelectedDataKey.Value );
        e.BusinessObject = GetForumPost( id );

        MainDetails.ChangeMode( DetailsViewMode.Edit );
    }
开发者ID:TertiumQuid,项目名称:Aphelion-Trigger,代码行数:8,代码来源:ForumTopic.aspx.cs


示例19: RichBrokenRule

 public RichBrokenRule(Csla.Core.BusinessBase businessBase, Csla.Rules.BrokenRule brokenRule)
 {
     BusinessObject = businessBase;
     Description = brokenRule.Description;
     Severity = brokenRule.Severity;
     Property = brokenRule.Property;
     RuleName = brokenRule.RuleName;
 }
开发者ID:LarryVon,项目名称:TestRepo,代码行数:8,代码来源:RichBrokenRule.cs


示例20: BusinessRule

 /// <summary>
 /// Creates an instance of the rule that applies
 /// to a specfic property.
 /// </summary>
 /// <param name="primaryProperty">Primary property for this rule.</param>
 protected BusinessRule(Csla.Core.IPropertyInfo primaryProperty)
 {
     AffectedProperties = new List<Core.IPropertyInfo>();
       InputProperties = new List<Core.IPropertyInfo>();
       PrimaryProperty = primaryProperty;
       this.RuleUri = new RuleUri(this, primaryProperty);
       RunMode = RunModes.Default;
 }
开发者ID:BiYiTuan,项目名称:csla,代码行数:13,代码来源:BusinessRule.cs



注:本文中的Csla类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CspProviderFlags类代码示例发布时间:2022-05-24
下一篇:
C# CsdlSemanticsSchema类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap