Beispiel #1
0
        public EntityCrosstabReportDTO ToEntityCrosstabReportDTO(DR_Requester requester, EntityCrosstabReport item, bool withDetails)
        {
            EntityCrosstabReportDTO result = new EntityCrosstabReportDTO();

            result.ID = item.ID;
            bizEntitySearchableReport.ToEntitySearchableReportDTO(item.EntitySearchableReport, result, withDetails);
            result.EntityListViewID = item.EntityListViewID;
            if (withDetails)
            {
                BizEntityListView bizEntityListView = new BizEntityListView();
                result.EntityListView = bizEntityListView.GetEntityListView(requester, item.EntityListViewID);
                if (result.EntityListView == null)
                {
                    throw new Exception("عدم دسترسی به لیست نمایش به شناسه" + " " + item.EntityListViewID);
                }
                BizEntityRelationshipTail bizEntityRelationshipTail = new MyModelManager.BizEntityRelationshipTail();
                foreach (var sub in item.CrosstabReportColumns)
                {
                    CrosstabReportColumnDTO rColumn = new CrosstabReportColumnDTO();
                    rColumn.ID = sub.ID;
                    rColumn.EntityListViewColumnID = sub.EntityListViewColumnsID;
                    rColumn.EntityListViewColumn   = result.EntityListView.EntityListViewAllColumns.FirstOrDefault(x => x.ID == sub.EntityListViewColumnsID);
                    if (rColumn.EntityListViewColumn == null)
                    {
                        throw new Exception("Crosstab report column" + " " + sub.ID + " " + "is not accessable!");
                    }
                    result.Columns.Add(rColumn);
                }
                foreach (var sub in item.CrosstabReportRows)
                {
                    CrosstabReportRowDTO rColumn = new CrosstabReportRowDTO();

                    rColumn.ID = sub.ID;
                    rColumn.EntityListViewColumnID = sub.EntityListViewColumnsID;
                    rColumn.EntityListViewColumn   = result.EntityListView.EntityListViewAllColumns.FirstOrDefault(x => x.ID == sub.EntityListViewColumnsID);
                    if (rColumn.EntityListViewColumn == null)
                    {
                        throw new Exception("Crosstab report row" + " " + sub.ID + " " + "is not accessable!");
                    }
                    result.Rows.Add(rColumn);
                }
                foreach (var sub in item.CrosstabReportValues)
                {
                    CrosstabReportValueDTO rColumn = new CrosstabReportValueDTO();

                    rColumn.ID = sub.ID;
                    rColumn.EntityListViewColumnID = sub.EntityListViewColumnsID;
                    rColumn.EntityListViewColumn   = result.EntityListView.EntityListViewAllColumns.First(x => x.ID == sub.EntityListViewColumnsID);
                    if (rColumn.EntityListViewColumn == null)
                    {
                        throw new Exception("Crosstab report value" + " " + sub.ID + " " + "is not accessable!");
                    }
                    rColumn.ValueFunction = (ChartReportValueFunction)sub.FunctoinType;

                    result.Values.Add(rColumn);
                }
            }

            return(result);
        }
        private TableGroup SetColumn(Crosstab crosstab, CrosstabReportValueDTO val)
        {
            TableGroup tableGroup = new TableGroup();
            var        textbox    = new TextBox();

            textbox.Value         = val.EntityListViewColumn.Alias;
            tableGroup.ReportItem = textbox;
            crosstab.Items.Add(textbox);
            return(tableGroup);
        }
        private TableGroup SetTotalColumn(Crosstab crosstab, CrosstabReportValueDTO val, CrosstabReportColumnDTO item1, int colindex, CrosstabReportColumnDTO nextColumn, CrosstabReportColumnDTO prevColumn)
        {
            TableGroup tableGroup = new TableGroup();
            var        textbox    = new TextBox();

            if (prevColumn == null)
            {
                textbox.Value = val.EntityListViewColumn.Alias;
            }
            tableGroup.ReportItem = textbox;
            crosstab.Items.Add(textbox);
            return(tableGroup);
        }