Source

main / Source / Excel / Excel.Common / Constants.cs

Full commit
Naethra D ba1cb57 














































































Naethra D db09f1b 
Naethra D ba1cb57 



































































































































using System;
using System.Configuration;
using System.Globalization;

namespace DataUp.Excel.Common
{
    /// <summary>
    /// Constants class
    /// </summary>
    public static class Constants
    {
        /// <summary>
        /// The application registry path.
        /// </summary>
        public const string AppRegistryPath = "Software\\Microsoft\\Office\\Excel\\Addins\\DataUp.Addin";

        /// <summary>
        /// The application registry key.
        /// </summary>
        public const string AppRegistryKey = "Manifest";

        /// <summary>
        /// Metadata sheet name
        /// </summary>
        public const string MetadataSheetName = "Metadata";

        /// <summary>
        /// Metadata Range name
        /// </summary>
        public const string MetadataRangeName = "MetadataRange";

        /// <summary>
        ///parameter Metadata Range name
        /// </summary>
        public const string ParaMetadataRangeName = "ParaMetadataRange";

        /// <summary>
        /// Metadata Table Style Name
        /// </summary>
        public const string MetadataTableStyleName = "TableStyleMedium9";

        /// <summary>
        /// Citation Field Name
        /// </summary>
        public const string CitationContent = "Citation";

        /// <summary>
        /// Citation format
        /// </summary>
        public const string CitationFormat = "{0} ({1}) : {2}. {3}. {4}. {5}";

        /// <summary>
        /// Default Date format supported.
        /// </summary>
        public const string DefaultDateFormat = "yyyy-MM-dd";

        /// <summary>
        /// Identifier Field Name
        /// </summary>
        public const string IdentifierKeyName = "Identifier";

        /// <summary>
        /// Regular expression for validating email address.
        /// </summary>
        public const string ValidateEmail = @"^([A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)+$";

        /// <summary>
        /// Regular expression for validating Phone.
        /// </summary>
        public const string ValidatePhone = @"^[0-9+-.()]+$";

        /// <summary>
        /// Identifier Field Name
        /// </summary>
        public const string HttpAddress = "^(http|https)://";

        /// <summary>
        /// IParameterMetadataType
        /// </summary>
        public const string ParameterMetadataType = "Text,Numeric,Datetime";

        /// <summary>
        /// MaxErrorCount
        /// </summary>
        public const int MaxErrorCount = 10;

        /// <summary>
        /// Gets MetadataXmlPath.
        /// </summary>
        public static string MetadataXmlPath
        {
            get
            {
                return ConfigurationManager.AppSettings["MetadataXmlPath"];
            }
        }

        /// <summary>
        /// Gets StandardUnitsPath.
        /// </summary>
        public static string StandardUnitsPath
        {
            get
            {
                return ConfigurationManager.AppSettings["StandardUnitsPath"];
            }
        }

        /// <summary>
        /// Gets CitationXmlPath.
        /// </summary>
        public static string CitationXmlPath
        {
            get
            {
                return ConfigurationManager.AppSettings["CitationXmlPath"];
            }
        }

        /// <summary>
        /// Gets the special character regex from app config.
        /// </summary>
        public static string SpecialCharacter
        {
            get
            {
                return ConfigurationManager.AppSettings["Reg"];
            }
        }

        /// <summary>
        /// Gets the special character key sequence  regex from app config.
        /// </summary>
        public static string SpecialCharKeySequence
        {
            get
            {
                return ConfigurationManager.AppSettings["Reg2"];
            }
        }

        /// <summary>
        /// Gets dataup  Web Service Link.
        /// </summary>
        public static string DcxlWebServiceLink
        {
            get
            {
                return ConfigurationManager.AppSettings["DcxlWebServiceLink"];
            }
        }

        /// <summary>
        /// Gets Post file timeOut in minutes.
        /// </summary>
        public static int PostFileTimeOutMinutes
        {
            get
            {
                int defaultValue = 100;
                try
                {
                    string settingValue = string.Empty;
                    settingValue = ConfigurationManager.AppSettings["PostFileTimeOutMinutes"];
                    if (!string.IsNullOrEmpty(settingValue))
                    {
                        return (int)Convert.ChangeType(settingValue, typeof(int), CultureInfo.InvariantCulture);
                    }
                }
                catch
                {
                    // -
                    // Swallow the exception to return a default value
                    // -
                }

                return defaultValue;
            }
        }

        /// <summary>
        /// Gets dataup Demo Video Link.
        /// </summary>
        public static string DemoVideoLink
        {
            get
            {
                return ConfigurationManager.AppSettings["DemoVideoLink"];
            }
        }
        /// <summary>
        /// Gets Profile string value for GetIdentifier request
        /// </summary>
        public static string GetIdentifierProfile
        {
            get
            {
                return ConfigurationManager.AppSettings["Profile_Identifier"];
            }
        }

        /// <summary>
        /// Gets Profile string value for Post request
        /// </summary>
        public static string GetPostProfile
        {
            get
            {
                return ConfigurationManager.AppSettings["Profile_Post"];
            }
        }
    }
}