コード例 #1
0
        private IEnumerator <IAsyncResult> CreateTableContainerImpl(string tableName, DateTime?expiryTime, byte[] serviceMetadata, byte[] applicationMetadata, AsyncIteratorContext <ITableContainer> context)
        {
            IAsyncResult           asyncResult;
            IStringDataEventStream verboseDebug = Logger <IRestProtocolHeadLogger> .Instance.VerboseDebug;

            object[] objArray = new object[] { tableName, expiryTime, serviceMetadata, applicationMetadata, this.Timeout };
            verboseDebug.Log("CreateTableContainerImpl({0},{1},{2},{3},{4})", objArray);
            try
            {
                asyncResult = this.internalAccount.BeginCreateTableContainer(tableName, StorageStampHelpers.AdjustNullableDatetimeRange(expiryTime), serviceMetadata, applicationMetadata, context.GetResumeCallback(), context.GetResumeState("StorageAccount.CreateTableContainerImpl"));
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            yield return(asyncResult);

            try
            {
                ITableContainer tableContainer = this.internalAccount.EndCreateTableContainer(asyncResult);
                context.ResultData = new TableContainer(tableContainer);
            }
            catch (Exception exception1)
            {
                StorageStamp.TranslateException(exception1);
                throw;
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取某个表
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns>返回对应的表容器</returns>
        public T GetTable <T>() where T : class
        {
            ITableContainer container = null;

            _containers.TryGetValue(typeof(T).GetHashCode(), out container);
            return(container as T);
        }
コード例 #3
0
        public ITableContainer CreateTableContainerInstance(string accountName, string tableName)
        {
            ITableContainer operationStatus = this.sharedStorageManager.CreateTableContainerInstance(accountName, tableName);

            operationStatus.OperationStatus = this.OperationStatus;
            return(operationStatus);
        }
コード例 #4
0
 private void DeserialiseTables(ITableContainer database, XmlNodeList tableNodes)
 {
     foreach (XmlNode tableNode in tableNodes)
     {
         ITable table = ProcessTableNode(tableNode);
         database.AddTable(table);
     }
 }
コード例 #5
0
        public void AddInternalTables(ITableContainer container)
        {
            if (internalTables == null)
            {
                internalTables = new List <ITableContainer>();
            }

            internalTables.Add(container);
        }
コード例 #6
0
        protected IEnumerator <IAsyncResult> SetTableAclImpl(IAccountIdentifier identifier, string account, string tableName, ContainerAclSettings acl, TimeSpan timeout, RequestContext requestContext, AsyncIteratorContext <NoResults> context)
        {
            byte[]   numArray;
            Duration startingNow = Duration.StartingNow;

            if (identifier == null)
            {
                throw new ArgumentNullException("identifier");
            }
            if (string.IsNullOrEmpty(account))
            {
                throw new ArgumentException("account", "Cannot be null or empty");
            }
            if (string.IsNullOrEmpty(tableName))
            {
                throw new ArgumentException("tableName", "Cannot be null or empty");
            }
            if (acl == null)
            {
                throw new ArgumentNullException("acl");
            }
            if (acl.SASIdentifiers == null)
            {
                throw new ArgumentNullException("sasidentifiers");
            }
            if (timeout <= TimeSpan.Zero)
            {
                throw new TimeoutException("Timed out in SetTableAcl");
            }
            RemainingTime remainingTime = new RemainingTime(timeout);

            if (identifier is TableSignedAccessAccountIdentifier || identifier is AccountSasAccessIdentifier)
            {
                throw new NephosUnauthorizedAccessException("Signed access not supported for this request", AuthorizationFailureReason.InvalidOperationSAS);
            }
            IAsyncResult asyncResult = this.authorizationManager.BeginCheckAccess(identifier, account, tableName, null, PermissionLevel.WriteAcl, remainingTime, context.GetResumeCallback(), context.GetResumeState("TableManager.SetTableAclImpl"));

            yield return(asyncResult);

            this.authorizationManager.EndCheckAccess(asyncResult);
            using (IStorageAccount storageAccount = this.storageManager.CreateAccountInstance(account))
            {
                using (ITableContainer tableContainer = storageAccount.CreateTableContainerInstance(tableName))
                {
                    acl.EncodeToServiceMetadata(out numArray);
                    ContainerCondition containerCondition = null;
                    tableContainer.ServiceMetadata = numArray;
                    tableContainer.Timeout         = startingNow.Remaining(timeout);
                    asyncResult = tableContainer.BeginSetProperties(ContainerPropertyNames.ServiceMetadata, containerCondition, context.GetResumeCallback(), context.GetResumeState("TableManager.SetTableAclImpl"));
                    yield return(asyncResult);

                    tableContainer.EndSetProperties(asyncResult);
                }
            }
        }
コード例 #7
0
        protected IEnumerator <IAsyncResult> GetTableAclImpl(IAccountIdentifier identifier, string account, string tableName, TimeSpan timeout, RequestContext requestContext, AsyncIteratorContext <ContainerAclSettings> context)
        {
            Duration startingNow = Duration.StartingNow;

            if (identifier == null)
            {
                throw new ArgumentNullException("identifier");
            }
            if (string.IsNullOrEmpty(account))
            {
                throw new ArgumentException("account", "Cannot be null or empty");
            }
            if (string.IsNullOrEmpty(tableName))
            {
                throw new ArgumentException("tableName", "Cannot be null or empty");
            }
            if (timeout <= TimeSpan.Zero)
            {
                throw new TimeoutException("Timed out in GetTableAcl");
            }
            if (identifier is TableSignedAccessAccountIdentifier || identifier is AccountSasAccessIdentifier)
            {
                throw new NephosUnauthorizedAccessException("Signed access not supported for this request", AuthorizationFailureReason.InvalidOperationSAS);
            }
            IAsyncResult asyncResult = this.authorizationManager.BeginCheckAccess(identifier, account, tableName, null, PermissionLevel.ReadAcl, startingNow.Remaining(timeout), context.GetResumeCallback(), context.GetResumeState("TableManager.GetTableAclImpl"));

            yield return(asyncResult);

            this.authorizationManager.EndCheckAccess(asyncResult);
            string str  = account;
            string str1 = tableName;

            using (IStorageAccount storageAccount = this.storageManager.CreateAccountInstance(str))
            {
                using (ITableContainer tableContainer = storageAccount.CreateTableContainerInstance(str1))
                {
                    ContainerPropertyNames containerPropertyName = ContainerPropertyNames.LastModificationTime | ContainerPropertyNames.ServiceMetadata;
                    tableContainer.Timeout = startingNow.Remaining(timeout);
                    asyncResult            = tableContainer.BeginGetProperties(containerPropertyName, null, CacheRefreshOptions.SkipAllCache, context.GetResumeCallback(), context.GetResumeState("TableManager.GetTableAclImpl"));
                    yield return(asyncResult);

                    tableContainer.EndGetProperties(asyncResult);
                    try
                    {
                        context.ResultData = new ContainerAclSettings(tableContainer.ServiceMetadata);
                    }
                    catch (MetadataFormatException metadataFormatException1)
                    {
                        MetadataFormatException metadataFormatException = metadataFormatException1;
                        throw new NephosStorageDataCorruptionException(string.Format("Error decoding Acl setting for {0}", RealServiceManager.GetResourceString(account, tableName)), metadataFormatException);
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// 获取某个表的字段
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T GetField <T>(int id) where T : class
        {
            ITableContainer container = null;

            if (!_containers.TryGetValue(typeof(TableContainer <T>).GetHashCode(), out container))
            {
                return(null);
            }
            var table = container as TableContainer <T>;

            return(table != null?table.GetField(id) : null);
        }
コード例 #9
0
        protected override ITable AddItemInternal()
        {
            ITableContainer container = itemContainer as ITableContainer;

            if (container != null)
            {
                var table = new Table("NewTable");
                container.AddTable(table);
                return(table);
            }

            throw new InvalidOperationException("No Entity attached to TableCollectionPresenter");
        }
コード例 #10
0
        protected override void RemoveItemInternal(ITable obj)
        {
            ITableContainer container = itemContainer as ITableContainer;

            if (container != null)
            {
                container.RemoveTable(obj);
            }
            else
            {
                throw new InvalidOperationException("No Entity attached to TableCollectionPresenter");
            }
        }
コード例 #11
0
        protected override void SetItemsOnForm()
        {
            ITableContainer container = itemContainer as ITableContainer;

            if (container != null)
            {
                form.Items = container.Tables;
            }
            else
            {
                throw new InvalidOperationException("No Entity attached to TableCollectionPresenter");
            }
        }
コード例 #12
0
		public override ExporterCollection Convert (BaseReportItem parent,BaseReportItem item)
		{
			if (parent == null) {
				throw new ArgumentNullException("parent");
			}
			if (item == null) {
				throw new ArgumentNullException("item");
			}
			
			ExporterCollection mylist = base.Convert(parent,item);
			this.table = (BaseTableItem)item ;
			this.table.Parent = parent;
			return ConvertInternal(mylist);
		}
コード例 #13
0
        private void AddEntitiesAndRelationships(ITableContainer database)
        {
            foreach (var entity in database.Tables.OrderBy(t => t.Name))
            {
                controller.AddEntity(entity);
            }

            // Have to add all entities before adding relationships
            foreach (var entity in database.Tables.OrderBy(t => t.Name))
            {
                foreach (var rel in entity.Relationships.OrderBy(r => r.PrimaryTable.Name))
                {
                    controller.AddRelationship(rel);
                }
            }
        }
コード例 #14
0
        public override ExporterCollection Convert(BaseReportItem parent, BaseReportItem item)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            ExporterCollection mylist = base.Convert(parent, item);

            this.table        = (BaseTableItem)item;
            this.table.Parent = parent;
            return(ConvertInternal(mylist));
        }
コード例 #15
0
        public ITableContainer CreateTableContainerInstance(string tableName)
        {
            ITableContainer tableContainer;

            try
            {
                ITableContainer operationStatus = this.internalAccount.CreateTableContainerInstance(tableName);
                operationStatus.OperationStatus = this.OperationStatus;
                tableContainer = new TableContainer(operationStatus);
            }
            catch (Exception exception)
            {
                StorageStamp.TranslateException(exception);
                throw;
            }
            return(tableContainer);
        }
コード例 #16
0
        private IEnumerator <IAsyncResult> AuthenticateImpl(IStorageAccount storageAccount, RequestContext requestContext, NephosUriComponents uriComponents, AuthenticationManager.GetStringToSignCallback getStringToSignCallback, TimeSpan timeout, AsyncIteratorContext <IAuthenticationResult> context)
        {
            bool flag;
            bool flag1;
            SignedAccessHelper   accountSasHelper;
            IStorageAccount      operationStatus;
            ContainerAclSettings containerAclSetting;
            string              signedVersion   = null;
            Duration            startingNow     = Duration.StartingNow;
            NameValueCollection queryParameters = requestContext.QueryParameters;

            if (AuthenticationManager.IsInvalidAccess(requestContext))
            {
                throw new InvalidAuthenticationInfoException("Ambiguous authentication scheme credentials providedRequest contains authentication credentials for signed access and authenticated access");
            }
            bool flag2 = AuthenticationManager.IsAuthenticatedAccess(requestContext);
            bool flag3 = AuthenticationManager.IsSignatureAccess(requestContext);

            flag = (!flag2 ? false : AuthenticationManager.IsAuthenticatedAccess(requestContext, "SignedKey"));
            bool flag4 = flag;

            flag1 = (flag2 ? false : !flag3);
            if ((!flag2 || flag4) && !flag1)
            {
                NephosAssertionException.Assert((flag3 ? true : flag4));
                bool flag5 = (flag3 ? false : flag4);
                TableSignedAccessHelper tableSignedAccessHelper = null;
                if (!AuthenticationManager.IsAccountSasAccess(requestContext.QueryParameters))
                {
                    tableSignedAccessHelper = new TableSignedAccessHelper(requestContext, uriComponents);
                    accountSasHelper        = tableSignedAccessHelper;
                }
                else
                {
                    if (flag5)
                    {
                        throw new AuthenticationFailureException("SignedKey is not supported with account-level SAS.");
                    }
                    accountSasHelper = new AccountSasHelper(requestContext, uriComponents);
                }
                accountSasHelper.ParseAccessPolicyFields(flag5);
                accountSasHelper.PerformSignedAccessAuthenticationFirstPhaseValidations();
                AccountIdentifier tableSignedAccessAccountIdentifier = null;
                if (!flag5)
                {
                    byte[] sign = accountSasHelper.ComputeUrlDecodedUtf8EncodedStringToSign();
                    if (storageAccount == null || !string.Equals(storageAccount.Name, uriComponents.AccountName))
                    {
                        try
                        {
                            operationStatus = this.storageManager.CreateAccountInstance(uriComponents.AccountName);
                            if (requestContext != null)
                            {
                                operationStatus.OperationStatus = requestContext.OperationStatus;
                            }
                        }
                        catch (ArgumentOutOfRangeException argumentOutOfRangeException)
                        {
                            throw new AuthenticationFailureException(string.Format(CultureInfo.InvariantCulture, "The account name is invalid.", new object[0]));
                        }
                        operationStatus.Timeout = startingNow.Remaining(timeout);
                        IAsyncResult asyncResult = operationStatus.BeginGetProperties(AccountPropertyNames.All, null, context.GetResumeCallback(), context.GetResumeState("XFETableAuthenticationManager.AuthenticateImpl"));
                        yield return(asyncResult);

                        try
                        {
                            operationStatus.EndGetProperties(asyncResult);
                        }
                        catch (AccountNotFoundException accountNotFoundException1)
                        {
                            AccountNotFoundException accountNotFoundException = accountNotFoundException1;
                            CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                            object[]    name             = new object[] { operationStatus.Name };
                            throw new AuthenticationFailureException(string.Format(invariantCulture, "Cannot find the claimed account when trying to GetProperties for the account {0}.", name), accountNotFoundException);
                        }
                        catch (Exception exception1)
                        {
                            Exception exception            = exception1;
                            IStringDataEventStream warning = Logger <IRestProtocolHeadLogger> .Instance.Warning;
                            object[] objArray = new object[] { operationStatus.Name, exception };
                            warning.Log("Rethrow exception when trying to GetProperties for the account {0}: {1}", objArray);
                            throw;
                        }
                    }
                    else
                    {
                        operationStatus = storageAccount;
                    }
                    if (!accountSasHelper.ComputeSignatureAndCompare(sign, operationStatus.SecretKeysV3))
                    {
                        throw new AuthenticationFailureException(string.Concat("Signature did not match. String to sign used was ", (new UTF8Encoding()).GetString(sign)));
                    }
                    NephosAssertionException.Assert(accountSasHelper.KeyUsedForSigning != null, "Key used for signing cannot be null");
                    tableSignedAccessAccountIdentifier = accountSasHelper.CreateAccountIdentifier(operationStatus);
                    tableSignedAccessAccountIdentifier.Initialize(accountSasHelper);
                    if (storageAccount != operationStatus)
                    {
                        operationStatus.Dispose();
                    }
                }
                else
                {
                    IAsyncResult asyncResult1 = this.nephosAuthenticationManager.BeginAuthenticate(storageAccount, requestContext, uriComponents, getStringToSignCallback, startingNow.Remaining(timeout), context.GetResumeCallback(), context.GetResumeState("XFETableAuthenticationManager.AuthenticateImpl"));
                    yield return(asyncResult1);

                    IAuthenticationResult authenticationResult = this.nephosAuthenticationManager.EndAuthenticate(asyncResult1);
                    tableSignedAccessAccountIdentifier = new TableSignedAccessAccountIdentifier(authenticationResult.AccountIdentifier, tableSignedAccessHelper.TableName, tableSignedAccessHelper.StartingPartitionKey, tableSignedAccessHelper.StartingRowKey, tableSignedAccessHelper.EndingPartitionKey, tableSignedAccessHelper.EndingRowKey);
                    tableSignedAccessAccountIdentifier.Initialize(accountSasHelper);
                }
                signedVersion = accountSasHelper.SignedVersion;
                if (accountSasHelper.IsRevocableAccess)
                {
                    using (ITableContainer tableContainer = this.storageManager.CreateTableContainerInstance(uriComponents.AccountName, tableSignedAccessHelper.TableName))
                    {
                        if (requestContext != null)
                        {
                            tableContainer.OperationStatus = requestContext.OperationStatus;
                        }
                        ContainerPropertyNames containerPropertyName = ContainerPropertyNames.ServiceMetadata;
                        tableContainer.Timeout = startingNow.Remaining(timeout);
                        IAsyncResult asyncResult2 = tableContainer.BeginGetProperties(containerPropertyName, null, context.GetResumeCallback(), context.GetResumeState("XFETableAuthenticationManager.AuthenticateImpl"));
                        yield return(asyncResult2);

                        try
                        {
                            tableContainer.EndGetProperties(asyncResult2);
                        }
                        catch (Exception exception3)
                        {
                            Exception exception2 = exception3;
                            if (exception2 is ContainerNotFoundException)
                            {
                                throw new AuthenticationFailureException("Error locating SAS identifier", exception2);
                            }
                            IStringDataEventStream stringDataEventStream = Logger <IRestProtocolHeadLogger> .Instance.Warning;
                            object[] accountName = new object[] { uriComponents.AccountName, tableSignedAccessHelper.TableName, exception2 };
                            stringDataEventStream.Log("Rethrow exception when trying to fetch SAS identifier account {0} container {1} : {2}", accountName);
                            throw;
                        }
                        try
                        {
                            containerAclSetting = new ContainerAclSettings(tableContainer.ServiceMetadata);
                        }
                        catch (MetadataFormatException metadataFormatException1)
                        {
                            MetadataFormatException metadataFormatException = metadataFormatException1;
                            throw new NephosStorageDataCorruptionException(string.Format("Error decoding Acl setting for container {0}", tableSignedAccessHelper.TableName), metadataFormatException);
                        }
                    }
                    try
                    {
                        accountSasHelper.ValidateAndDeriveEffectiveAccessPolicy(accountSasHelper.LocateSasIdentifier(containerAclSetting.SASIdentifiers));
                        accountSasHelper.PerformSignedAccessAuthenticationSecondPhaseValidations();
                        tableSignedAccessAccountIdentifier.Initialize(accountSasHelper);
                        context.ResultData = new AuthenticationResult(tableSignedAccessAccountIdentifier, signedVersion, true);
                    }
                    catch (FormatException formatException)
                    {
                        throw new AuthenticationFailureException("Signature fields not well formed.", formatException);
                    }
                }
                else
                {
                    tableSignedAccessAccountIdentifier.Initialize(accountSasHelper);
                    context.ResultData = new AuthenticationResult(tableSignedAccessAccountIdentifier, signedVersion, true);
                }
            }
            else
            {
                IAsyncResult asyncResult3 = this.nephosAuthenticationManager.BeginAuthenticate(storageAccount, requestContext, uriComponents, getStringToSignCallback, startingNow.Remaining(timeout), context.GetResumeCallback(), context.GetResumeState("XFETableAuthenticationManager.AuthenticateImpl"));
                yield return(asyncResult3);

                context.ResultData = this.nephosAuthenticationManager.EndAuthenticate(asyncResult3);
            }
        }
コード例 #17
0
 private void DeserialiseTables(ITableContainer database, XmlNodeList tableNodes)
 {
     foreach (XmlNode tableNode in tableNodes)
     {
         ITable table = ProcessTableNode(tableNode);
         database.AddTable(table);
     }
 }
コード例 #18
0
		protected void RenderTable (BaseReportItem parent,ITableContainer tableContainer,ReportPageEventArgs rpea)
		{
			if (rpea == null) {
				throw new ArgumentNullException("rpea");
			}

			Point saveLocation = tableContainer.Location;
			
			Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.CurrentSection,tableContainer).Location.X,
			                                                                           this.CurrentSection.Location.Y);
			tableContainer.Items.SortByLocation();
			
			Size rs = Size.Empty;
			
			foreach (BaseRowItem row in tableContainer.Items)
			{
			
				if (row != null)
				{
					rs = row.Size;
					PrintHelper.AdjustParent(tableContainer,tableContainer.Items);
					
					if (PrintHelper.IsTextOnlyRow(row) )
					{
						
						LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics,base.Layout,row);
						
						Rectangle r =  StandardPrinter.RenderContainer(row,Evaluator,currentPosition,rpea);
						
						
						currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);
					
						tableContainer.Location = saveLocation;
					}
					else {
						int adjust = row.Location.Y - saveLocation.Y;
						row.Location = new Point(row.Location.X,row.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer);
						rs = row.Size;
						
						do {
							if (PrintHelper.IsPageFull(new Rectangle(currentPosition,row.Size),this.SectionBounds)) {
								tableContainer.Location = saveLocation;
								AbstractRenderer.PageBreak(rpea);
								return;
							}
							
							this.dataNavigator.Fill(row.Items);
							
							LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics,base.Layout,row);
							
							Rectangle r =  StandardPrinter.RenderContainer(row,Evaluator,currentPosition,rpea);
							
							currentPosition = PrintHelper.ConvertRectangleToCurentPosition (r);

							row.Size = rs;
						}
						while (this.dataNavigator.MoveNext());
						
					}
				}
				row.Size = rs;
			}
//			base.NotifyAfterPrint (rpea.LocationAfterDraw);
		}
コード例 #19
0
        public void AddInternalTables(ITableContainer container)
        {
            if (internalTables == null)
                internalTables = new List<ITableContainer>();

            internalTables.Add(container);
        }
コード例 #20
0
        private void AddEntitiesAndRelationships(ITableContainer database)
        {
            foreach (var entity in database.Tables.OrderBy(t => t.Name))
            {
                controller.AddEntity(entity);
            }

            // Have to add all entities before adding relationships
            foreach (var entity in database.Tables.OrderBy(t => t.Name))
            {
                foreach (var rel in entity.Relationships.OrderBy(r => r.PrimaryTable.Name))
                    controller.AddRelationship(rel);
            }
        }
コード例 #21
0
        protected void RenderTable(BaseReportItem parent, ITableContainer tableContainer, ReportPageEventArgs rpea)
        {
            if (rpea == null)
            {
                throw new ArgumentNullException("rpea");
            }

            Point saveLocation = tableContainer.Location;

            Point currentPosition = new Point(PrintHelper.DrawingAreaRelativeToParent(this.CurrentSection, tableContainer).Location.X,
                                              this.CurrentSection.Location.Y);

            tableContainer.Items.SortByLocation();

            Size rs = Size.Empty;

            foreach (BaseRowItem row in tableContainer.Items)
            {
                if (row != null)
                {
                    rs = row.Size;
                    PrintHelper.AdjustParent(tableContainer, tableContainer.Items);

                    if (PrintHelper.IsTextOnlyRow(row))
                    {
                        LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics, base.Layout, row);

                        Rectangle r = StandardPrinter.RenderContainer(row, Evaluator, currentPosition, rpea);


                        currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);

                        tableContainer.Location = saveLocation;
                    }
                    else
                    {
                        int adjust = row.Location.Y - saveLocation.Y;
                        row.Location = new Point(row.Location.X, row.Location.Y - adjust - 3 * GlobalValues.GapBetweenContainer);
                        rs           = row.Size;

                        do
                        {
                            if (PrintHelper.IsPageFull(new Rectangle(currentPosition, row.Size), this.SectionBounds))
                            {
                                tableContainer.Location = saveLocation;
                                AbstractRenderer.PageBreak(rpea);
                                return;
                            }

                            this.dataNavigator.Fill(row.Items);

                            LayoutHelper.SetLayoutForRow(rpea.PrintPageEventArgs.Graphics, base.Layout, row);

                            Rectangle r = StandardPrinter.RenderContainer(row, Evaluator, currentPosition, rpea);

                            currentPosition = PrintHelper.ConvertRectangleToCurentPosition(r);

                            row.Size = rs;
                        }while (this.dataNavigator.MoveNext());
                    }
                }
                row.Size = rs;
            }
