Exemplo n.º 1
0
        public static void InsertFSSODetFromOpportunity(ServiceOrderEntry graphServiceOrder,
                                                        PXCache cacheOpportunityProducts,
                                                        CRSetup crSetupRow,
                                                        CROpportunityProducts crOpportunityProductRow,
                                                        FSxCROpportunityProducts fsxCROpportunityProductsRow,
                                                        InventoryItem inventoryItemRow)
        {
            if (graphServiceOrder == null ||
                crOpportunityProductRow == null ||
                fsxCROpportunityProductsRow == null ||
                inventoryItemRow == null)
            {
                return;
            }

            //Insert a new SODet line
            FSSODet fsSODetRow = new FSSODet();

            UpdateFSSODetFromOpportunity(graphServiceOrder.ServiceOrderDetails.Cache,
                                         fsSODetRow,
                                         crOpportunityProductRow,
                                         fsxCROpportunityProductsRow,
                                         SharedFunctions.GetLineTypeFromInventoryItem(inventoryItemRow));

            SharedFunctions.CopyNotesAndFiles(cacheOpportunityProducts,
                                              graphServiceOrder.ServiceOrderDetails.Cache,
                                              crOpportunityProductRow, graphServiceOrder.ServiceOrderDetails.Current,
                                              crSetupRow.CopyNotes,
                                              crSetupRow.CopyFiles);
        }
        private void UpdateSODetServiceRow(
            ServiceOrderEntry graphServiceOrder,
            FSSODetService fsSODetServiceRow,
            PMTimeActivity pmTimeActivity,
            FSxPMTimeActivity fsxPMTimeActivity)
        {
            //TODO SD-7788
            //**************************************************************
            // Update all FSSODetService fields but key fields *************
            //**************************************************************
            if (fsSODetServiceRow.LineType != ID.LineType_ServiceTemplate.SERVICE)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.lineType>(fsSODetServiceRow, ID.LineType_ServiceTemplate.SERVICE);
            }

            if (fsSODetServiceRow.InventoryID != fsxPMTimeActivity.ServiceID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.inventoryID>(fsSODetServiceRow, fsxPMTimeActivity.ServiceID);
            }

            if (fsSODetServiceRow.ProjectID != pmTimeActivity.ProjectID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.projectID>(fsSODetServiceRow, pmTimeActivity.ProjectID);
            }

            if (fsSODetServiceRow.ProjectTaskID != pmTimeActivity.ProjectTaskID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.projectTaskID>(fsSODetServiceRow, pmTimeActivity.ProjectTaskID);
            }

            if (fsSODetServiceRow.CostCodeID != pmTimeActivity.CostCodeID)
            {
                graphServiceOrder.ServiceOrderDetServices.SetValueExt <FSSODetService.costCodeID>(fsSODetServiceRow, pmTimeActivity.CostCodeID);
            }
        }
Exemplo n.º 3
0
        private void CreateServiceOrderDocument(CRCaseMaint graphCRCaseMaint, CRCase crCaseRow, FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow)
        {
            if (graphCRCaseMaint == null ||
                crCaseRow == null ||
                fsCreateServiceOrderOnCaseFilterRow == null)
            {
                return;
            }

            ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();

            FSServiceOrder newServiceOrderRow = CRExtensionHelper.InitNewServiceOrder(CreateServiceOrderFilter.Current.SrvOrdType, ID.SourceType_ServiceOrder.CASE);

            graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Insert(newServiceOrderRow);

            CRExtensionHelper.UpdateServiceOrderHeader(
                graphServiceOrderEntry,
                Base.Case.Cache,
                crCaseRow,
                fsCreateServiceOrderOnCaseFilterRow,
                graphServiceOrderEntry.ServiceOrderRecords.Current,
                true);

            graphServiceOrderEntry.ServiceOrderRecords.Current.SourceID     = crCaseRow.CaseID;
            graphServiceOrderEntry.ServiceOrderRecords.Current.SourceRefNbr = crCaseRow.CaseCD;

            if (!Base.IsContractBasedAPI)
            {
                throw new PXRedirectRequiredException(graphServiceOrderEntry, null);
            }
        }
        public static void Process(List <FSServiceOrder> list, bool isMassProcess)
        {
            ServiceOrderEntry serviceOrderEntryGraph = PXGraph.CreateInstance <ServiceOrderEntry>();

            for (int i = 0; i < list.Count; i++)
            {
                try
                {
                    serviceOrderEntryGraph.Clear();
                    serviceOrderEntryGraph.ServiceOrderRecords.Current = PXSelect <FSServiceOrder, Where <FSServiceOrder.srvOrdType, Equal <Required <FSServiceOrder.srvOrdType> >, And <FSServiceOrder.refNbr, Equal <Required <FSServiceOrder.refNbr> > > > > .Select(serviceOrderEntryGraph, list[i].SrvOrdType, list[i].RefNbr);

                    serviceOrderEntryGraph.CalculateExternalTax(serviceOrderEntryGraph.ServiceOrderRecords.Current);
                    PXProcessing <FSServiceOrder> .SetInfo(i, ActionsMessages.RecordProcessed);
                }
                catch (Exception e)
                {
                    if (isMassProcess)
                    {
                        PXProcessing <FSServiceOrder> .SetError(i, e is PXOuterException?e.Message + "\r\n" + String.Join("\r\n", ((PXOuterException)e).InnerMessages) : e.Message);
                    }
                    else
                    {
                        throw new PXMassProcessException(i, e);
                    }
                }
            }
        }
