/// <summary>
        ///
        /// </summary>
        private void cleanup()
        {
            if (pwnSecDataTools != null)
            {
                if (pwnSecDataTools.OracleDA != null &&
                    pwnSecDataTools.OracleDA.Initialized &&
                    pwnSecDataTools.OracleDA.GetConnectionStatus(PawnStoreProcedures.PAWNSEC) !=
                    OracleDataAccessor.Status.DISCONNECTED)
                {
                    pwnSecDataTools.OracleDA.DisconnectDbConnection(PawnStoreProcedures.PAWNSEC);
                }
                pwnSecDataTools.Dispose();
                pwnSecDataTools = null;
            }

            if (cshLnxDataTools != null)
            {
                if (cshLnxDataTools.OracleDA != null &&
                    cshLnxDataTools.OracleDA.Initialized &&
                    cshLnxDataTools.OracleDA.GetConnectionStatus(PawnStoreProcedures.CCSOWNER) !=
                    OracleDataAccessor.Status.DISCONNECTED)
                {
                    cshLnxDataTools.OracleDA.DisconnectDbConnection(PawnStoreProcedures.CCSOWNER);
                }
                cshLnxDataTools.Dispose();
                cshLnxDataTools = null;
            }
        }
예제 #2
0
        public PawnSecSetupForm(
            DataAccessTools dA,
            SecurityAccessor pSecAccess,
            StoreSetupVO sConfig,
            PawnSecVO pSecVo,
            EncryptedConfigContainer pEnc,
            string clientKey,
            string storeNum,
            bool initCreate)
        {
            InitializeComponent();
            this.logLevel      = LogLevel.DEBUG;
            this.storeNumber   = storeNum;
            GlobalChangesMade  = false;
            StoreChangesMade   = false;
            MachineChangesMade = false;
            initialCreation    = initCreate;
            this.storeData     = sConfig;
            pawnSecAccessor    = pSecAccess;
            pawnSecVo          = pSecVo;
            //CreatingWorkstation = false;
            this.dAPawnSec = dA;

            ResourceProperties resourceProperties = new ResourceProperties();

            resourceProperties.PrivateKey = clientKey;

            if (initCreate)
            {
                if (!pawnSecAccessor.InitializeSecurityData(resourceProperties, clientKey, storeNum, pSecVo,
                                                            out this.machineName,
                                                            out this.ipAddress,
                                                            out this.macAddress))
                {
                    throw new ApplicationException(
                              "Cannot initialize encryption portion of PAWNSEC™.");
                }
                this.pSec = pawnSecAccessor.EncryptConfig;
            }
            else
            {
                this.pSec = pEnc;
            }
        }
 private string getOracleError(DataAccessTools dTools)
 {
     if (dTools == null)
     {
         return("DataAccessTools object is null");
     }
     if (dTools.OracleDA == null)
     {
         return("OracleDataAccessor object is null");
     }
     if (!dTools.OracleDA.Initialized)
     {
         return("OracleDataAccessor's data connection is not initialized");
     }
     if (!string.IsNullOrEmpty(dTools.OracleDA.ErrorCode) &&
         !string.IsNullOrEmpty(dTools.OracleDA.ErrorDescription))
     {
         return(string.Format(
                    "OracleDataAccessor error: Code={0} Description={1}",
                    dTools.OracleDA.ErrorCode,
                    dTools.OracleDA.ErrorDescription));
     }
     return("DataAccessTools operation failed");
 }