//			base.NotifyAfterPrint (rpea.LocationAfterDraw);
        }
コード例 #22
0
 internal TableContainer(ITableContainer tableContainer) : base(tableContainer)
 {
 }
コード例 #23
0
        private void PrintDetailInternal(ReportPageEventArgs rpea, DataNavigator nav)
        {
            Rectangle sectionRect;

            base.PrintDetail(null, rpea);

            // no loop if there is no data
            if (!nav.HasMoreData)
            {
                rpea.PrintPageEventArgs.HasMorePages = false;
                return;
            }

            ITableContainer tableContainer = base.CurrentSection.Items[0] as ITableContainer;

            // branch to render table's etc
            if (tableContainer != null)
            {
                tableContainer.DataNavigator             = nav;
                tableContainer.Parent                    = base.CurrentSection;
                tableContainer.ExpressionEvaluatorFacade = base.ExpressionFassade;
                if (rpea.SinglePage.PageNumber == 1)
                {
                    tableContainer.StartLayoutAt(base.Sections[2]);
                }
                else
                {
                    tableContainer.StartLayoutAt(base.Sections[0]);
                }

                tableContainer.RenderTable(base.CurrentSection, this.SectionBounds, rpea, this.Layout);
                this.ReportDocument.DetailsDone = true;
            }

            else
            {
                // first element
                if (base.SinglePage.PageNumber == 1)
                {
                    this.dataNavigator.MoveNext();
                }

                do
                {
                    ISimpleContainer i = base.CurrentSection.Items[0] as ISimpleContainer;
                    if (i != null)
                    {
                        nav.Fill(i.Items);
                    }
                    else
                    {
                        nav.Fill(base.CurrentSection.Items);
                    }

                    sectionRect = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left,
                                                base.CurrentSection.SectionOffset,
                                                rpea.PrintPageEventArgs.MarginBounds.Width,
                                                base.CurrentSection.Size.Height);


                    if (PrintHelper.IsPageFull(sectionRect, base.SectionBounds))
                    {
                        AbstractRenderer.PageBreak(rpea);
                        this.RemoveSectionEvents();
                        return;
                    }

                    base.RenderItems(rpea);


                    if (nav.CurrentRow < nav.Count - 1)
                    {
                        if (base.CurrentSection.PageBreakAfter)
                        {
                            AbstractRenderer.PageBreak(rpea);
                            this.RemoveSectionEvents();

                            return;
                        }
                    }

                    Rectangle r = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left,
                                                base.CurrentSection.SectionOffset,
                                                rpea.PrintPageEventArgs.MarginBounds.Width,
                                                base.CurrentSection.Size.Height);


//					if (this.dataNavigator.CurrentRow % 2 == 0) {
//					PrintHelper.DebugRectangle(rpea.PrintPageEventArgs.Graphics,r);
//					}

                    base.CurrentSection.SectionOffset = r.Bottom;
                    rpea.LocationAfterDraw            = new Point(rpea.LocationAfterDraw.X,
                                                                  sectionRect.Bottom);

                    rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X,
                                                       r.Bottom);
                }while (nav.MoveNext());
                this.ReportDocument.DetailsDone = true;
            }

            rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, rpea.LocationAfterDraw.Y + 5);
            if (!PrintHelper.IsRoomForFooter(base.SectionBounds, rpea.LocationAfterDraw))
            {
                AbstractRenderer.PageBreak(rpea);
            }
        }
