public OrderMgmtHeaderVirtualTable(EBSVirtualReportTablesPackage package, ref IList<IReportTable> reportTables)
            : base(package)
        {
            this.Name = "OrderMgmtHeaderValTable";
            this.Label = "EBS Order Mgmt Header Value Table";
            this.Description = "EBS Order Mgmt Header Value Table";

            // from generated proxy HEADER_VAL_REC
            APPSOE_ORDER_PUB_HX219471X29X254 orderHeader = new APPSOE_ORDER_PUB_HX219471X29X254();
            addColumns(orderHeader.GetType());

            //HEADER_VAL_REC has no ID, add one for report linking
            this.Columns.Add(new ReportColumn()
            {
                DataType = ReportColumnType.Integer,
                Label = "ID",
                Name = "ID",
                CanDisplay = true,
                CanFilter = true
            });

            OutputParameters2 order = new OutputParameters2();
            // add the order child tables         
            foreach (PropertyInfo propertyInfo in order.GetType().GetProperties())
            {
                if (propertyInfo.PropertyType.IsArray)
                {
                    OrderMgmtGenericChildTable newTable = new OrderMgmtGenericChildTable(package, propertyInfo);
                    reportTables.Add(newTable);
                }
            }
        }
Ejemplo n.º 2
0
        public OrderMgmtHeaderVirtualTable(EBSVirtualReportTablesPackage package, ref IList <IReportTable> reportTables)
            : base(package)
        {
            this.Name        = "OrderMgmtHeaderValTable";
            this.Label       = "EBS Order Mgmt Header Value Table";
            this.Description = "EBS Order Mgmt Header Value Table";

            // from generated proxy HEADER_VAL_REC
            APPSOE_ORDER_PUB_HX219471X29X254 orderHeader = new APPSOE_ORDER_PUB_HX219471X29X254();

            addColumns(orderHeader.GetType());

            //HEADER_VAL_REC has no ID, add one for report linking
            this.Columns.Add(new ReportColumn()
            {
                DataType   = ReportColumnType.Integer,
                Label      = "ID",
                Name       = "ID",
                CanDisplay = true,
                CanFilter  = true
            });

            OutputParameters2 order = new OutputParameters2();

            // add the order child tables
            foreach (PropertyInfo propertyInfo in order.GetType().GetProperties())
            {
                if (propertyInfo.PropertyType.IsArray)
                {
                    OrderMgmtGenericChildTable newTable = new OrderMgmtGenericChildTable(package, propertyInfo);
                    reportTables.Add(newTable);
                }
            }
        }
Ejemplo n.º 3
0
        public Order(OutputParameters2 order)
        {
            Items = new List <OrderItem>();
            var keys = order.X_LINE_TBL;
            var vals = order.X_LINE_VAL_TBL;

            for (int i = 0; i < keys.Length && i < vals.Length; i++)
            {
                Items.Add(new OrderItem(keys[i], vals[i]));
            }
        }
        public override IList<IReportRow> GetRows(IList<string> columns, IReportFilterNode filterNode)
        {
            IList<IReportRow> reportRows = new List<IReportRow>();

            if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null)
                return reportRows;

            IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace;

            int orderID = 0, incidentID = 0;

            if (_context == null)
            {
                // filter is ID
                if (filterNode != null && filterNode.FilterNodes != null)
                {
                    IReportFilterNode IDFilterNode = filterNode.FilterNodes.ToList<IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ID", this.Parent.Name, this.Name));

                    if (IDFilterNode != null)
                        orderID = Convert.ToInt32(IDFilterNode.ReportFilter.Value);
                }

            }
            else
            {
                IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident;
                orderID = getEbsOrderIdCustomAttr(incidentRecord);               
                incidentID = incidentRecord.ID;
            }

            if (orderID == 0)
                return reportRows;

            OutputParameters2 op = null;

            op = Order.LookupOrder(orderID, incidentID, 0);
            _orderCompleteOutput = op;
            ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count);
            foreach (string column in columns)
            {
                ReportDataCell reportDataCell = new ReportDataCell();
                // put the "SRData$SRDetailTable." package name back
                string pkgNtblName = "SRData$" + this.Name + ".";
                string removePkgTblName = column.Replace(pkgNtblName, "");

                if (removePkgTblName == "ID")
                {
                    reportDataCell.GenericValue = orderID;
                }
                else
                {
                    string type = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.Name;
                    object propVal = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).GetValue(op.X_HEADER_VAL_REC, null);

                    if (propVal == null)
                        reportDataCell.GenericValue = null;
                    else if (type == "Nullable`1" &&
                       op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal")
                        reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0
                    else
                        reportDataCell.GenericValue = propVal;
                }

                reportDataRow.Cells.Add(reportDataCell);
            }
            reportRows.Add(reportDataRow);
            return reportRows;
        }
