public virtual void loadTemplateColumnsSS()
        {
            PMSetup pmSetupRow = this.Base.Setup.Current;

            if (pmSetupRow == null)
            {
                throw new PXException(SmartsheetConstants.Messages.ERROR_SETUP);
            }

            PXCache <PMSSMapping> mappingCache = this.Base.Caches <PMSSMapping>();

            if (MappingSetup.Select().Count() == 0)
            {
                InsertTemplate(mappingCache);
            }
            else
            {
                WebDialogResult result = this.Base.Setup.View.Ask(this.Base.Setup.Current, SmartsheetConstants.Messages.CONFIRM_HEADER, SmartsheetConstants.Messages.CONFIRM_RELOAD_VALUES, MessageButtons.YesNoCancel, MessageIcon.Warning);

                if (result == WebDialogResult.Yes)
                {
                    foreach (PMSSMapping item in MappingSetup.Select())
                    {
                        mappingCache.Delete(item);
                    }
                    mappingCache.Persist(PXDBOperation.Delete);
                    InsertTemplate(mappingCache);
                }
            }
        }
Пример #2
0
        public virtual IEnumerable prepareAdd(PXAdapter adapter)
        {
            if (Transfer.Current != null && Transfer.Current.Released != true)
            {
                Save.Press();
                //Current should be the only one inserted
                PXCache currencycache = Caches[typeof(CM.CurrencyInfo)];
                currencycache.SetStatus(currencycache.Current, PXEntryStatus.Inserted);
                Transfer.JustPersisted = true;

                //recreate currencyinfo on CurrencyInfoAttribute.RowUpdating
                AddFilter.Update(AddFilter.Current);

                WebDialogResult result = AddFilter.AskExt(true);
                if (result == WebDialogResult.OK)
                {
                    using (new PXTimeStampScope(this.TimeStamp))
                    {
                        CATran catran = AddTrxFilter.VerifyAndCreateTransaction(this, AddFilter, currencyinfo_addfilter);
                        catran = TransferTran.Update(catran);
                        Save.Press();
                    }
                }
                AddFilter.Cache.Clear();
            }
            else
            {
                throw new Exception(Messages.DocumentStatusInvalid);
            }
            return(adapter.Get());
        }
		protected virtual void Filter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
		{
			if (e.Row == null) return;
			Filter row = (Filter)e.Row;
			bool allDataIsFilled = !string.IsNullOrEmpty(row.OldPaymentMethodID) 
				&& !string.IsNullOrEmpty(row.OldCCProcessingCenterID) 
				&& !string.IsNullOrEmpty(row.NewCCProcessingCenterID);
			CustomerPaymentMethodList.SetProcessEnabled(allDataIsFilled);
			CustomerPaymentMethodList.SetProcessAllEnabled(allDataIsFilled);
			if (allDataIsFilled)
			{
				CCProcessingCenter newCCPC = NewProcessingCenter.Select();
				string oldProcCenterId = OldProcessingCenter.SelectSingle()?.ProcessingCenterID;
				string newProcCenterId = NewProcessingCenter.SelectSingle()?.ProcessingCenterID;
				CustomerPaymentMethodList.SetParametersDelegate(cpm =>
				{
					WebDialogResult result = filter.Ask(PXMessages.LocalizeFormatNoPrefix(Messages.PaymentMethodConverterWarning, oldProcCenterId, newProcCenterId), MessageButtons.OKCancel);
					return result == WebDialogResult.OK ? true : false;
				});
				CustomerPaymentMethodList.SetProcessDelegate(cpm => ConvertCustomerPaymentMethod(row, cpm, newCCPC));
			}

			ShowUnknownPluginWarningIfNeeded(row, OldProcessingCenter.Select(), nameof(Filter.OldCCProcessingCenterID));
			ShowUnknownPluginWarningIfNeeded(row, NewProcessingCenter.Select(), nameof(Filter.NewCCProcessingCenterID));
		}
Пример #4
0
        public virtual IEnumerable prepareAdd(PXAdapter adapter)
        {
            if (Transfer.Current != null && Transfer.Current.Released != true)
            {
                Save.Press();
                Transfer.JustPersisted = true;

                //recreate currencyinfo on CurrencyInfoAttribute.RowUpdating
                AddFilter.Update(AddFilter.Current);

                if (this.Views.ContainsKey("AddFilter"))
                {
                    WebDialogResult result = this.Views["AddFilter"].AskExt(true);
                    if (result == WebDialogResult.OK)
                    {
                        using (new PXTimeStampScope(this.TimeStamp))
                        {
                            CATran catran = null;
                            catran = (catran ?? AddTrxFilter.AddAPTransaction(this, AddFilter, currencyinfo_addfilter));
                            catran = (catran ?? AddTrxFilter.AddARTransaction(this, AddFilter, currencyinfo_addfilter));
                            catran = (catran ?? AddTrxFilter.AddCATransaction(this, AddFilter, currencyinfo_addfilter));
                            AddTrxFilter.Clear(this, AddFilter);

                            catran = TransferTran.Update(catran);
                            Save.Press();
                        }
                    }
                }
            }
            else
            {
                throw new Exception(Messages.DocumentStatusInvalid);
            }
            return(adapter.Get());
        }
