Exemplo n.º 1
0
        public void GetChatHistory(String uid, String fid)
        {
            Chat _Chat = new Chat(uid, fid);
            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT uid, fid, message, timestamp FROM chathistory WHERE chatID = '" + _Chat.ChatID + "'");
            String strMessage;

            foreach (DataRow _DataRow in _DataTable.Rows)
            {
                String msg = _DataRow["message"].ToString();
                String datetime = _DataRow["timestamp"].ToString();

                //If this message is sent by me
                if (_DataRow["uid"].ToString() == uid)
                {
                    strMessage = GetUIDChatString(msg, datetime);

                    Clients.Caller.updateChat(strMessage);
                }
                else
                {
                    strMessage = GetFIDChatString(msg, datetime, uid, fid);

                    Clients.Caller.updateChat(strMessage);
                }
            }
        }
Exemplo n.º 2
0
        public void GetChatHistory(String groupName, String uid, String userInfo)
        {
            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT UniqueID, Msg, TimeStamp, userInfo FROM PrivateChatData WHERE UniqueID = '" + uid + "'");
            String strMessage;

            foreach (DataRow _DataRow in _DataTable.Rows)
            {
                String msg = _DataRow["msg"].ToString();
                String datetime = _DataRow["timestamp"].ToString();

                //If this message is sent by me
                if (_DataRow["userInfo"].ToString() == userInfo)
                {
                    strMessage = GetUIDChatString(msg, datetime);

                    Clients.Caller.updateChat(strMessage);
                }
                else
                {
                    strMessage = GetFIDChatString(msg, datetime, _DataRow["UniqueID"].ToString(), _DataRow["userInfo"].ToString());

                    Clients.Caller.updateChat(strMessage);
                }
            }
        }
Exemplo n.º 3
0
        protected void addFriendButton_Click(object sender, EventArgs e)
        {
            string userName = userInfo.getUserName();
            string userID = userInfo.getUserID();

            string url = Request.Url.AbsoluteUri;
            int gidIndex = url.IndexOf("?gid=") + 5;
            int uidIndex = url.IndexOf("&uid=");

            string groupName = url.Substring(gidIndex, uidIndex - gidIndex);
            //groupName = groupName.Replace("+", " ");
            groupName = Server.UrlDecode(Request.QueryString["gid"]);

            string uniqueID = url.Substring(uidIndex+5);

            Boolean notFriend = true;

            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT memberID FROM PrivateChatList WHERE uniqueID='" + uniqueID + "'");
            String htmlCode = String.Empty;

            SqlConnection conn = new SqlConnection();

            conn.ConnectionString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

            conn.Open();

            foreach (int i in friendListBox.GetSelectedIndices())
            {
                foreach (DataRow _DataRow in _DataTable.Rows)
                {
                    if (_DataRow["memberID"].ToString() == friendListBox.Items[i].Value)
                    {
                        notFriend = false;
                        break;
                    }

                }
                if (notFriend == true)
                {
                    string insertFriend = "INSERT into PrivateChatList(UniqueID, GroupName, MemberName, MemberID) VALUES('"
                        + uniqueID + "',N'" + groupName + "','" + friendListBox.Items[i].Text + "','" + friendListBox.Items[i].Value + "');";
                    SqlCommand cmdFriend = new SqlCommand(insertFriend, conn);
                    cmdFriend.ExecuteNonQuery();
                }

                notFriend = true;
            }

            usersListBox.DataBind();

            string newUrl = url.Substring(0, gidIndex) +
               groupName + "&uid=" + uniqueID;

            Response.Redirect(newUrl);
        }
