Esempio n. 1
0
        public void LoadPrivateChat1(string fromEnrollNo, string toEnrollNo)
        {
            List <List <string> > Chat = new List <List <string> >();
            ConnClass             Conn = new ConnClass();

            try
            {
                string[] arr = new string[] { fromEnrollNo, toEnrollNo };
                Array.Sort(arr);
                string table_name = "f" + arr[0] + "to" + arr[1];

                string GetPrevoiuschat = "SELECT c" + fromEnrollNo + ",c" + toEnrollNo + ",message,time FROM " + table_name;

                Chat = Conn.GetAllMessage(GetPrevoiuschat);

                Clients.Caller.loadChat(Chat, GetUserName(toEnrollNo));
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                Console.WriteLine(ex.ToString());
                Clients.Caller.loadChat(null, GetUserName(toEnrollNo));
            }
            finally
            {
            }
        }
Esempio n. 2
0
        public void LoadPrivateChat(string toEnrollNo, string fromEnrollNo)
        {
            List <List <string> > Chat = new List <List <string> >();
            ConnClass             Conn = new ConnClass();
            bool check = false;

            try
            {
                string[] arr        = new string[] { fromEnrollNo, toEnrollNo };
                string   table_name = "f" + fromEnrollNo + "to" + toEnrollNo;
                Array.Sort(arr);
                string new_table_name = "f" + arr[0] + "to" + arr[1];
                if (new_table_name == table_name)
                {
                    check = true;
                }
                else
                {
                    check = false;
                }


                string GetPrevoiuschat = "SELECT * FROM " + new_table_name;

                Chat = Conn.GetAllMessage(GetPrevoiuschat);

                Clients.Caller.loadChat(Chat, check, GetUserName(toEnrollNo));
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                Console.WriteLine(ex.ToString());
                Clients.Caller.loadChat(null, check, GetUserName(toEnrollNo));
            }
            finally
            {
            }
        }