コード例 #24
0
        private void PrintDetailInternal(ReportPageEventArgs rpea, DataNavigator nav)
        {
            Rectangle sectionRect;

            base.PrintDetail(null, rpea);

            // no loop if there is no data
            if (!nav.HasMoreData)
            {
                rpea.PrintPageEventArgs.HasMorePages = false;
                return;
            }

            ITableContainer tableContainer = base.CurrentSection.Items[0] as ITableContainer;

            // branch to render table's etc
            if (tableContainer != null)
            {
                tableContainer.DataNavigator = nav;
                tableContainer.Parent        = base.CurrentSection;
                if (rpea.SinglePage.PageNumber == 1)
                {
                    tableContainer.StartLayoutAt(base.Sections[2]);
                }
                else
                {
                    tableContainer.StartLayoutAt(base.Sections[0]);
                }


                base.RenderTable(base.CurrentSection, tableContainer, rpea);

                this.ReportDocument.DetailsDone = true;
            }

            else
            {
                // first element
                if (base.SinglePage.PageNumber == 1)
                {
                    this.dataNavigator.MoveNext();
                }

                do
                {
                    ISimpleContainer simpleContainer = base.CurrentSection.Items[0] as ISimpleContainer;

                    if (simpleContainer != null)
                    {
                        nav.Fill(simpleContainer.Items);
                    }
                    else
                    {
                        nav.Fill(base.CurrentSection.Items);
                    }

                    sectionRect = new Rectangle(rpea.PrintPageEventArgs.MarginBounds.Left,
                                                base.CurrentSection.SectionOffset,
                                                rpea.PrintPageEventArgs.MarginBounds.Width,
                                                base.CurrentSection.Size.Height);


                    if (PrintHelper.IsPageFull(sectionRect, base.SectionBounds))
                    {
                        PerformPageBreak(rpea);
                        return;
                    }

                    Point currentPosition = base.RenderItems(rpea);


                    if (nav.CurrentRow < nav.Count - 1)
                    {
                        if (base.CurrentSection.PageBreakAfter)
                        {
                            PerformPageBreak(rpea);
                            return;
                        }
                    }

                    base.CurrentSection.SectionOffset = currentPosition.Y;

                    rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X,
                                                       currentPosition.Y);
                }while (nav.MoveNext());
                this.ReportDocument.DetailsDone = true;
            }

            rpea.LocationAfterDraw = new Point(rpea.LocationAfterDraw.X, rpea.LocationAfterDraw.Y + 5);
            if (!PrintHelper.IsRoomForFooter(base.SectionBounds, rpea.LocationAfterDraw))
            {
                AbstractRenderer.PageBreak(rpea);
            }
        }