public FinancialPeriodNotDefinedForDateException(DateTime?date)
     : base(date == null
                         ? Messages.NoPeriodsDefined
                         : PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodForDate, date?.ToShortDateString()))
 {
     Date = date;
 }
Пример #2
0
        protected override void TotalFieldSelecting(PXCache s, PXFieldSelectingEventArgs e, string fieldName)
        {
            var matrix = e.Row as EntryMatrix;

            var state = PXDecimalState.CreateInstance(e.ReturnState, _precision.Value, fieldName, false, 0, 0m, null);

            e.ReturnState = state;
            state.Enabled = false;

            state.DisplayName = PXLocalizer.Localize(Messages.TotalQty);

            var firstMatrix = s.Cached.FirstOrDefault_() as EntryMatrix;

            if (firstMatrix?.ColAttributeValueDescrs?.Length > 0)
            {
                state.Visibility = PXUIVisibility.Visible;
                state.Visible    = true;
            }
            else
            {
                state.Visibility = PXUIVisibility.Invisible;
                state.Visible    = false;
            }

            decimal sum = 0;

            for (int columnIndex = 0; columnIndex < matrix?.Quantities?.Length; columnIndex++)
            {
                sum += (matrix.IsTotal == true || matrix.InventoryIDs[columnIndex] != null) ? (matrix.Quantities[columnIndex] ?? 0m) : 0m;
            }

            e.ReturnValue = sum;
        }
Пример #3
0
        private string GetTextFromReloadTaxZonesResult(List <TaxReportLine> addedLines, List <TaxReportLine> deletedLines)
        {
            if (addedLines.Count == 0 && deletedLines.Count == 0)
            {
                return(PXLocalizer.Localize(Messages.TheTaxZonesReloadSummaryNoChangesOnReload, typeof(TX.Messages).FullName));
            }

            string resultsText = PXLocalizer.Localize(Messages.TheTaxZonesReloadSummaryBeginning, typeof(TX.Messages).FullName) + Environment.NewLine;

            if (deletedLines.Count > 0)
            {
                string delLineNumbersString = CreateTextToDisplayFromLineNumbers(deletedLines);
                string localizedDeletedInfo = PXMessages.LocalizeFormatNoPrefixNLA(Messages.TheTaxZonesReloadSummaryDeletedLinesFormat,
                                                                                   delLineNumbersString);

                resultsText += Environment.NewLine + localizedDeletedInfo;
            }

            if (addedLines.Count > 0)
            {
                string addedLineNumbersString = CreateTextToDisplayFromLineNumbers(addedLines);
                string localizedAddedInfo     = PXMessages.LocalizeFormatNoPrefixNLA(Messages.TheTaxZonesReloadSummaryCreatedLinesFormat,
                                                                                     addedLineNumbersString);

                resultsText += Environment.NewLine + localizedAddedInfo;
            }

            return(resultsText);
        }