Exemplo n.º 5
0
        public virtual void UpdateServiceOrderDetail(PXCache cache, CRActivity crActivityRow, PXDBOperation operation)
        {
            FSServiceOrder fsServiceOrderRow = GetServiceOrderRecord(cache.Graph, crActivityRow);

            if (fsServiceOrderRow != null)
            {
                PMTimeActivity pmTimeActivityRow = PXSelect <PMTimeActivity,
                                                             Where <
                                                                 PMTimeActivity.refNoteID, Equal <Required <PMTimeActivity.refNoteID> > > >
                                                   .Select(Base, crActivityRow.NoteID);

                if (pmTimeActivityRow == null)
                {
                    return;
                }

                FSxPMTimeActivity fsxPMTimeActivityRow = PXCache <PMTimeActivity> .GetExtension <FSxPMTimeActivity>(pmTimeActivityRow);

                ServiceOrderEntry graphServiceOrder = PXGraph.CreateInstance <ServiceOrderEntry>();

                //Load existing ServiceOrder
                graphServiceOrder.ServiceOrderRecords.Current = graphServiceOrder.ServiceOrderRecords
                                                                .Search <FSServiceOrder.refNbr>(fsServiceOrderRow.RefNbr, fsServiceOrderRow.SrvOrdType);

                //Update ServiceOrder detail
                InsertUpdateDeleteSODet(graphServiceOrder, pmTimeActivityRow, fsxPMTimeActivityRow, operation);

                if (graphServiceOrder.IsDirty)
                {
                    graphServiceOrder.Save.Press();
                }
            }
        }
 private static void SaveServicerOrder(ServiceOrderEntry graphServiceOrderEntry)
 {
     if (graphServiceOrderEntry.IsDirty)
     {
         graphServiceOrderEntry.SelectTimeStamp();
         graphServiceOrderEntry.Save.Press();
     }
 }
        public ServiceOrderProcess()
        {
            ServiceOrderProcess graphServiceOrderProcess;

            ServiceOrderRecords.SetProcessDelegate(
                delegate(List <FSServiceOrder> fsServiceOrderRowList)
            {
                graphServiceOrderProcess = PXGraph.CreateInstance <ServiceOrderProcess>();

                ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();

                int index = 0;

                foreach (FSServiceOrder fsServiceOrderRow in fsServiceOrderRowList)
                {
                    try
                    {
                        graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords
                                                                             .Search <FSServiceOrder.refNbr>(fsServiceOrderRow.RefNbr, fsServiceOrderRow.SrvOrdType);

                        switch (Filter.Current.SOAction)
                        {
                        case ID.ServiceOrder_Action_Filter.COMPLETE:
                            graphServiceOrderEntry.CompleteOrder();
                            break;

                        case ID.ServiceOrder_Action_Filter.CANCEL:
                            graphServiceOrderEntry.CancelOrder();
                            break;

                        case ID.ServiceOrder_Action_Filter.REOPEN:
                            graphServiceOrderEntry.ReopenOrder();
                            break;

                        case ID.ServiceOrder_Action_Filter.CLOSE:
                            graphServiceOrderEntry.CloseOrder();
                            break;

                        case ID.ServiceOrder_Action_Filter.UNCLOSE:
                            graphServiceOrderEntry.UncloseOrderWithOptions(false);
                            break;

                        case ID.ServiceOrder_Action_Filter.ALLOWINVOICE:
                            graphServiceOrderEntry.AllowInvoice();
                            break;
                        }

                        PXProcessing <FSServiceOrder> .SetInfo(index, TX.Messages.RECORD_PROCESSED_SUCCESSFULLY);
                    }
                    catch (Exception e)
                    {
                        PXProcessing <FSServiceOrder> .SetError(index, e);
                    }

                    index++;
                }
            });
        }
        public virtual void CreateServiceOrderDocument(OpportunityMaint graphOpportunityMaint, CROpportunity crOpportunityRow, FSCreateServiceOrderFilter fsCreateServiceOrderFilterRow)
        {
            if (graphOpportunityMaint == null ||
                crOpportunityRow == null ||
                fsCreateServiceOrderFilterRow == null)
            {
                return;
            }

            ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();

            FSServiceOrder newServiceOrderRow = CRExtensionHelper.InitNewServiceOrder(fsCreateServiceOrderFilterRow.SrvOrdType, ID.SourceType_ServiceOrder.OPPORTUNITY);

            CRSetup crSetupRow = GetCRSetup();

            graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Insert(newServiceOrderRow);

            CRExtensionHelper.UpdateServiceOrderHeader(graphServiceOrderEntry,
                                                       Base.Opportunity.Cache,
                                                       crOpportunityRow,
                                                       fsCreateServiceOrderFilterRow,
                                                       graphServiceOrderEntry.ServiceOrderRecords.Current,
                                                       Base.Opportunity_Contact.Current,
                                                       Base.Opportunity_Address.Current,
                                                       true);

            SharedFunctions.CopyNotesAndFiles(Base.Opportunity.Cache,
                                              graphServiceOrderEntry.ServiceOrderRecords.Cache,
                                              crOpportunityRow, graphServiceOrderEntry.ServiceOrderRecords.Current,
                                              crSetupRow.CopyNotes,
                                              crSetupRow.CopyFiles);

            foreach (CROpportunityProducts crOpportunityProductsRow in graphOpportunityMaint.Products.Select())
            {
                if (crOpportunityProductsRow.InventoryID != null)
                {
                    InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(graphServiceOrderEntry, crOpportunityProductsRow.InventoryID);

                    if (inventoryItemRow.StkItem == true &&
                        graphServiceOrderEntry.ServiceOrderTypeSelected.Current.PostTo == ID.SrvOrdType_PostTo.ACCOUNTS_RECEIVABLE_MODULE)
                    {
                        throw new PXException(TX.Error.STOCKITEM_NOT_HANDLED_BY_SRVORDTYPE, inventoryItemRow.InventoryCD);
                    }

                    FSxCROpportunityProducts fsxCROpportunityProductsRow = graphOpportunityMaint.Products.Cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow);
                    CRExtensionHelper.InsertFSSODetFromOpportunity(graphServiceOrderEntry, graphOpportunityMaint.Products.Cache, crSetupRow, crOpportunityProductsRow, fsxCROpportunityProductsRow, inventoryItemRow);
                }
            }

            graphServiceOrderEntry.ServiceOrderRecords.Current.SourceRefNbr = crOpportunityRow.OpportunityID;

            if (!Base.IsContractBasedAPI)
            {
                throw new PXRedirectRequiredException(graphServiceOrderEntry, null);
            }
        }
