/// <summary> /// This method calld when the user ( Elections Manager) press on the remove button. /// If the removing succeseed, a success message presented on the screen, if not an error message presented. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { manager.removePartyMember(int.Parse(memberCode1.Text.Trim()), party.Text.Trim(), memberName.Text.Trim(), memberLName.Text.Trim(), DateTime.Parse(dob.Text.Trim()), int.Parse(listplace.Text.Trim()), educ.Text.Trim(), exp.Text.Trim()); if ((p.Mode == true) && p.RemoveMember().Equals("1")) { MessageBox.Show("Removed succesfully!"); mode.Text = "False".ToString(); } else { MessageBox.Show("Failed, already removed"); } } catch { MessageBox.Show("Worng values, try again!"); } }
/// <summary> /// The Elections Manager removes the party member /// </summary> /// <param name="partyName"></param> /// <param name="mode"></param> /// <returns></returns> The removed party member public void removePartyMember(int code, string nameParty, string name, string lastname, DateTime brithDate, int sizeMemberSize, string exp, string education) { PartyMember p = new PartyMember(code, nameParty, name, lastname, brithDate, sizeMemberSize, exp, education); //Creating Party Member object p.RemoveMember(); //Using the RemoveMember function in PartyMember class }