protected void MapServiceToObject(SqlDataReader reader, object userData) { Entities.Service service = new Entities.Service(); service.Id = Utils.GetSafeInt32(reader, "ServiceId"); service.ServiceType = DomainModel.ServiceTypes.GetById( Utils.GetSafeInt32(reader, "TypeId")); service.PricePerPerson.Value = Utils.GetSafeDecimal(reader, "PricePerPerson"); service.PricePerPerson.Currency = DomainModel.Currencies.GetById( Utils.GetSafeInt32(reader, "PriceUnitId")); service.Name = Utils.GetSafeString(reader, "ServiceName"); service.IsDirty = false; Entities.ServiceCollection services = (Entities.ServiceCollection)userData; services.Add(service); }
internal bool Load(Entities.ServiceCollection services) { bool res = false; try { this.query.Parameters.Clear(); res = this.query.ExecuteReader("ServicesGetAll", MapServiceToObject, services); } catch (Exception ex) { try { DomainModel.Application.Status.Update( StatusController.Abstract.StatusTypes.Error, "", ex.Message); } catch { } } return(res); }