Exemplo n.º 4
0
        protected void addButton_Click(object sender, EventArgs e)
        {
            string userName = userInfo.getUserName();
            string userID = userInfo.getUserID();

            string url = Request.Url.AbsoluteUri;
            int docNameIndex = url.IndexOf("?docName=") + 9;
            int docIdIndex = url.IndexOf("&docId=");
            int userIdIndex = url.IndexOf("&userId=");

            string docName = url.Substring(docNameIndex, docIdIndex - docNameIndex);
            string docId = url.Substring(docIdIndex + 7, userIdIndex - (docIdIndex + 7));

            //docName = docName.Replace("+", " ");
            docName = Server.UrlDecode(Request.QueryString["docName"]);

            SqlConnection conn = new SqlConnection();

            conn.ConnectionString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

            conn.Open();

            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT memberID, memberName FROM Documents where docId='" + docId + "'");

            foreach (int i in friendListBox.GetSelectedIndices())
            {
                Boolean notFriend = true;

                foreach (DataRow _DataRow in _DataTable.Rows)
                {
                    if (_DataRow["memberID"].ToString() == friendListBox.Items[i].Value)
                    {
                        notFriend = false;
                        break;
                    }

                }
                if (notFriend == true)
                {
                    string insertFriend = "INSERT into Documents(docName, memberID, memberName, docId) VALUES(N'"
                        + docName + "','" + friendListBox.Items[i].Value + "','" + friendListBox.Items[i].Text + "','" + docId + "');";
                    SqlCommand cmdFriend = new SqlCommand(insertFriend, conn);
                    cmdFriend.ExecuteNonQuery();
                }

            }

            usersListBox.DataBind();

            string newUrl = url.Substring(0, docNameIndex) +
               docName + "&docId=" + docId +"&userId=" + userID;

            Response.Redirect(newUrl);
        }
Exemplo n.º 5
0
        public String getMyChatListHtml()
        {
            string userID = userInfo.getUserID();

            String htmlCode = String.Empty;

            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");

            //Individual List
            DataTable _individualDataTable = _SqlWrapper.executeQuery(@"SELECT friendID, friendName FROM IndividualChatList WHERE userID='" + userID + "'");
            foreach (DataRow _DataRow in _individualDataTable.Rows)
            {
                htmlCode += @"<tr>
                                <td>" + _DataRow["friendName"].ToString() + @"</td>
                                 <td>Individual</td>
                                <td><a ID=""indivChatGrp"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""individualChatGroup('" + userID + "','" + _DataRow["friendID"].ToString() + @"')"" >Chat</a></td>
                                 <td><a ID=""deleteLink"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""deleteChat('individual','" + _DataRow["friendID"].ToString() + @"')"" >Delete</a></td></tr>";
            }

            //Group List
            DataTable _groupDataTable = _SqlWrapper.executeQuery(@"SELECT UniqueID, GroupName FROM PrivateChatList WHERE memberID='" + userID + "'");
            foreach (DataRow _DataRow in _groupDataTable.Rows)
            {
                htmlCode += @"<tr>
                                <td>" + _DataRow["GroupName"].ToString() + @"</td>
                                 <td>Group</td>
                                <td><a ID=""pvtChatGrp"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""privateChatGroup('" + _DataRow["GroupName"].ToString() + "','" + _DataRow["UniqueID"].ToString() + @"')"" >Chat</a></td>
                                 <td><a ID=""deleteLink"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""deleteChat('group','" + _DataRow["UniqueID"].ToString() + @"')"" >Delete</a></td></tr>";
            }

            //Public List
            DataTable _publicDataTable = _SqlWrapper.executeQuery(@"SELECT UniqueID, GroupName FROM PublicChatList WHERE memberID='" + userID + "'");
            foreach (DataRow _DataRow in _publicDataTable.Rows)
            {
                htmlCode += @"<tr>
                                <td>" + _DataRow["GroupName"].ToString() + @"</td>
                                 <td>Public</td>
                                <td><a ID=""pubChatGrp"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""publicChatGroup('" + _DataRow["GroupName"].ToString() + "','" + _DataRow["UniqueID"].ToString() + @"')"" >Chat</a></td>
                                <td><a ID=""deleteLink"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""deleteChat('public','" + _DataRow["UniqueID"].ToString() + @"')"" >Delete</a></td></tr>";
            }
            return htmlCode;
        }