Пример #5
0
 public virtual IEnumerable MultipleDelete(PXAdapter adapter)
 {
     if (Campaign.Current != null && Campaign.Current.CampaignID != null && CampaignMembers.Cache.IsDirty &&
         Campaign.Cache.GetStatus(Campaign.Current) != PXEntryStatus.Inserted)
     {
         WebDialogResult res = this.Campaign.Ask(Messages.Confirmation, Messages.CampaignDeleteMembersQuestion, MessageButtons.YesNo);
         if (res == WebDialogResult.Yes)
         {
             List <SelCampaignMembers> membersToDelete = new List <SelCampaignMembers>();
             foreach (SelCampaignMembers member in CampaignMembers.Cache.Updated)
             {
                 if (member.Selected ?? false)
                 {
                     membersToDelete.Add(member);
                 }
             }
             foreach (SelCampaignMembers member in membersToDelete)
             {
                 CampaignMembers.Cache.Delete(member);
             }
             Save.Press();
         }
     }
     return(adapter.Get());
 }
Пример #6
0
        protected virtual void APIntegrityCheckFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            bool errorsOnForm = PXUIFieldAttribute.GetErrors(sender, null, PXErrorLevel.Error, PXErrorLevel.RowError).Count > 0;

            APVendorList.SetProcessEnabled(!errorsOnForm);
            APVendorList.SetProcessAllEnabled(!errorsOnForm);

            APIntegrityCheckFilter filter = Filter.Current;

            APVendorList.SetProcessDelegate <APReleaseProcess>(
                delegate(APReleaseProcess re, Vendor vend)
            {
                re.Clear(PXClearOption.PreserveTimeStamp);
                re.IntegrityCheckProc(vend, filter.FinPeriodID);
            }
                );

            //For perfomance recomended select not more than maxVendorCount vendors,
            //because the operation is performed for a long time.
            const int maxVendorCount = 5;

            APVendorList.SetParametersDelegate(delegate(List <Vendor> list)
            {
                bool processing = true;
                if (PX.Common.PXContext.GetSlot <AUSchedule>() == null && list.Count > maxVendorCount)
                {
                    WebDialogResult wdr = APVendorList.Ask(Messages.ContinueValidatingBalancesForMultipleVendors, MessageButtons.OKCancel);
                    processing          = wdr == WebDialogResult.OK;
                }
                return(processing);
            });
        }
Пример #7
0
        protected virtual void ARIntegrityCheckFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            ARIntegrityCheckFilter filter = Filter.Current;

            ARCustomerList.SetProcessDelegate <ARReleaseProcess>(
                delegate(ARReleaseProcess re, Customer cust)
            {
                re.Clear(PXClearOption.PreserveTimeStamp);
                re.IntegrityCheckProc(cust, filter.FinPeriodID);
            }
                );

            //For perfomance recomended select not more than maxCustomerCount customers,
            //becouse the operation is performed for a long time.
            const int maxCustomerCount = 5;

            ARCustomerList.SetParametersDelegate(delegate(List <Customer> list)
            {
                bool processing = true;

                if (list.Count > maxCustomerCount)
                {
                    WebDialogResult wdr = ARCustomerList.Ask(Messages.ContinueValidatingBalancesForMultipleCustomers, MessageButtons.OKCancel);
                    processing          = wdr == WebDialogResult.OK;
                }
                return(processing);
            });
        }
Пример #8
0
        public virtual IEnumerable Recalculate(PXAdapter adapter)
        {
            DRSchedule schedule = Base.DocumentProperties.Current;

            if (schedule.IsOverridden == true)
            {
                WebDialogResult result = Base.DocumentProperties.View.Ask(
                    Base.DocumentProperties.Current,
                    GL.Messages.Confirmation,
                    Messages.ClearOverriden,
                    MessageButtons.YesNo,
                    MessageIcon.Question);

                if (result != WebDialogResult.Yes)
                {
                    return(adapter.Get());
                }
            }

            schedule.IsOverridden   = false;
            schedule.IsRecalculated = false;
            Base.DocumentProperties.Update(schedule);

            SingleScheduleCreator.RecalculateSchedule(Base);

            return(adapter.Get());
        }
Пример #9
0
        public virtual IEnumerable GenTran(PXAdapter adapter)
        {
            if (Components.Current != null)
            {
                DRDeferredCode defCode = DeferredCode.Select();
                if (defCode != null)
                {
                    PXResultset <DRScheduleTran> res = Transactions.Select();

                    if (res.Count > 0)
                    {
                        WebDialogResult result = Components.View.Ask(Components.Current, GL.Messages.Confirmation, Messages.RegenerateTran, MessageButtons.YesNo, MessageIcon.Question);
                        if (result == WebDialogResult.Yes)
                        {
                            CreateTransactions(defCode, Accessinfo.BranchID);
                        }
                    }
                    else
                    {
                        CreateTransactions(defCode, Accessinfo.BranchID);
                    }
                }
            }
            return(adapter.Get());
        }
