public EditMember() { InitializeComponent(); edit_memb = GlobalVars.member; member_name.Text = edit_memb.Name; textBox_name.Text = edit_memb.Name; textBox_email.Text = edit_memb.Email; textBox_phone.Text = edit_memb.Phone; }
private void listPicker_members_SelectionChanged(object sender, SelectionChangedEventArgs e) { mem = (Member)listPicker_members.SelectedItem; IList<Item> items = new List<Item>(); IList<Member> allMembers = Database_Functions.GetAllMembers(); for (int i = 0; i < allMembers.Count; i++) { if (allMembers[i].Name.Equals(mem.Name)) { foreach (Item item in Database_Functions.GetOwedItems(allMembers[i].ID)) { items.Add(item); } } } listPicker_items.ItemsSource = items; }
public static int AddMember(int group_id, String member_name, String email, string phone_number) { // Get associated Group for group_id IList<Group> groupList = null; using (GroupDataContext context = new GroupDataContext(ConnectionString)) { IQueryable<Group> query = from c in context.Groups where c.ID == group_id select c; groupList = query.ToList(); Member member = new Member(); member.Name = member_name; member.Active = true; member.Email = email; member.Phone = phone_number; member.Group = groupList.FirstOrDefault(); context.Members.InsertOnSubmit(member); context.SubmitChanges(); return member.ID; } }
private void button_addMembers_Click(object sender, EventArgs e) { //// Check whether if the member that is added exist in the database //newMem = checkMembers(textBox_name.Text); //if (newMem) //{ // MessageBox.Show("Member name already exists. Please enter in new name", "Member name exists", MessageBoxButton.OK); // textBox_name.Text = ""; //} //else //{ // //new_group = (Group)listPicker_group.SelectedItem; // Database_Functions.AddMember(new_group.ID, textBox_name.Text, textBox_email.Text, textBox_phone.Text); // NavigationService.Navigate(new Uri("/People.xaml", UriKind.Relative)); //} Member m = new Member(); m.Name = textBox_name.Text; m.Email = textBox_email.Text; m.Phone = textBox_phone.Text; GlobalVars.member = m; NavigationService.GoBack(); }
private void OnMemberAdded(Member member) { member.Group = this; }
private void OnMemberRemoved(Member member) { member.Group = null; }
private void Member_Hold(object sender, GestureEventArgs e) { IList<Member> members = Database_Functions.GetAllMembers(); Member temp = new Member(); TextBlock tapped = (TextBlock)sender; int index = findMember(tapped.Text); temp = member[index - 1]; GlobalVars.member = temp; }
private int findNumMember(Member mbr, IList<Member> members) { int count = 0; foreach (Member m in members) { if (m.Name.Equals(mbr.Name)) count++; } return count; }
private IList<Member> findMember(int count, Member mem, IList<Member> members) { IList<Member> newMember = new List<Member>(count); foreach (Member m in members) { if (m.Name.Equals(mem.Name)) newMember.Add(m); } return newMember; }