Exemple #1
0
        static public AhsActiveRecord Find(string id)
        {
            var set = new AhsActiveRecordSet
            {
                Query = "select * from ACCOUNT_HIERARCHY_STEP where ACTIVE_STATUS = 'ACTIVE' AND ACCNT_HRCY_STEP_ID = :ahsId "
            };

            set.AddParameter("ahsId", id);
            return(set.Results().FirstOrDefault());
        }
Exemple #2
0
        /// <summary>
        /// Gets the active ahs record by type and location code.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="locationCode">The location code.</param>
        /// <returns></returns>
        static public AhsActiveRecord GetActiveAhsByTypeAndLocationCode(string type, string locationCode)
        {
            var set = new AhsActiveRecordSet
            {
                Query = string.Format(
                    "select * from ACCOUNT_HIERARCHY_STEP where ACTIVE_STATUS = 'ACTIVE' AND TYPE = '{0}' AND LOCATION_CODE = '{1}'",
                    type, locationCode)
            };

            return(set.Results().FirstOrDefault());
        }
Exemple #3
0
        static public AhsActiveRecord GetRiskLocationByAccountIdInsured(string accountId, string insured, string location)
        {
            var set = new AhsActiveRecordSet
            {
                Query = string.Format(
                    "select * from ACCOUNT_HIERARCHY_STEP AHS where AHS.ACTIVE_STATUS = 'ACTIVE' AND AHS.TYPE = 'RISK LOCATION' AND AHS.LOCATION_CODE = '{0}' and parent_node_id = (",
                    location)
            };

            set.Query +=
                "select INS.ACCNT_HRCY_STEP_ID from ACCOUNT_HIERARCHY_STEP INS where INS.ACTIVE_STATUS = 'ACTIVE' AND INS.TYPE = 'INSURED' ";
            set.Query += string.Format("AND INS.LOCATION_CODE = '{0}' AND INS.parent_node_id = {1})", insured, accountId);
            return(set.Results().FirstOrDefault());
        }
Exemple #4
0
        /// <summary>
        /// Gets the ahs active record by upload key.
        /// </summary>
        public static AhsActiveRecord GetAhsActiveRecordByUploadKey(string uploadKey, string instance)
        {
            var records = new AhsActiveRecordSet
            {
                Instance = instance,
                Query    = "select * from ACCOUNT_HIERARCHY_STEP where UPLOAD_KEY = :uploadKey"
            };

            records.AddParameter("uploadKey", uploadKey);

            if (!records.Execute())
            {
                throw new ApplicationException(records.LastError);
            }

            foreach (var record in records)
            {
                return(record);
            }

            return(null);
        }