private void btnEdit_Click(object sender, EventArgs e) { ClubMember c = new ClubMember(gridMembers.SelectedRows[0].Cells[0].Value.ToString()); AddEditClubMemberForm child = new AddEditClubMemberForm(c); child.MdiParent = this.MdiParent; child.Show(); }
private void loadFields(ClubMember member) { cbUsernames.Text = member.getUsername(); cbStatus.Text = member.status; txtUsername.Text = member.getUsername(); txtNickname.Text = member.nickName; txtFname.Text = member.firstName; txtLname.Text = member.lastName; txtAddress1.Text = member.addressLine1; txtAddress2.Text = member.addressLine2; txtCity.Text = member.city; cbState.Text = member.state; txtZip.Text = member.zip; txtEmail.Text = member.email; txtHomePh.Text = member.homePhone; txtCellPh.Text = member.cellPhone; dtpDOB.Value = member.dateOfBirth; txtEName1.Text = member.emergencyContact1; txtERelation1.Text = member.emergencyContact1Relation; txtEPhone1.Text = member.emergencyContact1Phone; txtEName2.Text = member.emergencyContact2; txtERelation2.Text = member.emergencyContact2Relation; txtEPhone2.Text = member.emergencyContact2Phone; txtInsName.Text = member.insuranceCompanyName; txtInsPolicyNum.Text = member.insurancePolicyNumber; txtInsGroupNum.Text = member.insuranceGroupNumber; }
public AddEditClubMemberForm(ClubMember c) { InitializeComponent(); fillInUsernames(); loadFields(c); btnUpdate.Enabled = false; btnAdd.Visible = false; btnUpdate.Visible = true; btnUnlock.Visible = true; lockFields(); }
public static DataTable getMemberTransactions(ClubMember member) { //this returns a list of transactions for one individual //club member string SQL; SQL = "SELECT * FROM transactions where username = '******'"; Debug.WriteLine(SQL); DataTable dt = App.getGenericData(SQL); return(dt); }
private void btnAddCM_Click(object sender, EventArgs e) { // validate username is available if (!validateUsername()) { MessageBox.Show("Username field was left blank or unavailable, try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { ClubMember c = new ClubMember(cbUsernames.SelectedValue.ToString()); c.status = cbStatus.Text; c.nickName = txtNickname.Text; c.firstName = txtFname.Text; c.lastName = txtLname.Text; c.addressLine1 = txtAddress1.Text; c.addressLine2 = txtAddress2.Text; c.city = txtCity.Text; c.state = cbState.SelectedItem.ToString(); c.zip = txtZip.Text; c.email = txtEmail.Text; c.homePhone = txtHomePh.Text; c.cellPhone = txtCellPh.Text; c.dateOfBirth = dtpDOB.Value.Date; c.emergencyContact1 = txtEName1.Text; c.emergencyContact1Relation = txtERelation1.Text; c.emergencyContact1Phone = txtEPhone1.Text; c.emergencyContact2 = txtEName2.Text; c.emergencyContact2Relation = txtERelation2.Text; c.emergencyContact2Phone = txtEPhone2.Text; c.insuranceCompanyName = txtInsName.Text; c.insurancePolicyNumber = txtInsPolicyNum.Text; c.insuranceGroupNumber = txtInsGroupNum.Text; string str = c.Save(); if (str.Equals("Success")) { btnClear.PerformClick(); btnAdd.Visible = false; btnUpdate.Visible = true; btnUnlock.Visible = true; } else { MessageBox.Show(str, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnUpdate_Click(object sender, EventArgs e) { ClubMember c = new ClubMember(txtUsername.Text); DialogResult result = DialogResult.OK; if (!txtUsername.Text.Equals(c.getUsername())) { result = MessageBox.Show("Username cannot be updated.\nContinue without updating username?", "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); } if (result.Equals(DialogResult.OK)) { c.status = cbStatus.Text; c.nickName = txtNickname.Text; c.firstName = txtFname.Text; c.lastName = txtLname.Text; c.addressLine1 = txtAddress1.Text; c.addressLine2 = txtAddress2.Text; c.city = txtCity.Text; c.state = cbState.SelectedItem.ToString(); c.zip = txtZip.Text; c.email = txtEmail.Text; c.homePhone = txtHomePh.Text; c.cellPhone = txtCellPh.Text; c.dateOfBirth = dtpDOB.Value.Date; c.emergencyContact1 = txtEName1.Text; c.emergencyContact1Relation = txtERelation1.Text; c.emergencyContact1Phone = txtEPhone1.Text; c.emergencyContact2 = txtEName2.Text; c.emergencyContact2Relation = txtERelation2.Text; c.emergencyContact2Phone = txtEPhone2.Text; c.insuranceCompanyName = txtInsName.Text; c.insurancePolicyNumber = txtInsPolicyNum.Text; c.insuranceGroupNumber = txtInsGroupNum.Text; string str = c.Save(); if (str.Equals("Success")) { btnClear.PerformClick(); } else { MessageBox.Show(str, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnDelete_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to delete this member?", "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.Equals(DialogResult.Yes)) { ClubMember c = new ClubMember(gridMembers.SelectedRows[0].Cells[0].Value.ToString()); c.Delete(); Debug.WriteLine(c.DBstatus); if (c.DBstatus.Equals("Exists")) { btnRefresh.PerformClick(); updateSnapshot(); } else { MessageBox.Show("Member does not exist", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
public static DataTable getMemberTransactions(ClubMember member) { //this returns a list of transactions for one individual //club member string SQL; SQL = "SELECT * FROM transactions where username = '******'"; Debug.WriteLine(SQL); DataTable dt = App.getGenericData(SQL); return dt; }
private void btnSave_Click(object sender, EventArgs e) { Transaction trans; if (checkRequiredInput()) { if (lblActualID.Text == "") { // new transaction trans = new Transaction(); trans.username = cbUsernames.Text; string type = cbType.SelectedItem.ToString(); //string fAmt = txtAmt.Text.Substring(1); trans.amount = App.MyDecParse(txtAmt.Text); if (type.Equals("Payment") || type.Equals("Refund") || type.Equals("Credit")) { trans.amount = trans.amount * -1; } trans.transDate = dtpDate.Value.Date; trans.type = type; trans.semester = cbSemester.Text; trans.description = rtbDescr.Text; trans.depositNumber = txtDepID.Text; trans.checkNumber = txtCheckNo.Text; ClubMember cm = new ClubMember(trans); lblResult.Text = cm.addTransaction(); btnRefresh.PerformClick(); System.Threading.Thread.Sleep(1000); lblResult.Text = ""; } else { trans = new Transaction(Int32.Parse(lblActualID.Text)); trans.username = cbUsernames.Text; string type = cbType.SelectedItem.ToString(); trans.amount = App.MyDecParse(txtAmt.Text); if (type.Equals("Payment") || type.Equals("Refund") || type.Equals("Credit")) { trans.amount = trans.amount * -1; } // incase a payment, refund or credit is changed to a charge else if (type.Equals("Charge")) { trans.amount = Math.Abs(trans.amount); } trans.transDate = dtpDate.Value.Date; trans.type = cbType.Text; trans.semester = cbSemester.Text; trans.description = rtbDescr.Text; trans.depositNumber = txtDepID.Text; trans.checkNumber = txtCheckNo.Text; lblResult.Text = trans.Save(); btnRefresh.PerformClick(); System.Threading.Thread.Sleep(1000); lblResult.Text = ""; } if (lblResult.Text.Equals("Success!")) { alterAdvanced(false); lblActualID.Text = trans.getTransNo().ToString(); } } }