예제 #1
0
 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);
         }
     }
 }
예제 #2
0
        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 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);
         }
     }
 }