Пример #10
0
        protected virtual void DefaultRecords(Document row, Contact oldContact, Address oldAddress)
        {
            PXCache cache = Documents.Cache;

            if (row.AllowOverrideContactAddress == true && (row.LocationID != null || row.ContactID != null) &&
                !IsDefaultContactAdress() && !IsContactAddressNoChanged(oldContact, oldAddress))
            {
                WebDialogResult dialogResult = this.Documents.View.Ask((object)null, CR.Messages.Warning, CR.Messages.ReplaceContactDetails,
                                                                       MessageButtons.AbortRetryIgnore,
                                                                       new Dictionary <WebDialogResult, string>()
                {
                    { WebDialogResult.Abort, "Yes" },
                    { WebDialogResult.Retry, "No" },
                    { WebDialogResult.Ignore, "Cancel" }
                }, MessageIcon.Warning);

                if (dialogResult == WebDialogResult.Abort)
                {
                    CRAddressAttribute.DefaultRecord <Document.documentAddressID>(cache, cache.GetMain(row));
                    CRContactAttribute.DefaultRecord <Document.documentContactID>(cache, cache.GetMain(row));
                    cache.SetValue <Document.allowOverrideContactAddress>(row, false);
                }
                else if (dialogResult == WebDialogResult.Ignore)
                {
                    cache.SetValue <Document.bAccountID>(row, cache.GetValueOriginal <Document.bAccountID>(cache.GetMain(row)));
                    cache.SetValue <Document.contactID>(row, cache.GetValueOriginal <Document.contactID>(cache.GetMain(row)));
                }
            }
            else
            {
                if (row.LocationID != null || row.ContactID != null)
                {
                    CRAddressAttribute.DefaultRecord <Document.documentAddressID>(cache, cache.GetMain(row));
                    CRContactAttribute.DefaultRecord <Document.documentContactID>(cache, cache.GetMain(row));
                    cache.SetValue <Document.allowOverrideContactAddress>(row, false);
                }
            }

            if (row.LocationID == null && row.ContactID == null && row.BAccountID == null)
            {
                if (row.AllowOverrideContactAddress == false)
                {
                    CRAddressAttribute.DefaultRecord <Document.documentAddressID>(cache, cache.GetMain(row));
                    CRContactAttribute.DefaultRecord <Document.documentContactID>(cache, cache.GetMain(row));
                    cache.SetValue <Document.allowOverrideContactAddress>(row, false);
                }
            }

            if (IsDefaultContactAdress())
            {
                cache.SetValue <Document.allowOverrideContactAddress>(row, true);
            }
        }
Пример #11
0
        protected virtual void ARInvoice_RetainageApply_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            ARInvoice document = (ARInvoice)e.Row;
            bool?     newValue = (bool?)e.NewValue;

            if (document == null)
            {
                return;
            }

            if (Base.GetType() == typeof(PX.Objects.CT.CTBillEngine.ARContractInvoiceEntry))
            {
                e.NewValue = false;
                return;
            }

            if (document.RetainageApply == true && newValue == false)
            {
                IEnumerable <ARTran> trans = Base.Transactions.Select().Where(tran => ((ARTran)tran).CuryRetainageAmt != 0 || ((ARTran)tran).RetainagePct != 0).RowCast <ARTran>();

                if (!trans.Any())
                {
                    return;
                }

                WebDialogResult wdr =
                    Base.Document.Ask(
                        Messages.Warning,
                        AP.Messages.UncheckApplyRetainage,
                        MessageButtons.YesNo,
                        MessageIcon.Warning);

                if (wdr == WebDialogResult.Yes)
                {
                    foreach (ARTran tran in trans)
                    {
                        tran.CuryRetainageAmt = 0m;
                        tran.RetainagePct     = 0m;
                        Base.Transactions.Update(tran);
                    }
                }
                else
                {
                    e.Cancel   = true;
                    e.NewValue = true;
                }
            }
            else if (document.RetainageApply != true && newValue == true)
            {
                ClearCurrentDocumentDiscountDetails();
            }
        }
        private void ShowProcessingWarnIfLock(PXAdapter adapter)
        {
            TPrimary doc = adapter.Get <TPrimary>().FirstOrDefault();

            if (doc != null && adapter.ExternalCall && LockExists(doc))
            {
                WebDialogResult result = PaymentTransaction.Ask(AR.Messages.CCProcessingARPaymentAlreadyProcessed, MessageButtons.OKCancel);
                if (result == WebDialogResult.No)
                {
                    throw new PXException(AR.Messages.CCProcessingOperationCancelled);
                }
            }
        }
Пример #13
0
        protected virtual bool ConfirmProcessing(List <APAdjust> adjustments)
        {
            if (LienWaiverSetup.Current.ShouldStopPayments == true &&
                adjustments.Any(LienWaiverWarningsCacheService.ShouldShowWarning))
            {
                var             warningMessage = GetWarningMessage();
                WebDialogResult result         = Base.APDocumentList.Ask(warningMessage, MessageButtons.OKCancel);

                return(result == WebDialogResult.OK);
            }

            return(true);
        }
