Ejemplo n.º 1
0
        /// <summary>
        /// static constructor
        /// </summary>
        static Config()
        {
            // Get VALUES / PROPERTIES
            try
            {
                APP_NAME = ConfigurationManager.AppSettings["AppName"];

                // load database properties values
                aladdinService.StorageComponentImplService sc = new aladdinService.StorageComponentImplService();
                stringArray[] res1 = sc.getEhealthParameters();

                if ((res1 != null) && (res1.Length > 0))
                {
                    PROPERTIES_DICTIONARY = new Dictionary<string, string>();

                    for (int i = 0; i < res1.Length; i++)
                    {
                        PROPERTIES_DICTIONARY.Add(res1[i].item[0], res1[i].item[1]);
                    }
                }

                // roles
                stringArray[] res2 = sc.getEhealthRoles();

                if ((res2 != null) && (res2.Length > 0))
                {
                    ROLES_DICTIONARY = new Dictionary<string, string>();

                    for (int i = 0; i < res2.Length; i++)
                    {
                        ROLES_DICTIONARY.Add(res2[i].item[0], res2[i].item[1]);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, Config.APP_NAME, MessageBoxButton.OK, MessageBoxImage.Error);
            }

            // Set VALUES / PROPERTIES from Database
            try
            {
                USERTYPE_ADMIN = ROLES_DICTIONARY["ADMIN"];
                USERTYPE_CLINICIAN = ROLES_DICTIONARY["CLINICIAN"];
                USERTYPE_CARER = ROLES_DICTIONARY["CARER"];
                USERTYPE_PATIENT = ROLES_DICTIONARY["PATIENT"];
            }
             catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, Config.APP_NAME, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }