Example #1
0
        public JsonResult CheckDuplicateConfigName(string ConfigName)
        {
            long?                     TimeZone            = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;
            var                       data                = "";
            BLConfigurations          objBLConfigurations = new BLConfigurations();
            List <DOMGR_ConfigMaster> lstDDOMGR_ConfigMaster;

            DOMGR_ConfigMaster objDOMGR_ConfigMaster = new DOMGR_ConfigMaster();

            objDOMGR_ConfigMaster.ConfigName = ConfigName;
            objDOMGR_ConfigMaster.IsActive   = true;

            string         errorMessage = string.Empty;
            ExceptionTypes result       = objBLConfigurations.SearchConfiguration(TimeZone, objDOMGR_ConfigMaster, out lstDDOMGR_ConfigMaster, out errorMessage);

            if (result != (long)ExceptionTypes.Success)
            {
                //Log error
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Configurations, (long)ExceptionTypes.Uncategorized, errorMessage.ToString(), errorMessage.ToString());
            }
            else if (result == ExceptionTypes.ZeroRecords)
            {
                lstDDOMGR_ConfigMaster.Add(objDOMGR_ConfigMaster);
                lstDDOMGR_ConfigMaster = new List <DOMGR_ConfigMaster>();
            }

            int i = lstDDOMGR_ConfigMaster.Count;

            if (i > 0)
            {
                data = "Configuration Name already exists.";
            }
            return(Json(new { Data = data }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        /// <summary>
        /// Get All master configuration
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        private static void GetAllConfigurationIfNoCache()
        {
            long?  TimeZone     = (long)DefaultTimeZone.CentralStandardTime;
            string errorMessage = string.Empty;

            if (System.Web.HttpContext.Current.Cache[ConstantTexts.MasterConfigurarionsCacheKey] == null)
            {
                BLConfigurations          objBLConfigurations   = new BLConfigurations();
                List <DOMGR_ConfigMaster> lstDOMGR_ConfigMaster = new List <DOMGR_ConfigMaster>();
                DOMGR_ConfigMaster        objDOMGR_ConfigMaster = new DOMGR_ConfigMaster();
                objDOMGR_ConfigMaster.IsActive = true;
                ExceptionTypes reportResult = objBLConfigurations.SearchConfiguration(TimeZone, objDOMGR_ConfigMaster, out lstDOMGR_ConfigMaster, out errorMessage);
                AddToCache(ConstantTexts.MasterConfigurarionsCacheKey, lstDOMGR_ConfigMaster);
            }
        }
Example #3
0
        /// <summary>
        /// Fetch all Configurations If no Cache is available
        /// </summary>
        private static void GetAllConfigurationIfNoCache()
        {
            long TimeZone = (long)DefaultTimeZone.CentralStandardTime;

            if (!MemoryCache.Default.Contains(ConstantTexts.ConfigurationsCacheKey))
            {
                BLConfigurations   objBLConfigurations   = new BLConfigurations();
                DOMGR_ConfigMaster objDOMGR_ConfigMaster = new DOMGR_ConfigMaster()
                {
                    IsActive = true
                };
                ExceptionTypes exResult = objBLConfigurations.SearchConfiguration(TimeZone, objDOMGR_ConfigMaster, out List <DOMGR_ConfigMaster> lstDOMGR_ConfigMaster, out string errorMessage);
                // Store data in the cache
                AddToCache(ConstantTexts.ConfigurationsCacheKey, lstDOMGR_ConfigMaster, DateTime.Now.AddHours(1));
            }
        }
Example #4
0
        internal List <DOMGR_ConfigMaster> PGetConfiguration(string strConfigName = "", bool isActive = true)
        {
            long?                     TimeZone            = currentUser.ADM_UserPreference.TimezoneLkup != null ? currentUser.ADM_UserPreference.TimezoneLkup : (long)DefaultTimeZone.CentralStandardTime;
            BLConfigurations          objBLConfigurations = new BLConfigurations();
            List <DOMGR_ConfigMaster> lstDOMGR_ConfigMaster;

            try
            {
                DOMGR_ConfigMaster objDOMGR_ConfigMaster = new DOMGR_ConfigMaster();
                objDOMGR_ConfigMaster.ConfigName = strConfigName;
                if (isActive)
                {
                    objDOMGR_ConfigMaster.IsActive = Convert.ToBoolean(isActive);
                }
                else
                {
                    objDOMGR_ConfigMaster.IsActive = false;
                }
                string         errorMessage = string.Empty;
                ExceptionTypes result       = objBLConfigurations.SearchConfiguration(TimeZone, objDOMGR_ConfigMaster, out lstDOMGR_ConfigMaster, out errorMessage);
                if (result != (long)ExceptionTypes.Success)
                {
                    //Log error
                    BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Configurations, (long)ExceptionTypes.Uncategorized, errorMessage.ToString(), errorMessage.ToString());
                }
                else if (result == ExceptionTypes.ZeroRecords)
                {
                    lstDOMGR_ConfigMaster.Add(objDOMGR_ConfigMaster);
                    lstDOMGR_ConfigMaster = new List <DOMGR_ConfigMaster>();
                }
                return(lstDOMGR_ConfigMaster);
            }
            catch (Exception ex)
            {
                BLCommon.LogError(currentUser.ADM_UserMasterId, MethodBase.GetCurrentMethod().Name, (long)ErrorModuleName.Configurations, (long)ExceptionTypes.Uncategorized, ex.ToString(), ex.ToString());
                throw ex;
            }
        }