protected void DeleteMethod(object obj) { try { if (MessageBox.Show("You are going to Delete this Member.Do you want to proceed?", MessageBoxCaption, MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } using (SqlConnection conn = new SqlConnection(GlobalClass.TConnectionString)) { conn.Open(); using (SqlTransaction tran = conn.BeginTransaction()) { member.Delete(tran); tran.Commit(); } } MemberList.Remove(MemberList.First(x => x.MemberId == member.MemberId)); MessageBox.Show("Member Successfully Deleted.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Information); UndoMethod(null); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } MessageBox.Show(ex.Message, MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Error); } }
public AdminVM() { MemberList = Members.Instance.MemberList; Member = MemberList.First(); PromoteCommand = new DelegateCommand(PromoteOnExecuteClick); SwitchCommand = new DelegateCommand(SwitchOnExecuteClick); DeleteCommand = new DelegateCommand(DeleteOnExecuteClick); }
private void SwitchOnExecuteClick(object obj) { if (_isMember) { TextList = "Members"; TextPromote = "Demote"; _isMember = false; MemberList = Administrators.Instance.AdministratorList; } else { TextList = "Admins"; TextPromote = "Promote"; _isMember = true; MemberList = Members.Instance.MemberList; } Member = MemberList.First(); }
public ulong GetLeaderGuid() { return(MemberList.First(p => p.RankId == (uint)GuildDefaultRanks.Master).CharGuid); }
public static Member GetMemberById(string id) { return(MemberList.First(v => v.UserId == id)); }