示例#1
0
        public async Task EndNewAsync(Authentication authentication, TypeMember member)
        {
            try
            {
                if (authentication is null)
                {
                    throw new ArgumentNullException(nameof(authentication));
                }
                if (authentication.IsExpired == true)
                {
                    throw new AuthenticationExpiredException(nameof(authentication));
                }
                if (member is null)
                {
                    throw new ArgumentNullException(nameof(member));
                }

                this.ValidateExpired();
                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.CremaHost.DebugMethod(authentication, this, nameof(EndNewAsync));
                });

                await member.EndNewAsync(authentication);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                throw;
            }
        }
示例#2
0
        public async Task <TypeMember> AddNewAsync(Authentication authentication)
        {
            try
            {
                if (authentication is null)
                {
                    throw new ArgumentNullException(nameof(authentication));
                }
                if (authentication.IsExpired == true)
                {
                    throw new AuthenticationExpiredException(nameof(authentication));
                }

                this.ValidateExpired();
                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.CremaHost.DebugMethod(authentication, this, nameof(AddNewAsync));
                    this.ValidateAddNew(authentication);
                });

                var member = await TypeMember.CreateAsync(authentication, this, this.TypeSource.View.Table);

                return(member);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                throw;
            }
        }
示例#3
0
        public static async Task <TypeMember> CreateAsync(Authentication authentication, TypeTemplateBase template, DataTable table)
        {
            var domain = template.Domain;
            var tuple  = await domain.DataDispatcher.InvokeAsync(() =>
            {
                var member = new TypeMember(template, table);
                var query  = from DataRow item in table.Rows
                             select item.Field <string>(CremaSchema.Name);

                var newName = NameUtility.GenerateNewName("Member", query);
                return(member, newName);
            });

            await tuple.member.SetFieldAsync(authentication, CremaSchema.Name, tuple.newName);

            return(tuple.member);
        }
示例#4
0
        public async Task EndNewAsync(Authentication authentication, TypeMember member)
        {
            try
            {
                this.ValidateExpired();
                await this.Dispatcher.InvokeAsync(() =>
                {
                    this.CremaHost.DebugMethod(authentication, this, nameof(EndNewAsync));
                });

                await member.EndNewAsync(authentication);
            }
            catch (Exception e)
            {
                this.CremaHost.Error(e);
                throw;
            }
        }