Пример #4
0
        public virtual void ValidateProjectAndProjectTask(EPExpenseClaimDetails info)
        {
            if (info != null)
            {
                string errProjectMsg = PXUIFieldAttribute.GetError <EPExpenseClaimDetails.contractID>(ClaimDetails.Cache, info);
                if (!string.IsNullOrEmpty(errProjectMsg) && errProjectMsg.Equals(PXLocalizer.Localize(PM.Messages.ProjectExpired)))
                {
                    PXUIFieldAttribute.SetError <EPExpenseClaimDetails.contractID>(ClaimDetails.Cache, info, null);
                }

                if (info.ContractID != null)
                {
                    PMProject project = PXSelect <PMProject, Where <PMProject.contractID, Equal <Required <EPExpenseClaimDetails.contractID> > > > .SelectWindowed(this, 0, 1, info.ContractID);

                    if (project != null && project.ExpireDate != null && info.ExpenseDate != null)
                    {
                        if (info.ExpenseDate > project.ExpireDate)
                        {
                            ClaimDetails.Cache.RaiseExceptionHandling <EPExpenseClaimDetails.contractID>(
                                info, info.ContractID,
                                new PXSetPropertyException(
                                    PM.Messages.ProjectExpired,
                                    PXErrorLevel.Warning));
                        }
                    }
                }

                string errProjTaskMsg = PXUIFieldAttribute.GetError <EPExpenseClaimDetails.taskID>(ClaimDetails.Cache, info);
                if (!string.IsNullOrEmpty(errProjTaskMsg) && (errProjTaskMsg.Equals(PXLocalizer.Localize(PM.Messages.ProjectTaskExpired)) ||
                                                              errProjTaskMsg.Equals(PXLocalizer.Localize(PM.Messages.TaskIsCompleted))))
                {
                    PXUIFieldAttribute.SetError <EPExpenseClaimDetails.taskID>(ClaimDetails.Cache, info, null);
                }

                if (info.TaskID != null)
                {
                    PMTask projectTask = PXSelect <PMTask, Where <PMTask.taskID, Equal <Required <EPExpenseClaimDetails.taskID> > > > .SelectWindowed(this, 0, 1, info.TaskID);

                    if (projectTask != null && projectTask.EndDate != null && info.ExpenseDate != null)
                    {
                        if (info.ExpenseDate > projectTask.EndDate && projectTask.Status != ProjectTaskStatus.Completed)
                        {
                            ClaimDetails.Cache.RaiseExceptionHandling <EPExpenseClaimDetails.taskID>(
                                info, info.TaskID,
                                new PXSetPropertyException(
                                    PM.Messages.ProjectTaskExpired,
                                    PXErrorLevel.Warning));
                        }
                        else if (projectTask.Status == ProjectTaskStatus.Completed)
                        {
                            ClaimDetails.Cache.RaiseExceptionHandling <EPExpenseClaimDetails.taskID>(
                                info, info.TaskID,
                                new PXSetPropertyException(
                                    PM.Messages.TaskIsCompleted,
                                    PXErrorLevel.Warning));
                        }
                    }
                }
            }
        }
Пример #5
0
        public virtual void InsertDefaultProject(PMSetup row)
        {
            PMProject rec = new PMProject();

            rec.CustomerID  = null;
            rec.ContractCD  = row.NonProjectCode;
            rec.Description = PXLocalizer.Localize(Messages.NonProjectDescription);
            PXDBLocalizableStringAttribute.SetTranslationsFromMessage <PMProject.description>
                (Caches[typeof(PMProject)], rec, Messages.NonProjectDescription);
            rec.StartDate       = new DateTime(DateTime.Now.Year, 1, 1);
            rec.CuryID          = Company.Current.BaseCuryID;
            rec.IsActive        = true;
            rec.Status          = ProjectStatus.Active;
            rec.ServiceActivate = false;
            rec.VisibleInAP     = true;
            rec.VisibleInAR     = true;
            rec.VisibleInCA     = true;
            rec.VisibleInCR     = true;
            rec.VisibleInEA     = true;
            rec.VisibleInGL     = true;
            rec.VisibleInIN     = true;
            rec.VisibleInPO     = true;
            rec.VisibleInSO     = true;
            rec.VisibleInTA     = true;
            rec = DefaultProject.Insert(rec);
        }
            protected override void TotalFieldSelecting(PXCache s, PXFieldSelectingEventArgs e, string fieldName)
            {
                var matrix = (EntryMatrix)e.Row;

                var state = PXDecimalState.CreateInstance(e.ReturnState, _precision.Value, fieldName, false, 0, 0m, null);

                e.ReturnState = state;
                state.Enabled = false;

                state.DisplayName = PXLocalizer.Localize(Messages.TotalQty);

                var anyMatrixRow = matrix ?? GetFirstMatrixRow();

                if (anyMatrixRow?.ColAttributeValueDescrs?.Length > 0)
                {
                    state.Visibility = PXUIVisibility.Visible;
                    state.Visible    = true;
                }
                else
                {
                    state.Visibility = PXUIVisibility.Invisible;
                    state.Visible    = false;
                }

                decimal sum = 0;

                for (int columnIndex = 0; columnIndex < matrix?.Quantities?.Length; columnIndex++)
                {
                    sum += (matrix.Quantities[columnIndex] ?? 0m);
                }

                e.ReturnValue = sum;
            }