Ejemplo n.º 5
0
        public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode)
        {
            IList <IReportRow> reportRows = new List <IReportRow>();
            OutputParameters2  op         = OrderMgmtHeaderVirtualTable._orderCompleteOutput;

            /* get the table name based on the filter
             * filter is "{0}${1}.HEADER_ID"
             * {1} == this.Name (the child table name)
             */
            string headerId = null;

            if (filterNode != null && filterNode.FilterNodes != null)
            {
                IReportFilterNode headerIdFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(
                    fn => fn.ReportFilter.Expression == string.Format("{0}${1}.HEADER_ID", this.Parent.Name, this.Name));

                if (headerIdFilterNode != null)
                {
                    headerId = headerIdFilterNode.ReportFilter.Value;
                }
            }
            if (headerId == "" || headerId == null)
            {
                return(reportRows);
            }

            int headerIdInt = Convert.ToInt32(headerId);

            // call the ws if the header is not the same
            if (op == null || (op != null && op.X_HEADER_REC.HEADER_ID != headerIdInt))
            {
                op = Order.LookupOrder(headerIdInt, 0, 0);
            }

            // get the table array
            object[] obj = (object[])op.GetType().GetProperty(this.Name).GetValue(op, null);
            foreach (object orderChild in obj)
            {
                ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count);
                foreach (string column in columns)
                {
                    ReportDataCell reportDataCell = new ReportDataCell();
                    // put the "SRData$SRDetailTable." package name back, that's required by the report framework
                    string pkgNtblName      = "SRData$" + this.Name + ".";
                    string removePkgTblName = column.Replace(pkgNtblName, "");

                    if (removePkgTblName == "HEADER_ID")
                    {
                        reportDataCell.GenericValue = headerIdInt;
                    }
                    else
                    {
                        string type    = orderChild.GetType().GetProperty(removePkgTblName).PropertyType.Name;
                        object propVal = orderChild.GetType().GetProperty(removePkgTblName).GetValue(orderChild, null);

                        if (propVal == null)
                        {
                            reportDataCell.GenericValue = null;
                        }
                        else if (type == "Nullable`1" &&
                                 orderChild.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal")
                        {
                            reportDataCell.GenericValue = Convert.ToInt32(propVal);     // need to convert, otherwise show up as 0
                        }
                        else
                        {
                            reportDataCell.GenericValue = propVal;
                        }
                    }
                    reportDataRow.Cells.Add(reportDataCell);
                }
                reportRows.Add(reportDataRow);
            }
            return(reportRows);
        }
Ejemplo n.º 6
0
        public override IList <IReportRow> GetRows(IList <string> columns, IReportFilterNode filterNode)
        {
            IList <IReportRow> reportRows = new List <IReportRow>();

            if (((EBSVirtualReportTablesPackage)this.Parent)._globalContext == null)
            {
                return(reportRows);
            }

            IRecordContext _context = ((EBSVirtualReportTablesPackage)this.Parent)._globalContext.AutomationContext.CurrentWorkspace;

            int orderID = 0, incidentID = 0;

            if (_context == null)
            {
                // filter is ID
                if (filterNode != null && filterNode.FilterNodes != null)
                {
                    IReportFilterNode IDFilterNode = filterNode.FilterNodes.ToList <IReportFilterNode>().Find(fn => fn.ReportFilter.Expression == string.Format("{0}${1}.ID", this.Parent.Name, this.Name));

                    if (IDFilterNode != null)
                    {
                        orderID = Convert.ToInt32(IDFilterNode.ReportFilter.Value);
                    }
                }
            }
            else
            {
                IIncident incidentRecord = _context.GetWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Incident) as IIncident;
                orderID    = getEbsOrderIdCustomAttr(incidentRecord);
                incidentID = incidentRecord.ID;
            }

            if (orderID == 0)
            {
                return(reportRows);
            }

            OutputParameters2 op = null;

            op = Order.LookupOrder(orderID, incidentID, 0);
            _orderCompleteOutput = op;
            ReportDataRow reportDataRow = new ReportDataRow(this.Columns.Count);

            foreach (string column in columns)
            {
                ReportDataCell reportDataCell = new ReportDataCell();
                // put the "SRData$SRDetailTable." package name back
                string pkgNtblName      = "SRData$" + this.Name + ".";
                string removePkgTblName = column.Replace(pkgNtblName, "");

                if (removePkgTblName == "ID")
                {
                    reportDataCell.GenericValue = orderID;
                }
                else
                {
                    string type    = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.Name;
                    object propVal = op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).GetValue(op.X_HEADER_VAL_REC, null);

                    if (propVal == null)
                    {
                        reportDataCell.GenericValue = null;
                    }
                    else if (type == "Nullable`1" &&
                             op.X_HEADER_VAL_REC.GetType().GetProperty(removePkgTblName).PropertyType.GetGenericArguments()[0].ToString() == "System.Decimal")
                    {
                        reportDataCell.GenericValue = Convert.ToInt32(propVal); // need to convert, otherwise show up as 0
                    }
                    else
                    {
                        reportDataCell.GenericValue = propVal;
                    }
                }

                reportDataRow.Cells.Add(reportDataCell);
            }
            reportRows.Add(reportDataRow);
            return(reportRows);
        }
Ejemplo n.º 7
0
 public Order(OutputParameters2 order)
 {
     Items = new List<OrderItem>();
     var keys = order.X_LINE_TBL;
     var vals = order.X_LINE_VAL_TBL;
     for (int i = 0; i < keys.Length && i < vals.Length; i++)
     {
         Items.Add(new OrderItem(keys[i], vals[i]));
     }
 }