Exemple #1
0
        public ChatContrato selectChatCIdServ(int id)
        {
            string          sql    = "SELECT * FROM chat_contrato WHERE id_servico = " + id;
            ChatContrato    chatC  = new ChatContrato();
            MySqlConnection conn   = new Conn().conectar();
            MySqlDataReader reader = new Conn().consultar(sql, conn);

            chatC = preencherChatC(reader);

            conn.Close();
            return(chatC);
        }
Exemple #2
0
        public void insertChatContrato(ChatContrato chatC)
        {
            string sql = "INSERT INTO chat_contrato(id,id_servico,id_usuario,id_user_empresa)" +
                         "VALUES (NULL, " +
                         " " + chatC.IdServ + "," +
                         " " + chatC.IdUser + "," +
                         " " + chatC.IdUserEmp + "" +
                         ")";
            MySqlConnection conn = new Conn().conectar();

            new Conn().executar(sql, conn);
            conn.Close();
        }
Exemple #3
0
        public ChatContrato selectChatC(ChatContrato chatC)
        {
            string sql = "SELECT * FROM chat_contrato WHERE id = " + chatC.Id;

            MySqlConnection conn   = new Conn().conectar();
            MySqlDataReader reader = new Conn().consultar(sql, conn);

            while (reader.Read() && reader.HasRows)
            {
                chatC = preencherChatC(reader);
            }
            conn.Close();
            return(chatC);
        }
Exemple #4
0
        public List <ChatContrato> selectChatCIdUserEmp(int id)
        {
            string sql = "SELECT * FROM chat_contrato WHERE id_user_empresa = " + id;
            List <ChatContrato> chatCs = new List <ChatContrato>();
            ChatContrato        chatC  = new ChatContrato();
            MySqlConnection     conn   = new Conn().conectar();
            MySqlDataReader     reader = new Conn().consultar(sql, conn);

            while (reader.Read() && reader.HasRows)
            {
                chatC = preencherChatC(reader);
                chatCs.Add(chatC);
            }
            conn.Close();
            return(chatCs);
        }
Exemple #5
0
        private ChatContrato preencherChatC(MySqlDataReader reader)
        {
            ChatContrato chatC = new ChatContrato();

            if (reader.Read() && reader.HasRows)
            {
                chatC.Id        = reader.GetInt32(0);
                chatC.IdServ    = reader.GetInt32(1);
                chatC.IdUser    = reader.GetInt32(2);
                chatC.IdUserEmp = reader.GetInt32(3);
            }
            else
            {
            }
            return(chatC);
        }