コード例 #1
0
        public static void AssignOrders(List <RSSVWorkOrder> orders)
        {
            // The result set to run the report on.
            PXReportResultset assignedOrders = new PXReportResultset(typeof(RSSVWorkOrder));

            RSSVWorkOrderEntry graph = PXGraph.CreateInstance <RSSVWorkOrderEntry>();

            foreach (RSSVWorkOrder order in orders)
            {
                try
                {
                    //Change the assignee to the value selected on the form
                    order.Assignee = order.AssignTo;

                    graph.Clear();
                    graph.AssignOrder(order, true);

                    // Add to the result set the order that has been successfully assigned.
                    if (order.Status == WorkOrderStatusConstants.Assigned)
                    {
                        assignedOrders.Add(order);
                    }
                }
                catch (Exception e)
                {
                    PXProcessing <RSSVWorkOrder> .SetError(orders.IndexOf(order), e);
                }
            }

            if (assignedOrders.GetRowCount() > 0)
            {
                throw new PXReportRequiredException(assignedOrders, "RS601000", Messages.ReportRS601000Title);
            }
        }
        protected virtual void Report()
        {
            PXReportResultset reportData = new PXReportResultset(typeof(AppointmentData));

            foreach (AppointmentData row in RouteAppointmentGPSLocationRecords.Select())
            {
                reportData.Add(row);
            }

            throw new PXReportRequiredException(reportData, ID.ReportID.ROUTE_APP_GPS_LOCATION, PXBaseRedirectException.WindowMode.NewWindow, "Report");
        }