public EntityList <LightboxAsset> GetLightboxAssetList() { LightboxAssetFinder finder = new LightboxAssetFinder { LightboxId = LightboxId.GetValueOrDefault(-1) }; return(LightboxAsset.FindMany(finder)); }
protected override object ReadRow(IRowReader reader) { LightboxAsset lightboxAsset = LightboxAsset.New(); // Table Fields lightboxAsset.LightboxAssetId = reader.GetInt32("LightboxAssetId"); lightboxAsset.LightboxId = reader.GetInt32("LightboxId"); lightboxAsset.AssetId = reader.GetInt32("AssetId"); lightboxAsset.Notes = reader.GetString("Notes"); lightboxAsset.CreateDate = reader.GetDateTime("CreateDate"); lightboxAsset.OrderNumber = reader.GetNullableInt32("OrderNumber"); // View Fields lightboxAsset.IsDirty = false; lightboxAsset.ChangedProperties.Clear(); return(lightboxAsset); }
public virtual LightboxAsset Update(LightboxAsset lightboxAsset) { if (!lightboxAsset.IsDirty || lightboxAsset.IsNull) { // Nothing to do - no point hammering the database unnecessarily return(lightboxAsset); } IDbCommand command = CreateCommand(); if (lightboxAsset.IsNew) { // Adding command.CommandText = "INSERT INTO [LightboxAsset] ([LightboxId], [AssetId], [Notes], [CreateDate], [OrderNumber]) VALUES (@lightboxId, @assetId, @notes, @createDate, @orderNumber) ; SELECT @@identity AS NewId;"; } else { // Updating command.CommandText = "UPDATE [LightboxAsset] SET [LightboxId] = @lightboxId, [AssetId] = @assetId, [Notes] = @notes, [CreateDate] = @createDate, [OrderNumber] = @orderNumber WHERE LightboxAssetId = @lightboxAssetId"; } command.Parameters.Add(CreateParameter("@lightboxId", lightboxAsset.LightboxId)); command.Parameters.Add(CreateParameter("@assetId", lightboxAsset.AssetId)); command.Parameters.Add(CreateParameter("@notes", lightboxAsset.Notes)); command.Parameters.Add(CreateParameter("@createDate", lightboxAsset.CreateDate)); command.Parameters.Add(CreateParameter("@orderNumber", lightboxAsset.OrderNumber)); if (lightboxAsset.IsNew) { lightboxAsset.LightboxAssetId = Convert.ToInt32(ExecScalar(command)); } else { command.Parameters.Add(CreateParameter("@lightboxAssetId", lightboxAsset.LightboxAssetId)); ExecuteCommand(command); } lightboxAsset.IsDirty = false; lightboxAsset.ChangedProperties.Clear(); return(lightboxAsset); }
public static LightboxAsset FindOne(LightboxAssetFinder finder) { LightboxAsset LightboxAsset = LightboxAssetMapper.Instance.FindOne(finder); return(LightboxAsset ?? Empty); }
public static LightboxAsset Update(LightboxAsset lightboxAsset) { return(LightboxAssetMapper.Instance.Update(lightboxAsset)); }
public static LightboxAsset Get(Nullable <Int32> LightboxAssetId) { LightboxAsset LightboxAsset = LightboxAssetMapper.Instance.Get(LightboxAssetId); return(LightboxAsset ?? Empty); }