示例#1
0
文件: Domain.cs 项目: teize001/Crema
        public void InvokeUserAdded(Authentication authentication, DomainUserInfo domainUserInfo, DomainUserState domainUserState)
        {
            this.dispatcher.VerifyAccess();

            var domainUser = new DomainUser(this, domainUserInfo, domainUserState);

            this.users.Add(domainUser);
            if (domainUser.IsOwner == true)
            {
                this.users.Owner = domainUser;
            }
            this.OnUserAdded(new DomainUserEventArgs(authentication, this, domainUser));
            this.Container.InvokeDomainUserAddedEvent(authentication, this, domainUser);
        }
示例#2
0
 protected override void OnRemoveRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
 {
     foreach (var item in rows.Reverse())
     {
         var view = this.views[item.TableName];
         if (DomainRowInfo.ClearKey.SequenceEqual(item.Keys) == true)
         {
             view.Table.Clear();
         }
         else
         {
             CremaDomainUtility.Delete(view, item.Keys);
         }
         this.tables[view].ContentsInfo = signatureDate;
     }
     this.dataSet.AcceptChanges();
 }
示例#3
0
 protected override void OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
 {
     this.dataType.BeginLoadData();
     try
     {
         foreach (var item in rows)
         {
             CremaDomainUtility.SetFieldsForce(this.view, item.Keys, item.Fields);
         }
     }
     finally
     {
         this.dataType.EndLoadData();
     }
     this.dataType.ModificationInfo = signatureDate;
     this.dataType.AcceptChanges();
 }
示例#4
0
 protected override void OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
 {
     this.dataSet.BeginLoad();
     try
     {
         foreach (var item in rows)
         {
             var view = this.views[item.TableName];
             CremaDomainUtility.SetFieldsForce(view, item.Keys, item.Fields);
             this.tables[view].ContentsInfo = signatureDate;
         }
     }
     finally
     {
         this.dataSet.EndLoad();
     }
     this.dataSet.AcceptChanges();
 }
示例#5
0
        protected override void OnRemoveRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataType.SignatureDateProvider = signatureProvider;

            try
            {
                foreach (var item in rows)
                {
                    CremaDomainUtility.Delete(this.view, item.Keys);
                }

                this.dataType.AcceptChanges();
            }
            catch (Exception e)
            {
                this.dataType.RejectChanges();
                throw e;
            }
        }
示例#6
0
        protected override DomainRowInfo[] OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataType.SignatureDateProvider = signatureProvider;

            try
            {
                for (int i = 0; i < rows.Length; i++)
                {
                    rows[i].Fields = CremaDomainUtility.SetFields(this.view, rows[i].Keys, rows[i].Fields);
                }

                this.dataType.AcceptChanges();

                return(rows);
            }
            catch (Exception e)
            {
                this.dataType.RejectChanges();
                throw e;
            }
        }
示例#7
0
        protected override DomainRowInfo[] OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataSet.SignatureDateProvider = signatureProvider;

            try
            {
                for (var i = 0; i < rows.Length; i++)
                {
                    var view = this.views[rows[i].TableName];
                    rows[i].Fields = CremaDomainUtility.SetFields(view, rows[i].Keys, rows[i].Fields);
                }

                this.dataSet.AcceptChanges();
                return(rows);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                this.dataSet.RejectChanges();
                throw e;
            }
        }
示例#8
0
        protected override DomainRowInfo[] OnNewRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
        {
            this.dataType.SignatureDateProvider = signatureProvider;

            try
            {
                for (int i = 0; i < rows.Length; i++)
                {
                    var rowView = CremaDomainUtility.AddNew(this.view, rows[i].Fields);
                    rows[i].Keys   = CremaDomainUtility.GetKeys(rowView);
                    rows[i].Fields = CremaDomainUtility.GetFields(rowView);
                }
                this.dataType.AcceptChanges();

                return(rows);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                this.dataType.RejectChanges();
                throw e;
            }
        }