Пример #14
0
        public virtual bool ConfirmDeletion(PXView view, string gUIFmtCode)
        {
            isCreditNote = true;

            if (gUIFmtCode != TWGUIFormatCode.vATOutCode33 && gUIFmtCode != TWGUIFormatCode.vATOutCode34 && gUIFmtCode != null)
            {
                WebDialogResult result = view.Ask(TWMessages.CfmMegOnDelete, MessageButtons.YesNo);

                isCreditNote = false;
                notBeDeleted = (result == WebDialogResult.No);
            }

            return(notBeDeleted);
        }
        public override void Persist()
        {
            WebDialogResult result = Setup.Ask(ActionsMessages.Warning, PXMessages.LocalizeFormatNoPrefix("Saving will modify instance behavior"), MessageButtons.OKCancel, MessageIcon.Warning, true);

            //        //checking answer
            if (result == WebDialogResult.OK)
            {
                base.Persist();
                PXDatabase.ResetSlots();
                PXPageCacheUtils.InvalidateCachedPages();
                this.Clear();
                throw new PXRefreshException();
            }
        }
Пример #16
0
        public void ReloadTaxReportLinesForTaxZones()
        {
            messageDisplayed = messageDisplayed ?? ReloadTaxReportLinesForTaxZonesInternalAndPrepareChangesDescription();

            if (messageDisplayed != null)
            {
                WebDialogResult result = taxReportGraph.TaxVendor.Ask(Messages.CreateReportLinesForNewTaxZones, messageDisplayed,
                                                                      MessageButtons.OK, refreshRequired: false);

                if (result.IsPositive())
                {
                    //Cleanup during the second pass of the method after the user clicked on OK button
                    messageDisplayed = null;
                }
            }
        }
        public virtual IEnumerable CreateRecon(PXAdapter adapter)
        {
            if (this.Views.ContainsKey("cashAccountFilter"))
            {
                CashAccountFilter createReconFilter = cashAccountFilter.Current;
                WebDialogResult   result            = this.Views["cashAccountFilter"].AskExt();
                if (result == WebDialogResult.OK)
                {
                    CashAccount acct = PXSelect <CashAccount, Where <CashAccount.cashAccountID, Equal <Required <AddTrxFilter.cashAccountID> > > > .Select(this, createReconFilter.CashAccountID);

                    CAReconEntry.ReconCreate(acct);
                    CAReconRecords.View.RequestRefresh();
                }
            }

            return(adapter.Get());
        }
Пример #18
0
        protected virtual void CCProcessingCenterPmntMethod_RowInserting(PXCache cache, PXRowInsertingEventArgs e)
        {
            if (errorKey)
            {
                errorKey = false;
                e.Cancel = true;
            }
            else
            {
                CCProcessingCenterPmntMethod row = e.Row as CCProcessingCenterPmntMethod;
                string detID   = row.ProcessingCenterID;
                bool   isExist = false;

                foreach (CCProcessingCenterPmntMethod it in this.ProcessingCenters.Select())
                {
                    if (!Object.ReferenceEquals(it, row) && it.ProcessingCenterID == row.ProcessingCenterID)
                    {
                        isExist = true;
                    }
                }

                if (isExist)
                {
                    cache.RaiseExceptionHandling <CCProcessingCenterPmntMethod.processingCenterID>(e.Row, detID, new PXException(Messages.ProcessingCenterIsAlreadyAssignedToTheCard));
                    e.Cancel = true;
                }
                else
                {
                    CCProcessingCenter procCenter = GetProcessingCenterById(row.ProcessingCenterID);
                    bool supported = CCProcessingFeatureHelper.IsFeatureSupported(procCenter, CCProcessingFeature.PaymentHostedForm);

                    if (supported)
                    {
                        if (row.IsDefault == false)
                        {
                            WebDialogResult result = ProcessingCenters.Ask(Messages.DefaultProcessingCenterConfirmation, MessageButtons.YesNo);
                            if (result == WebDialogResult.Yes)
                            {
                                row.IsDefault = true;
                            }
                        }
                    }
                }
            }
        }