Exemplo n.º 9
0
        private static void ApplyChangesfromContactInfo(ServiceOrderEntry graphServiceOrderEntry, CRContact crContactRow, FSContact fsContactRow, ref bool somethingChanged)
        {
            if (crContactRow == null)
            {
                return;
            }

            if (fsContactRow.Title != crContactRow.Title)
            {
                graphServiceOrderEntry.ServiceOrder_Contact.SetValueExt <FSContact.title>(fsContactRow, crContactRow.Title);
                somethingChanged = true;
            }

            if (fsContactRow.Attention != crContactRow.Attention)
            {
                graphServiceOrderEntry.ServiceOrder_Contact.SetValueExt <FSContact.attention>(fsContactRow, crContactRow.Attention);
                somethingChanged = true;
            }

            if (fsContactRow.Email != crContactRow.Email)
            {
                graphServiceOrderEntry.ServiceOrder_Contact.SetValueExt <FSContact.email>(fsContactRow, crContactRow.Email);
                somethingChanged = true;
            }

            if (fsContactRow.Phone1 != crContactRow.Phone1)
            {
                graphServiceOrderEntry.ServiceOrder_Contact.SetValueExt <FSContact.phone1>(fsContactRow, crContactRow.Phone1);
                somethingChanged = true;
            }

            if (fsContactRow.Phone2 != crContactRow.Phone2)
            {
                graphServiceOrderEntry.ServiceOrder_Contact.SetValueExt <FSContact.phone2>(fsContactRow, crContactRow.Phone2);
                somethingChanged = true;
            }

            if (fsContactRow.Phone3 != crContactRow.Phone3)
            {
                graphServiceOrderEntry.ServiceOrder_Contact.SetValueExt <FSContact.phone3>(fsContactRow, crContactRow.Phone3);
                somethingChanged = true;
            }

            if (fsContactRow.Fax != crContactRow.Fax)
            {
                graphServiceOrderEntry.ServiceOrder_Contact.SetValueExt <FSContact.fax>(fsContactRow, crContactRow.Fax);
                somethingChanged = true;
            }
        }
        private static void ApplyChangesfromAddressInfo(ServiceOrderEntry graphServiceOrderEntry, CRAddress crAddressRow, FSServiceOrder fsServiceOrderRow, ref bool somethingChanged)
        {
            if (crAddressRow == null)
            {
                return;
            }

            if (fsServiceOrderRow.AddressLine1 != crAddressRow.AddressLine1)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.addressLine1>(fsServiceOrderRow, crAddressRow.AddressLine1);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.AddressLine2 != crAddressRow.AddressLine2)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.addressLine2>(fsServiceOrderRow, crAddressRow.AddressLine2);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.AddressLine3 != crAddressRow.AddressLine3)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.addressLine3>(fsServiceOrderRow, crAddressRow.AddressLine3);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.City != crAddressRow.City)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.city>(fsServiceOrderRow, crAddressRow.City);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.CountryID != crAddressRow.CountryID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.countryID>(fsServiceOrderRow, crAddressRow.CountryID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.State != crAddressRow.State)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.state>(fsServiceOrderRow, crAddressRow.State);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.PostalCode != crAddressRow.PostalCode)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.postalCode>(fsServiceOrderRow, crAddressRow.PostalCode);
                somethingChanged = true;
            }
        }
        public static void LaunchEmployeeBoard(PXGraph graph, int?soID)
        {
            if (soID == null)
            {
                return;
            }

            FSServiceOrder fsServiceOrderRow = GetServiceOrder(graph, soID);

            if (fsServiceOrderRow != null)
            {
                ServiceOrderEntry graphServiceOrder = PXGraph.CreateInstance <ServiceOrderEntry>();
                graphServiceOrder.ServiceOrderRecords.Current = graphServiceOrder.ServiceOrderRecords
                                                                .Search <FSServiceOrder.refNbr>(fsServiceOrderRow.RefNbr, fsServiceOrderRow.SrvOrdType);
                graphServiceOrder.OpenEmployeeBoard();
            }
        }
Exemplo n.º 12
0
        public virtual IEnumerable ViewServiceOrderDocument(PXAdapter adapter)
        {
            POFixedDemand line = Base.FixedDemand.Current;

            if (line == null || line.RefNoteID == null)
            {
                return(adapter.Get());
            }

            FSServiceOrder doc = PXSelect <FSServiceOrder, Where <FSServiceOrder.noteID, Equal <Required <POFixedDemand.refNoteID> > > > .Select(Base, line.RefNoteID);

            if (doc != null)
            {
                ServiceOrderEntry graph = PXGraph.CreateInstance <ServiceOrderEntry>();
                graph.ServiceOrderRecords.Current = graph.ServiceOrderRecords.Search <FSServiceOrder.refNbr>
                                                        (doc.RefNbr, doc.SrvOrdType);
                PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.NewWindow);
            }
            return(adapter.Get());
        }
        public static void LaunchServiceOrderScreen(PXGraph graph, int?soID)
        {
            if (soID == null)
            {
                return;
            }

            FSServiceOrder fsServiceOrderRow = GetServiceOrder(graph, soID);

            if (fsServiceOrderRow != null)
            {
                ServiceOrderEntry graphServiceOrder = PXGraph.CreateInstance <ServiceOrderEntry>();
                graphServiceOrder.ServiceOrderRecords.Current = graphServiceOrder.ServiceOrderRecords
                                                                .Search <FSServiceOrder.refNbr>(fsServiceOrderRow.RefNbr, fsServiceOrderRow.SrvOrdType);
                throw new PXRedirectRequiredException(graphServiceOrder, null)
                      {
                          Mode = PXBaseRedirectException.WindowMode.NewWindow
                      };
            }
        }
