Beispiel #1
0
        protected virtual void CRCase_SDEnabled_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            CRCase    crCaseRow    = (CRCase)e.Row;
            FSxCRCase fsxCRCaseRow = cache.GetExtension <FSxCRCase>(crCaseRow);

            if (fsxCRCaseRow.SDEnabled == true)
            {
                FSSetup fsSetupRow = GetFSSetup();

                if (fsSetupRow != null &&
                    fsSetupRow.DfltCasesSrvOrdType != null)
                {
                    fsxCRCaseRow.SrvOrdType = fsSetupRow.DfltCasesSrvOrdType;
                }

                SetBranchLocationID(Base, fsxCRCaseRow);
            }
            else
            {
                fsxCRCaseRow.SrvOrdType       = null;
                fsxCRCaseRow.BranchLocationID = null;
            }
        }
Beispiel #2
0
        private void SetPersistingChecks(
            PXCache cache,
            CRCase crCaseRow,
            FSxCRCase fsxCRCaseRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            if (fsxCRCaseRow.SDEnabled == true)
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCRCase.srvOrdType>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);
                PXDefaultAttribute.SetPersistingCheck <FSxCRCase.branchLocationID>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);

                if (fsSrvOrdTypeRow == null)
                {
                    fsSrvOrdTypeRow = CRExtensionHelper.GetServiceOrderType(Base, fsxCRCaseRow.SrvOrdType);
                }

                if (fsSrvOrdTypeRow != null &&
                    fsSrvOrdTypeRow.Behavior != ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT)
                {
                    PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);
                    if (PXAccess.FeatureInstalled <FeaturesSet.accountLocations>() == true)
                    {
                        PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crCaseRow, PXPersistingCheck.NullOrBlank);
                    }
                }
            }
            else
            {
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.srvOrdType>(cache, crCaseRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <FSxCROpportunity.branchLocationID>(cache, crCaseRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.bAccountID>(cache, crCaseRow, PXPersistingCheck.Nothing);
                PXDefaultAttribute.SetPersistingCheck <CROpportunity.locationID>(cache, crCaseRow, PXPersistingCheck.Nothing);
            }
        }
Beispiel #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);
            }
        }
Beispiel #4
0
        private static void UpdateReminderCount(CRCaseMaint graphCase, int?CaseID, int ReminderCount, bool bShouldClose = false)
        {
            try
            {
                CRCase rowCRCase = PXSelect <CRCase, Where <CRCase.caseID, Equal <Required <CRCase.caseID> > > > .Select(graphCase, CaseID);

                if (rowCRCase != null)
                {
                    graphCase.Case.Current = rowCRCase;

                    if (bShouldClose)
                    {
                        rowCRCase.Status      = CRCaseStatusesAttribute._CLOSED;
                        rowCRCase.MajorStatus = CRCaseMajorStatusesAttribute._CLOSED;

                        //Set resolution/reason to "Abandoned"
                        rowCRCase.Resolution = "CA";
                    }

                    CRCaseExt caseExt = PXCache <CRCase> .GetExtension <CRCaseExt>(graphCase.Case.Current);

                    caseExt.UsrReminderCount = ReminderCount;

                    graphCase.Case.Update(graphCase.Case.Current);
                    graphCase.Save.Press();
                }
            }
            catch (Exception Err)
            {
                throw Err;
            }
        }
Beispiel #5
0
        private void EnableDisableCustomFields(
            PXCache cache,
            CRCase crCaseRow,
            FSxCRCase fsxCRCaseRow,
            FSServiceOrder fsServiceOrderRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            if (fsSrvOrdTypeRow != null)
            {
                bool isAnInternalSrvOrdType = fsSrvOrdTypeRow.Behavior == ID.Behavior_SrvOrderType.INTERNAL_APPOINTMENT;

                PXUIFieldAttribute.SetEnabled <CRCase.customerID>(
                    cache,
                    null,
                    isAnInternalSrvOrdType ||
                    (!isAnInternalSrvOrdType && fsServiceOrderRow == null));
            }
            else
            {
                PXUIFieldAttribute.SetEnabled <CRCase.customerID>(
                    cache,
                    null,
                    true);
            }
        }
 private static bool IsTheRequiredFieldsPresent(PXGraph graph, CRCase crCaseRow, FSxCRCase fsxCRCaseRow)
 {
     return(!(crCaseRow == null ||
              fsxCRCaseRow == null ||
              crCaseRow.ClassID == null ||
              crCaseRow.CustomerID == null ||
              crCaseRow.Subject == null ||
              fsxCRCaseRow.SrvOrdType == null ||
              fsxCRCaseRow.BranchLocationID == null));
 }