Пример #19
0
        protected virtual void _(Events.RowPersisted <EPPosition> e)
        {
            if (e.Row == null)
            {
                return;
            }

            if (e.TranStatus == PXTranStatus.Open)
            {
                EPPosition    epPositionRow    = (EPPosition)e.Row;
                FSxEPPosition fsxEPPositionRow = e.Cache.GetExtension <FSxEPPosition>(epPositionRow);

                if (fsxEPPositionRow.SDEnabledModified == true)
                {
                    WebDialogResult confirmResult = Base.EPPosition.Ask(TX.WebDialogTitles.POSITION_PROPAGATE_CONFIRM, TX.Messages.POSITION_PROPAGATE_CONFIRM, MessageButtons.YesNo);
                    if (confirmResult == WebDialogResult.Yes)
                    {
                        Employee.Cache.Clear();

                        var epEmployeeSet = PXSelectJoin <EPEmployee,
                                                          InnerJoin <EPEmployeePosition,
                                                                     On <
                                                                         EPEmployeePosition.employeeID, Equal <EPEmployee.bAccountID> > >,
                                                          Where <
                                                              EPEmployeePosition.positionID, Equal <Required <EPEmployeePosition.positionID> >,
                                                              And <EPEmployeePosition.isActive, Equal <True> > > >
                                            .Select(Base, epPositionRow.PositionID);

                        foreach (EPEmployee epEmployeeRow in epEmployeeSet)
                        {
                            var fsxEPEmployeeRow = Employee.Cache.GetExtension <FSxEPEmployee>(epEmployeeRow);
                            if (fsxEPEmployeeRow != null)
                            {
                                fsxEPEmployeeRow.SDEnabled = fsxEPPositionRow.SDEnabled;
                                Employee.Cache.Update(epEmployeeRow);
                                Employee.Cache.SetStatus(epEmployeeRow, PXEntryStatus.Updated);
                            }
                        }


                        Employee.Cache.Persist(PXDBOperation.Insert | PXDBOperation.Update);
                    }
                }
            }
        }
        protected virtual void PaymentMethod_PaymentType_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e)
        {
            bool found = false;

            foreach (PaymentMethodDetail iDet in this.Details.Select())
            {
                found = true; break;
            }
            if (found)
            {
                WebDialogResult res = this.PaymentMethod.Ask(Messages.AskConfirmation, Messages.PaymentMethodDetailsWillReset, MessageButtons.YesNo);
                if (res != WebDialogResult.Yes)
                {
                    PaymentMethod row = (PaymentMethod)e.Row;
                    e.Cancel   = true;
                    e.NewValue = row.PaymentType;
                }
            }
        }
        protected virtual void _(Events.FieldUpdated <Document, Document.bAccountID> e)
        {
            if (e.Row == null
                //|| e.Row.BAccountID == e.OldValue as int?
                || e.Row.RefContactID != null && Documents.View.Answer != WebDialogResult.Ignore ||
                Base.IsImport ||
                Base.IsContractBasedAPI ||
                Base.UnattendedMode)
            {
                return;
            }

            if (e.Row.BAccountID == null && e.Row.RefContactID == null)
            {
                e.Cache.SetValueExt <Document.overrideRefContact>(e.Row, false);

                return;
            }

            WebDialogResult dialogResult = Documents.View.Ask(null, Messages.Warning, Messages.ReplaceContactInfoFromAccount,
                                                              MessageButtons.AbortRetryIgnore,
                                                              new Dictionary <WebDialogResult, string>()
            {
                { WebDialogResult.Abort, "Yes" },
                { WebDialogResult.Retry, "No" },
                { WebDialogResult.Ignore, "Cancel" }
            }, MessageIcon.Warning);

            if (dialogResult == WebDialogResult.Abort)
            {
                FillFromAccount();

                Documents.Cache.SetValue <Document.overrideRefContact>(Documents.Current, false);
            }
            else if (dialogResult == WebDialogResult.Retry)
            {
                Documents.Cache.SetValue <Document.overrideRefContact>(Documents.Current, true);
            }
            else if (dialogResult == WebDialogResult.Ignore)
            {
                Documents.Cache.SetValue <Document.bAccountID>(Documents.Current, e.OldValue);
            }
        }
Пример #22
0
        protected virtual void CurrencyList_DecimalPlaces_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e)
        {
            CurrencyList currencyList = e.Row as CurrencyList;

            if (currencyList == null)
            {
                return;
            }

            WebDialogResult wdr =
                CuryListRecords.Ask(
                    CS.Messages.Warning,
                    CS.Messages.ChangingCurrencyPrecisionWarning,
                    MessageButtons.YesNo,
                    MessageIcon.Warning);

            e.NewValue = wdr == WebDialogResult.Yes
                                ? e.NewValue
                                : currencyList.DecimalPlaces;
        }
Пример #23
0
        /// <summary>
        /// Get InventoryItem when item class = 'PACKMTRL' and attribute 'DEFBOX' = TRUE
        /// </summary>
        /// <param name="graph"></param>
        /// <returns></returns>
        public static int?GetPackMatlBox(SOOrderEntry graph)
        {
            var item = SelectFrom <InventoryItem> .InnerJoin <CSAnswers> .On <CSAnswers.refNoteID.IsEqual <InventoryItem.noteID> >
                       .InnerJoin <INItemClass> .On <INItemClass.itemClassID.IsEqual <InventoryItem.itemClassID> >
                       .Where <CSAnswers.attributeID.IsEqual <@P.AsString>
                               .And <CSAnswers.value.IsEqual <@P.AsString> >
                               .And <INItemClass.itemClassCD.StartsWith <@P.AsString> > > .View.Select(graph, ItemAttr_DefBox, Convert.ToInt32(true).ToString(), ItemClass_PackMtrl);

            if (item.Count > 1)
            {
                WebDialogResult wdr = graph.Transactions.Ask(DefBoxHeader, DefBoxInfo, MessageButtons.OKCancel);

                if (wdr == WebDialogResult.Cancel)
                {
                    return(null);
                }
            }

            return(item.TopFirst?.InventoryID);
        }
