Ejemplo n.º 1
0
        private async Task <List <string> > GetAllTablesAsync()
        {
            string        sqlText          = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_CATALOG = 'chat-hub-db'";
            List <string> listOfTableNames = await SQLQueryExecutor.ExecuteQuery(sqlText, Configuration);

            return(listOfTableNames);
        }
Ejemplo n.º 2
0
        public async Task <List <ChatMessage> > GetAllChatMessagesThatHaveNotBeenSeenByYou(string yourPhoneNum)
        {
            string sql = "SELECT " + "*"
                         + " FROM " + "[" + yourPhoneNum + "] "
                         + "WHERE " + ApplicationConstants.SEEN_COLUMN + "=" + "'no';";
            List <ChatMessage> listOfChatMsgsHaveNotBeenSeen = await SQLQueryExecutor.ExecuteQueryToReturnChatMessages(sql, Configuration);

            return(listOfChatMsgsHaveNotBeenSeen);
        }
Ejemplo n.º 3
0
        public async Task <List <string> > GetIDsOfYourMessagesSeenByFriend(string friendPhoneNum, string yourPhoneNum)
        {
            string sql = "SELECT " + ApplicationConstants.MSG_ID
                         + " FROM " + "[" + friendPhoneNum + "] "
                         + "WHERE " + ApplicationConstants.MSG_PHONE_NUM_WRITER + "=" + "'" + yourPhoneNum + "' "
                         + "AND " + ApplicationConstants.SEEN_COLUMN + "=" + "'yes';";
            List <string> listOfIDs = await SQLQueryExecutor.ExecuteGetSeenMessagesQuery(sql, Configuration);

            return(listOfIDs);
        }
Ejemplo n.º 4
0
        public async Task <bool> IsUserTableInDatabase(string userPhoneNum)
        {
            string sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES "
                         + "WHERE TABLE_NAME ='" + userPhoneNum + "';";
            List <string> tableNames = await SQLQueryExecutor.ExecuteQuery(sql, Configuration);

            if (tableNames.Count > 0)
            {
                System.Diagnostics.Debug.WriteLine("tableNames count > 0");
                return(true);
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("tableNames count = 0");
                return(false);
            }
        }