Пример #7
0
 /// <param name="financialPeriodId">
 /// The financial period ID in the internal representation.
 /// It will automatically be formatted for display in the error message.
 /// </param>
 public FinancialPeriodWithIdNotFoundException(string financialPeriodId)
     : base(string.IsNullOrEmpty(financialPeriodId)
                         ? Messages.NoPeriodsDefined
                         : PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodWithId, FinPeriodIDAttribute.FormatForError(financialPeriodId)))
 {
     FinancialPeriodId = financialPeriodId;
 }
Пример #8
0
        protected override void FillInventoryMatrixItem(EntryMatrix newRow, int colAttributeIndex, InventoryMapValue inventoryValue)
        {
            if (inventoryValue?.InventoryID == null)
            {
                return;
            }
            var item = InventoryItem.PK.Find(Base, inventoryValue.InventoryID);

            if (!IsItemStatusDisabled(item))
            {
                newRow.InventoryIDs[colAttributeIndex] = inventoryValue.InventoryID;

                try
                {
                    newRow.Quantities[colAttributeIndex] = GetQty(Header.Current.SiteID, inventoryValue.InventoryID);
                }
                catch (PXSetPropertyException exception)
                {
                    newRow.InventoryIDs[colAttributeIndex] = null;
                    newRow.Errors[colAttributeIndex]       = exception.Message;
                }
            }
            else
            {
                string label = PXStringListAttribute.GetLocalizedLabel <InventoryItem.itemStatus>(Base.Caches <InventoryItem>(), item);
                newRow.Errors[colAttributeIndex] = PXLocalizer.LocalizeFormat(Messages.InventoryItemIsInStatus, label);
            }
        }
Пример #9
0
        protected override EntryMatrix GenerateTotalRow(IEnumerable <EntryMatrix> rows)
        {
            bool rowsExist = false;
            var  totalRow  = (EntryMatrix)Matrix.Cache.CreateInstance();

            foreach (EntryMatrix row in Matrix.Cache.Cached)
            {
                rowsExist = true;

                if (totalRow.Quantities == null)
                {
                    totalRow.Quantities = new decimal?[row.Quantities.Length];
                }

                for (int columnIndex = 0; columnIndex < row.Quantities.Length; columnIndex++)
                {
                    totalRow.Quantities[columnIndex]  = totalRow.Quantities[columnIndex] ?? 0m;
                    totalRow.Quantities[columnIndex] += row.InventoryIDs[columnIndex] != null ? row.Quantities[columnIndex] : 0m;
                }
            }

            totalRow.RowAttributeValueDescr = PXLocalizer.Localize(Messages.TotalQty);
            totalRow.IsTotal = true;
            totalRow.LineNbr = int.MaxValue;

            return(rowsExist ? totalRow : null);
        }
 protected virtual void PerformAction(List <Contact> list)
 {
     if (Operations.Current.Action == REMOVE_ACTION)
     {
         if (MailLists.Current != null &&
             Operations.Ask(
                 Messages.AskConfirmation,
                 string.Format(PXLocalizer.Localize(Messages.ConfirmRemoving, typeof(Messages).ToString()), list.Count),
                 MessageButtons.YesNoCancel) == WebDialogResult.Yes)
         {
             try
             {
                 foreach (Contact item in list)
                 {
                     if (item.Selected == true)
                     {
                         var newItem = (CRMarketingListMember)MailRecipients.Cache.CreateInstance();
                         newItem.MarketingListID = MailLists.Current.MarketingListID;
                         newItem.ContactID       = item.ContactID;
                         MailRecipients.Cache.Delete(newItem);
                     }
                 }
                 Save.Press();
                 MailRecipients.Cache.Clear();
             }
             finally
             {
                 MailRecipients.Cache.Clear();
             }
         }
     }
     else
     {
         if (MailLists.Current != null)
         {
             try
             {
                 foreach (Contact item in list)
                 {
                     if (item.Selected == true)
                     {
                         var newItem = (CRMarketingListMember)MailRecipients.Cache.CreateInstance();
                         newItem.MarketingListID = MailLists.Current.MarketingListID;
                         newItem.ContactID       = item.ContactID;
                         MailRecipients.Cache.Insert(newItem);
                     }
                 }
                 Save.Press();
                 FilteredItems.Cache.Clear();
             }
             finally
             {
                 MailRecipients.Cache.Clear();
             }
         }
     }
     this.MailRecipients.View.RequestRefresh();
 }
