Exemplo n.º 1
0
        public async Task <IField> AddCurrencyAsync(string title, FieldCurrencyOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(await AddFieldAsync(FieldCurrencyOptionsToCreation(title, options)).ConfigureAwait(false));
        }
Exemplo n.º 2
0
        private static FieldCreationOptions FieldCurrencyOptionsToCreation(string title, FieldCurrencyOptions options)
        {
            FieldCreationOptions creationOptions = new FieldCreationOptions(FieldType.Currency);

            creationOptions.ImportFromCommonFieldOptions(title, options);
            if (options.Decimals.HasValue)
            {
                creationOptions.SetAttribute("Decimals", options.Decimals.ToString().ToUpper());
            }
            if (options.CurrencyLocaleId.HasValue)
            {
                creationOptions.SetAttribute("LCID", options.CurrencyLocaleId.ToString().ToUpper());
            }
            return(creationOptions);
        }
Exemplo n.º 3
0
 public IField AddCurrency(string title, FieldCurrencyOptions options)
 {
     return(AddCurrencyAsync(title, options).GetAwaiter().GetResult());
 }
Exemplo n.º 4
0
 public IField AddCurrencyBatch(Batch batch, string title, FieldCurrencyOptions options)
 {
     return(AddCurrencyBatchAsync(batch, title, options).GetAwaiter().GetResult());
 }
Exemplo n.º 5
0
 public async Task <IField> AddCurrencyBatchAsync(string title, FieldCurrencyOptions options)
 {
     return(await AddCurrencyBatchAsync(PnPContext.CurrentBatch, title, options).ConfigureAwait(false));
 }