chaosbot/ChaosBot/Database/Entity/CommandPermission.cs

53 lines
1.5 KiB
C#

using System;
using System.Data;
using ChaosBot.Attribute;
namespace ChaosBot.Database.Entity
{
[DBEntity("CommandPermissions")]
public class CommandPermission : BaseEntity
{
[DBPrimaryKey]
[DBAutoIncrement]
[DBNotNull]
[DBUnique]
public Nullable<long> 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 CommandPermission() {}
public CommandPermission(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 CommandPermission(string type, string value, string cmd, long guildId)
{
this.type = type;
this.value = value;
this.cmd = cmd;
this.guildId = guildId;
}
public static QueryBuilder<CommandPermission> Query()
{
return BaseEntity.Query<CommandPermission>();
}
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"];
}
}
}