예제 #4
0
        //*********************************************************************
        //** Date created: Tuesday, Jan 19, 2010
        //** Created by  : PAWN\rmcbai1
        //*********************************************************************
        /// <summary>
        ///    build the datasets needed to generate the report
        /// </summary>
        ///
        /// <returns> the data needed to build the report ( DataSet)</returns>
        //*********************************************************************
        public DataSetOutput BuildDataset()
        {
            _reportData = null;

            try
            {
                DataAccessTools dataAccessTools = DataAccessService.CreateDataAccessTools();

                DataAccessService.Connect(_Credentials,
                                          DataAccessTools.ConnectMode.SINGLE,
                                          DataAccessTools.LogMode.DEBUG,
                                          ref dataAccessTools);


                List <OracleProcParam> inParams = new List <OracleProcParam>();

                inParams.Add(new OracleProcParam("store_num", _storeNum));
                string date_in = _runDate.ToString("d");
                inParams.Add(new OracleProcParam("date_in", date_in));

                string date_out = _runEndDate.ToString("d");
                inParams.Add(new OracleProcParam("date_out", date_out));

                List <PairType <string, string> > refCursors = new List <PairType <string, string> >();
                refCursors.Add(new PairType <string, string>("o_disp_data", "DISP_DATA"));

                inParams.Add(new OracleProcParam("o_store_name", OracleDbType.Varchar2, _storeName, ParameterDirection.Output, 100));

                bool retval = DataAccessService.ExecuteStoredProc(_Credentials.DBSchema
                                                                  , "PAWN_REPORTS"
                                                                  , "getData"
                                                                  , inParams
                                                                  , null
                                                                  , refCursors
                                                                  , "o_error_code"
                                                                  , "o_error_text"
                                                                  , null
                                                                  , out _errCode
                                                                  , out _errTxt
                                                                  , out _reportData
                                                                  , ref dataAccessTools);

                if (!retval)
                {
                    retval = DataAccessService.ExecuteStoredProc(_Credentials.DBSchema
                                                                 , "PAWN_REPORTS"
                                                                 , "getData"
                                                                 , inParams
                                                                 , null
                                                                 , refCursors
                                                                 , "o_error_code"
                                                                 , "o_error_text"
                                                                 , null
                                                                 , out _errCode
                                                                 , out _errTxt
                                                                 , out _reportData
                                                                 , ref dataAccessTools);
                }


                if (!retval)
                {
                    _errCode = "1";
                    _errTxt  = "An error occurred retrieving the report data.  Please try again, if this error persists then contact support.";
                }
            }
            catch (Exception ex)
            {
                _reportData = null;
                _errCode    = "1";
                _errTxt     = ex.Message;
            }


            return(_reportData);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="environmentStr"></param>
        /// <param name="errTxt"></param>
        /// <returns></returns>
        private bool loadEnvironmentData(string environmentStr, out string errTxt)
        {
            errTxt = string.Empty;
            var rt = true;

            if (string.IsNullOrEmpty(environmentStr))
            {
                errTxt = "Invalid environment string.";
                return(false);
            }

            //Setup file logger
            FileLogger.Instance.initializeLogger(
                string.Format("logs/dstr_viewer_{0}.log", DateTime.Now.Ticks),
                DefaultLoggerHandlers.defaultLogLevelCheckHandler,
                DefaultLoggerHandlers.defaultLogLevelGenerator,
                DefaultLoggerHandlers.defaultDateStampGenerator,
                DefaultLoggerHandlers.defaultLogMessageHandler,
                DefaultLoggerHandlers.defaultLogMessageFormatHandler);
            FileLogger.Instance.setEnabled(true);
            FileLogger.Instance.setLogLevel(LogLevel.DEBUG);

            //Setup audit logger
            this.auditLogger = AuditLogger.Instance;
            this.auditLogger.SetAuditLogEnabledChangeHandler(auditLogEnabledChangeHandler);
            this.auditLogger.SetAuditLogHandler(logAuditMessageHandler);
            this.auditLogger.SetEnabled(true);

            //Pwn sec tuples (user name, password, host, port, schema, service)
            var internalStorage = new Dictionary <string, Tuple <string, string, string, string, string, string> >(8)
            {
                {
                    "CLXD3", new Tuple <string, string, string, string, string, string>
                        (@"Ny2VIxVYqnA=", @"jZekk5GlbvfnRVTll7RpCw==",
                        @"5HYH35IsmBLxuFKgDA0deV4cSI9w/aeE", @"c5oa+iWxTPs=", @"Ny2VIxVYqnA=",
                        @"tN2vG1Y6pleVpj7+YIrMdxtI3uI0kDL1")
                },
                {
                    "CLXI", new Tuple <string, string, string, string, string, string>
                        (@"Ny2VIxVYqnA=", @"jZekk5GlbvfnRVTll7RpCw==",
                        @"1xaOn6Ot6HRjXbIPl7E2WJ3Bs9SmWpEy", @"c5oa+iWxTPs=", @"Ny2VIxVYqnA=",
                        @"7GS8RS4GC4MRrLvSkAHG8w==")
                },
                {
                    "CLXT", new Tuple <string, string, string, string, string, string>
                        (@"Ny2VIxVYqnA=", @"jZekk5GlbvfnRVTll7RpCw==",
                        @"bYtNZ/PbgPkj30psRLKPF+5CvrNdg5WA", @"07s4aRvDFLs=", @"Ny2VIxVYqnA=",
                        @"BBBxdZodCA0RrLvSkAHG8w==")
                },
                {
                    "CLXT2", new Tuple <string, string, string, string, string, string>
                        (@"Ny2VIxVYqnA=", @"jZekk5GlbvfnRVTll7RpCw==",
                        @"bYtNZ/PbgPkj30psRLKPF+5CvrNdg5WA", @"07s4aRvDFLs=", @"Ny2VIxVYqnA=",
                        @"Ny/sG2mylyCVpj7+YIrMdxtI3uI0kDL1")
                },
                {
                    PROD, new Tuple <string, string, string, string, string, string>
                        (@"Ny2VIxVYqnA=", @"jZekk5GlbvfnRVTll7RpCw==",
                        @"bIyV3M7QftbxuFKgDA0deV4cSI9w/aeE", @"07s4aRvDFLs=", @"Ny2VIxVYqnA=",
                        @"ZisF3qmLAEMRrLvSkAHG8w==")
                }
            };



            //Construct data storage at runtime and select based on environment string
            //Grab the tuple and make the proper connections
            if (CollectionUtilities.isNotEmptyContainsKey(internalStorage, environmentStr))
            {
                var cxnInfo = internalStorage[environmentStr];
                var privKey = Common.Properties.Resources.PrivateKey;
                if (cxnInfo != null)
                {
                    //Create pawn security connection credentials
                    this.pwnSecCred = new Credentials
                    {
                        UserName  = StringUtilities.Decrypt(cxnInfo.Item1, privKey, true),
                        PassWord  = StringUtilities.Decrypt(cxnInfo.Item2, privKey, true),
                        DBHost    = StringUtilities.Decrypt(cxnInfo.Item3, privKey, true),
                        DBPort    = StringUtilities.Decrypt(cxnInfo.Item4, privKey, true),
                        DBService = StringUtilities.Decrypt(cxnInfo.Item6, privKey, true),
                        DBSchema  = StringUtilities.Decrypt(cxnInfo.Item5, privKey, true)
                    };

                    //Create pawn security data access tools
                    this.pwnSecDataTools = DataAccessService.CreateDataAccessTools();
                    if (!DataAccessService.Connect(PawnStoreProcedures.PAWNSEC, this.pwnSecCred, DataAccessTools.ConnectMode.MULTIPLE, DataAccessTools.LogMode.DEBUG, ref this.pwnSecDataTools))
                    {
                        errTxt = "Could not connect to pawn security database.";
                        if (FileLogger.Instance.IsLogError)
                        {
                            FileLogger.Instance.logMessage(LogLevel.ERROR, this, errTxt);
                        }
                        rt = false;
                    }
                    else
                    {
                        //Create pawn sec vo
                        this.pawnSecData = new PawnSecVO();
                        string decryptKey;

                        //Get primary oracle connection credentials
                        if (!PawnStoreProcedures.GetAllPawnSecData(ref this.pwnSecDataTools, ref this.pawnSecData, out decryptKey))
                        {
                            errTxt = "Could not load pawn security data for selected environment";
                            if (FileLogger.Instance.IsLogError)
                            {
                                FileLogger.Instance.logMessage(LogLevel.ERROR, this, errTxt);
                            }
                            rt = false;
                        }
                        else
                        {
                            //Get the oracle server info
                            this.databaseServer = this.pawnSecData.DatabaseServiceList.Find(
                                vo => (string.Equals(vo.ServiceType, EncryptedConfigContainer.ORACLEKEY, StringComparison.Ordinal)));

                            //Connect to the primary Oracle server
                            this.cshLnxCred = new Credentials
                            {
                                UserName  = StringUtilities.Decrypt(this.databaseServer.DbUser, decryptKey, true),
                                PassWord  = StringUtilities.Decrypt(this.databaseServer.DbUserPwd, decryptKey, true),
                                DBHost    = StringUtilities.Decrypt(this.databaseServer.Server, decryptKey, true),
                                DBPort    = StringUtilities.Decrypt(this.databaseServer.Port, decryptKey, true),
                                DBService = StringUtilities.Decrypt(this.databaseServer.AuxInfo, decryptKey, true),
                                DBSchema  = StringUtilities.Decrypt(this.databaseServer.Schema, decryptKey, true)
                            };

                            this.cshLnxDataTools = DataAccessService.CreateDataAccessTools();
                            if (!DataAccessService.Connect(PawnStoreProcedures.CCSOWNER, this.cshLnxCred, DataAccessTools.ConnectMode.MULTIPLE,
                                                           DataAccessTools.LogMode.DEBUG, ref this.cshLnxDataTools))
                            {
                                errTxt = "Could not connect to primary Cashlinx database";
                                if (FileLogger.Instance.IsLogError)
                                {
                                    FileLogger.Instance.logMessage(LogLevel.ERROR, this, errTxt);
                                }
                                rt = false;
                            }
                            else
                            {
                                //Get the couch server info
                                this.couchServer = this.pawnSecData.DatabaseServiceList.Find(
                                    vo => (string.Equals(vo.ServiceType, EncryptedConfigContainer.COUCHDBKEY, StringComparison.Ordinal)));
                                //Get the LDAP server info

                                //Change #00042 - Removing LDAP authentication from DSTR viewer

                                /*this.ldapServer = this.pawnSecData.DatabaseServiceList.Find(
                                 *  vo => (string.Equals(vo.ServiceType, EncryptedConfigContainer.LDAPKEY, StringComparison.Ordinal)));*/

                                //Setup the LDAP connection
                                this.encConfig = new EncryptedConfigContainer(
                                    Common.Properties.Resources.PrivateKey,
                                    this.pawnSecData.GlobalConfiguration.DataPublicKey,
                                    "00152",   //Hard coded to 00152 for pawn security retrieval - GJL 05/08/2012
                                    this.pawnSecData,
                                    PawnSecApplication.None,
                                    true);

                                //Change #00042 - Removing LDAP authentication from DSTR viewer

                                /*
                                 * var ldapService =
                                 *  conf.GetLDAPService(
                                 *      out loginDN,
                                 *      out searchDN,
                                 *      out userIdKey,
                                 *      out userPwd,
                                 *      out pwdPolicyCN);
                                 * if (ldapService != null && FileLogger.Instance.IsLogDebug)
                                 * {
                                 *  FileLogger.Instance.logMessage(
                                 *      LogLevel.DEBUG, this, "- Connecting to LDAP server:{0}{1}",
                                 *      System.Environment.NewLine, conf.DecryptValue(ldapService.Server));
                                 * }
                                 *
                                 * //Connect to the LDAP server
                                 * PawnLDAPAccessor.Instance.InitializeConnection(
                                 *  conf.DecryptValue(ldapService.Server),
                                 *  conf.DecryptValue(ldapService.Port),
                                 *  loginDN,
                                 *  userPwd,
                                 *  pwdPolicyCN,
                                 *  searchDN,
                                 *  userIdKey);
                                 *
                                 * if (PawnLDAPAccessor.Instance.State != PawnLDAPAccessor.LDAPState.CONNECTED)
                                 * {
                                 *  errTxt = "Could not connect to the LDAP Server";
                                 *  if (FileLogger.Instance.IsLogError)
                                 *  {
                                 *      FileLogger.Instance.logMessage(LogLevel.ERROR, this, errTxt);
                                 *  }
                                 *  rt = false;
                                 * }
                                 * else
                                 * {
                                 *  //Authenticate the user
                                 *  var attemptCount = 1;
                                 *  DateTime pwdLastMod;
                                 *  bool lockedOut;
                                 *  string[] pwdHistory;
                                 *  string displayName;
                                 *  if (!PawnLDAPAccessor.Instance.AuthorizeUser(
                                 *      this.curUserName, this.curPassword, ref attemptCount,
                                 *      out pwdLastMod, out pwdHistory, out displayName, out lockedOut))
                                 *  {
                                 *      errTxt = "Could not verify user name and password";
                                 *      if (FileLogger.Instance.IsLogError)
                                 *      {
                                 *          FileLogger.Instance.logMessage(LogLevel.ERROR, this, errTxt);
                                 *      }
                                 *      rt = false;
                                 *  }
                                 * }
                                 */
                            }
                        }
                    }
                }
                else
                {
                    errTxt = "Could not find valid connection info in internal environment data.";
                    if (FileLogger.Instance.IsLogError)
                    {
                        FileLogger.Instance.logMessage(LogLevel.ERROR, this, errTxt);
                    }
                    rt = false;
                }
            }
            else
            {
                errTxt = "Environment string not found in internal environment data.";
                if (FileLogger.Instance.IsLogError)
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this, errTxt);
                }
                rt = false;
            }

            return(rt);
        }
        public static bool GetGlobalConfig(
            ref DataAccessTools dA,
            ref PawnSecVO pwnSec,
            out string decryptKey)
        {
            //Set changed public key to false
            decryptKey = string.Empty;

            //Get global configuration
            DataReturnSet globalConfig;

            if (!DataAccessService.ExecuteQuery(false,
                                                PawnStoreSetupQueries.SELECT_PAWNSEC_GLOBAL,
                                                "globalconfig",
                                                PAWNSEC,
                                                out globalConfig,
                                                ref dA))
            {
                MessageBox.Show("Could not query global configuration from pawn sec",
                                "Alert");
                return(false);
            }

            if (globalConfig == null || globalConfig.NumberRows <= 0)
            {
                MessageBox.Show("Invalid or unexpected number of global config rows returned",
                                "Alert");
                return(false);
            }

            //Retrieve the data row
            DataReturnSetRow globDr;

            if (!globalConfig.GetRow(0, out globDr))
            {
                MessageBox.Show("Could not retrieve first row of the global config data table",
                                "Alert");
                return(false);
            }

            pwnSec.GlobalConfiguration.Version =
                Utilities.GetStringValue(globDr.GetData("APPVERSIONID"));
            pwnSec.GlobalConfiguration.BaseTemplatePath =
                Utilities.GetStringValue(globDr.GetData("TEMPLATEPATH"));
            //BZ 485: RB:  The following line needs to be added to pickup the base log path and keep it from getting hard coded.
            pwnSec.GlobalConfiguration.BaseLogPath =
                Utilities.GetStringValue(globDr.GetData("LOGPATH"));
            pwnSec.GlobalConfiguration.BaseMediaPath =
                Utilities.GetStringValue(globDr.GetData("MEDIAPATH"));
            pwnSec.GlobalConfiguration.AdobeReaderPath =
                Utilities.GetStringValue(globDr.GetData("ADOBEPATH"));
            pwnSec.GlobalConfiguration.GhostScriptPath =
                Utilities.GetStringValue(globDr.GetData("GHOSTPATH"));
            //Decrypt the global public key
            var globPubKeyEnc = Utilities.GetStringValue(globDr.GetData("PUBLICKEY"));
            var globPubKeyDec =
                StringUtilities.Decrypt(globPubKeyEnc,
                                        Common.Properties.Resources.PrivateKey,
                                        true);

            //Set the global public key if we do not have one
            if (string.IsNullOrEmpty(pwnSec.GlobalConfiguration.DataPublicKey))
            {
                pwnSec.GlobalConfiguration.DataPublicKey = globPubKeyDec;
            }

            //If we made it here, we were successful in acquiring global configuration
            decryptKey = globPubKeyDec + Common.Properties.Resources.PrivateKey;

            //Pull MD5 hash
            DataReturnSet verDataOut;

            if (!DataAccessService.ExecuteQuery(false, "select verchk from pawnsec.storeappversion where id = 5",
                                                "storeappversion", PAWNSEC, out verDataOut, ref dA))
            {
                MessageBox.Show("Could not retrieve version row from pawnsec");
                return(false);
            }

            //Validate data set
            if (verDataOut == null || verDataOut.NumberRows <= 0)
            {
                MessageBox.Show("No rows returned from storeappversion table in pawnsec");
                return(false);
            }

            //Extract row data
            DataReturnSetRow verRow;

            if (!verDataOut.GetRow(0, out verRow))
            {
                MessageBox.Show("Could not retrieve row data from pawnsec appversion data set");
                return(false);
            }

            //Retrieve remote MD5 value for this application
            var remoteMD5 = Utilities.GetStringValue(verRow.GetData("VERCHK"));

            //Generate MD5 value for this application version
            var appMD5 = StringUtilities.GenerateRawMD5Hash(Assembly.GetExecutingAssembly().GetName().Version.ToString(), Encoding.ASCII);

            //Ensure the MD5 keys match
            if (!string.Equals(remoteMD5, appMD5, StringComparison.OrdinalIgnoreCase))
            {
                MessageBox.Show("App version in pawn sec does not match the executing assembly version.");
                return(false);
            }

            return(true);
        }
        /// <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);
        }
