private void ShowUsers()
 {
     if (fpnUsers.Controls.Count > 0)
     {
         fpnUsers.Controls.Clear();
     }
     all = new UserBLL().RetrieveALL();
     UserPanel[] users = new UserPanel[all.Count];
     for (int i = 0; i < users.Length; i++)
     {
         users[i] = new UserPanel(table.Size.Width, table.Size.Height)
         {
             ID                  = all[i].ID,
             UserName            = all[i].UserName,
             Password            = all[i].Password,
             FirstName           = all[i].FirstName,
             LastName            = all[i].LastName,
             Role                = all[i].Role.Name,
             LastLoginDate       = all[i].LastLoginDate.ToString("dd-MM-yyyy"),
             LastPasswordChanged = all[i].LastPasswordChangeDate.ToString("dd-MM-yyyy"),
             IsPasswordChanged   = all[i].IsPasswordChanged.ToString()
         };
         fpnUsers.Controls.Add(users[i]);
     }
 }
 private void ShowUsers(Roles roles)
 {
     if (fpnUsers.Controls.Count > 0)
     {
         fpnUsers.Controls.Clear();
     }
     if (roles == Roles.Admin)
     {
         all = new UserBLL().RetrieveByRole(1);
     }
     else if (roles == Roles.Manager)
     {
         all = new UserBLL().RetrieveByRole(2);
     }
     else if (roles == Roles.Receptionist)
     {
         all = new UserBLL().RetrieveByRole(3);
     }
     else if (roles == Roles.SuperAdmin)
     {
         all = new UserBLL().RetrieveByRole(4);
     }
     UserPanel[] users = new UserPanel[all.Count];
     for (int i = 0; i < users.Length; i++)
     {
         users[i] = new UserPanel(table.Size.Width, table.Size.Height)
         {
             ID                  = all[i].ID,
             UserName            = all[i].UserName,
             Password            = all[i].Password,
             FirstName           = all[i].FirstName,
             LastName            = all[i].LastName,
             Role                = all[i].Role.Name,
             LastLoginDate       = all[i].LastLoginDate.ToString("dd-MM-yyyy"),
             LastPasswordChanged = all[i].LastPasswordChangeDate.ToString("dd-MM-yyyy"),
             IsPasswordChanged   = all[i].IsPasswordChanged.ToString()
         };
         fpnUsers.Controls.Add(users[i]);
     }
 }
        private void ShowUsers(string firstName)
        {
            if (fpnUsers.Controls.Count > 0)
            {
                fpnUsers.Controls.Clear();
            }
            if (all == null)
            {
                all = new UserBLL().RetrieveALL();
            }
            List <User> u = new List <User>();

            foreach (var item in all)
            {
                if (System.Text.RegularExpressions.Regex.IsMatch(item.FirstName.ToLower(), firstName.ToLower()))
                {
                    u.Add(item);
                }
            }
            UserPanel[] users = new UserPanel[u.Count];
            for (int i = 0; i < users.Length; i++)
            {
                users[i] = new UserPanel(table.Size.Width, table.Size.Height)
                {
                    ID                  = u[i].ID,
                    UserName            = u[i].UserName,
                    Password            = u[i].Password,
                    FirstName           = u[i].FirstName,
                    LastName            = u[i].LastName,
                    Role                = u[i].Role.Name,
                    LastLoginDate       = u[i].LastLoginDate.ToString("dd-MM-yyyy"),
                    LastPasswordChanged = u[i].LastPasswordChangeDate.ToString("dd-MM-yyyy"),
                    IsPasswordChanged   = u[i].IsPasswordChanged.ToString()
                };
                fpnUsers.Controls.Add(users[i]);
            }
        }