Source

main-vinayFork / Source / WebService / Web.Common / Constants.cs

using System;
using System.Configuration;
using Microsoft.WindowsAzure.StorageClient;

namespace DataUp.Web.Common
{
    /// <summary>
    /// Class representing all the constants used across the applications..
    /// </summary>
    public static class Constants
    {
        /// <summary>
        /// Config setting name for getting the azure connection string.
        /// </summary>
        public const string StorageSettingName = "DCXLStorage";

        /// <summary>
        /// Path separator for azure folders.
        /// </summary>
        public const string PathSeparator = "/";

        /// <summary>
        /// Default Mime Type for blobs.
        /// </summary>
        public const string DefaultMimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";

        /// <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>
        /// Date formate
        /// </summary>
        public const string Dateformate = "yyyy-MM-dd";

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

        public const string AP = @"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties";
        public const string DC = @"http://purl.org/dc/elements/1.1/";
        public const string CP = @"http://schemas.openxmlformats.org/package/2006/metadata/core-properties";

        /// <summary>
        /// Timeout for azure retry policy.
        /// </summary>
        public static readonly TimeSpan Timeout = TimeSpan.FromSeconds(30);

        /// <summary>
        /// Gets Container name for files in azure.
        /// </summary>
        public static string ContainerName
        {
            get
            {
                return ConfigReader<string>.GetSetting("PrimaryContainer");
            }
        }

        /// <summary>
        /// Gets Retry policy for azure connections.
        /// </summary>
        public static RetryPolicy DefaultRetryPolicy
        {
            get
            {
                return RetryPolicies.Retry(3, TimeSpan.FromSeconds(1));
            }
        }

        /// <summary>
        /// Gets the number of times we need to retry for sending mails.
        /// </summary>
        public static int RetryCount
        {
            get
            {
                int retryCount = 3;
                if (int.TryParse(ConfigurationManager.AppSettings["RetryCount"], out retryCount))
                {
                    // Dummy call
                }

                return retryCount;
            }
        }

        /// <summary>
        /// Gets indicating whether we need to upload files to azure or not.
        /// </summary>
        public static bool UploadToAzure
        {
            get
            {
                return ConfigReader<bool>.GetSetting("UploadToAzure");
            }
        }

        public static string SpecialCharacter
        {
            get
            {
                return ConfigReader<string>.GetSetting("Reg");

            }
        }
        public static string SpecialCharKeySequence
        {
            get
            {
                return ConfigReader<string>.GetSetting("Reg2");
            }
        }

        /// <summary>
        /// Gets MetadataXmlPath.
        /// </summary>
        public static string MetadataXmlPath
        {
            get
            {
                return ConfigReader<string>.GetSetting("MetadataXmlPath");
            }
        }

        /// <summary>
        /// Gets DcxlWebServiceLink.
        /// </summary>
        public static string DcxlWebServiceLink
        {
            get
            {
                return ConfigReader<string>.GetSetting("DcxlWebServiceLink");
            }
        }

        /// <summary>
        /// Gets PostFileTimeOutMinutes.
        /// </summary>
        public static int PostFileTimeOutMinutes
        {
            get
            {
                return ConfigReader<int>.GetSetting("PostFileTimeOutMinutes", 60);
            }
        }
    }
}