예제 #8
0
        //*********************************************************************
        //** Date created: Tuesday, Jan 19, 2010
        //** Created by  : PAWN\rmcbai1
        //*********************************************************************
        /// <summary>
        ///    build the datasets needed to generate the report
        /// </summary>
        ///
        /// <returns> the data needed to build the report ( DataSet)</returns>
        //*********************************************************************
        public DataSetOutput BuildDataset()
        {
            _reportData = null;

            try
            {
                DataAccessTools dataAccessTools = DataAccessService.CreateDataAccessTools();

                DataAccessService.Connect(_Credentials,
                                          DataAccessTools.ConnectMode.SINGLE,
                                          DataAccessTools.LogMode.DEBUG,
                                          ref dataAccessTools);


                List <OracleProcParam> inParams = new List <OracleProcParam>();

                inParams.Add(new OracleProcParam("store_num", _storeNum));
                string date_in = _runDate.ToString("d");
                inParams.Add(new OracleProcParam("date_in", date_in));

                List <PairType <string, string> > refCursors = new List <PairType <string, string> >();
                refCursors.Add(new PairType <string, string>("o_cash_adv_1", "CASH_ADV_1"));
                refCursors.Add(new PairType <string, string>("o_xpp_2", "XPP_2"));
                refCursors.Add(new PairType <string, string>("o_payment_3", "PAYMENT_3"));
                refCursors.Add(new PairType <string, string>("o_recissions_4", "RECISSIONS_4"));
                refCursors.Add(new PairType <string, string>("o_debit_card_5", "DEBIT_CARDS_5"));
                refCursors.Add(new PairType <string, string>("o_phone_card_6", "PHONE_CARDS_6"));
                refCursors.Add(new PairType <string, string>("o_safe_transfer_7", "SAFE_TRANSFER_7"));
                refCursors.Add(new PairType <string, string>("o_drawer_transfer_7", "DRAWER_TRANSFER_7"));
                refCursors.Add(new PairType <string, string>("o_check_cashing_8", "CHECK_CASHING_8"));
                refCursors.Add(new PairType <string, string>("o_insurance_9", "INSURANCE_9"));
                refCursors.Add(new PairType <string, string>("o_convenience_11", "CONVENIENCE_11"));
                refCursors.Add(new PairType <string, string>("o_tax_prep_12", "TAX_PREP_12"));
                refCursors.Add(new PairType <string, string>("o_other_13", "OTHER_13"));
                refCursors.Add(new PairType <string, string>("o_money_order_14", "MONEY_ORDER_14"));
                refCursors.Add(new PairType <string, string>("o_wire_transfer_15", "WIRE_TRANSFER_15"));
                refCursors.Add(new PairType <string, string>("o_coupons_16", "COUPONS_16"));
                refCursors.Add(new PairType <string, string>("o_petty_cash_17", "PETTY_CASH_17"));
                refCursors.Add(new PairType <string, string>("o_paid_inout_18", "PAID_INOUT18"));
                refCursors.Add(new PairType <string, string>("o_extensions_19", "EXTENSIONS_19"));
                refCursors.Add(new PairType <string, string>("o_cancel_cso_20", "CANCEL_CSO_20"));
                refCursors.Add(new PairType <string, string>("o_ach_rvk_21", "ACH_RVK_21"));
                refCursors.Add(new PairType <string, string>("o_waive_off_22", "WAIVE_OFF_22"));
                refCursors.Add(new PairType <string, string>("o_reimbsmts_23", "REIMBURSEMENTS_23"));
                refCursors.Add(new PairType <string, string>("o_new_loans_24", "NEW_LOANS_24"));
                refCursors.Add(new PairType <string, string>("o_ext_25", "EXT_25"));
                refCursors.Add(new PairType <string, string>("o_renew_26", "RENEW_26"));
                refCursors.Add(new PairType <string, string>("o_paydown_27", "PAYDOWN_27"));
                refCursors.Add(new PairType <string, string>("o_pickup_28", "PICKUP_28"));
                refCursors.Add(new PairType <string, string>("o_seizure_29", "SEIZURE_29"));
                refCursors.Add(new PairType <string, string>("o_police_ret_30", "POLICE_RET_30"));
                refCursors.Add(new PairType <string, string>("o_claim_rel_31", "CLAIM_REL_31"));
                refCursors.Add(new PairType <string, string>("o_pfi_32", "PFI_32"));
                refCursors.Add(new PairType <string, string>("o_transfer_out_33", "TRANSFER_OUT_33"));
                refCursors.Add(new PairType <string, string>("o_purchase_37", "PURCHASE_37"));
                refCursors.Add(new PairType <string, string>("o_return_38", "RETURN_38"));

                refCursors.Add(new PairType <string, string>("O_RETAIL_40", "RETAIL_40"));
                refCursors.Add(new PairType <string, string>("O_RETAIL_40_DETL", "RETAIL_40_DETL"));
                refCursors.Add(new PairType <string, string>("O_LAYAWAY_41", "LAYAWAY_41"));
                refCursors.Add(new PairType <string, string>("O_LAYAWAY_41_DETL", "LAYAWAY_41_DETL"));
                refCursors.Add(new PairType <string, string>("O_SALE_REFUND", "SALE_REFUND"));
                refCursors.Add(new PairType <string, string>("O_SALE_REFUND_DETL", "SALE_REFUND_DETL"));
                refCursors.Add(new PairType <string, string>("O_LAYAWAY_REFUND", "LAYAWAY_REFUND"));
                refCursors.Add(new PairType <string, string>("o_forfeited", "LAYAWAY_TERMATION"));
                refCursors.Add(new PairType <string, string>("o_charge_off", "CHARGE_OFF"));
                refCursors.Add(new PairType <string, string>("O_PARPYMT_45", "O_PARPYMT_45"));

                /* var outParamList = new List<TupleType<string, DataTypeConstants.PawnDataType, int>>(1)
                 *                       {
                 *                           new TupleType<string, DataTypeConstants.PawnDataType, int>
                 *                                   (
                 *                                       "o_store_name",
                 *                                       DataTypeConstants.PawnDataType.STRING, 40
                 *                                   )
                 *                       };*/
                inParams.Add(new OracleProcParam("o_store_name", OracleDbType.Varchar2, _storeName, ParameterDirection.Output, 100));
                bool retval = DataAccessService.ExecuteStoredProc(_Credentials.DBSchema
                                                                  , "PAWN_DSTR"
                                                                  , "get_dstr_data"
                                                                  , inParams
                                                                  , null
                                                                  , refCursors
                                                                  , "o_error_code"
                                                                  , "o_error_text"
                                                                  , null
                                                                  , out _errCode
                                                                  , out _errTxt
                                                                  , out _reportData
                                                                  , ref dataAccessTools);

                if (!retval)
                {
                    retval = DataAccessService.ExecuteStoredProc(_Credentials.DBSchema
                                                                 , "PAWN_DSTR"
                                                                 , "get_dstr_data"
                                                                 , inParams
                                                                 , null
                                                                 , refCursors
                                                                 , "o_error_code"
                                                                 , "o_error_text"
                                                                 , null
                                                                 , out _errCode
                                                                 , out _errTxt
                                                                 , out _reportData
                                                                 , ref dataAccessTools);
                }


                if (!retval)
                {
                    _errCode = "1";
                    _errTxt  = "An error occurred retrieving the report data.  Please try again, if this error persists then contact support.";
                }
            }
            catch (Exception ex)
            {
                _reportData = null;
                _errCode    = "1";
                _errTxt     = ex.Message;
            }


            return(_reportData);
        }