コード例 #1
0
ファイル: Notification.cs プロジェクト: Rohansi/RohBot
        public void Save()
        {
            var cmd = new SqlCommand("UPDATE rohbot.notifications SET regex=:regex WHERE id=:id");
            cmd["id"] = Id;
            cmd["regex"] = Regex.ToString();

            cmd.ExecuteNonQuery();
        }
コード例 #2
0
ファイル: Notification.cs プロジェクト: Rohansi/RohBot
        public void Remove()
        {
            var cmd = new SqlCommand("DELETE FROM rohbot.notifications WHERE devicetoken=:devicetoken AND userid=:userid");
            cmd["devicetoken"] = DeviceToken;
            cmd["userid"] = UserId;

            cmd.ExecuteNonQuery();
        }
コード例 #3
0
ファイル: Notification.cs プロジェクト: Rohansi/RohBot
        public void Insert()
        {
            var cmd = new SqlCommand("INSERT INTO rohbot.notifications (userid, regex, devicetoken) VALUES(:userid, :regex, :devicetoken) RETURNING id;");
            cmd["userid"] = UserId;
            cmd["regex"] = Regex.ToString();
            cmd["devicetoken"] = DeviceToken;

            Id = (long)cmd.ExecuteScalar();
        }
コード例 #4
0
ファイル: HistoryLine.cs プロジェクト: Rohansi/RohBot
        public override void Insert()
        {
            if (Id != 0)
                throw new InvalidOperationException("Cannot insert existing row");

            var cmd = new SqlCommand("INSERT INTO rohbot.chathistory (type,date,chat,content,usertype,sender,senderid,senderstyle,ingame)" +
                                     "VALUES (:type,:date,:chat,:content,:usertype,:sender,:senderid,:senderstyle,:ingame) RETURNING id;");
            cmd["type"] = Type;
            cmd["date"] = Date;
            cmd["chat"] = Chat;
            cmd["content"] = Content;
            cmd["usertype"] = UserType;
            cmd["sender"] = Sender;
            cmd["senderid"] = SenderId;
            cmd["senderstyle"] = SenderStyle;
            cmd["ingame"] = InGame;
            Id = (long)cmd.ExecuteScalar();
        }
コード例 #5
0
ファイル: HistoryLine.cs プロジェクト: Rohansi/RohBot
        public override void Insert()
        {
            if (Id != 0)
                throw new InvalidOperationException("Cannot insert existing row");

            var cmd = new SqlCommand("INSERT INTO rohbot.chathistory (type,date,chat,content,state,\"for\",forid,fortype,forstyle,by,byid,bytype,bystyle)" +
                                     "VALUES (:type,:date,:chat,:content,:state,:for,:forid,:fortype,:forstyle,:by,:byid,:bytype,:bystyle) RETURNING id;");
            cmd["type"] = Type;
            cmd["date"] = Date;
            cmd["chat"] = Chat;
            cmd["content"] = Content;
            cmd["state"] = State;
            cmd["for"] = For;
            cmd["forid"] = ForId;
            cmd["fortype"] = ForType;
            cmd["forstyle"] = ForStyle;
            cmd["by"] = By;
            cmd["byid"] = ById;
            cmd["bytype"] = ByType;
            cmd["bystyle"] = ByStyle;
            Id = (long)cmd.ExecuteScalar();
        }
コード例 #6
0
ファイル: NotificationManager.cs プロジェクト: Rohansi/RohBot
 public void InvalidateNotificationCache()
 {
     var cmd = new SqlCommand("SELECT notifications.*, accounts.name, accounts.rooms FROM rohbot.accounts INNER JOIN rohbot.notifications ON (rohbot.accounts.id = rohbot.notifications.userid)");
     Notifications = cmd.Execute().Select(row => new Notification(row)).ToList();
 }