示例#9
0
 protected override void OnSetProperty(DomainUser domainUser, string propertyName, object value, SignatureDateProvider signatureProvider)
 {
     if (propertyName == "TableName")
     {
         if (this.IsNew == false)
         {
             throw new InvalidOperationException(Resources.Exception_CannotRename);
         }
         this.template.TableName = (string)value;
     }
     else if (propertyName == "Comment")
     {
         this.template.Comment = (string)value;
     }
     else if (propertyName == "Tags")
     {
         this.template.Tags = (TagInfo)((string)value);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
示例#10
0
 protected override void OnSetProperty(DomainUser domainUser, string propertyName, object value, SignatureDateProvider signatureProvider)
 {
     if (propertyName == "TableName")
     {
         if (this.IsNew == false)
         {
             throw new CremaException("테이블 이름은 변경할 수 없습니다.");
         }
         this.template.TableName = (string)value;
     }
     else if (propertyName == "Comment")
     {
         this.template.Comment = (string)value;
     }
     else if (propertyName == "Tags")
     {
         this.template.Tags = (TagInfo)((string)value);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
示例#11
0
 protected virtual void OnRemoveRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
 {
 }
示例#12
0
 protected virtual DomainRowInfo[] OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDateProvider signatureProvider)
 {
     return(rows);
 }
示例#13
0
 private void InvokeAddUser(Authentication authentication, DomainAccessType accessType, out DomainUser domainUser)
 {
     domainUser = new DomainUser(this, authentication.ID, authentication.Name, accessType)
     {
         IsOnline = authentication.Types.HasFlag(AuthenticationType.User),
     };
     domainUser.Authentication = authentication;
     authentication.Expired   += Authentication_Expired;
 }
示例#14
0
 private void InvokeKick(Authentication authentication, string userID, string comment, out DomainUser domainUser, out RemoveInfo removeInfo)
 {
     removeInfo = new RemoveInfo(RemoveReason.Kick, comment);
     domainUser = this.users[userID];
 }
示例#15
0
 private void InvokeBeginUserEdit(Authentication authentication, DomainLocationInfo location, out DomainUser domainUser)
 {
     domainUser = this.GetDomainUser(authentication);
     this.OnBeginUserEdit(domainUser, location);
     domainUser.Location      = location;
     domainUser.IsBeingEdited = true;
 }
示例#16
0
 protected virtual void OnBeginUserEdit(DomainUser domainUser, DomainLocationInfo location)
 {
 }
示例#17
0
        public void InvokeDomainUserRemovedEvent(Authentication authentication, Domain domain, DomainUser domainUser, RemoveInfo removeInfo)
        {
            var args     = new DomainUserRemovedEventArgs(authentication, domain, domainUser, removeInfo);
            var eventLog = EventLogBuilder.Build(authentication, this, nameof(InvokeDomainUserRemovedEvent), domain, domainUser, removeInfo.Reason, removeInfo.Message);
            var comment  = removeInfo.Reason == RemoveReason.Kick
                ? EventMessageBuilder.KickDomainUser(authentication, domain, domainUser)
                : EventMessageBuilder.LeaveDomainUser(authentication, domain);

            this.Dispatcher.InvokeAsync(() =>
            {
                this.CremaHost.Debug(eventLog);
                this.CremaHost.Info(comment);
                this.OnDomainUserRemoved(args);
            });
        }
示例#18
0
        public void InvokeDomainUserAddedEvent(Authentication authentication, Domain domain, DomainUser domainUser)
        {
            var args     = new DomainUserEventArgs(authentication, domain, domainUser);
            var eventLog = EventLogBuilder.Build(authentication, this, nameof(InvokeDomainUserAddedEvent), domain, domainUser);
            var comment  = EventMessageBuilder.EnterDomainUser(authentication, domain);

            this.Dispatcher.InvokeAsync(() =>
            {
                this.CremaHost.Debug(eventLog);
                this.CremaHost.Info(comment);
                this.OnDomainUserAdded(args);
            });
        }
示例#19
0
 protected virtual void OnSetProperty(DomainUser domainUser, string propertyName, object value, SignatureDateProvider signatureProvider)
 {
 }
示例#20
0
 protected virtual void OnSetLocation(DomainUser domainUser, DomainLocationInfo location)
 {
 }
示例#21
0
        public void InvokeDomainUserChangedEvent(Authentication authentication, Domain domain, DomainUser domainUser)
        {
            var args = new DomainUserEventArgs(authentication, domain, domainUser);

            this.Dispatcher.InvokeAsync(() =>
            {
                this.OnDomainUserChanged(args);
            });
        }
示例#22
0
 protected virtual void OnEndUserEdit(DomainUser domainUser)
 {
 }
示例#23
0
 private void InvokeKick(Authentication authentication, string userID, string comment, out DomainUser domainUser, out RemoveInfo removeInfo)
 {
     removeInfo = new RemoveInfo(RemoveReason.Kick, comment);
     domainUser = this.users[userID];
     if (domainUser.Authentication != null)
     {
         domainUser.Authentication.Expired -= Authentication_Expired;
         domainUser.Authentication          = null;
     }
 }
示例#24
0
 private void InvokeEndUserEdit(Authentication authentication, out DomainUser domainUser)
 {
     domainUser = this.GetDomainUser(authentication);
     this.OnEndUserEdit(domainUser);
     domainUser.IsBeingEdited = false;
 }
示例#25
0
 private void InvokeSetOwner(Authentication authentication, string userID, out DomainUser oldOwner, out DomainUser newOwner)
 {
     oldOwner = this.users.Owner;
     newOwner = this.users[userID];
 }
示例#26
0
 private void InvokeSetUserLocation(Authentication authentication, DomainLocationInfo location, out DomainUser domainUser)
 {
     domainUser = this.GetDomainUser(authentication);
     this.OnSetLocation(domainUser, location);
     domainUser.Location = location;
 }
示例#27
0
        protected virtual void OnSetRow(DomainUser domainUser, DomainRowInfo[] rows, SignatureDate signatureDate)
        {

        }