Exemplo n.º 6
0
        public void Send(String msg, String groupName, String uid, String datetime)
        {
            String strMessage;

            strMessage = GetFIDChatString(msg, datetime, uid);
            //Clients.Others.updateChat(strMessage);
            Clients.OthersInGroup(groupName).updateChat(strMessage);

            strMessage = GetUIDChatString(msg, datetime);
            Clients.Caller.updateChat(strMessage);

            /* Add Message to DB */

            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            _SqlWrapper.executeNonQuery(@"INSERT INTO GroupChatHistory (groupName, uid,message, timestamp) VALUES ('" + groupName + "', '" + uid + "', '" + msg + "', '" + datetime + "')");
        }
Exemplo n.º 7
0
        public String getPublicChatListHtml()
        {
            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT uniqueID, groupName, authorName FROM publicChatAuthor");
            String htmlCode = String.Empty;

            foreach (DataRow _DataRow in _DataTable.Rows)
            {

                htmlCode += @"<tr><td>" + _DataRow["groupName"].ToString() + @"</td>" +
                            @"<td>" + _DataRow["authorName"].ToString() + @"</td>"
                         + @"<td><a ID=""pubChatGrp"" runat=""server""  style=""cursor: pointer;""
                        onclick=""joinPublicChat('" + _DataRow["uniqueID"].ToString() + "','" + _DataRow["groupName"].ToString() + @"')"">Join</a> </td></tr>";
            }

            return htmlCode;
        }
Exemplo n.º 8
0
        public String getDocumentListHtml()
        {
            string userID = userInfo.getUserID();

            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT docName, docId FROM documents WHERE memberID='" + userID + "'");
            String htmlCode = String.Empty;

            foreach (DataRow _DataRow in _DataTable.Rows)
            {

                htmlCode += @"<tr>
                                <td>" + _DataRow["docName"].ToString() + @"</td>
                                <td><a ID=""openDocLink"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""openDoc('" + _DataRow["docName"].ToString()  + "','" + _DataRow["docId"].ToString() + "','" + userID + @"')"" >Open</a></td>
                                 <td><a ID=""deleteLink"" runat=""server""  style=""cursor: pointer;""
                                        onclick=""deleteDoc('doc','" + _DataRow["docId"].ToString() + "','" + userID + @"')"" >Delete</a></td></tr>";
            }

            return htmlCode;
        }