Пример #24
0
        protected virtual void _(Events.FieldUpdating <FeaturesSet.aSC606> e)
        {
            e.NewValue = PXBoolAttribute.ConvertValue(e.NewValue);

            FeaturesSet row = (FeaturesSet)e.Row;

            if (row == null)
            {
                return;
            }

            bool?oldValue = row.ASC606;

            if (row.ASC606 != null && oldValue != (bool)e.NewValue)
            {
                int?result = PXSelectGroupBy <
                    ARTranAlias,
                    Aggregate <Count> >
                             .SelectSingleBound(this, null)
                             .RowCount;

                if (result > 0)
                {
                    string          question = PXMessages.LocalizeFormatNoPrefixNLA(AR.Messages.UnreleasedDocsWithDRCodes, result);
                    WebDialogResult wdr      = Features.Ask(question, MessageButtons.YesNo);
                    if (wdr != WebDialogResult.Yes)
                    {
                        e.NewValue = oldValue;
                        e.Cancel   = true;
                        return;
                    }
                }

                //The system calculates the number of Stock and Non-Stock Inventories
                //in Active status which have MDA deferral code and empty field Allocation Method in Revenue Components.
                if ((bool)e.NewValue == false)
                {
                    //use AR.Messages.MDAInventoriesWithoutAllocationMethod
                }
            }
        }
Пример #25
0
        public virtual IEnumerable SendVATReturn(PXAdapter adapter)
        {
            VATPeriodFilter tp = Period_Header.Current;

            if (tp.RevisionId == null)
            {
                return(adapter.Get());
            }

            WebDialogResult dialogResult = Period_Header.Ask(Messages.VatReturnWillBeSentToHMRC, MessageButtons.YesNoCancel);

            Period_Header.ClearDialog();
            if (dialogResult == WebDialogResult.Cancel)
            {
                return(adapter.Get());
            }

            VATMaint.SendVATReturnProc(this, tp, dialogResult == WebDialogResult.Yes);

            return(adapter.Get());
        }
Пример #26
0
        protected virtual void FSSetup_ManageRooms_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            FSSetup fsSetupRow = (FSSetup)e.Row;

            if (fsSetupRow.ManageRooms == false)
            {
                var fsServiceOrderTypeSet = SrvOrdTypeRequireRoomRecords.Select();

                if (fsServiceOrderTypeSet != null && fsServiceOrderTypeSet.Count > 0)
                {
                    WebDialogResult result = SrvOrdTypeRequireRoomRecords.Ask(TX.WebDialogTitles.CONFIRM_MANAGE_ROOMS, TX.Messages.CANNOT_HIDE_ROOMS_IN_SM, MessageButtons.YesNo);
                    if (result == WebDialogResult.Yes)
                    {
                        SvrOrdTypeMaint graphSvrOrdTypeMaint = PXGraph.CreateInstance <SvrOrdTypeMaint>();
                        foreach (FSSrvOrdType fsSrvOrdTypeRow in fsServiceOrderTypeSet)
                        {
                            fsSrvOrdTypeRow.RequireRoom = false;
                            graphSvrOrdTypeMaint.SvrOrdTypeRecords.Update(fsSrvOrdTypeRow);
                            graphSvrOrdTypeMaint.Save.Press();
                            graphSvrOrdTypeMaint.Clear();
                        }
                    }
                    else
                    {
                        fsSetupRow.ManageRooms = true;
                    }
                }
            }

            PXUIFieldAttribute.SetEnabled <FSSetup.manageAttendees>(cache, fsSetupRow, (bool)fsSetupRow.ManageRooms);
            if (fsSetupRow.ManageRooms == false)
            {
                fsSetupRow.ManageAttendees = false;
            }
        }
        public virtual IEnumerable deleteOrganizationLedgerLink(PXAdapter adapter)
        {
            var link = LinkCache.Current as OrganizationLedgerLink;

            if (link?.OrganizationID == null || link.LedgerID == null)
            {
                return(adapter.Get());
            }

            Ledger ledger = GeneralLedgerMaint.FindLedgerByID(Base, link.LedgerID);

            if (ledger.BalanceType == LedgerBalanceType.Actual)
            {
                LinkCache.Delete(link);
            }
            else
            {
                if (GLUtility.RelatedGLHistoryExists(Base, link.LedgerID, link.OrganizationID))
                {
                    Organization org = OrganizationMaint.FindOrganizationByID(Base, link.OrganizationID, true);

                    WebDialogResult dialogResult = OrganizationLedgerLinkSelect.Ask(PXMessages.LocalizeFormatNoPrefix(
                                                                                        Messages.AtLeastOneGeneralLedgerTransactionHasBeenPosted,
                                                                                        LinkCache.GetValueExt <OrganizationLedgerLink.ledgerID>(link).ToString().Trim(),
                                                                                        org.OrganizationCD.Trim()),
                                                                                    MessageButtons.YesNo);

                    if (dialogResult == WebDialogResult.Yes)
                    {
                        LinkCache.Delete(link);
                    }
                }
                else
                {
                    LinkCache.Delete(link);
                }
            }

            return(adapter.Get());
        }
Пример #28
0
        public virtual IEnumerable ShowMatrixPanel(PXAdapter adapter)
        {
            const WebDialogResult LookupViewButtonDialogResult = WebDialogResult.Yes;

            var answer = Header.View.GetAnswer(null);

            if (answer == WebDialogResult.OK)
            {
                AddItemsToOrder(Header.Current.SiteID);
            }
            else if (answer == LookupViewButtonDialogResult)
            {
                Header.View.SetAnswer(null, WebDialogResult.None);

                answer = Matrix.AskExt((g, v) =>
                {
                    Header.Current.SmartPanelType = EntryHeader.smartPanelType.Lookup;
                    RecalcAttributesGrid();
                    RecalcMatrixGrid();
                });
            }
            else if (Matrix.View.GetAnswer(null) == WebDialogResult.OK)
            {
                AddMatrixItemsToOrder(Header.Current.SiteID);
            }
            else
            {
                Header.AskExt((g, v) =>
                {
                    Header.Current.SmartPanelType = EntryHeader.smartPanelType.Entry;
                    RecalcAttributesGrid();
                    RecalcMatrixGrid();
                });
            }

            return(adapter.Get());
        }
