Beispiel #1
0
        /// <summary> This method retrieves a current System Parameters by Application.
        /// Change this method to alter how that record is received.
        /// </summary>
        internal static Dictionary <string, SystemParameter> GetCurrentSystemParameters()
        {
            DataManager manager         = new DataManager();
            ConfigurationDataContext db = manager.CreateDataContext <ConfigurationDataContext>();

            return(db.SystemParameters.Where(x => x.ApplicationId == _currentApplication.ApplicationId).ToDictionary(x => x.Name));
        }
Beispiel #2
0
        /// <summary> This method retrieves a current Application.
        /// Change this method to alter how that record is received.
        /// </summary>
        internal static Application GetCurrentApplication()
        {
            Application application = new Application()
            {
                Name = "/"
            };

            string text = "/";

            text = System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath;
            if (!string.IsNullOrEmpty(text))
            {
                application.Name = text.Trim('/');
            }

            text = System.Configuration.ConfigurationManager.AppSettings["ApplicationName"];
            if (!string.IsNullOrEmpty(text))
            {
                application.Name = text;
            }

            try
            {
                using (ConfigurationDataContext db = (new DataManager()).CreateDataContext <ConfigurationDataContext>())
                    application = db.Applications.Where(x => x.Name == application.Name).FirstOrDefault();

                if (application == null)
                {
                    throw new ConfigurationErrorsException("The application name dont match in database");
                }
            }
            catch { }



            return(application);
        }