예제 #1
0
파일: Message.cs 프로젝트: HilayVais/WPF
        //	private MessageHandler messageHandler = new MessageHandler(this);

        public Message(CommunicationLayer.IMessage m, BussinessLayer.User user, string gid)
        {
            this.body     = m.MessageContent;
            this.time     = m.Date;
            this.user     = user;
            this.group_id = gid;
            //	Save();
        }
예제 #2
0
        public static User GetUserByUserName(string UserName)
        {
            DataRow myRow = Users.GetUserByUserName(UserName);

            if (myRow == null)
            {
                return(null);
            }

            User user = new BussinessLayer.User(Convert.ToInt32(myRow["Id"].ToString()), myRow["FirstName"].ToString()
                                                , myRow["LastName"].ToString(), myRow["UserName"].ToString(), myRow["Password"].ToString());

            return(user);
        }
예제 #3
0
파일: ChatRoom.cs 프로젝트: HilayVais/WPF
        public Boolean Registeration(string nickname, string groupID)
        {
            foreach (BussinessLayer.User u in users)
            {
                if (u.GetNickname().Equals(nickname))
                {
                    DateTime c6 = DateTime.Now;
                    // Create a string array with the lines of text
                    string[] lines1 = { c6 + "     registaration failed  " };
                    // Write the string array to a new file named "WriteLines.txt".

                    StreamWriter outputFile1;
                    using (outputFile1 = File.AppendText(GuiChatRoom.Paths.logDBPath()))
                    {
                        foreach (string line in lines1)
                        {
                            outputFile1.WriteLine(line);
                        }
                    }

                    outputFile1.Close();
                    return(false);
                }
            }
            BussinessLayer.User u1 = new BussinessLayer.User(nickname, groupID);
            users.Add(u1);
            this.loogedInUser = u1;
            DateTime c4 = DateTime.Now;

            // Create a string array with the lines of text
            string[] lines = { c4 + "     registaration success " };
            // Write the string array to a new file named "WriteLines.txt".
            StreamWriter outputFile;

            using (outputFile = File.AppendText(GuiChatRoom.Paths.logDBPath()))
            {
                foreach (string line in lines)
                {
                    outputFile.WriteLine(line);
                }
            }

            outputFile.Close();
            return(DBmanager.Register(nickname, groupID));
        }
예제 #4
0
파일: ChatRoom.cs 프로젝트: HilayVais/WPF
        public void LogOut()
        {
            DateTime c3 = DateTime.Now;

            // Create a string array with the lines of text
            string[] lines = { c3 + "    the user is logged out " };
            // Write the string array to a new file named "WriteLines.txt".
            StreamWriter outputFile;

            using (outputFile = File.AppendText(GuiChatRoom.Paths.logDBPath()))
            {
                foreach (string line in lines)
                {
                    outputFile.WriteLine(line);
                }
            }

            outputFile.Close();
            this.loogedInUser = null;
        }
예제 #5
0
파일: ChatRoom.cs 프로젝트: HilayVais/WPF
        public Boolean LogIn(string nickname, string groupID)
        {
            BussinessLayer.User u = FindUser(nickname, groupID, true);
            if (u == null || u.GetGroupID() != groupID)
            {
                DateTime c2    = DateTime.Now;
                string[] lines = { c2 + "     login failed " };
                // Write the string array to a new file named "WriteLines.txt".

                StreamWriter outputFile;
                using (outputFile = File.AppendText(GuiChatRoom.Paths.logDBPath()))
                {
                    foreach (string line in lines)
                    {
                        outputFile.WriteLine(line);
                    }
                }
                outputFile.Close();
                return(false);
            }
            else
            {
                DateTime c     = DateTime.Now;
                string[] lines = { c + "    logged in " };
                // Write the string array to a new file named "WriteLines.txt".
                StreamWriter outputFile;
                using (outputFile = File.AppendText(Paths.logDBPath()))
                {
                    foreach (string line in lines)
                    {
                        outputFile.WriteLine(line);
                    }
                }

                outputFile.Close();
                loogedInUser = u;
                return(true);
            }
        }