Пример #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IEnumerable <TraceItem> errors = TraceMaint.GetTrace().Reverse();

        DrawTable(placeholder, errors);

        lblVersion.Text = PX.Data.PXVersionInfo.Version;
        String cust = Customization.CstWebsiteStorage.PublishedProjectList;

        lblCustomization.Text = String.IsNullOrEmpty(cust) ? PXLocalizer.Localize(Messages.None, typeof(Messages).FullName) : cust;
    }
Пример #12
0
 private static void CheckBqlField(Type field, string argumentName)
 {
     if (field == null)
     {
         throw new ArgumentNullException(argumentName);
     }
     if (!typeof(IBqlField).IsAssignableFrom(field))
     {
         throw new ArgumentException(PXLocalizer.LocalizeFormat(ErrorMessages.InvalidIBqlField, field.FullName), argumentName);
     }
 }
        public string PXLocalizerAll()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXLocalizer.Localize(NonLocalizableMessages.CommasInUserName);
            localizedString = PXLocalizer.Localize(NonLocalizableMessages.CommasInUserName, typeof(NonLocalizableMessages).FullName);
            localizedString = PXLocalizer.LocalizeFormat(NonLocalizableMessages.StringToFormat, parameter);
            localizedString = PXLocalizer.LocalizeFormatWithKey(NonLocalizableMessages.StringToFormat, typeof(NonLocalizableMessages).FullName, parameter);

            return(localizedString);
        }
        public string PXLocalizerAll()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXLocalizer.Localize("Hardcoded String");
            localizedString = PXLocalizer.Localize("Hardcoded String", typeof(MyMessages).FullName);
            localizedString = PXLocalizer.LocalizeFormat("Hardcoded String To Format {0}", parameter);
            localizedString = PXLocalizer.LocalizeFormatWithKey("Hardcoded String To Format {0}", typeof(MyMessages).FullName, parameter);

            return(localizedString);
        }
Пример #15
0
        public virtual void dataSourceFieldSelecting(PXFieldSelectingEventArgs e, string field)
        {
            RMReport     report     = (RMReport)e.Row;
            RMDataSource dataSource = report != null?Base.DataSourceByID.Select(report.DataSourceID) : null;

            if (dataSource == null)
            {
                object defValue;
                if (Base.DataSourceByID.Cache.RaiseFieldDefaulting(field, null, out defValue))
                {
                    Base.DataSourceByID.Cache.RaiseFieldUpdating(field, null, ref defValue);
                }
                Base.DataSourceByID.Cache.RaiseFieldSelecting(field, null, ref defValue, true);
                e.ReturnState = defValue;
            }
            else
            {
                e.ReturnState = Base.DataSourceByID.Cache.GetStateExt(dataSource, field);
            }

            //Fix AmountType Combo for PM:
            if (report != null && report.Type == RMType.PM && field.Equals(typeof(RMDataSource.amountType).Name, StringComparison.InvariantCultureIgnoreCase))
            {
                e.ReturnState = PXIntState.CreateInstance(e.ReturnValue, field, false, 0, null, null,
                                                          new int[] { BalanceType.NotSet, BalanceType.Amount, BalanceType.Quantity, BalanceType.TurnoverAmount, BalanceType.TurnoverQuantity, BalanceType.BudgetAmount, BalanceType.BudgetQuantity, BalanceType.RevisedAmount, BalanceType.RevisedQuantity, BalanceType.BudgetPTDAmount, BalanceType.BudgetPTDQuantity, BalanceType.RevisedPTDAmount, BalanceType.RevisedPTDQuantity },
                                                          new string[]
                {
                    PXLocalizer.Localize(Messages.NotSet, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.Amount, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.Quantity, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.AmountTurnover, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.QuantityTurnover, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.BudgetAmount, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.BudgetQuantity, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.RevisedAmount, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.RevisedQuantity, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.BudgetPTDAmount, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.BudgetPTDQuantity, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.RevisedPTDAmount, typeof(Messages).FullName),
                    PXLocalizer.Localize(Messages.RevisedPTDQuantity, typeof(Messages).FullName),
                },
                                                          typeof(short), 0);
                ((PXFieldState)e.ReturnState).DisplayName = PXLocalizer.Localize(Messages.AmountType, typeof(Messages).FullName);
            }

            Base1.dataSourceFieldSelecting(e, field);

            if (e.ReturnState is PXFieldState)
            {
                ((PXFieldState)e.ReturnState).SetFieldName("DataSource" + field);
                ((PXFieldState)e.ReturnState).Visible = Base.IsFieldVisible(field, report);
            }
        }