Exemplo n.º 14
0
        public virtual IEnumerable ViewFSDocumentToApply(PXAdapter adapter)
        {
            FSAdjust fsAdjustRow = FSAdjustments.Current;

            if (fsAdjustRow != null &&
                !(String.IsNullOrEmpty(fsAdjustRow.AdjdOrderType) ||
                  String.IsNullOrEmpty(fsAdjustRow.AdjdOrderNbr)))
            {
                ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();
                graphServiceOrderEntry.ServiceOrderRecords.Current = graphServiceOrderEntry.ServiceOrderRecords.Search <FSServiceOrder.refNbr>(fsAdjustRow.AdjdOrderNbr, fsAdjustRow.AdjdOrderType);

                if (graphServiceOrderEntry.ServiceOrderRecords.Current != null)
                {
                    throw new PXRedirectRequiredException(graphServiceOrderEntry, true, "View Service Order")
                          {
                              Mode = PXBaseRedirectException.WindowMode.NewWindow
                          };
                }
            }
            return(adapter.Get());
        }
        private void InsertUpdateDeleteSODet(
            ServiceOrderEntry graphServiceOrder,
            PMTimeActivity pmTimeActivityRow,
            FSxPMTimeActivity fsxPMTimeActivityRow,
            PXDBOperation operation)
        {
            FSSODetService fsSODetServiceRow;

            graphServiceOrder.ServiceOrderDetServices.Current = graphServiceOrder.ServiceOrderDetServices
                                                                .Search <FSSODet.sourceNoteID>(pmTimeActivityRow.NoteID);
            if (graphServiceOrder.ServiceOrderDetServices.Current != null)
            {
                if (operation == PXDBOperation.Delete || fsxPMTimeActivityRow.ServiceID == null)
                {
                    graphServiceOrder.ServiceOrderDetServices.Delete(graphServiceOrder.ServiceOrderDetServices.Current);
                    return;
                }
            }
            else
            {
                //This line does not require appointment
                if (fsxPMTimeActivityRow.ServiceID == null)
                {
                    return;
                }

                //Insert a new SODet line
                fsSODetServiceRow = new FSSODetService();

                //Assign the PMTimeActivity reference to the new FSSODet line
                fsSODetServiceRow.SourceNoteID = pmTimeActivityRow.NoteID;

                graphServiceOrder.ServiceOrderDetServices.Current = graphServiceOrder.ServiceOrderDetServices.Insert(fsSODetServiceRow);
            }

            //Update the SODet line
            UpdateSODetServiceRow(graphServiceOrder, graphServiceOrder.ServiceOrderDetServices.Current, pmTimeActivityRow, fsxPMTimeActivityRow);
        }
Exemplo n.º 16
0
        protected override void _(Events.RowSelected <Extensions.MultiCurrency.Document> e)
        {
            base._(e);

            if (e.Row == null)
            {
                return;
            }

            PXUIFieldAttribute.SetVisible <Extensions.MultiCurrency.Document.curyID>(e.Cache, e.Row, ExtensionHelper.IsMultyCurrencyEnabled);
            var doc = Documents.Cache.GetMain <Extensions.MultiCurrency.Document>(e.Row);

            if (doc is FSServiceOrder)
            {
                ServiceOrderEntry graphServiceOrder = (ServiceOrderEntry)Documents.Cache.Graph;
                PXUIFieldAttribute.SetEnabled <Extensions.MultiCurrency.Document.curyID>(e.Cache, e.Row, graphServiceOrder.ServiceOrderAppointments.Select().Count == 0);
            }
            else if (doc is FSAppointment)
            {
                FSAppointment fsAppointmentRow = (FSAppointment)doc;
                PXUIFieldAttribute.SetEnabled <Extensions.MultiCurrency.Document.curyID>(e.Cache, e.Row, fsAppointmentRow.SOID < 0);
            }
        }
Exemplo n.º 17
0
        public virtual IEnumerable ViewDocument(PXAdapter adapter)
        {
            LinesToPO.Cache.IsDirty = false;

            POEnabledFSSODet poEnabledFSSODetRow = LinesToPO.Current;

            if (poEnabledFSSODetRow == null ||
                poEnabledFSSODetRow.SrvOrdType == null ||
                poEnabledFSSODetRow.RefNbr == null)
            {
                return(adapter.Get());
            }

            ServiceOrderEntry graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();

            graphServiceOrderEntry.ServiceOrderRecords.Current =
                graphServiceOrderEntry.ServiceOrderRecords
                .Search <FSServiceOrder.refNbr>(poEnabledFSSODetRow.RefNbr, poEnabledFSSODetRow.SrvOrdType);

            PXRedirectHelper.TryRedirect(graphServiceOrderEntry, PXRedirectHelper.WindowMode.Popup);

            return(adapter.Get());
        }
