protected override object ReadRow(IRowReader reader)
        {
            AssetImageSize assetImageSize = AssetImageSize.New();

            // Table Fields
            assetImageSize.AssetImageSizeId = reader.GetInt32("AssetImageSizeId");
            assetImageSize.Description      = reader.GetString("Description");
            assetImageSize.Height           = reader.GetInt32("Height");
            assetImageSize.Width            = reader.GetInt32("Width");
            assetImageSize.DotsPerInch      = reader.GetInt32("DotsPerInch");
            assetImageSize.FileSuffix       = reader.GetString("FileSuffix");


            assetImageSize.IsDirty = false;
            assetImageSize.ChangedProperties.Clear();

            return(assetImageSize);
        }
        public virtual AssetImageSize Update(AssetImageSize assetImageSize)
        {
            if (!assetImageSize.IsDirty || assetImageSize.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(assetImageSize);
            }

            IDbCommand command = CreateCommand();

            if (assetImageSize.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [AssetImageSize] ([Description], [Height], [Width], [DotsPerInch], [FileSuffix]) VALUES (@description, @height, @width, @dotsPerInch, @fileSuffix) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [AssetImageSize] SET [Description] = @description, [Height] = @height, [Width] = @width, [DotsPerInch] = @dotsPerInch, [FileSuffix] = @fileSuffix WHERE AssetImageSizeId = @assetImageSizeId";
            }

            command.Parameters.Add(CreateParameter("@description", assetImageSize.Description));
            command.Parameters.Add(CreateParameter("@height", assetImageSize.Height));
            command.Parameters.Add(CreateParameter("@width", assetImageSize.Width));
            command.Parameters.Add(CreateParameter("@dotsPerInch", assetImageSize.DotsPerInch));
            command.Parameters.Add(CreateParameter("@fileSuffix", assetImageSize.FileSuffix));

            if (assetImageSize.IsNew)
            {
                assetImageSize.AssetImageSizeId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@assetImageSizeId", assetImageSize.AssetImageSizeId));
                ExecuteCommand(command);
            }

            assetImageSize.IsDirty = false;
            assetImageSize.ChangedProperties.Clear();

            return(assetImageSize);
        }
Exemplo n.º 3
0
 public static AssetImageSize Update(AssetImageSize assetImageSize)
 {
     return(AssetImageSizeMapper.Instance.Update(assetImageSize));
 }
Exemplo n.º 4
0
        public static AssetImageSize FindOne(AssetImageSizeFinder finder)
        {
            AssetImageSize AssetImageSize = AssetImageSizeMapper.Instance.FindOne(finder);

            return(AssetImageSize ?? Empty);
        }
Exemplo n.º 5
0
        public static AssetImageSize Get(Nullable <Int32> AssetImageSizeId)
        {
            AssetImageSize AssetImageSize = AssetImageSizeMapper.Instance.Get(AssetImageSizeId);

            return(AssetImageSize ?? Empty);
        }