/// <summary>
        /// Constructor
        /// </summary>
        public GroupSelector(USER.Data client)
        {
            InitializeComponent();
            SetSelector();

            _client = client;

            _listOfGroups = DATABASE.DbConnect.GetAllGroupInfo();
        }
Пример #2
0
 /// <summary>
 /// Returns a SmallSelector Form for the given group
 /// </summary>
 /// <param name="group"></param>
 /// <returns></returns>
 public static Form ShowSmallSelector(USER.Data client, GROUP.Data group)
 {
     return(new COMPONENTS.SmallSelector(group, client)
     {
         TopLevel = false,
         AutoScroll = false,     //  UI  This could be changed
         Visible = true
     });
 }
Пример #3
0
 public void UpdateUserInformation(USER.Data newData)
 {
     this.Name        = newData.Name;
     this.Surname     = newData.Surname;
     this.Department  = newData.Department;
     this.Region      = newData.Region;
     this.Email       = newData.Email;
     this.Phonenumber = newData.Phonenumber;
     this.Quote       = newData.Quote;
     this.PhotoLink   = newData.PhotoLink;
     this.Img         = newData.Img;
     this.Portfolio   = newData.Portfolio;
     this.Adres       = newData.Adres;
 }
Пример #4
0
 public void UpdateUserInformation()
 {
     USER.Data newData = DATABASE.DbConnect.GetUser(this.UserId);
     this.Name        = newData.Name;
     this.Surname     = newData.Surname;
     this.Department  = newData.Department;
     this.Region      = newData.Region;
     this.Email       = newData.Email;
     this.Phonenumber = newData.Phonenumber;
     this.Quote       = newData.Quote;
     this.PhotoLink   = newData.PhotoLink;
     this.Img         = newData.Img;
     this.Portfolio   = newData.Portfolio;
     this.Adres       = newData.Adres;
 }
Пример #5
0
        /// <summary>
        /// Initializes the form with the given values
        /// </summary>
        /// <param name="name">Name of the group</param>
        /// <param name="description">Description of the group</param>
        public SmallSelector(GROUP.Data group, USER.Data client)
        {
            InitializeComponent();

            _myGroup = group;
            _client  = client;

            this.lbl_Name.Text        = _myGroup.Name;
            this.lbl_Description.Text = _myGroup.Description;

            foreach (var item in client.Groups)
            {
                if (item.GroupId == group.GroupId)
                {
                    _usable = false;
                }
            }
        }
Пример #6
0
        public static void JoinGroup(USER.Data client, GROUP.Data myGroup)
        {
            //use try so the code doesn`t crash
            try
            {
                if (_connection.State != System.Data.ConnectionState.Open)
                {
                    _connection.Open();
                }

                //  the incomplete query
                string query =
                    "INSERT INTO `group_members` (`GroupID`, `UserID`)" +
                    "VALUES(@GroupId, @ClientId)";


                //  DEFINE the paramaters
                MySqlParameter param1 = new MySqlParameter();
                param1.ParameterName = "@ClientId";
                param1.Value         = client.UserId;

                MySqlParameter param2 = new MySqlParameter();
                param2.ParameterName = "@GroupId";
                param2.Value         = myGroup.GroupId;

                //  build the command
                MySqlCommand command = new MySqlCommand(query, _connection);

                //  add the parameters to the command
                command.Parameters.Add(param1);
                command.Parameters.Add(param2);

                //  use the command
                ExecuteInsert(command);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            _connection.Close();
        }
        public FormMain(int userId)
        {
            User = User.LoadUser(userId, User);

            foreach (GROUP.Data item in User.Groups)
            {
                item.FillChats();
            }

            InitializeComponent();

            //  starts the controlller
            CONTROLLERS.ControllerMain.StartController(
                this.P_MainPanel,
                this.LB_Groups,
                this.P_SidePanel,
                this.P_UserInformation,
                this.P_Title,
                User
                );
        }
 /// <summary>
 /// Changes the current pages that should be put in de Panels
 /// </summary>
 /// <param name="page"></param>
 /// <seealso cref="Page"/>
 public static void ChangePanels(FORMS.FormMain.Page page, USER.Data selectedUser)
 {
     _selectedUser = selectedUser;
     ChangePanels(page);
 }
 public ProfileShow(USER.Data user, USER.Data client)
 {
     _user   = user;
     _client = client;
     InitializeComponent();
 }
Пример #10
0
 public static void JoinGroup(USER.Data client, GROUP.Data myGroup)
 {
     DATABASE.DbConnect.JoinGroup(client, myGroup);
 }
Пример #11
0
 public ProfileEdit(USER.Data selectedUser)
 {
     _user = selectedUser;
     InitializeComponent();
 }
Пример #12
0
 public Chat(CHAT.Data inputChat, USER.Data client)
 {
     SelectedChat = inputChat;
     Client       = client;
     InitializeComponent();
 }
Пример #13
0
        static public USER.Data GetUser(int id)
        {
            //Define output:
            USER.Data output = new USER.Data();

            //use try so the code doesn`t crash
            try
            {
                if (_connection.State != System.Data.ConnectionState.Open)
                {
                    _connection.Open();
                }
                //  the incomplete query
                string query = "Select * FROM users WHERE UserID = @id";

                //  DEFINE the paramaters
                MySqlParameter param1 = new MySqlParameter();
                param1.ParameterName = "@id";
                param1.Value         = id;

                //  build the command
                MySqlCommand command = new MySqlCommand(query, _connection);

                //  add the parameters to the command
                command.Parameters.Add(param1);

                //  use the command
                using (MySqlDataReader reader = command.ExecuteReader())
                {
                    //  if the query finds a result
                    if (reader.HasRows)
                    {
                        //  read through the result
                        while (reader.Read())
                        {
                            //Save all info from user
                            int      userId      = Convert.ToInt32(reader["UserID"]);
                            string   name        = Convert.ToString(reader["UserName"]);
                            string   surname     = Convert.ToString(reader["UserSurname"]);
                            string   email       = Convert.ToString(reader["UserEmail"]);
                            string   region      = Convert.ToString(reader["UserRegion"]);
                            string   department  = Convert.ToString(reader["UserDepartment"]);
                            string   phonenumber = Convert.ToString(reader["UserPhoneNumber"]);
                            string   quote       = Convert.ToString(reader["UserQuote"]);
                            string   portfolio   = Convert.ToString(reader["UserPortfolio"]);
                            string   photolink   = Convert.ToString(reader["UserPhotoLink"]);
                            string   adres       = Convert.ToString(reader["UserAdres"]);
                            int      gender      = Convert.ToInt32(reader["UserGender"]);
                            int      type        = Convert.ToInt32(reader["UserType"]);
                            DateTime dob         = Convert.ToDateTime(reader["UserDOB"]);
                            byte[]   img         = null;
                            if (reader["UserProfilePicture"] != DBNull.Value)
                            {
                                img = (byte[])(reader["UserProfilePicture"]);
                            }
                            output = new USER.Data(userId, name, surname, email, region, department, phonenumber, quote, portfolio, photolink, adres, gender, type, dob, img);
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            CloseConn();
            return(output);
        }
 public ListUsersSidePanel(List <USER.Data> input, USER.Data client)
 {
     _users  = input;
     _client = client;
     InitializeComponent();
 }
 public FormUserInformation(USER.Data user)
 {
     this._user = user;
     InitializeComponent();
 }