Beispiel #7
0
        public virtual int?GetLaborClass(PMTimeActivity activity)
        {
            CRCase refCase = PXSelectJoin <CRCase,
                                           InnerJoin <CRActivityLink,
                                                      On <CRActivityLink.refNoteID, Equal <CRCase.noteID> > >,
                                           Where <CRActivityLink.noteID, Equal <Required <PMTimeActivity.refNoteID> > > > .Select(graph, activity.RefNoteID);

            EPEmployee employee = PXSelect <EPEmployee> .Search <EPEmployee.userID>(graph, activity.OwnerID);

            return(GetLaborClass(activity, employee, refCase));
        }
        public virtual void EnableDisableActions(PXCache cache,
                                                 CRCase crCaseRow,
                                                 FSxCRCase fsxCRCaseRow,
                                                 FSServiceOrder fsServiceOrderRow,
                                                 FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            CreateServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && !string.IsNullOrWhiteSpace(crCaseRow.CaseCD) && fsServiceOrderRow == null);
            ViewServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && !string.IsNullOrWhiteSpace(crCaseRow.CaseCD) && fsServiceOrderRow != null);
            OpenAppointmentBoard.SetEnabled(fsServiceOrderRow != null);
        }
Beispiel #9
0
        private void EnableDisableActions(
            PXCache cache,
            CRCase crCaseRow,
            FSxCRCase fsxCRCaseRow,
            FSServiceOrder fsServiceOrderRow,
            FSSrvOrdType fsSrvOrdTypeRow)
        {
            bool isSMSetup = GetFSSetup() != null;

            CreateServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && crCaseRow.CaseID > 0 && fsServiceOrderRow == null);
            ViewServiceOrder.SetEnabled(isSMSetup && crCaseRow != null && crCaseRow.CaseID > 0 && fsServiceOrderRow != null);
            OpenAppointmentBoard.SetEnabled(fsServiceOrderRow != null);
        }
        public virtual IEnumerable ViewCase(PXAdapter adapter)
        {
            CRActivityLink row = (PXResultset <EPActivityApprove, CRActivityLink>)Activity.Search <EPActivityApprove.noteID>(Activity.Current?.NoteID);

            if (row != null)
            {
                CRCase caseRow = PXSelect <CRCase> .Search <CRCase.noteID>(this, row.RefNoteID);

                if (caseRow != null)
                {
                    PXRedirectHelper.TryRedirect(this, caseRow, PXRedirectHelper.WindowMode.NewWindow);
                }
            }
            return(adapter.Get());
        }
Beispiel #11
0
        public virtual IEnumerable ViewCase(PXAdapter adapter)
        {
            EPActivity row = Activity.Current;

            if (row != null)
            {
                CRCase caseRow = PXSelect <CRCase> .Search <CRCase.noteID>(this, row.RefNoteID);

                if (caseRow != null)
                {
                    PXRedirectHelper.TryRedirect(this, caseRow, PXRedirectHelper.WindowMode.NewWindow);
                }
            }
            return(adapter.Get());
        }
Beispiel #12
0
        public virtual void createServiceOrder()
        {
            CRCase    crCaseRow    = Base.Case.Current;
            FSxCRCase fsxCRCaseRow = Base.Case.Cache.GetExtension <FSxCRCase>(crCaseRow);

            if (CreateServiceOrderFilter.AskExt() == WebDialogResult.OK)
            {
                fsxCRCaseRow.SDEnabled        = true;
                fsxCRCaseRow.BranchLocationID = CreateServiceOrderFilter.Current.BranchLocationID;
                fsxCRCaseRow.SrvOrdType       = CreateServiceOrderFilter.Current.SrvOrdType;
                fsxCRCaseRow.AssignedEmpID    = CreateServiceOrderFilter.Current.AssignedEmpID;
                fsxCRCaseRow.ProblemID        = CreateServiceOrderFilter.Current.ProblemID;

                PXLongOperation.StartOperation(Base, delegate()
                {
                    CreateServiceOrderDocument(Base, crCaseRow, CreateServiceOrderFilter.Current);
                });
            }
        }