Пример #16
0
        public CampaignMaint()
        {
            PXUIFieldAttribute.SetEnabled <CRCampaign.leadsGenerated>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.leadsConverted>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.contacts>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.responses>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.opportunities>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.closedOpportunities>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.opportunitiesValue>(CampaignCurrent.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <CRCampaign.closedOpportunitiesValue>(CampaignCurrent.Cache, null, false);

            PXUIFieldAttribute.SetRequired <CRCampaign.startDate>(CampaignCurrent.Cache, true);
            PXUIFieldAttribute.SetRequired <CRCampaign.status>(CampaignCurrent.Cache, true);

            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.bAccountID>(CampaignMembers.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.salutation>(CampaignMembers.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.eMail>(CampaignMembers.Cache, null, false);
            PXUIFieldAttribute.SetEnabled <SelCampaignMembers.phone1>(CampaignMembers.Cache, null, false);

            //PXUIFieldAttribute.SetVisible<SelCampaignMembers.title>(CampaignMembers.Cache, null, false);

            var cache = Caches[typeof(Contact)];

            PXDBAttributeAttribute.Activate(cache);
            PXUIFieldAttribute.SetVisible <Contact.title>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.workgroupID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.ownerID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.firstName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.midName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.phone2>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.phone3>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.fax>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.webSite>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.isActive>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.dateOfBirth>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.createdByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.createdDateTime>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastModifiedByID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.lastModifiedDateTime>(cache, null, false);

            PXUIFieldAttribute.SetVisible <Address.addressLine1>(Caches[typeof(Address)], null, false);
            PXUIFieldAttribute.SetVisible <Address.addressLine2>(Caches[typeof(Address)], null, false);

            PXUIFieldAttribute.SetVisible <Contact.classID>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.source>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.fullName>(cache, null, false);
            PXUIFieldAttribute.SetVisible <Contact.status>(cache, null, false);

            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(Caches[typeof(BAccount)], "Customer Name");
            PXUIFieldAttribute.SetDisplayName <Contact.bAccountID>(cache, PXLocalizer.Localize(Messages.ContactBAccountID, typeof(Messages).ToString()));
            PXUIFieldAttribute.SetDisplayName <Contact.status>(cache, PXLocalizer.Localize(Messages.ContactStatus, typeof(Messages).ToString()));
        }
        public string All()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXLocalizer.LocalizeFormat(MyMessages.CommasInUserName, parameter);
            localizedString = PXMessages.LocalizeFormat(MyMessages.CommasInUserName, parameter);
            localizedString = PXMessages.LocalizeFormat(MyMessages.CommasInUserName, out string refix, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix(MyMessages.CommasInUserName, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefixNLA(MyMessages.CommasInUserName, parameter);

            return(localizedString);
        }
 private string[] LocalizeFilterConditionLabels(string[] labels)
 {
     if (labels != null)
     {
         string[] localizedLabels = new string[labels.Length];
         for (int i = 0; i < labels.Length; i++)
         {
             localizedLabels[i] = PXLocalizer.Localize(labels[i], typeof(InfoMessages).FullName);
         }
         return(localizedLabels);
     }
     return(null);
 }
        protected override void PreliminaryFieldSelecting(PXCache s, PXFieldSelectingEventArgs e, string fieldName)
        {
            var matrix = (EntryMatrix)e.Row;
            var ret    = PXFieldState.CreateInstance(e.ReturnState, typeof(bool), fieldName: fieldName);

            ret.Enabled     = AllAdditionalAttributesArePopulated();
            ret.DisplayName = PXLocalizer.Localize(Messages.SelectRow);
            ret.Visibility  = PXUIVisibility.Visible;
            ret.Visible     = true;

            e.ReturnState = ret;
            e.ReturnValue = matrix?.AllSelected;
        }
Пример #20
0
        public string PXLocalizerLocalization()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXLocalizer.Localize(MyMessages.CommasInUserName);
            localizedString = PXLocalizer.Localize(MyMessages.CommasInUserName, typeof(MyMessages).FullName);
            localizedString = PXLocalizer.LocalizeFormat(MyMessages.StringToFormat, parameter);
            localizedString = PXLocalizer.LocalizeFormat(ComplexMessages.DocDiscountExceedLimit, parameter);
            localizedString = PXLocalizer.LocalizeFormatWithKey(MyMessages.StringToFormat, typeof(MyMessages).FullName, parameter);

            return(localizedString);
        }
        public static void OnPublished(USCustomizationPlugin plugin, ref List <Tuple <string, object[]> > errors)
        {
            string companyName = PXAccess.GetCompanyName();

            plugin.WriteLog(PXLocalizer.LocalizeFormatWithKey(USMessages.SomePluginRunning, typeof(USMessages).FullName, companyName));

            //Select an Account that is Active
            PXDataRecord record = PXDatabase.SelectSingle <Account>(new PXDataFieldValue <Account.active>(PXDbType.Bit, true));

            if (record == null)
            {
                errors.Add(new Tuple <string, object[]>(USMessages.NoActiveAccounts, new object[] { companyName }));
            }
        }
 /// <param name="financialPeriodId">
 /// The financial period ID in the internal representation.
 /// It will automatically be formatted for display in the error message.
 /// </param>
 public FinancialPeriodOffsetNotFoundException(string financialPeriodId, int offset)
     : base(string.IsNullOrEmpty(financialPeriodId)
                         ? Messages.NoPeriodsDefined
                         : offset == 0
                                 ? PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodWithId, FinPeriodIDAttribute.FormatForError(financialPeriodId))
                                 : offset == -1
                                         ? PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodBefore, FinPeriodIDAttribute.FormatForError(financialPeriodId))
                                         : offset == 1
                                                 ? PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodAfter, FinPeriodIDAttribute.FormatForError(financialPeriodId))
                                                 : PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodForOffset, Math.Abs(offset), FinPeriodIDAttribute.FormatForError(financialPeriodId)))
 {
     FinancialPeriodId = financialPeriodId;
     Offset            = offset;
 }
        protected override EntryMatrix GeneratePreliminaryRow(IEnumerable <EntryMatrix> rows)
        {
            var preliminaryRow = (EntryMatrix)Matrix.Cache.CreateInstance();

            preliminaryRow.RowAttributeValueDescr = PXLocalizer.Localize(Messages.SelectColumn);
            preliminaryRow.IsPreliminary          = true;
            preliminaryRow.LineNbr = -1;
            var firstRow = rows.FirstOrDefault();

            preliminaryRow.Selected     = new bool?[firstRow?.InventoryIDs.Length ?? 0];
            preliminaryRow.InventoryIDs = new int?[firstRow?.InventoryIDs.Length ?? 0];

            return(preliminaryRow);
        }
