Ejemplo n.º 1
0
        /// <summary>
        /// Gets the zip from city state instance.
        /// </summary>
        /// <param name="city">The city.</param>
        /// <param name="state">The state.</param>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static string GetZipFromCityStateInstance(string city, string state, string instance)
        {
            string results = String.Empty;

            try
            {
                if (city.Length > 0 && state.Length == 2)
                {
                    GetZipFromCityState location = new GetZipFromCityState(instance);
                    location.City  = city.ToUpper();
                    location.State = state.ToUpper();

                    if (location.Execute())
                    {
                        results = location.Zip;
                    }
                }
            }
            catch (Exception ex)
            {
                GeneralUtility.DebugLog(ex.Message, "GetZipFromCityStateInstance");
            }
            return(results);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates the insert SQL.
        /// </summary>
        /// <returns></returns>
        //protected override string GenerateInsertSql()
        //{
        //  var sql = new StringBuilder("INSERT INTO CALL (CALL_ID, ACCNT_HRCY_STEP_ID, ENTRY_POINT_HRCY_STEP_ID, LOB_CD, ");
        //  sql.Append("CLIENT_HRCY_STEP_ID, CALL_START_TIME, STATUS,USER_ID, ");
        //  sql.Append("INPUT_SYSTEM_NAME, CALLER_INFO, ORGINAL_CALL_ID, SERVER_NAME) VALUES(");
        //  sql.AppendFormat("{0}, {1}, {2}, '{3}', {4}, sysdate, 'INPROC', {5}, 'FNS NET', '{6}', {7}, '{8}')",
        //    CallId, AccntHrcyStepId, ClientHrcyStepId, LobCd, ClientHrcyStepId, UserId, CallerInfo, (OrginalCallId.Length > 0 ? OrginalCallId : "NULL"),ServerName );
        //  return sql.ToString();
        //}

        /// <summary>
        /// Gets the ahs id from call id.
        /// </summary>
        /// <param name="callId">The call id.</param>
        /// <param name="instance">The instance.</param>
        /// <returns></returns>
        public static string GetAhsIdFromCallId(string callId, string instance)
        {
            var results = string.Empty;

            try
            {
                var record = new CallRecord {
                    Instance = instance, CallId = callId
                };
                if (record.Execute())
                {
                    results = record.AccntHrcyStepId;
                }
                else
                {
                    throw new ApplicationException(record.LastError);
                }
            }
            catch (Exception ex)
            {
                GeneralUtility.LogError(ex.Message, "GetAhsIdFromCallId");
            }
            return(results);
        }
Ejemplo n.º 3
0
 static public int GetSequence(string table)
 {
     return(GetSequence(table, GeneralUtility.GetDbInstanceFromRegistry()));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Execute stored procedure as defined by derived classes
        /// </summary>
        /// <returns>true if no errors</returns>
        /// <remarks>submits parameters and executes target procedure</remarks>
        /// <exception cref="FormatException"><c>FormatException</c>.</exception>
        public bool Execute()
        {
            try
            {
                GeneralUtility.DebugLog("Execute entered", _name);
                if (_databaseInstance.Length == 0)
                {
                    _databaseInstance = ApplicationConfiguration.Instance.DefaultInstance;
                }

                var db = new OracleDatabase(GeneralUtility.GetConnectStringFromInstance(_databaseInstance));
                GeneralUtility.DebugLog("Database created", _name);
                var cmd = (OracleCommand)db.GetStoredProcCommand(_name);
                if (_alParameters.Count > 0)
                {
                    for (var i = 0; i < _alParameters.Count; i++)
                    {
                        var paramList = (SpParameters)_alParameters[_alParamNames[i]];
                        if (paramList.Direction == ParameterDirection.Input)
                        {
                            if (string.IsNullOrEmpty(paramList.Value))
                            {
                                db.AddInParameter(cmd, paramList.Name, paramList.DataType);
                            }
                            else
                            {
                                try
                                {
                                    switch (paramList.DataType)
                                    {
                                    case DbType.Date:
                                        GeneralUtility.DebugLog("converting date " + paramList.Value, _name);
                                        var myDateParm = Convert.ToDateTime(paramList.Value);
                                        db.AddInParameter(cmd, paramList.Name, paramList.DataType, myDateParm);
                                        break;

                                    case DbType.Int32:
                                        var myInt32Parm = Convert.ToInt32(paramList.Value);
                                        db.AddInParameter(cmd, paramList.Name, paramList.DataType, myInt32Parm);
                                        break;

                                    case DbType.Double:
                                        var myDoubleParm = Convert.ToDouble(paramList.Value);
                                        db.AddInParameter(cmd, paramList.Name, paramList.DataType, myDoubleParm);
                                        break;

                                    case DbType.Byte:
                                        var val = Convert.ToByte(paramList.Value[0]);
                                        db.AddInParameter(cmd, paramList.Name, paramList.DataType, val);
                                        break;

                                    default:
                                        db.AddInParameter(cmd, paramList.Name, paramList.DataType, paramList.Value);
                                        break;
                                    }
                                }
                                catch (FormatException formatException)
                                {
                                    throw new FormatException(string.Format("{0}'s value \"{1}\" is not of type {2}.", paramList.Name, paramList.Value, paramList.DataType), formatException);
                                }
                            }
                        }
                        else
                        {
                            if (paramList.DataType == DbType.Object)
                            {
                                _hasCursor = true;
                                db.AddParameter(cmd, paramList.Name, OracleDbType.RefCursor, 0, ParameterDirection.Output, true, 0, 0, String.Empty, DataRowVersion.Default, Convert.DBNull);
                            }
                            else if (paramList.Direction == ParameterDirection.ReturnValue)
                            {
                                db.AddParameter(cmd, paramList.Name, paramList.DataType, 4000, ParameterDirection.ReturnValue, true, 0, 0, String.Empty, DataRowVersion.Default, Convert.DBNull);
                            }
                            else
                            {
                                db.AddOutParameter(cmd, paramList.Name, paramList.DataType, 4000);
                            }
                        }
                    }
                    if (_hasCursor == false)
                    {
                        GeneralUtility.DebugLog("ExecuteNonQuery -start", _name);
                        db.ExecuteNonQuery(cmd);
                        GeneralUtility.DebugLog("ExecuteNonQuery -finish", _name);

                        for (var i = 0; i < _alParameters.Count; i++)
                        {
                            var paramList = (SpParameters)_alParameters[_alParamNames[i]];
                            if (paramList.Direction != ParameterDirection.Input)
                            {
                                paramList.Value = db.GetParameterValue(cmd, paramList.Name).ToString();
                            }
                        }
                    }
                    else
                    {
                        if (_data != null)
                        {
                            _data.Dispose();
                            _data = null;
                            GeneralUtility.DebugLog("Dataset reset", _name);
                        }
                        GeneralUtility.DebugLog("ExecuteDataSet -start", _name);
                        _data = db.ExecuteDataSet(cmd);
                        GeneralUtility.DebugLog("ExecuteDataSet -finish", _name);
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                _lastErrorMessage = ex.Message;
                GeneralUtility.DebugLog(_lastErrorMessage, _name);
                return(false);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Gets the call XML.
 /// </summary>
 /// <param name="callId">The call identifier.</param>
 /// <returns></returns>
 static public string GetCallXml(int callId)
 {
     return(GetCallXml(callId.ToString(CultureInfo.InvariantCulture), GeneralUtility.GetDbInstanceFromRegistry()));
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Commits this instance.
        /// </summary>
        /// <returns></returns>
        public virtual bool Commit()
        {
            bool results;

            try
            {
                GeneralUtility.DebugLog("Transaction started", ToString());
                using (var oTranScope = new TransactionScope(TransactionScopeOption.RequiresNew))
                {
                    if (DbInstance.Length == 0)
                    {
                        DbInstance = ApplicationConfiguration.Instance.DefaultInstance;
                    }
                    GeneralUtility.DebugLog("Execute entered", ToString());
                    var db = new Microsoft.Practices.EnterpriseLibrary.Data.Oracle.OracleDatabase(GeneralUtility.GetConnectStringFromInstance(DbInstance));
                    GeneralUtility.DebugLog("Database created", ToString());

                    results = CommitInserted(db);
                    if (results)
                    {
                        if (CommitUpdated(db))
                        {
                            oTranScope.Complete();
                            GeneralUtility.DebugLog("Transaction complete ", ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LastError = ex.Message;
                GeneralUtility.LogError(LastError, ToString());
                results = false;
            }
            ClearAll();
            return(results);
        }
Ejemplo n.º 7
0
 public override void ToJson(JsonWriter jsonWriter)
 {
     jsonWriter.WritePropertyName(GeneralUtility.PascalCase(Name));
     jsonWriter.WriteValue(Value);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Executes this instance.
        /// </summary>
        /// <returns>The resultSet as ADODB.RecordSetwvb
        /// </returns>
        public string Execute()
        {
            string results = String.Empty;
            object dummy   = Type.Missing;

            try
            {
                Connection connection = new ConnectionClass();
                connection.Open(GeneralUtility.GetAdoConnectStringFromInstance(dbInstance), String.Empty, String.Empty, -1);
                Command command = new CommandClass();
                command.ActiveConnection = connection;
                command.CommandType      = CommandTypeEnum.adCmdStoredProc;
                command.CommandText      = "DBCLASSLIBRARY.DoEsisLookupByPolicy";
                //===========================================================
                // ParentNodeId
                //===========================================================
                AddParameter(command, "p_parentNodeId", _parentNodeId, DataTypeEnum.adInteger, false);
                //===========================================================
                // Permitted
                //===========================================================
                AddParameter(command, "p_permittedNodeId", _permittedNodeId, DataTypeEnum.adInteger, false);
                //===========================================================
                // Policy Number
                //===========================================================
                AddParameter(command, "p_policyNumber", _policyNumber, DataTypeEnum.adVarChar, false);
                //===========================================================
                // LOB_CD
                //===========================================================
                AddParameter(command, "p_lobCd", _lobCd, DataTypeEnum.adVarChar, false);
                //===========================================================
                // LocationCode
                //===========================================================
                AddParameter(command, "p_locationCode", _locationCode, DataTypeEnum.adVarChar, false);
                //===========================================================
                // DepartmentCode
                //===========================================================
                AddParameter(command, "p_departmentCode", _departmentCode, DataTypeEnum.adVarChar, false);
                //===========================================================
                // ContractNumber
                //===========================================================
                AddParameter(command, "p_contractNumber", _contractNumber, DataTypeEnum.adVarChar, false);
                //===========================================================
                // Name
                //===========================================================
                AddParameter(command, "p_name", _name, DataTypeEnum.adVarChar, false);
                //===========================================================
                // City
                //===========================================================
                AddParameter(command, "p_city", _city, DataTypeEnum.adVarChar, false);
                //===========================================================
                // State
                //===========================================================
                AddParameter(command, "p_state", _state, DataTypeEnum.adVarChar, false);
                //===========================================================
                // Zip
                //===========================================================
                AddParameter(command, "p_zip", _zip, DataTypeEnum.adVarChar, false);

                Recordset policies = command.Execute(out dummy, ref dummy, 0);
                if (policies != null)
                {
                    results = GeneralUtility.GetXmlFromAdoRecordset(policies);
                    policies.Close();
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                _lastError = ex.Message;
            }

            return(results);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="EntityResponse"/> class.
 /// </summary>
 public EntityResponse()
     : this(GeneralUtility.GetDbInstanceFromRegistry())
 {
 }
Ejemplo n.º 10
0
 public ClaimAssignment() : this(GeneralUtility.GetDbInstanceFromRegistry())
 {
 }