Exemplo n.º 18
0
        public virtual void UpdateUnitPricesAndCosts(List <ServiceOrderToPost> serviceOrderToPostRows)
        {
            if (serviceOrderToPostRows[0].PostTo != ID.SrvOrdType_PostTo.PROJECTS)
            {
                return;
            }

            ServiceOrderEntry serviceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();

            foreach (ServiceOrderToPost serviceOrderPosted in serviceOrderToPostRows)
            {
                serviceOrderEntry.ServiceOrderRecords.Current = serviceOrderEntry.ServiceOrderRecords.Search <FSServiceOrder.refNbr>(serviceOrderPosted.RefNbr, serviceOrderPosted.SrvOrdType);

                serviceOrderEntry.UpdateUnitCostsAndUnitPrices(serviceOrderEntry,
                                                               serviceOrderEntry.ServiceOrderDetails.Cache,
                                                               serviceOrderEntry.ServiceOrderDetails.Select().RowCast <FSSODet>(),
                                                               serviceOrderEntry.ServiceOrderDetails.Current.SOID);

                if (serviceOrderEntry.ServiceOrderDetails.Cache.IsDirty)
                {
                    serviceOrderEntry.Save.Press();
                }
            }
        }
        /// <summary>
        /// Create a Service Order from a TimeSlot.
        /// </summary>
        protected void CreateServiceOrder(TimeSlot timeSlotServiceOrder, bool createAppointmentFlag = false, bool appointmentsBelongToRoute = false)
        {
            // This action allows to avoid errors related to cache
            if (graphServiceOrderEntry != null)
            {
                graphServiceOrderEntry.Clear(PXClearOption.ClearAll);
            }
            else
            {
                graphServiceOrderEntry = PXGraph.CreateInstance <ServiceOrderEntry>();
                graphServiceOrderEntry.DisableServiceOrderUnboundFieldCalc = true;
            }

            FSSchedule        fsScheduleRow        = ScheduleSelected.Select(timeSlotServiceOrder.ScheduleID);
            FSServiceContract fsServiceContractRow = ServiceContractSelected.Select(fsScheduleRow.EntityID);

            bool isPrepaidContract = fsServiceContractRow.BillingType == ID.Contract_BillingType.STANDARDIZED_BILLINGS;

            //Services from the Schedule
            var fsScheduleDetSet = ScheduleLinesSelected.Select(timeSlotServiceOrder.ScheduleID);

            //Templates from the Schedule
            var fsScheduleDetTemplateSet = ScheduleTemplatesSelected.Select(timeSlotServiceOrder.ScheduleID);

            FSServiceOrder fsServiceOrderRow = new FSServiceOrder();

            fsServiceOrderRow.SrvOrdType = fsScheduleRow.SrvOrdType;
            graphServiceOrderEntry.ServiceOrderRecords.Insert(fsServiceOrderRow);

            fsServiceOrderRow = graphServiceOrderEntry.ServiceOrderRecords.Cache.CreateCopy(graphServiceOrderEntry.ServiceOrderRecords.Current) as FSServiceOrder;

            fsServiceOrderRow.BranchID         = fsScheduleRow.BranchID;
            fsServiceOrderRow.BranchLocationID = fsScheduleRow.BranchLocationID;
            fsServiceOrderRow.OrderDate        = timeSlotServiceOrder.DateTimeBegin.Date;
            fsServiceOrderRow.CustomerID       = fsServiceContractRow.CustomerID;
            fsServiceOrderRow.LocationID       = fsScheduleRow.CustomerLocationID;

            graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);
            fsServiceOrderRow = graphServiceOrderEntry.ServiceOrderRecords.Cache.CreateCopy(graphServiceOrderEntry.ServiceOrderRecords.Current) as FSServiceOrder;

            // Currently Service-Management's contracts DO NOT support multi-currency specification
            // therefore their ServiceOrders MUST be created in customer base currency
            if (PXAccess.FeatureInstalled <FeaturesSet.multicurrency>())
            {
                string curyID = null;

                Customer customer = (Customer)PXSelect <Customer,
                                                        Where <Customer.bAccountID, Equal <Required <Customer.bAccountID> > > >
                                    .Select(this, fsServiceContractRow.CustomerID);

                if (customer != null)
                {
                    curyID = customer.CuryID;
                }

                if (string.IsNullOrEmpty(curyID) == true)
                {
                    curyID = this.Accessinfo.BaseCuryID ?? new PXSetup <PX.Objects.GL.Company>(this).Current?.BaseCuryID;
                }

                fsServiceOrderRow.CuryID = curyID;
            }

            fsServiceOrderRow.DocDesc           = timeSlotServiceOrder.Descr;
            fsServiceOrderRow.BillCustomerID    = fsServiceContractRow.BillCustomerID;
            fsServiceOrderRow.BillLocationID    = fsServiceContractRow.BillLocationID;
            fsServiceOrderRow.ServiceContractID = fsServiceContractRow.ServiceContractID;
            fsServiceOrderRow.ProjectID         = fsServiceContractRow.ProjectID;
            fsServiceOrderRow.DfltProjectTaskID = fsServiceContractRow.DfltProjectTaskID;

            if (isPrepaidContract == true &&
                graphServiceOrderEntry.BillingCycleRelated.Current != null &&
                graphServiceOrderEntry.BillingCycleRelated.Current.BillingBy == ID.Billing_By.SERVICE_ORDER)
            {
                fsServiceOrderRow.BillServiceContractID = fsServiceContractRow.ServiceContractID;
            }

            fsServiceOrderRow.ScheduleID        = timeSlotServiceOrder.ScheduleID;
            fsServiceOrderRow.ServiceContractID = fsServiceContractRow.ServiceContractID;
            fsServiceOrderRow.GenerationID      = timeSlotServiceOrder.GenerationID;

            fsServiceOrderRow.SalesPersonID  = fsServiceContractRow.SalesPersonID;
            fsServiceOrderRow.Commissionable = fsServiceContractRow.Commissionable;

            fsServiceOrderRow = graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);

            if (fsServiceOrderRow.SalesPersonID == null)
            {
                object salesPersonID;
                graphServiceOrderEntry.ServiceOrderRecords.Cache.RaiseFieldDefaulting <FSServiceOrder.salesPersonID>(fsServiceOrderRow, out salesPersonID);
                fsServiceOrderRow.SalesPersonID = (int?)salesPersonID;

                object commissionable;
                graphServiceOrderEntry.ServiceOrderRecords.Cache.RaiseFieldDefaulting <FSServiceOrder.commissionable>(fsServiceOrderRow, out commissionable);
                fsServiceOrderRow.Commissionable = (bool?)commissionable;
            }

            graphServiceOrderEntry.Answers.CopyAllAttributes(fsServiceOrderRow, fsScheduleRow);

            #region Setting Service Order Details
            foreach (FSScheduleDet fsScheduleDetRow in fsScheduleDetSet)
            {
                if (fsScheduleDetRow.LineType == ID.LineType_ServiceContract.SERVICE_TEMPLATE)
                {
                    foreach (FSScheduleDet fsScheduleDetLocalRow in fsScheduleDetTemplateSet.Where(x => ((FSScheduleDet)x).ServiceTemplateID == fsScheduleDetRow.ServiceTemplateID))
                    {
                        var fsServiceTemplateDetSet_Service = ServiceTemplateSelected.Select(fsScheduleDetRow.ServiceTemplateID);

                        foreach (FSServiceTemplateDet fsServiceTemplateDetRow_Service in fsServiceTemplateDetSet_Service)
                        {
                            FSSODet fsSODetRow = new FSSODet();

                            // Insert the new row with key fields
                            fsSODetRow.ScheduleID    = fsScheduleDetLocalRow.ScheduleID;
                            fsSODetRow.ScheduleDetID = fsScheduleDetLocalRow.ScheduleDetID;
                            fsSODetRow.LineType      = fsServiceTemplateDetRow_Service.LineType;

                            fsSODetRow = graphServiceOrderEntry.ServiceOrderDetails.Insert(fsSODetRow);

                            fsSODetRow.InventoryID = fsServiceTemplateDetRow_Service.InventoryID;

                            fsSODetRow = graphServiceOrderEntry.ServiceOrderDetails.Update(fsSODetRow);

                            PXNoteAttribute.CopyNoteAndFiles(ScheduleLinesSelected.Cache,
                                                             fsScheduleDetLocalRow,
                                                             graphServiceOrderEntry.ServiceOrderDetails.Cache,
                                                             fsSODetRow,
                                                             copyNotes: true,
                                                             copyFiles: true);

                            // Create a copy to update the other fields
                            fsSODetRow = (FSSODet)graphServiceOrderEntry.ServiceOrderDetails.Cache.CreateCopy(fsSODetRow);

                            fsSODetRow.TranDesc = fsServiceTemplateDetRow_Service.TranDesc;

                            InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(this, fsServiceTemplateDetRow_Service.InventoryID);

                            if (inventoryItemRow != null)
                            {
                                FSxService fsxServiceRow = PXCache <InventoryItem> .GetExtension <FSxService>(inventoryItemRow);

                                if (fsxServiceRow != null && fsxServiceRow.BillingRule == ID.BillingRule.TIME)
                                {
                                    int?estimatedDuration = CalculateEstimatedDuration(fsSODetRow, fsServiceTemplateDetRow_Service.Qty);
                                    fsSODetRow.EstimatedDuration = estimatedDuration;
                                }
                                else
                                {
                                    fsSODetRow.EstimatedQty = fsServiceTemplateDetRow_Service.Qty;
                                }
                            }

                            if (fsServiceContractRow.SourcePrice == ID.SourcePrice.CONTRACT)
                            {
                                fsSODetRow.ManualPrice = true;
                                // TODO: Check where is assigned the contract price?
                            }

                            if (createAppointmentFlag)
                            {
                                fsSODetRow.Scheduled = true;
                                fsSODetRow.Status    = ID.Status_SODet.SCHEDULED;
                            }

                            fsSODetRow.EquipmentAction  = fsScheduleDetRow.EquipmentAction;
                            fsSODetRow.SMEquipmentID    = fsScheduleDetRow.SMEquipmentID;
                            fsSODetRow.ComponentID      = fsScheduleDetRow.ComponentID;
                            fsSODetRow.EquipmentLineRef = fsScheduleDetRow.EquipmentLineRef;
                            fsSODetRow.ProjectTaskID    = fsScheduleDetRow.ProjectTaskID;
                            fsSODetRow.CostCodeID       = fsScheduleDetRow.CostCodeID;

                            if (fsSODetRow.InventoryID != null)
                            {
                                fsSODetRow.ProjectTaskID = fsScheduleDetRow.ProjectTaskID;
                                fsSODetRow.CostCodeID    = fsScheduleDetRow.CostCodeID;
                            }

                            graphServiceOrderEntry.ServiceOrderDetails.Update(fsSODetRow);
                        }
                    }
                }
                else
                {
                    FSSODet fsSODetRow = new FSSODet();

                    // Insert the new row with key fields
                    fsSODetRow.ScheduleID    = fsScheduleDetRow.ScheduleID;
                    fsSODetRow.ScheduleDetID = fsScheduleDetRow.ScheduleDetID;
                    fsSODetRow.LineType      = fsScheduleDetRow.LineType;

                    fsSODetRow = graphServiceOrderEntry.ServiceOrderDetails.Insert(fsSODetRow);

                    fsSODetRow.InventoryID = fsScheduleDetRow.InventoryID;

                    fsSODetRow = graphServiceOrderEntry.ServiceOrderDetails.Update(fsSODetRow);

                    PXNoteAttribute.CopyNoteAndFiles(ScheduleLinesSelected.Cache,
                                                     fsScheduleDetRow,
                                                     graphServiceOrderEntry.ServiceOrderDetails.Cache,
                                                     fsSODetRow,
                                                     copyNotes: true,
                                                     copyFiles: true);

                    // Create a copy to update the other fields
                    fsSODetRow = (FSSODet)graphServiceOrderEntry.ServiceOrderDetails.Cache.CreateCopy(fsSODetRow);

                    fsSODetRow.TranDesc    = fsScheduleDetRow.TranDesc;
                    fsSODetRow.BillingRule = fsScheduleDetRow.BillingRule;

                    if (fsSODetRow.BillingRule == ID.BillingRule.TIME)
                    {
                        int?estimatedDuration = CalculateEstimatedDuration(fsSODetRow, fsScheduleDetRow?.Qty);
                        fsSODetRow.EstimatedDuration = estimatedDuration;
                    }
                    else
                    {
                        fsSODetRow.EstimatedQty = fsScheduleDetRow.Qty;
                    }

                    if (fsServiceContractRow.SourcePrice == ID.SourcePrice.CONTRACT)
                    {
                        fsSODetRow.ManualPrice = true;
                        // TODO: AC-142850 Check where is assigned the contract price?
                    }

                    if (createAppointmentFlag)
                    {
                        fsSODetRow.Scheduled = true;
                        fsSODetRow.Status    = ID.Status_SODet.SCHEDULED;
                    }

                    fsSODetRow.EquipmentAction  = fsScheduleDetRow.EquipmentAction;
                    fsSODetRow.SMEquipmentID    = fsScheduleDetRow.SMEquipmentID;
                    fsSODetRow.ComponentID      = fsScheduleDetRow.ComponentID;
                    fsSODetRow.EquipmentLineRef = fsScheduleDetRow.EquipmentLineRef;
                    fsSODetRow.ProjectTaskID    = fsScheduleDetRow.ProjectTaskID;
                    fsSODetRow.CostCodeID       = fsScheduleDetRow.CostCodeID;

                    if (fsSODetRow.InventoryID != null)
                    {
                        fsSODetRow.ProjectTaskID = fsScheduleDetRow.ProjectTaskID;
                        fsSODetRow.CostCodeID    = fsScheduleDetRow.CostCodeID;
                    }

                    graphServiceOrderEntry.ServiceOrderDetails.Update(fsSODetRow);
                }
            }

            if (fsScheduleRow.VendorID != null)
            {
                FSSOEmployee fsSOEmployeeRow = new FSSOEmployee();
                fsSOEmployeeRow.EmployeeID = fsScheduleRow.VendorID;
                graphServiceOrderEntry.ServiceOrderEmployees.Insert(fsSOEmployeeRow);
            }

            #endregion

            graphServiceOrderEntry.Save.Press();

            if (createAppointmentFlag)
            {
                string origStatus = graphServiceOrderEntry.ServiceOrderRecords.Current.Status;

                if (origStatus != ID.Status_ServiceOrder.OPEN)
                {
                    //Due to FSAppointment.sORefNbr selector, Service Order status must be OPEN to allow the SetValueExt<SORefNbr> inside createAppointment() work properly.
                    //PXUpdate is used to avoid raising any ServiceOrderEntry event.
                    PXUpdate <
                        Set <FSServiceOrder.status, FSServiceOrder.status.Open>,
                        FSServiceOrder,
                        Where <
                            FSServiceOrder.sOID, Equal <Required <FSServiceOrder.sOID> > > >
                    .Update(this, graphServiceOrderEntry.ServiceOrderRecords.Current.SOID);
                }

                CreateAppointment(graphServiceOrderEntry.ServiceOrderRecords.Current, timeSlotServiceOrder, fsScheduleRow, true, appointmentsBelongToRoute, isPrepaidContract);

                if (origStatus != ID.Status_ServiceOrder.OPEN)
                {
                    PXUpdate <
                        Set <FSServiceOrder.status, Required <FSServiceOrder.status> >,
                        FSServiceOrder,
                        Where <
                            FSServiceOrder.sOID, Equal <Required <FSServiceOrder.sOID> > > >
                    .Update(this, origStatus, graphServiceOrderEntry.ServiceOrderRecords.Current.SOID);
                }
            }
        }
        public static void UpdateServiceOrderHeader(
            ServiceOrderEntry graphServiceOrderEntry,
            PXCache cache,
            CROpportunity crOpportunityRow,
            FSCreateServiceOrderOnOpportunityFilter fsCreateServiceOrderOnOpportunityFilterRow,
            FSServiceOrder fsServiceOrderRow,
            CRContact crContactRow,
            CRAddress crAddressRow,
            bool updatingExistingSO)
        {
            bool somethingChanged = false;

            FSSrvOrdType fsSrvOrdTypeRow = GetServiceOrderType(graphServiceOrderEntry, fsServiceOrderRow.SrvOrdType);

            if (fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT)
            {
                if (fsServiceOrderRow.CustomerID != crOpportunityRow.BAccountID)
                {
                    graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.customerID>(fsServiceOrderRow, crOpportunityRow.BAccountID);
                    somethingChanged = true;
                }

                if (fsServiceOrderRow.LocationID != crOpportunityRow.LocationID)
                {
                    graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.locationID>(fsServiceOrderRow, crOpportunityRow.LocationID);
                    somethingChanged = true;
                }
            }

            if (fsServiceOrderRow.BranchID != crOpportunityRow.BranchID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.branchID>(fsServiceOrderRow, crOpportunityRow.BranchID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.BranchLocationID != fsCreateServiceOrderOnOpportunityFilterRow.BranchLocationID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.branchLocationID>(fsServiceOrderRow, fsCreateServiceOrderOnOpportunityFilterRow.BranchLocationID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.ContactID != crOpportunityRow.ContactID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.contactID>(fsServiceOrderRow, crOpportunityRow.ContactID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.DocDesc != crOpportunityRow.Subject)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.docDesc>(fsServiceOrderRow, crOpportunityRow.Subject);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.ProjectID != crOpportunityRow.ProjectID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.projectID>(fsServiceOrderRow, crOpportunityRow.ProjectID);
                somethingChanged = true;
            }

            if (crOpportunityRow.OwnerID != null)
            {
                if (crOpportunityRow.OwnerID != (Guid?)cache.GetValueOriginal <CROpportunity.ownerID>(crOpportunityRow))
                {
                    int?salesPersonID = GetSalesPersonID(graphServiceOrderEntry, crOpportunityRow.OwnerID);

                    if (salesPersonID != null)
                    {
                        graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.salesPersonID>(fsServiceOrderRow, salesPersonID);
                        somethingChanged = true;
                    }
                }
            }

            if (fsServiceOrderRow.OrderDate != crOpportunityRow.CloseDate)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.orderDate>(fsServiceOrderRow, crOpportunityRow.CloseDate);
                somethingChanged = true;
            }

            ApplyChangesfromContactInfo(graphServiceOrderEntry, crContactRow, fsServiceOrderRow, ref somethingChanged);
            ApplyChangesfromAddressInfo(graphServiceOrderEntry, crAddressRow, fsServiceOrderRow, ref somethingChanged);

            if (fsServiceOrderRow.TaxZoneID != crOpportunityRow.TaxZoneID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.taxZoneID>(fsServiceOrderRow, crOpportunityRow.TaxZoneID);
                somethingChanged = true;
            }

            if (somethingChanged && updatingExistingSO)
            {
                graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);
            }
        }
        public static void UpdateServiceOrderHeader(
            ServiceOrderEntry graphServiceOrderEntry,
            PXCache cache,
            CRCase crCaseRow,
            FSCreateServiceOrderOnCaseFilter fsCreateServiceOrderOnCaseFilterRow,
            FSServiceOrder fsServiceOrderRow,
            bool updatingExistingSO)
        {
            if (fsServiceOrderRow.Status == ID.Status_ServiceOrder.CLOSED)
            {
                return;
            }

            bool somethingChanged = false;

            FSSrvOrdType fsSrvOrdTypeRow = GetServiceOrderType(graphServiceOrderEntry, fsServiceOrderRow.SrvOrdType);

            if (fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT)
            {
                if (fsServiceOrderRow.CustomerID != crCaseRow.CustomerID)
                {
                    graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.customerID>(fsServiceOrderRow, crCaseRow.CustomerID);
                    somethingChanged = true;
                }

                if (fsServiceOrderRow.LocationID != crCaseRow.LocationID)
                {
                    graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.locationID>(fsServiceOrderRow, crCaseRow.LocationID);
                    somethingChanged = true;
                }
            }

            if (fsServiceOrderRow.BranchLocationID != fsCreateServiceOrderOnCaseFilterRow.BranchLocationID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.branchLocationID>(fsServiceOrderRow, fsCreateServiceOrderOnCaseFilterRow.BranchLocationID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.ContactID != crCaseRow.ContactID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.contactID>(fsServiceOrderRow, crCaseRow.ContactID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.DocDesc != crCaseRow.Subject)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.docDesc>(fsServiceOrderRow, crCaseRow.Subject);
                somethingChanged = true;
            }

            if (crCaseRow.OwnerID != null)
            {
                if (crCaseRow.OwnerID != (Guid?)cache.GetValueOriginal <CROpportunity.ownerID>(crCaseRow))
                {
                    int?salesPersonID = GetSalesPersonID(graphServiceOrderEntry, crCaseRow.OwnerID);

                    if (salesPersonID != null)
                    {
                        graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.salesPersonID>(fsServiceOrderRow, salesPersonID);
                        somethingChanged = true;
                    }
                }
            }

            if (crCaseRow.CreatedDateTime.HasValue &&
                fsServiceOrderRow.OrderDate != crCaseRow.CreatedDateTime.Value.Date)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.orderDate>(fsServiceOrderRow, crCaseRow.CreatedDateTime.Value.Date);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.SLAETA != crCaseRow.SLAETA)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.sLAETA>(fsServiceOrderRow, crCaseRow.SLAETA);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.AssignedEmpID != fsCreateServiceOrderOnCaseFilterRow.AssignedEmpID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.assignedEmpID>(fsServiceOrderRow, fsCreateServiceOrderOnCaseFilterRow.AssignedEmpID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.ProblemID != fsCreateServiceOrderOnCaseFilterRow.ProblemID)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.problemID>(fsServiceOrderRow, fsCreateServiceOrderOnCaseFilterRow.ProblemID);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.LongDescr != crCaseRow.Description)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.longDescr>(fsServiceOrderRow, crCaseRow.Description);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.Priority != crCaseRow.Priority)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.priority>(fsServiceOrderRow, crCaseRow.Priority);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.PromisedDate != crCaseRow.ETA)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.promisedDate>(fsServiceOrderRow, crCaseRow.ETA);
                somethingChanged = true;
            }

            if (fsServiceOrderRow.Severity != crCaseRow.Severity)
            {
                graphServiceOrderEntry.ServiceOrderRecords.SetValueExt <FSServiceOrder.severity>(fsServiceOrderRow, crCaseRow.Severity);
                somethingChanged = true;
            }

            if (somethingChanged && updatingExistingSO)
            {
                graphServiceOrderEntry.ServiceOrderRecords.Update(fsServiceOrderRow);
            }
        }