Пример #24
0
        private void HandleExceptions(List <Tuple <string, object[]> > errors)
        {
            if (errors.Count != 0)
            {
                //Normally you shouldn't localize Exceptions, but this code generates an amalgamation of errors.
                StringBuilder builder = new StringBuilder(PXLocalizer.Localize(USMessages.MainError, typeof(USMessages).FullName));

                foreach (Tuple <string, object[]> error in errors)
                {
                    builder.AppendLine(PXLocalizer.LocalizeFormatWithKey(error.Item1, typeof(USMessages).FullName, error.Item2));
                }

                throw new PXException(builder.ToString());
            }
        }
        public CRMarketingListMaint()
        {
            var contactCache = Caches[typeof(Contact)];

            PXUIFieldAttribute.SetDisplayName <Contact.fullName>(contactCache, PXLocalizer.Localize(Messages.ContactFullName, typeof(Messages).ToString()));
            PXDBAttributeAttribute.Activate(FilteredItems.Cache);

            var parentBAccountCache = Caches[typeof(BAccount)];

            parentBAccountCache.DisplayName = Messages.ParentAccount;
            PXUIFieldAttribute.SetDisplayName <BAccount.acctCD>(parentBAccountCache, PXLocalizer.Localize(Messages.BAccountAcctCD, typeof(Messages).ToString()));
            PXUIFieldAttribute.SetDisplayName <BAccount.acctName>(parentBAccountCache, Messages.ParentAccountNameShort);
            PXDBAttributeAttribute.Activate(parentBAccountCache);

            PXUIFieldAttribute.SetVisible <CRMarketingListMember.marketingListID>(MailRecipients.Cache, null, false);
        }