Пример #29
0
        protected virtual void DefaultRecords(Document row, ChangedData changedForContactInfo, ChangedData changedForShippingInfo)
        {
            PXCache cache = Documents.Cache;

            bool needAskFromContactAddress         = AskForConfirmationForAddress(row, changedForContactInfo);
            bool needAskFromShippingContactAddress = AskForConfirmationForShippingAddress(row, changedForShippingInfo);

            if ((needAskFromContactAddress || needAskFromShippingContactAddress) && (row.LocationID != null || row.ContactID != null))
            {
                string message = needAskFromContactAddress && needAskFromShippingContactAddress ?
                                 CR.Messages.ReplaceContactDetailsAndShippingInfo :
                                 needAskFromContactAddress ? CR.Messages.ReplaceContactDetails :
                                 CR.Messages.ReplaceShippingInfo;
                WebDialogResult dialogResult = this.Documents.View.Ask((object)null, CR.Messages.Warning, message,
                                                                       MessageButtons.AbortRetryIgnore,
                                                                       new Dictionary <WebDialogResult, string>()
                {
                    { WebDialogResult.Abort, "Yes" },
                    { WebDialogResult.Retry, "No" },
                    { WebDialogResult.Ignore, "Cancel" }
                }, MessageIcon.Warning);

                if (dialogResult == WebDialogResult.Abort)
                {
                    if (needAskFromContactAddress)
                    {
                        CRAddressAttribute.DefaultRecord <Document.documentAddressID>(cache, cache.GetMain(row));
                        CRContactAttribute.DefaultRecord <Document.documentContactID>(cache, cache.GetMain(row));
                        cache.SetValue <Document.allowOverrideContactAddress>(row, false);
                    }
                    if (needAskFromShippingContactAddress)
                    {
                        CRShippingContactAttribute.DefaultRecord <Document.shipContactID>(cache, cache.GetMain(row));
                        CRShippingAddressAttribute.DefaultRecord <Document.shipAddressID>(cache, cache.GetMain(row));
                        cache.SetValue <Document.allowOverrideShippingContactAddress>(row, false);
                    }
                }
                else if (dialogResult == WebDialogResult.Ignore)
                {
                    cache.SetValue <Document.bAccountID>(row, cache.GetValueOriginal <Document.bAccountID>(cache.GetMain(row)));
                    cache.SetValue <Document.contactID>(row, cache.GetValueOriginal <Document.contactID>(cache.GetMain(row)));
                }
                else if (dialogResult == WebDialogResult.Retry)
                {
                    if (row.AllowOverrideContactAddress == false)
                    {
                        CRAddressAttribute.DefaultRecord <Document.documentAddressID>(cache, cache.GetMain(row));
                        CRContactAttribute.DefaultRecord <Document.documentContactID>(cache, cache.GetMain(row));
                        cache.SetValue <Document.allowOverrideContactAddress>(row, false);
                    }
                    else if (row.AllowOverrideShippingContactAddress == false)
                    {
                        CRShippingContactAttribute.DefaultRecord <Document.shipContactID>(cache, cache.GetMain(row));
                        CRShippingAddressAttribute.DefaultRecord <Document.shipAddressID>(cache, cache.GetMain(row));
                        cache.SetValue <Document.allowOverrideShippingContactAddress>(row, false);
                    }
                }
            }
            else
            {
                if (IsThereSomeContactAddressSourceValue(cache, row))
                {
                    if (changedForContactInfo.CanBeReplace)
                    {
                        CRAddressAttribute.DefaultRecord <Document.documentAddressID>(cache, cache.GetMain(row));
                        CRContactAttribute.DefaultRecord <Document.documentContactID>(cache, cache.GetMain(row));
                        cache.SetValue <Document.allowOverrideContactAddress>(row, false);
                    }

                    if (changedForShippingInfo.CanBeReplace)
                    {
                        CRShippingContactAttribute.DefaultRecord <Document.shipContactID>(cache, cache.GetMain(row));
                        CRShippingAddressAttribute.DefaultRecord <Document.shipAddressID>(cache, cache.GetMain(row));
                        cache.SetValue <Document.allowOverrideShippingContactAddress>(row, false);
                    }
                }
            }

            if (row.LocationID == null && row.ContactID == null && row.BAccountID == null)
            {
                if (row.AllowOverrideContactAddress == false)
                {
                    CRAddressAttribute.DefaultRecord <Document.documentAddressID>(cache, cache.GetMain(row));
                    CRContactAttribute.DefaultRecord <Document.documentContactID>(cache, cache.GetMain(row));
                    cache.SetValue <Document.allowOverrideContactAddress>(row, false);
                }
                if (row.AllowOverrideShippingContactAddress == false)
                {
                    CRShippingContactAttribute.DefaultRecord <Document.shipContactID>(cache, cache.GetMain(row));
                    CRShippingAddressAttribute.DefaultRecord <Document.shipAddressID>(cache, cache.GetMain(row));
                    cache.SetValue <Document.allowOverrideShippingContactAddress>(row, false);
                    PXCache cacheContact = GetContactCache();
                    var     contact      = GetCurrentContact();
                    cacheContact.RaiseRowUpdated(contact, contact);
                    PXCache cacheAddress = GetAddressCache();
                    var     address      = GetCurrentAddress();
                    cacheAddress.RaiseRowUpdated(address, address);
                }
            }

            if (IsDefaultContactAdress())
            {
                cache.SetValue <Document.allowOverrideContactAddress>(row, true);
            }
        }
