Beispiel #1
0
        public OperationResult updateEventStatus(string tokenEventID, byte tokenStatus)
        {
            IDbCommand      _cmd = null;
            OperationResult result;

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
                _cmd = base.CreateCommand("TokenEventsUpdateStatus", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@param1", tokenStatus));
                _cmd.Parameters.Add(base.AddParameter("@param2", tokenEventID));
                base.Connection.Open();
                result = ((_cmd.ExecuteNonQuery() != 0) ? OperationResult.Success : OperationResult.Error);
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
                {
                    "http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = OperationResult.Error;
            }
            finally
            {
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
Beispiel #2
0
        public OperationResult insertTokenEventFields(long tokenEventID, string tokenEventFields)
        {
            IDbCommand _cmd = null;

            string[] _arrayEventFields = tokenEventFields.Split(new char[]
            {
                '|'
            });
            OperationResult result;

            if (_arrayEventFields.Length % 2 != 0 || _arrayEventFields.Length < 4)
            {
                result = OperationResult.Error;
            }
            else
            {
                try
                {
                    base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
                    _cmd = base.CreateCommand("TokenEventsFieldsInsert", CommandType.StoredProcedure);
                    _cmd.Parameters.Add(base.AddParameter("@param0", tokenEventID));
                    _cmd.Parameters.Add(base.AddParameter("@param1", null));
                    _cmd.Parameters.Add(base.AddParameter("@param2", null));
                    base.Connection.Open();
                    for (int i = 0; i < _arrayEventFields.Length; i += 2)
                    {
                        ((IDataParameter)_cmd.Parameters["@param1"]).Value = _arrayEventFields[i];
                        ((IDataParameter)_cmd.Parameters["@param2"]).Value = _arrayEventFields[i + 1];
                        _cmd.ExecuteNonQuery();
                    }
                    result = OperationResult.Success;
                }
                catch (Exception ex)
                {
                    SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
                    {
                        "http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
                        Assembly.GetExecutingAssembly().FullName.ToString(),
                        ex.ToString()
                    });
                    result = OperationResult.Error;
                }
                finally
                {
                    if (_cmd != null)
                    {
                        _cmd.Dispose();
                    }
                    base.CloseConnection();
                }
            }
            return(result);
        }
        /// <summary>
        /// </summary>
        /// <param name="tokenParamsID"></param>
        /// <param name="httpUserAgent"></param>
        /// <param name="deployProcessor"></param>
        /// <returns></returns>
        public OperationResult loadDeployProcessorByHttpUserAgent(string tokenParamsID, string httpUserAgent, out string deployProcessor)
        {
            object _resp = null;

            deployProcessor = null;
            IDbCommand _cmd        = null;
            IDbCommand _cmdDefault = null;

            try
            {
                this.ConnectionString = DBConnectionString.ExpandSecureBusiness();
                _cmd = base.CreateCommand(cLOAD_CUSTOM_TEMPLATE_BY_USERAGENT, CommandType.Text);
                _cmd.Parameters.Add(base.AddParameter("@param0", (object)tokenParamsID));
                _cmd.Parameters.Add(base.AddParameter("@param1", (object)httpUserAgent));

                this.Connection.Open();
                _resp = (object)_cmd.ExecuteScalar();
                if (_resp != null)
                {
                    deployProcessor = _resp.ToString().Trim();
                    return(OperationResult.Success);
                }
                _cmdDefault = base.CreateCommand(cLOAD_DEFAULT_TEMPLATE_BY_TOKENPARAMSID, CommandType.Text);
                _cmdDefault.Parameters.Add(base.AddParameter("@param0", (object)tokenParamsID));
                _resp = (object)_cmdDefault.ExecuteScalar();
                if (_resp != DBNull.Value)
                {
                    deployProcessor = _resp.ToString().Trim();
                    return(OperationResult.Success);
                }
                return(OperationResult.Error);
            }
            catch (Exception ex)
            {
                LOGGER.Write(LOGGER.LogCategory.ERROR, _baseName + "loadDeployProcessorByHttpUserAgent[]" + NEW_LINE + ex.Message, null);
                return(OperationResult.Error);
            }
            finally
            {
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                if (_cmdDefault != null)
                {
                    _cmdDefault.Dispose();
                }
                this.CloseConnection();
            }
        }
Beispiel #4
0
        public TokensEventFields[] loadAllTokenEventFields(long tokenEventID, string firstItem, int pageSize, int pageDirection, out int totRows)
        {
            totRows = -1;
            IDbCommand  _cmd = null;
            IDataReader _dr  = null;
            List <TokensEventFields> _tokensEventsFields = new List <TokensEventFields>();

            TokensEventFields[] result;
            try
            {
                base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
                _cmd = base.CreateCommand("TokenEventsFields", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@Param0", tokenEventID));
                base.Connection.Open();
                _dr = _cmd.ExecuteReader(CommandBehavior.CloseConnection);
                while (_dr.Read())
                {
                    _tokensEventsFields.Add(TokensEventFields.loadTokensEventFields((long)_dr[0], (DateTime)_dr[1], (string)_dr[2], (string)_dr[3]));
                }
                result = _tokensEventsFields.ToArray();
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
                {
                    "http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = null;
            }
            finally
            {
                if (_dr != null)
                {
                    _dr.Dispose();
                }
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
Beispiel #5
0
        public TokensEvents[] loadAllEvents(DateTime dateInitial, DateTime dateFinal, string tokenParamsID, string operationID, string tokenID, string applicationUser, string eventOperationStatus, string firstItem, int pageSize, int pageDirection, out int totRows)
        {
            totRows = -1;
            IDbCommand _cmd = null;

            TokensEvents[] result;
            try
            {
                base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
                _cmd = base.CreateCommand("GetTokensEventsPAG", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@InitialDate", dateInitial));
                _cmd.Parameters.Add(base.AddParameter("@FinalDate", dateFinal));
                _cmd.Parameters.Add(base.AddParameter("@TokenParamsID", tokenParamsID));
                _cmd.Parameters.Add(base.AddParameter("@EventOperationID", operationID));
                _cmd.Parameters.Add(base.AddParameter("@TokenID", tokenID));
                _cmd.Parameters.Add(base.AddParameter("@ApplicationUser", applicationUser));
                _cmd.Parameters.Add(base.AddParameter("@EventOperationStatus", eventOperationStatus));
                this._PrepPagination(_cmd, int.Parse(firstItem), pageSize, pageDirection);
                result = this._loadBusinessEvents(_cmd, out totRows);
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
                {
                    "http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = null;
            }
            finally
            {
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
Beispiel #6
0
        public OperationResult loadDeployEventInfo(string deployEventID, out DataTable dataTable)
        {
            DataSet         _ds  = new DataSet("EventDeploy");
            IDbCommand      _cmd = null;
            OperationResult result;

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
                _cmd = base.CreateCommand("GetTokenIdByEventDeploy", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@param0", deployEventID));
                base.CreateDataAdapter(_cmd).Fill(_ds);
                dataTable = _ds.Tables[0];
                result    = OperationResult.Success;
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
                {
                    "http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                dataTable = null;
                result    = OperationResult.Error;
            }
            finally
            {
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                if (_ds != null)
                {
                    _ds.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }
Beispiel #7
0
        public OperationResult insertTokenEvent(string tokenID, int eventOperation, int eventOperationStatus, string applicationUser, out long tokenEventID)
        {
            tokenEventID = -1L;
            IDbCommand      _cmd = null;
            OperationResult result;

            try
            {
                base.ConnectionString = DBConnectionString.ExpandSecureBusiness();
                _cmd = base.CreateCommand("TokenEventsInsert", CommandType.StoredProcedure);
                _cmd.Parameters.Add(base.AddParameter("@param1", tokenID));
                _cmd.Parameters.Add(base.AddParameter("@param2", eventOperation));
                _cmd.Parameters.Add(base.AddParameter("@param3", (byte)eventOperationStatus));
                _cmd.Parameters.Add(base.AddParameter("@param4", applicationUser));
                base.Connection.Open();
                tokenEventID = long.Parse(_cmd.ExecuteScalar().ToString());
                result       = ((0L != tokenEventID) ? OperationResult.Success : OperationResult.Error);
            }
            catch (Exception ex)
            {
                SAFLOGGER.Write(SAFLOGGER.LOGGEREventID.EXCEPTION, "SAFBUSINESS", new string[]
                {
                    "http://sfexpand.SAFBusiness.TokenBusinessDAO.softfinanca.com/",
                    Assembly.GetExecutingAssembly().FullName.ToString(),
                    ex.ToString()
                });
                result = OperationResult.Error;
            }
            finally
            {
                if (_cmd != null)
                {
                    _cmd.Dispose();
                }
                base.CloseConnection();
            }
            return(result);
        }