/// <summary> /// /// /// Comment : If the user doesn't have the settings, insert them. /// </summary> /// <returns></returns> public static string LanguageSetting() { string value = null; OracleConnection conn_ = Database_Connector.GetConnection(); string select = "SELECT value FROM user_settings WHERE user_id=:userid AND key=:keyp"; OracleCommand cmd = new OracleCommand(select, conn_); cmd.Parameters.Add(new OracleParameter("userid", Main.user.ID.ToString())); cmd.Parameters.Add(new OracleParameter("keyp", "Language")); OracleDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { value = Convert.ToString(dr["value"]); } else { // Insert default value here. value = Settings.Default.Language; //Insert.LanguageSetting(Settings.Default.Language); } conn_.Close(); return(value); }
private void Load(int Userid) { string select = "SELECT PERMISSION FROM USER_PERMISSIONS where USER_ID=:userid " + "UNION ALL SELECT PERMISSION FROM USER_GROUPS inner join GROUP_PERMISSIONS " + "on USER_GROUPS.GROUP_ID=GROUP_PERMISSIONS.GROUP_ID where USER_GROUPS.USER_ID=:userid"; OracleCommand cmd = new OracleCommand(select, Database_Connector.GetConnection()); OracleParameter uid = new OracleParameter("userid", OracleDbType.Int32); uid.Value = Userid; cmd.Parameters.Add(uid); OracleDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { UserPermissions.Add(dr["PERMISSION"].ToString().ToLower()); } Database_Connector.CloseConnection(); }
private void LoadSettings() { //Settings.Default["Language"] = Database_Connector.Select.LanguageSetting(); /* Fonction to load ALL SETTINGS */ OracleConnection conn_ = Database_Connector.GetConnection(); string select = "SELECT key, value FROM user_settings WHERE user_id=:userid"; OracleCommand cmd = new OracleCommand(select, conn_); cmd.Parameters.Add(new OracleParameter("userid", Main.user.ID.ToString())); OracleDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { string key = Convert.ToString(dr["key"]); string value = Convert.ToString(dr["value"]); Settings.Default[key] = value; } conn_.Close(); // Load into Main }
private static void GetDBData(string TableName, string SelectSQL) { OracleDataAdapter DataAdapter = new OracleDataAdapter(new OracleCommand(SelectSQL, Database_Connector.GetConnection())); DataAdapter.Fill(DS, TableName); Database_Connector.CloseConnection(); }