Пример #30
0
        /// <summary>
        /// Verifies the connection Token and the existence of the Sheet
        /// </summary>
        /// <param name="projectEntryGraph">Project's Graph</param>
        /// <param name="pmProjectRow">Current PMProject row</param>
        /// <param name="refreshedToken">Existing token</param>
        /// <param name="isMassProcess">Indicates if it's used in a processing page</param>
        /// <returns></returns>
        public SmartsheetClient CheckTokenSheetSS(ProjectEntry projectEntryGraph, PMProject pmProjectRow, string refreshedToken = "", bool isMassProcess = false)
        {
            //Primary Data View is set
            projectEntryGraph.Project.Current = pmProjectRow;

            SmartsheetHelper smartSheetHelperObject = new SmartsheetHelper();

            string sheetName = pmProjectRow.ContractCD.Trim() + " - " + pmProjectRow.Description.Trim();

            sheetName = smartSheetHelperObject.Left(sheetName, SmartsheetConstants.SSConstants.SS_PROJECT_NAME_LENGTH);

            PMSetup      setupRecord  = projectEntryGraph.Setup.Select();
            PMSetupSSExt pmSetupSSExt = PXCache <PMSetup> .GetExtension <PMSetupSSExt>(setupRecord);

            PMProjectSSExt pmProjectSSExt = PXCache <PMProject> .GetExtension <PMProjectSSExt>(pmProjectRow);

            Users userRecord = PXSelect <
                Users,
                Where <Users.pKID, Equal <Required <AccessInfo.userID> > > >
                               .Select(projectEntryGraph, projectEntryGraph.Accessinfo.UserID);

            UsersSSExt userRecordSSExt = PXCache <Users> .GetExtension <UsersSSExt>(userRecord);

            smartSheetHelperObject.SetupValidation(userRecordSSExt, pmSetupSSExt);
            smartSheetHelperObject.ProjectValidation(projectEntryGraph);

            Token token = new Token();

            token.AccessToken = (String.IsNullOrEmpty(refreshedToken)) ? userRecordSSExt.UsrSmartsheetToken : refreshedToken;

            try
            {
                SmartsheetClient smartsheetClient = new SmartsheetBuilder().SetAccessToken(token.AccessToken).Build();

                long?sheetSelected;
                Dictionary <string, long> currentColumnMap = new Dictionary <string, long>();

                if (pmProjectSSExt != null &&
                    pmProjectSSExt.UsrSmartsheetContractID != null)        //Acumatica Project is already linked to SS
                {
                    sheetSelected = pmProjectSSExt.UsrSmartsheetContractID;

                    Sheet ssProjectSheet = smartsheetClient.SheetResources.GetSheet((long)sheetSelected, null, null, null, null, null, null, null);
                }

                return(smartsheetClient);
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains(SmartsheetConstants.SSConstants.EXPIRED_TOKEN_MESSAGE))
                {
                    MyProfileMaint    profileMaintGraph = PXGraph.CreateInstance <MyProfileMaint>();
                    MyProfileMaintExt graphExtended     = profileMaintGraph.GetExtension <MyProfileMaintExt>();
                    string            updatedToken      = graphExtended.RefreshSmartsheetToken();
                    CheckTokenSheetSS(projectEntryGraph, pmProjectRow, updatedToken);
                }

                if (ex.Message.Contains(SmartsheetConstants.SSConstants.NOTFOUND_PROJECT_MESSAGE))
                {
                    if (isMassProcess)
                    {
                        SmartsheetClient smartsheetClient = new SmartsheetBuilder().SetAccessToken(token.AccessToken).Build();
                        UnlinkSmartsheetProject(projectEntryGraph);
                        CreateUpdateGanttProject(projectEntryGraph, pmProjectRow, smartsheetClient, true);
                    }
                    else
                    {
                        WebDialogResult result = this.Base.Project.Ask(Base.Project.Current, SmartsheetConstants.Messages.CONFIRM_HEADER, SmartsheetConstants.Messages.CONFIRM_UNLINK_PROJECT, MessageButtons.YesNo, MessageIcon.Question);
                        if (result == WebDialogResult.Yes)
                        {
                            UnlinkSmartsheetProject(projectEntryGraph);
                            this.synGanttSmartsheetProject.Press();
                        }
                        else
                        {
                            UnlinkSmartsheetProject(projectEntryGraph);
                        }
                    }
                }
                else
                {
                    throw new PXException(ex.Message);
                }

                return(null);
            }
        }