Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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,by,byid,bytype)" +
                                     "VALUES (:type,:date,:chat,:content,:state,:for,:forid,:fortype,:by,:byid,:bytype) 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["by"] = By;
            cmd["byid"] = ById;
            cmd["bytype"] = ByType;
            Id = (long)cmd.ExecuteScalar();
        }