/// <summary> /// /// </summary> /// <param name="dA"></param> /// <param name="pwnSec"></param> /// <param name="decryptKey"> </param> /// <returns></returns> public static bool GetAllPawnSecData( ref DataAccessTools dA, ref PawnSecVO pwnSec, out string decryptKey) { decryptKey = string.Empty; if (pwnSec == null) { MessageBox.Show("Data passed into method is invalid", "Alert"); return(false); } //Get global configuration if (!GetGlobalConfig(ref dA, ref pwnSec, out decryptKey)) { MessageBox.Show("Could not acquire global configuration", "Alert"); } //Setup store config as the single parameter needed for the next few queries var ptStoCfg = new PairType <string, string> [1]; ptStoCfg[0] = new PairType <string, string>("STORECONFIGID", "1"); //Load db services and map DataReturnSet dbServices; if (!DataAccessService.ExecuteVariableQuery(false, PawnStoreSetupQueries.SELECT_PAWNSEC_DB, "databaseservice", PAWNSEC, out dbServices, ref dA, ptStoCfg)) { MessageBox.Show("Could not execute query against the database service table", "Alert"); return(false); } if (dbServices == null || dbServices.NumberRows <= 0) { MessageBox.Show("Could not find any database services in the pawnsec database", "Alert"); return(false); } for (int i = 0; i < dbServices.NumberRows; ++i) { DataReturnSetRow dR; if (!dbServices.GetRow(i, out dR)) { continue; } var enabFlag = Utilities.GetStringValue(dR.GetData("ENABLED")); var enabFlagBool = (!string.IsNullOrEmpty(enabFlag) && enabFlag.Equals("1")); var userName = Utilities.GetStringValue(dR.GetData("DBUSER")); var userPwd = Utilities.GetStringValue(dR.GetData("DBUSERPWD")); var dbServiceVo = new DatabaseServiceVO(userName, userPwd, enabFlagBool) { Id = Utilities.GetULongValue(dR.GetData("ID")), Name = Utilities.GetStringValue(dR.GetData("NAME")), Server = Utilities.GetStringValue(dR.GetData("SERVER")), Port = Utilities.GetStringValue(dR.GetData("PORT")), Schema = Utilities.GetStringValue(dR.GetData("SCHEMA")), AuxInfo = Utilities.GetStringValue(dR.GetData("AUXINFO")), ServiceType = Utilities.GetStringValue(dR.GetData("SERVICETYPE")) }; var dbMapVo = new PawnSecVO.DatabaseServiceStoreMapVO { Id = Utilities.GetULongValue(dR.GetData("DATABASEMAPID")), StoreConfigId = Utilities.GetULongValue(dR.GetData("DATABASEMAPSTORECONFIGID")), DatabaseServiceId = dbServiceVo.Id }; //Add vo objects to lists pwnSec.DatabaseServiceList.Add(dbServiceVo); pwnSec.DatabaseServiceMapList.Add(dbMapVo); } return(true); }