public virtual void Localize() { var localizer = _form.Resources; string description; string[] terms; if (localizer.Lookup(_name + nameof(_description), out description)) { _description = new DescribeAttribute(description); } if (localizer.LookupValues(_name + nameof(_terms), out terms)) { _terms = new TermsAttribute(terms); } localizer.LookupDictionary(_name + nameof(_valueDescriptions), _valueDescriptions); localizer.LookupDictionary(_name + nameof(_valueTerms), _valueTerms); string[] patterns; if (localizer.LookupValues(_name + nameof(_promptDefinition), out patterns)) { _promptDefinition.Patterns = patterns; } localizer.LookupTemplates(_name, _templates); if (!_promptSet) { _promptDefinition = null; } _prompt = null; _recognizer = null; if (_define == null) { DefinePrompt(); DefineRecognizer(); } }
protected void ProcessFieldAttributes(object step) { _optional = false; if (!_ignoreAnnotations) { var field = step as FieldInfo; var prop = step as PropertyInfo; var name = (field == null ? prop.Name : field.Name); var describe = (field == null ? prop.GetCustomAttribute <DescribeAttribute>() : field.GetCustomAttribute <DescribeAttribute>()); var terms = (field == null ? prop.GetCustomAttribute <TermsAttribute>() : field.GetCustomAttribute <TermsAttribute>()); var prompt = (field == null ? prop.GetCustomAttribute <PromptAttribute>() : field.GetCustomAttribute <PromptAttribute>()); var optional = (field == null ? prop.GetCustomAttribute <OptionalAttribute>() : field.GetCustomAttribute <OptionalAttribute>()); var numeric = (field == null ? prop.GetCustomAttribute <NumericAttribute>() : field.GetCustomAttribute <NumericAttribute>()); var pattern = (field == null ? prop.GetCustomAttribute <PatternAttribute>() : field.GetCustomAttribute <PatternAttribute>()); if (describe != null) { _description = describe; } else { _description = new DescribeAttribute(Language.CamelCase(name)); } if (terms != null) { _terms = terms; } else { _terms = new TermsAttribute(Language.GenerateTerms((string.IsNullOrWhiteSpace(_description.Description) ? Language.CamelCase(name) : _description.Description), 3)); } if (prompt != null) { SetPrompt(prompt); } if (numeric != null) { double oldMin, oldMax; Limits(out oldMin, out oldMax); SetLimits(numeric.Min, numeric.Max, numeric.Min != oldMin || numeric.Max != oldMax); } if (pattern != null) { SetPattern(pattern.Pattern); } _optional = (optional != null); foreach (var attribute in (field == null ? prop.GetCustomAttributes <TemplateAttribute>() : field.GetCustomAttributes <TemplateAttribute>())) { var template = (TemplateAttribute)attribute; AddTemplate(template); } } }
public void LookupDictionary(string prefix, IDictionary <object, TermsAttribute> dictionary) { foreach (var key in dictionary.Keys.ToArray()) { string skey; if (key.GetType().IsEnum) { skey = key.GetType().Name + "." + key; } else { skey = prefix + SEPARATOR + key; } string[] values; if (_arrayTranslations.TryGetValue(skey, out values)) { dictionary[key] = new TermsAttribute(values); } } }
public void InvoicePOReceipt( POReceipt receipt, DocumentList <APInvoice> list, bool saveAndAdd, bool usePOParemeters, bool keepOrderTaxes, bool errorIfUnreleasedAPExists, APInvoiceEntry_Extension.InvoicePOReceiptDel baseMetod) { baseMetod(receipt, list, saveAndAdd, usePOParemeters, keepOrderTaxes, errorIfUnreleasedAPExists); bool?autoCreateInvoice = receipt.AutoCreateInvoice; bool flag = true; if (!(autoCreateInvoice.GetValueOrDefault() == flag & autoCreateInvoice.HasValue)) { return; } DateTime?dueDate; TermsAttribute.CalcTermsDates(SelectFrom <Terms> .Where <Terms.termsID.IsEqual <APInvoice.termsID.FromCurrent> > .View.Select((PXGraph)this.Base), receipt.GetExtension <POReceiptExt>().UsrSuppInvDate, out dueDate, out DateTime? _); this.Base.CurrentDocument.SetValueExt <APInvoice.dueDate>(this.Base.CurrentDocument.Current, (object)dueDate); }
protected virtual void RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { if (!PXAccess.FeatureInstalled <FeaturesSet.vATReporting>() || e.Row == null) { return; } string termsID = (string)sender.GetValue <TermsID>(e.Row); Terms terms = TermsAttribute.SelectTerms(sender.Graph, termsID); if (terms?.InstallmentType == TermsInstallmentType.Multiple) { foreach (PXResult <InvoiceTaxTran, Tax> taxtran in View.SelectMulti()) { Tax tax = taxtran; if (tax?.PendingTax == true) { sender.RaiseExceptionHandling <TermsID>(e.Row, termsID, new PXSetPropertyException(Messages.MultInstallmentTermsWithSVAT)); break; } } } }
/// <summary> Adds terms for a value. </summary> /// <param name="value"> The value. </param> /// <param name="terms"> The terms. </param> /// <returns> A <see cref="Field{T}"/>. </returns> public Field <T> AddTerms(object value, params string[] terms) { _valueTerms[value] = new TermsAttribute(terms); return(this); }
/// <summary> Set the terms associated with the field. </summary> /// <param name="terms"> The terms. </param> /// <returns> A <see cref="Field{T}"/>. </returns> public Field <T> SetFieldTerms(params string[] terms) { _terms = new TermsAttribute(terms); return(this); }
/// <summary> Adds terms for a value. </summary> /// <param name="value"> The value. </param> /// <param name="terms"> The terms to add. </param> /// <returns> A <see cref="Field{T}"/>. </returns> public Field <T> AddTerms(object value, TermsAttribute terms) { _valueTerms[value] = terms; return(this); }
public void LookupDictionary(string prefix, IDictionary<object, TermsAttribute> dictionary) { foreach (var key in dictionary.Keys.ToArray()) { string skey; if (key.GetType().IsEnum) { skey = key.GetType().Name + "." + key; } else { skey = prefix + SEPARATOR + key; } string[] values; if (_arrayTranslations.TryGetValue(skey, out values)) { dictionary[key] = new TermsAttribute(values); } } }