Пример #26
0
        private string ReloadTaxReportLinesForTaxZonesInternalAndPrepareChangesDescription()
        {
            VendorMaster vendor = taxReportGraph?.TaxVendor.Current;

            if (vendor == null)
            {
                return(null);
            }

            Dictionary <int, TaxReportLine> templateLinesByLineNumber =
                PXSelect <TaxReportLine,
                          Where <TaxReportLine.vendorID, Equal <Required <VendorMaster.bAccountID> >,
                                 And <TaxReportLine.tempLineNbr, IsNull,
                                      And <TaxReportLine.tempLine, Equal <True> > > > >
                .Select(taxReportGraph, vendor.BAccountID)
                .RowCast <TaxReportLine>()
                .ToDictionary(line => line.LineNbr.Value);

            if (templateLinesByLineNumber.Count == 0)
            {
                return(PXLocalizer.Localize(Messages.NoLinesByTaxZone, typeof(TX.Messages).FullName));
            }

            Dictionary <string, TaxZone> zonesInSystem = PXSelect <TaxZone> .Select(taxReportGraph)
                                                         .RowCast <TaxZone>()
                                                         .ToDictionary(zone => zone.TaxZoneID);

            ILookup <int, TaxReportLine> detailLinesByTemplateLineNumber =
                PXSelect <TaxReportLine,
                          Where <TaxReportLine.vendorID, Equal <Required <VendorMaster.bAccountID> >,
                                 And <TaxReportLine.tempLineNbr, IsNotNull> > >
                .Select(taxReportGraph, vendor.BAccountID)
                .RowCast <TaxReportLine>()
                .ToLookup(line => line.TempLineNbr.Value);


            List <TaxReportLine> deletedLines = DeleteChildTaxLinesForOldZones(zonesInSystem, detailLinesByTemplateLineNumber);
            List <TaxReportLine> addedLines   = GenerateChildTaxLinesForMissingZones(templateLinesByLineNumber, zonesInSystem,
                                                                                     detailLinesByTemplateLineNumber);

            return(GetTextFromReloadTaxZonesResult(addedLines, deletedLines));
        }