Exemplo n.º 9
0
        protected void chatFriendButton_Click(object sender, EventArgs e)
        {
            string userID = userInfo.getUserID();
            string userName = userInfo.getUserName();
            string friendID = friendListBox2.SelectedItem.Value;
            string friendName = friendListBox2.SelectedItem.Text;
            Boolean notFriend = true;
            Boolean notFriend1 = true;
            /*
            string cid = "";
            if (String.Compare(userID, friendID) < 0)
                cid = userID + friendID;
            else
                cid = friendID + userID;

            string chatID = cid;
            DataEncryptor keys = new DataEncryptor();
            string encryptChatID = keys.EncryptString(chatID);
            */

            SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT friendID FROM individualChatList where userID='" + userID + "'");
            String htmlCode = String.Empty;

            foreach (DataRow _DataRow in _DataTable.Rows)
            {
                if (_DataRow["friendID"].ToString() == friendID)
                {
                    notFriend = false;
                    break;
                }

            }

            SqlWrapper _SqlWrapper1 = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
            DataTable _DataTable1 = _SqlWrapper1.executeQuery(@"SELECT userID FROM individualChatList where friendID='" + friendID + "'");
            foreach (DataRow _DataRow1 in _DataTable1.Rows)
            {
                if (_DataRow1["userID"].ToString() == userID)
                {
                    notFriend1 = false;
                    break;
                }

            }
            if (notFriend == true)
            {
                string connString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

                string insert = "INSERT INTO IndividualChatList(userID, userName, friendID, friendName) VALUES('"
                    + userID + "','" + userName + "','" + friendID + "','" + friendName + "');";
                /*
                insert += "INSERT INTO IndividualChatList(userID, userName, friendID, friendName) VALUES('"
                    + friendID + "','" + friendName + "','" + userID + "','" + userName + "');";
                */
                using (SqlConnection con = new SqlConnection(connString))
                using (SqlCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = insert;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }

            if (notFriend1 == true)
            {
                string connString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";
                /*
                string insert = "INSERT INTO IndividualChatList(userID, userName, friendID, friendName) VALUES('"
                    + userID + "','" + userName + "','" + friendID + "','" + friendName + "');";
                */
                string insert = "INSERT INTO IndividualChatList(userID, userName, friendID, friendName) VALUES('"
                    + friendID + "','" + friendName + "','" + userID + "','" + userName + "');";

                using (SqlConnection con = new SqlConnection(connString))
                using (SqlCommand cmd = con.CreateCommand())
                {
                    cmd.CommandText = insert;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }

            Response.Redirect("MainChat.aspx?uid=" + userID + "&fid=" + friendID);
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string userID = userInfo.getUserID();

               HelperClasses.Token myToken = new HelperClasses.Token();

               if (myToken.getToken() == "")
               {
               Response.Redirect("Home.aspx");
               }

                try
                {
                    string url = Request.Url.AbsoluteUri;

                    int docNameIndex = url.IndexOf("?docName=") + 9;
                    int docIdIndex = url.IndexOf("&docId=");
                    int userIdIndex = url.IndexOf("&userId=");

                    string strDocName = url.Substring(docNameIndex, docIdIndex - docNameIndex);
                    string strDocID = url.Substring(docIdIndex + 7, userIdIndex - (docIdIndex + 7));

                    //docTitleLabel.Text = strDocName.Replace("%20", " ");
                    docTitleLabel.Text = Server.UrlDecode(Request.QueryString["docName"]);
                    //renameTextBox.Value = strDocName;

                    SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
                    DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT memberID FROM documents WHERE docId = '" + strDocID + "'");

                    foreach (DataRow _DataRow in _DataTable.Rows)
                    {
                        if (_DataRow["memberID"].ToString() == userID)
                        {
                            SqlConnection conn = new SqlConnection();

                            conn.ConnectionString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

                            conn.Open();

                            string selectData = "SELECT data FROM myDoc WHERE docID='" + strDocID + "';";
                            SqlCommand cmd = new SqlCommand(selectData, conn);

                            SqlDataReader dataReader = null;

                            dataReader = cmd.ExecuteReader();

                            string data = null;

                            while (dataReader.Read())
                            {
                                data = dataReader["data"].ToString();
                            }

                            myText.Value = data;

                            break;
                        }
                    }

                }
                catch { }
        }
Exemplo n.º 11
0
        public void addFriendToSql()
        {
            HelperClasses.IvleUserInfo userInfo = new HelperClasses.IvleUserInfo();

            string url = HttpContext.Current.Request.RawUrl;

            string userName = userInfo.getUserName();
            string userID = userInfo.getUserID();
            string friendID = "";
            string friendName = "";
            if (url.IndexOf('?') > -1)
            {
                int idIndex = url.IndexOf("id=");
                int nameIndex = url.IndexOf("name=");

                friendID = url.Substring(idIndex + 3, 8);
                friendID = friendID.ToLower();
                friendName = url.Substring(nameIndex + 5);

                friendName = friendName.Replace("%20", " ");
                friendName = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(friendName.ToLower());
                //Response.Redirect(Request.Url.AbsoluteUri);

                try
                {
                    Boolean notFriend = true;

                    SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
                    DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT friendID FROM friendList");
                    String htmlCode = String.Empty;

                    foreach (DataRow _DataRow in _DataTable.Rows)
                    {
                        if (_DataRow["friendID"].ToString() == friendID)
                        {
                            notFriend = false;
                            break;
                        }

                    }

                    if(friendID == userID)
                    {
                        notFriend = false;
                    }

                    if (notFriend == true)
                    {

                        SqlConnection conn = new SqlConnection();

                        conn.ConnectionString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

                        conn.Open();

                        string insert = "INSERT into FriendList(userID,userName,friendID,friendName, isFriend, isAck, isAccepted) " + " VALUES ('" + userID + "', '" + userName + "', '" + friendID + "', '" + friendName + "','False','False','False')"
                            + "INSERT into FriendList(userID,userName,friendID,friendName, isFriend, isAck, isAccepted) " + " VALUES ('" + friendID + "', '" + friendName + "', '" + userID + "', '" + userName + "','False','False','False');";
                        SqlCommand cmd = new SqlCommand(insert, conn);

                        cmd.ExecuteNonQuery();

                        conn.Close();
                        Response.Redirect("Friend.aspx");
                    }
                }
                catch { }
            }
        }
Exemplo n.º 12
0
        protected void addFriendButton_Click(object sender, EventArgs e)
        {
            string userName = userInfo.getUserName();
            string userID = userInfo.getUserID();
            string friendID = friendIdTextBox.Text.ToLower();
            string friendName = friendNameTextBox.Text;
            friendName = System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(friendName);

            if (friendName == "")
                warningLabel.Text = "No Name enter ";
            else if (friendID == "")
                warningLabel.Text = "No id enter";
            else if (checkFriendID(friendID) == false)
                warningLabel.Text = "Invalid friend ID";
            else
            {
                Boolean notFriend = true;

                SqlWrapper _SqlWrapper = new SqlWrapper(@"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
                DataTable _DataTable = _SqlWrapper.executeQuery(@"SELECT friendID, friendName FROM friendList where userId='" + userID + "'");
                String htmlCode = String.Empty;
                String clashName = "";
                foreach (DataRow _DataRow in _DataTable.Rows)
                {
                    if (_DataRow["friendID"].ToString() == friendID)
                    {
                        clashName = _DataRow["friendName"].ToString();
                        notFriend = false;
                        break;
                    }

                }

                if(friendID == userID)
                {
                    notFriend = false;
                }
                if (notFriend == true)
                {
                    SqlConnection conn = new SqlConnection();

                    conn.ConnectionString = @"Server=tcp:yq6ulqknjf.database.windows.net,1433;Database=ModulesDB;User ID=rstyle@yq6ulqknjf;Password=Zxcv2345;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;";

                    conn.Open();

                    string insert = "INSERT into FriendList(userID,userName,friendID,friendName, isFriend, isAck, isAccepted) " + " VALUES ('" + userID + "', '" + userName + "', '" + friendID + "', '" + friendName + "','False','False','False')"
                        + "INSERT into FriendList(userID,userName,friendID,friendName, isFriend, isAck, isAccepted) " + " VALUES ('" + friendID + "', '" + friendName + "', '" + userID + "', '" + userName + "','False','False','False');";
                    SqlCommand cmd = new SqlCommand(insert, conn);

                    cmd.ExecuteNonQuery();

                    conn.Close();

                    //friendListBox.DataBind();
                    editNameListBox.DataBind();
                    warningLabel.Text = "";
                    friendIdTextBox.Text = "";
                    friendNameTextBox.Text = "";
                    editNameTextBox.Text = "";
                }
                else
                {
                    editNameListBox.DataBind();
                    warningLabel.Text = "Friend ID belongs to " + clashName;
                    friendIdTextBox.Text = "";
                    friendNameTextBox.Text = "";
                    editNameTextBox.Text = "";
                }
            }
        }