// Load members from the database
        // TODO: Add listview filler to GlobalVariables
        private void LoadMembers()
        {
            string  sqlCommandText = "Select * from [Member]";
            DataSet ds             = Database.SqlQueryDataSet(sqlCommandText);

            MembersList.Clear();

            if (ds.Tables.Count > 0)
            {
                for (int index = 0; index < ds.Tables[0].Rows.Count; ++index)
                {
                    DataRow row = ds.Tables[0].Rows[index];
                    if (row.RowState != DataRowState.Deleted)
                    {
                        MembersList.Add(new MemberModel()
                        {
                            Firstname   = (string)row["firstname"],
                            Lastname    = (string)row["lastname"],
                            Partner     = (bool)row["partner"],
                            MemberSince = (DateTime)row["memberSince"]
                        });
                    }
                }
            }
        }
        public void OnNavigatedTo(INavigationParameters parameters)
        {
            celula = (Celula)parameters["celula"];

            if (celula != null)
            {
                PageTitle = "Editar";

                Name                      = celula.Name;
                StartTime                 = celula.CelulaStartTime;
                Country                   = celula.Country;
                State                     = celula.State;
                City                      = celula.City;
                Address                   = celula.Address;
                SelectLiderButtonText     = celula.LeaderName;
                SelectAnfitriaoButtonText = celula.AnfitriaoName;

                foreach (Person member in celula.Members)
                {
                    MembersList.Add(member);
                }
            }
            else
            {
                PageTitle                 = "Nova Célula";
                SelectLiderButtonText     = "Selectione o líder";
                SelectAnfitriaoButtonText = "Selectione o anfitrião";
            }
        }
 private void TeamSelected(TeamDetailSelectedMessage teamDetailSelectedMessage)
 {
     Model            = apiClient.GetTeamById(teamDetailSelectedMessage.Id);
     this.MembersList = new BindingList <UserListModelInner>();
     foreach (var member in Model.Members)
     {
         MembersList.Add(member);
     }
 }
        private void AddUserToTeam(UserAddToTeamMessage user)
        {
            var mapper    = new UserMapper();
            var userModel = apiClient.GetUserById(user.Id);

            MembersList.Add(new UserListModelInner
            {
                Id   = userModel.Id,
                Name = userModel.Name
            });
        }
        public static MembersList GetMembers()
        {
            MembersList membersList;

            using (MySqlConnection conn = new MySqlConnection(connString))
            {
                string query = @"SELECT id_member, name_member, lastName_member, phone_member, type_member, profile_member, email_member, passwor_member
                                FROM members;";
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    membersList     = new MembersList();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = query;
                    cmd.Connection  = conn;
                    conn.Open();
                    using (MySqlDataReader reader = cmd.ExecuteReader())
                    {
                        string name;
                        string lName;
                        string email;
                        string profile;
                        string password;
                        string phone;
                        string type;
                        int    id;
                        while (reader.Read())
                        {
                            name     = reader["name_member"] as string;
                            lName    = reader["lastName_member"] as string;
                            email    = reader["email_member"] as string;
                            profile  = reader["profile_member"] as string;
                            password = reader["passwor_member"] as string;
                            type     = reader["type_member"] as string;
                            id       = (int)reader["id_member"];
                            phone    = reader.IsDBNull(3) ? null : reader["phone_member"] as string;
                            membersList.Add(new Member()
                            {
                                Name     = name,
                                LastName = lName,
                                Email    = email,
                                Profile  = profile,
                                Password = password,
                                Phone    = phone,
                                Type     = type,
                                ID       = id,
                            });
                        }
                    }
                }
            }
            return(membersList);
        }
        public async System.Threading.Tasks.Task Init()
        {
            if (FunctionalFieldsList.Count == 0)
            {
                var functionalFieldsList = await _functionalFieldService.Get <List <FunctionalField> >(null);

                FunctionalFieldsList.Add(new FunctionalField
                {
                    Id   = 0,
                    Name = ""
                });

                foreach (var funcField in functionalFieldsList)
                {
                    FunctionalFieldsList.Add(funcField);
                }
            }
            if (LocalCommitteesList.Count == 0)
            {
                var localCommittees = await _localCommitteeService.Get <List <LocalCommittee> >(null);

                LocalCommitteesList.Add(new LocalCommittee
                {
                    Id   = 0,
                    Name = ""
                });
                foreach (var localCommittee in localCommittees)
                {
                    LocalCommitteesList.Add(localCommittee);
                }
            }
            Model.Search.Member searchMember = new Model.Search.Member();
            if (SelectedFunctionalField != null)
            {
                searchMember.FunctionalFieldId = SelectedFunctionalField.Id;
                var list = await _membersService.Get <IEnumerable <Model.Response.MemberLL> >(searchMember);

                MembersList.Clear();
                foreach (var member in list)
                {
                    MembersList.Add(member);
                }
            }
            if (SelectedLocalCommittee != null)
            {
                searchMember.LocalCommitteeId = SelectedLocalCommittee.Id;
                var list = await _membersService.Get <IEnumerable <Model.Response.MemberLL> >(searchMember);

                MembersList.Clear();
                foreach (var member in list)
                {
                    MembersList.Add(member);
                }
            }
            if (SelectedFunctionalField == null && SelectedLocalCommittee == null)
            {
                var list = await _membersService.Get <IEnumerable <Model.Response.MemberLL> >(null);

                MembersList.Clear();
                foreach (var member in list)
                {
                    MembersList.Add(member);
                }
            }
        }