Пример #27
0
        public string All()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXLocalizer.Localize(MyMessages.CommasInUserName + MyMessages.SomeString);
            localizedString = PXLocalizer.Localize(string.Format(MyMessages.StringToFormat, parameter), typeof(MyMessages).FullName);
            localizedString = PXLocalizer.LocalizeFormat(String.Concat(MyMessages.CommasInUserName, MyMessages.SomeString), parameter);

            localizedString = PXMessages.Localize(MyMessages.CommasInUserName + "123");
            localizedString = PXMessages.Localize(string.Format(MyMessages.StringToFormat, 123), out string strPrefix);
            localizedString = PXMessages.LocalizeNoPrefix(string.Concat(MyMessages.CommasInUserName, "123"));

            localizedString = PXMessages.LocalizeFormat(MyMessages.StringToFormat + "456", parameter);
            localizedString = PXMessages.LocalizeFormat(string.Format(MyMessages.StringToFormat, parameter), out string prefix, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix(string.Concat(MyMessages.StringToFormat, "456"), parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefixNLA(string.Concat(MyMessages.StringToFormat, "456", "789"), parameter);

            return(localizedString);
        }
        private void ChangeDisplayName(PXCache cache, SOOrder row)
        {
            if (cache == null)
            {
                PXArgumentException e = new PXArgumentException(nameof(cache), "incorrect PXCache value");

                throw e;
            }

            if (row == null)
            {
                throw new PXArgumentException(nameof(row), "incorrect SOOrder value");
            }

            string newDisplayName = null;

            if (row.OrderNbr.Equals(SOOrderExt.SpecialOrderNbr, StringComparison.Ordinal))
            {
                newDisplayName = PXLocalizer.Localize("Special Text");
            }
            else if (row.OrderNbr.Equals(SOOrderExt.SpecialOrderNbr2, StringComparison.Ordinal))
            {
                newDisplayName = PXLocalizer.Localize(Messages.SpecialText, typeof(Messages).FullName);
            }
            else if (row.OrderNbr.Equals(SOOrderExt.SpecialOrderNbr3, StringComparison.Ordinal))
            {
                newDisplayName = PXLocalizer.LocalizeFormat(SOOrderExt.SpecialOrderNbr3, row.OrderNbr);
            }
            else if (row.OrderNbr.Equals(SOOrderExt.SpecialOrderNbr4, StringComparison.Ordinal))
            {
                newDisplayName = PXLocalizer.Localize(string.Format(Messages.SpecialTextToFormat, row.OrderNbr));
            }

            if (string.IsNullOrEmpty(newDisplayName))
            {
                return;
            }

            PXUIFieldAttribute.SetDisplayName <SOOrderExt.customText>(cache, newDisplayName);
        }
        public virtual void BoxUserTokens_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            var user = (BoxUserTokens)e.Row;

            if (string.IsNullOrEmpty(user.BoxUserID))
            {
                user.UserStatus = PXLocalizer.Localize(Messages.NotConfigured);
            }
            else
            {
                if (string.IsNullOrEmpty(user.AccessToken))
                {
                    user.UserStatus = PXLocalizer.Localize(Messages.Expired);
                }
                else
                {
                    user.UserStatus = PXLocalizer.Localize(Messages.Configured);
                }
            }

            Save.SetVisible(false);
        }
        private static string GetMessage(string financialPeriodId, int offset)
        {
            if (string.IsNullOrEmpty(financialPeriodId))
            {
                return(Messages.NoPeriodsDefined);
            }
            else
            {
                switch (offset)
                {
                case 0: return(PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodWithId, FinPeriodIDAttribute.FormatForError(financialPeriodId)));

                case -1: return(PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodBefore, FinPeriodIDAttribute.FormatForError(financialPeriodId)));

                case 1: return(PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodAfter, FinPeriodIDAttribute.FormatForError(financialPeriodId)));

                default: return(PXLocalizer.LocalizeFormat(Messages.NoFinancialPeriodForOffset,
                                                           Math.Abs(offset),
                                                           offset > 0 ? Messages.AfterLowercase : Messages.BeforeLowercase,
                                                           FinPeriodIDAttribute.FormatForError(financialPeriodId)));
                }
            }
        }