From 703e5ae41190c51310943317e70e9cf31be70372 Mon Sep 17 00:00:00 2001 From: Sean Stoves Date: Mon, 15 Jun 2020 22:32:25 -0400 Subject: [PATCH] Adding CommandPermission Entity --- .../Database/Entity/CommandPermissions.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 ChaosBot/Database/Entity/CommandPermissions.cs diff --git a/ChaosBot/Database/Entity/CommandPermissions.cs b/ChaosBot/Database/Entity/CommandPermissions.cs new file mode 100644 index 0000000..67ed04e --- /dev/null +++ b/ChaosBot/Database/Entity/CommandPermissions.cs @@ -0,0 +1,53 @@ +using System; +using System.Data; +using ChaosBot.Attribute; + +namespace ChaosBot.Database.Entity +{ + [DBEntity("CommandPermissions")] + public class CommandPermissions : BaseEntity + { + [DBPrimaryKey] + [DBAutoIncrement] + [DBNotNull] + [DBUnique] + public Nullable id { get; private set; } + public string type { get; private set; } + public string value { get; private set; } + public string cmd { get; private set; } + public long guildId { get; private set; } + + public CommandPermissions() {} + + public CommandPermissions(int id, string type, string value, string cmd, long guildId) + { + this.id = id; + this.type = type; + this.value = value; + this.cmd = cmd; + this.guildId = guildId; + } + + public CommandPermissions(string type, string value, string cmd, long guildId) + { + this.type = type; + this.value = value; + this.cmd = cmd; + this.guildId = guildId; + } + + public static QueryBuilder Query() + { + return BaseEntity.Query(); + } + + public override void SetFromRow(DataRow row) + { + id = (long)row["id"]; + type = (string)row["type"]; + value = (string)row["value"]; + cmd = (string)row["cmd"]; + guildId = (long) row["guildid"]; + } + } +} \ No newline at end of file