public virtual ServiceType CreateServiceTypeFromReader(IDataReader reader) { ServiceType item = new ServiceType(); try { if (!reader.IsDBNull(reader.GetOrdinal("ServiceTypeID"))) item.ServiceTypeID = (int)reader["ServiceTypeID"]; if (!reader.IsDBNull(reader.GetOrdinal("ServiceTypeDescription"))) item.ServiceTypeDescription = (string)reader["ServiceTypeDescription"]; if (!reader.IsDBNull(reader.GetOrdinal("CreatedDate"))) item.CreatedDate = (DateTime)reader["CreatedDate"]; if (!reader.IsDBNull(reader.GetOrdinal("ModifiedDate"))) item.ModifiedDate = (DateTime)reader["ModifiedDate"]; } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.DataAccessCreateServiceTypeFromReaderException, ex); } return item; }
public static void UpdateServiceType(ServiceType serviceType) { try { ServiceTypeDAO serviceTypeDAO = new ServiceTypeDAO(); serviceTypeDAO.UpdateServiceType(serviceType); } catch (ApplicationException) { throw; } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.BusinessUpdateServiceTypeException, ex); } }
public virtual void UpdateServiceType(ServiceType serviceType) { try { Database database = DatabaseFactory.CreateDatabase("CustommerServiceConnection"); DbCommand dbCommand = database.GetStoredProcCommand("spServiceTypeUpdate"); database.AddInParameter(dbCommand, "@ServiceTypeID", DbType.Int32, serviceType.ServiceTypeID); database.AddInParameter(dbCommand, "@ServiceTypeDescription", DbType.String, serviceType.ServiceTypeDescription); database.AddInParameter(dbCommand, "@CreatedDate", DbType.DateTime, serviceType.CreatedDate); database.AddInParameter(dbCommand, "@ModifiedDate", DbType.DateTime, serviceType.ModifiedDate); database.ExecuteNonQuery(dbCommand); } catch (Exception ex) { // log this exception log4net.Util.LogLog.Error(ex.Message, ex); // wrap it and rethrow throw new ApplicationException(SR.DataAccessUpdateServiceTypeException, ex); } }