add icon(128*128)
This commit is contained in:
@@ -36,6 +36,7 @@ namespace VNCServerList.Services
|
||||
[Description] [varchar](100) NULL,
|
||||
[Password] [varchar](20) NULL,
|
||||
[Argument] [varchar](50) NULL,
|
||||
[Icon] [image] NULL,
|
||||
CONSTRAINT [PK_VNC_ServerList] PRIMARY KEY CLUSTERED
|
||||
(
|
||||
[User] ASC,
|
||||
@@ -47,6 +48,16 @@ namespace VNCServerList.Services
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
// Icon 컬럼이 존재하는지 확인하고 없으면 추가
|
||||
string checkIconColumnSql = @"
|
||||
IF NOT EXISTS (SELECT * FROM sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[VNC_ServerList]') AND name = 'Icon')
|
||||
ALTER TABLE [dbo].[VNC_ServerList] ADD [Icon] [image] NULL";
|
||||
|
||||
using (var command = new SqlCommand(checkIconColumnSql, connection))
|
||||
{
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +83,8 @@ namespace VNCServerList.Services
|
||||
Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(),
|
||||
Description = reader["Description"] == DBNull.Value ? null : reader["Description"].ToString(),
|
||||
Password = reader["Password"] == DBNull.Value ? null : reader["Password"].ToString(),
|
||||
Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString()
|
||||
Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString(),
|
||||
Icon = reader["Icon"] == DBNull.Value ? null : (byte[])reader["Icon"]
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -105,7 +117,8 @@ namespace VNCServerList.Services
|
||||
Title = reader["Title"] == DBNull.Value ? null : reader["Title"].ToString(),
|
||||
Description = reader["Description"] == DBNull.Value ? null : reader["Description"].ToString(),
|
||||
Password = reader["Password"] == DBNull.Value ? null : reader["Password"].ToString(),
|
||||
Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString()
|
||||
Argument = reader["Argument"] == DBNull.Value ? null : reader["Argument"].ToString(),
|
||||
Icon = reader["Icon"] == DBNull.Value ? null : (byte[])reader["Icon"]
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -121,8 +134,8 @@ namespace VNCServerList.Services
|
||||
{
|
||||
connection.Open();
|
||||
string sql = @"
|
||||
INSERT INTO VNC_ServerList ([User], [IP], [Category], [Title],[Description], [Password], [Argument])
|
||||
VALUES (@User, @IP, @Category, @Title,@Description, @Password, @Argument)";
|
||||
INSERT INTO VNC_ServerList ([User], [IP], [Category], [Title],[Description], [Password], [Argument], [Icon])
|
||||
VALUES (@User, @IP, @Category, @Title,@Description, @Password, @Argument, @Icon)";
|
||||
|
||||
using (var command = new SqlCommand(sql, connection))
|
||||
{
|
||||
@@ -133,6 +146,7 @@ namespace VNCServerList.Services
|
||||
command.Parameters.AddWithValue("@Description", (object)server.Description ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Password", (object)server.Password ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Argument", (object)server.Argument ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Icon", (object)server.Icon ?? DBNull.Value);
|
||||
|
||||
return command.ExecuteNonQuery() > 0;
|
||||
}
|
||||
@@ -147,7 +161,7 @@ namespace VNCServerList.Services
|
||||
string sql = @"
|
||||
UPDATE VNC_ServerList
|
||||
SET [Category] = @Category, [Title] = @Title, [Description] = @Description,
|
||||
[Password] = @Password, [Argument] = @Argument
|
||||
[Password] = @Password, [Argument] = @Argument, [Icon] = @Icon
|
||||
WHERE [User] = @User AND [IP] = @IP";
|
||||
|
||||
using (var command = new SqlCommand(sql, connection))
|
||||
@@ -159,6 +173,7 @@ namespace VNCServerList.Services
|
||||
command.Parameters.AddWithValue("@Description", (object)server.Description ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Password", (object)server.Password ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Argument", (object)server.Argument ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Icon", (object)server.Icon ?? DBNull.Value);
|
||||
|
||||
return command.ExecuteNonQuery() > 0;
|
||||
}
|
||||
@@ -173,7 +188,7 @@ namespace VNCServerList.Services
|
||||
string sql = @"
|
||||
UPDATE VNC_ServerList
|
||||
SET [IP] = @NewIP, [Category] = @Category, [Title] = @Title, [Description] = @Description,
|
||||
[Password] = @Password, [Argument] = @Argument
|
||||
[Password] = @Password, [Argument] = @Argument, [Icon] = @Icon
|
||||
WHERE [User] = @User AND [IP] = @OriginalIP";
|
||||
|
||||
using (var command = new SqlCommand(sql, connection))
|
||||
@@ -186,6 +201,7 @@ namespace VNCServerList.Services
|
||||
command.Parameters.AddWithValue("@Description", (object)newServerData.Description ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Password", (object)newServerData.Password ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Argument", (object)newServerData.Argument ?? DBNull.Value);
|
||||
command.Parameters.AddWithValue("@Icon", (object)newServerData.Icon ?? DBNull.Value);
|
||||
|
||||
return command.ExecuteNonQuery() > 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user