Beispiel #13
0
        public virtual IEnumerable ViewCase(PXAdapter adapter)
        {
            var row = Activity.Current;

            var apRow = (EPActivityApprove)row;

            if (row != null && row.RefNoteID != null)
            {
                CRCase caseRow = PXSelectJoin <CRCase,
                                               InnerJoin <CRActivityLink,
                                                          On <CRActivityLink.refNoteID, Equal <CRCase.noteID> > >,
                                               Where <CRActivityLink.noteID, Equal <Required <EPActivityApprove.refNoteID> > > > .Select(this, apRow.RefNoteID);

                if (caseRow != null)
                {
                    PXRedirectHelper.TryRedirect(this, caseRow, PXRedirectHelper.WindowMode.NewWindow);
                }
            }
            return(adapter.Get());
        }
        protected virtual void GetCallerEntity(Guid?refNoteID)
        {
            if (refNoteID != null)
            {
                CRCase crCaseRow = PXSelect <CRCase,
                                             Where <
                                                 CRCase.noteID, Equal <Required <CRCase.noteID> > > >
                                   .Select(Base, refNoteID);

                if (crCaseRow != null)
                {
                    FSxCRCase fsxCRCaseRow = PXCache <CRCase> .GetExtension <FSxCRCase>(crCaseRow);

                    if (fsxCRCaseRow != null && fsxCRCaseRow.SDEnabled == false)
                    {
                        _disableServiceID = false;
                    }

                    _callerEntity = typeof(CRCase);
                }
                else
                {
                    CROpportunity crOpportuniyRow = PXSelect <CROpportunity,
                                                              Where <
                                                                  CROpportunity.noteID, Equal <Required <CROpportunity.noteID> > > >
                                                    .Select(Base, refNoteID);

                    if (crOpportuniyRow != null)
                    {
                        FSxCROpportunity fsxCROpportunityRow = PXCache <CROpportunity> .GetExtension <FSxCROpportunity>(crOpportuniyRow);

                        if (fsxCROpportunityRow != null && fsxCROpportunityRow.SDEnabled == true)
                        {
                            _disableServiceID = false;
                        }

                        _callerEntity = typeof(CROpportunity);
                    }
                }
            }
        }
Beispiel #15
0
        protected void CRCase_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            CRCase    crCaseRow    = (CRCase)e.Row;
            FSxCRCase fsxCRCaseRow = cache.GetExtension <FSxCRCase>(crCaseRow);

            FSServiceOrder fsServiceOrderRow = CRExtensionHelper.GetRelatedServiceOrder(Base, cache, crCaseRow, fsxCRCaseRow.SOID);
            FSSrvOrdType   fsSrvOrdTypeRow   = null;

            if (fsServiceOrderRow != null)
            {
                fsSrvOrdTypeRow = CRExtensionHelper.GetServiceOrderType(Base, fsServiceOrderRow.SrvOrdType);
            }

            EnableDisableCustomFields(cache, crCaseRow, fsxCRCaseRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            EnableDisableActions(cache, crCaseRow, fsxCRCaseRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            SetPersistingChecks(cache, crCaseRow, fsxCRCaseRow, fsSrvOrdTypeRow);
        }
Beispiel #16
0
    protected void edContactID_EditRecord(object sender, PX.Web.UI.PXNavigateEventArgs e)
    {
        CRCaseMaint casemaint = this.ds.DataGraph as CRCaseMaint;

        if (casemaint != null)
        {
            CRCase currentcase = this.ds.DataGraph.Views[this.ds.DataGraph.PrimaryView].Cache.Current as CRCase;
            if (currentcase.ContactID == null && currentcase.CustomerID != null)
            {
                {
                    try
                    {
                        casemaint.addNewContact.Press();
                    }
                    catch (PX.Data.PXRedirectRequiredException e1)
                    {
                        PX.Web.UI.PXBaseDataSource ds = this.ds as PX.Web.UI.PXBaseDataSource;
                        PX.Web.UI.PXBaseDataSource.RedirectHelper helper = new PX.Web.UI.PXBaseDataSource.RedirectHelper(ds);
                        helper.TryRedirect(e1);
                    }
                }
            }
        }
    }
Beispiel #17
0
        public virtual int?GetLaborClass(PMTimeActivity activity, EPEmployee employee, CRCase refCase)
        {
            if (employee == null)
            {
                throw new ArgumentNullException("employee", Messages.EmptyEmployeeID);
            }

            int?laborClassID = null;

            if (refCase != null)
            {
                CRCaseClass caseClass = (CRCaseClass)PXSelectorAttribute.Select <CRCase.caseClassID>(graph.Caches[typeof(CRCase)], refCase);
                if (caseClass.PerItemBilling == BillingTypeListAttribute.PerActivity)
                {
                    laborClassID = CRCaseClassLaborMatrix.GetLaborClassID(graph, caseClass.CaseClassID, activity.EarningTypeID);
                }
            }

            if (laborClassID == null && activity.LabourItemID != null)
            {
                laborClassID = activity.LabourItemID;
            }
            if (laborClassID == null && activity.ProjectID != null && employee.BAccountID != null)
            {
                laborClassID = EPContractRate.GetProjectLaborClassID(graph, (int)activity.ProjectID, (int)employee.BAccountID, activity.EarningTypeID);
            }

            if (laborClassID == null)
            {
                laborClassID = EPEmployeeClassLaborMatrix.GetLaborClassID(graph, employee.BAccountID, activity.EarningTypeID);
            }

            if (laborClassID == null)
            {
                laborClassID = employee.LabourItemID;
            }

            return(laborClassID);
        }
        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);
            }
        }