public ViolationsDAL FindViolationByViolationID(int ViolationID)
        {
            ViolationsDAL ProposedReturnValue = null;

            try
            {
                EnsureConnected();
                using (SqlCommand command
                           = new SqlCommand("FindViolationByViolationID", _connection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@ViolationID", ViolationID);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        ViolationsMapper m = new ViolationsMapper(reader);
                        int count          = 0;
                        while (reader.Read())
                        {
                            ProposedReturnValue = m.ViolationFromReader(reader);
                            count++;
                        }
                        if (count > 1)
                        {
                            throw new
                                  Exception($"Found more than 1 Violation with key   {ViolationID}");
                        }
                    }
                }
            }
            catch (Exception ex) when(Log(ex))
            {
            }
            return(ProposedReturnValue);
        }
        public List <ViolationsDAL> GetViolationsRelatedToObsID(int ObsID, int skip, int take)
        {
            List <ViolationsDAL> ProposedReturnValue = new List <ViolationsDAL>();

            try
            {
                EnsureConnected();
                using (SqlCommand command = new SqlCommand("GetViolationsRelatedToObsID", _connection))
                {
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@ObsID", ObsID);
                    command.Parameters.AddWithValue("@Skip", skip);
                    command.Parameters.AddWithValue("@Take", take);
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        ViolationsMapper m = new ViolationsMapper(reader);
                        while (reader.Read())
                        {
                            ViolationsDAL r = m.ViolationFromReader(reader);
                            ProposedReturnValue.Add(r);
                        }
                    }
                }
            }
            catch (Exception ex) when(Log(ex))
            {
            }
            return(ProposedReturnValue);
        }
        public ViolationsDAL ViolationFromReader(System.Data.SqlClient.SqlDataReader reader)
        {
            ViolationsDAL proposedReturnValue = new ViolationsDAL();

            proposedReturnValue.ViolationID     = GetInt32OrDefault(reader, OffsetToViolationID);
            proposedReturnValue.ViolationDesc   = GetStringOrDefault(reader, OffsetToViolationDesc);
            proposedReturnValue.RecordSpeed     = GetInt32OrDefault(reader, OffsetToRecordSpeed);
            proposedReturnValue.FineAmount      = GetDecimalOrDefault(reader, OffsetToFineAmount);
            proposedReturnValue.PlateID         = GetInt32OrDefault(reader, OffsetToPlateID);
            proposedReturnValue.ObsID           = GetInt32OrDefault(reader, OffsetToObsID);
            proposedReturnValue.LatNumber       = GetStringOrDefault(reader, OffsetToLatNumber);
            proposedReturnValue.LongNumber      = GetStringOrDefault(reader, OffsetToLongNumber);
            proposedReturnValue.RegisteredOwner = GetStringOrDefault(reader, OffsetToRegisteredOwner);

            return(proposedReturnValue);
        }