public HourTypeEntity Create(HourTypeEntity entity) { using (IDatabaseProvider provider = ProviderFactory.GetProvider(_connectionStringName)) { return provider.Insert<HourTypeEntity>(entity); } }
internal static List<ItemHoursEntity> GetItemHoursEntriesForInsert(HourTypeEntity hourType, CostCentreEntity costCentre) { List<ItemHoursEntity> entities = new List<ItemHoursEntity>(); entities.Add(GetItemHoursEntryForInsert(hourType, costCentre)); ItemHoursEntity entity = GetItemHoursEntryForInsert(hourType, costCentre); entity.OrderNumber = 1111; entities.Add(entity); return entities; }
public static HourTypeEntity GetHourTypeForInsert() { HourTypeEntity entity = new HourTypeEntity() { LookupCode = "BUDG", Description = "Budgeted", DeletedDate = DateTime.MinValue }; return entity; }
public void SetUpRelatedData() { RoomHoursRepository repository = new RoomHoursRepository(ConfigSettings.MySqlDatabaseConnectionName); repository.ClearCollection(); CostCentreRepository costCentreRepository = new CostCentreRepository(ConfigSettings.MySqlDatabaseConnectionName); CostCentreEntity costCentreEntity = HoursData.GetCostCentreForInsert(); costCentreRepository.ClearCollection(); _costCentre = costCentreRepository.Create(costCentreEntity); HourTypeRepository hourTypeRepository = new HourTypeRepository(ConfigSettings.MySqlDatabaseConnectionName); HourTypeEntity hourTypeEntity = HoursData.GetHourTypeForInsert(); hourTypeRepository.ClearCollection(); _hourType = hourTypeRepository.Create(hourTypeEntity); }
public HourTypeEntity Update(HourTypeEntity entity) { using (IDatabaseProvider provider = ProviderFactory.GetProvider(_connectionStringName)) { HourTypeEntity entityToUpdate = Read(entity.Id); if (entityToUpdate == null) throw new DataAccessException("Address not found"); // This should not happen seeing that validation should check. entityToUpdate = UpdateProperties(entity, entityToUpdate); provider.Update<HourTypeEntity>(entityToUpdate); return entityToUpdate; } }
public static ItemHoursEntity GetItemHoursEntryForInsert(HourTypeEntity hourType, CostCentreEntity costCentre) { ItemHoursEntity entity = new ItemHoursEntity() { HourTypeId = hourType.Id, CostCentreId = costCentre.Id, OrderNumber = 1234, RoomNumber = 67, ItemNumber = 5678, ParentItemNumber = 8765, PersonNumber = 123456789, Description = "Work on Monday", Date = DateTime.UtcNow, Deleted = true, DeletedDate = DateTime.MinValue }; return entity; }
private HourType TranslateToHourTypeResponse(HourTypeEntity entity) { return entity.TranslateTo<HourType>(); }
public static RoomHoursEntity GetRoomHoursEntryForInsert(HourTypeEntity hourType, CostCentreEntity costCentre) { RoomHoursEntity entity = new RoomHoursEntity() { HourTypeId = hourType.Id, CostCentreId = costCentre.Id, ConceptNumber = 9999, OrderNumber = 1234, RoomNumber = 67, PersonNumber = 123456789, Description = "Work on Monday", DeliveryDate = DateTime.UtcNow, Deleted = true, DeletedDate = DateTime.MinValue }; return entity; }
public HourTypeEntity Delete(HourTypeEntity entity) { entity.DeletedDate = DateTime.UtcNow; return Update(entity); }
private HourTypeEntity UpdateProperties(HourTypeEntity entity, HourTypeEntity entityToUpdate) { entityToUpdate.Description = entity.Description; entityToUpdate.LookupCode = entity.LookupCode; entityToUpdate.DeletedDate = entity.DeletedDate; return entityToUpdate; }