示例#1
0
    //loads the fields that are common to Juvenile members.
    private void LoadJuvenileFields(LibraryWebService.Member myMember)
    {
        juve = (LibraryWebService.JuvenileMember)myMember;

        //set the fields visibles
        lblBirthDte.Visible      = true;
        lblAdultMember.Visible   = true;
        txtBirthDte.Visible      = true;
        txtAdultMemberID.Visible = true;

        //move the myMemberfields into the txt fields.
        txtAdultMemberID.Text = juve.AdultMemberID.ToString();
        txtBirthDte.Text      = juve.BirthDate.ToString("MM/dd/yyyy");
    }
示例#2
0
    private void ConvertToAdult(LibraryWebService.Member myMember)
    {
        string myErr;

        if (myMember is LibraryWebService.JuvenileMember)
        {
            LibraryWebService.JuvenileMember myJuv = (LibraryWebService.JuvenileMember)myMember;
            if ((DateTime)myJuv.BirthDate.AddYears(+18) <= DateTime.Today)
            {
                try
                {
                    myDb.ConvertJuvenile(myJuv.MemberID);
                    myErr    = string.Format("Member ID: {0} Converted to Adult.", txtMemberID.Text);
                    myMember = myDb.GetMember(Convert.ToInt16(txtMemberID.Text));

                    LoadGenericFields(myMember);
                    FormatAdultWindow();

                    Label lbl = (Label)Page.Master.FindControl("lblStatus");
                    lbl.Text               = myErr;
                    lbl.ForeColor          = Color.Blue;
                    txtExpDte.BackColor    = Color.White;
                    btnRenewMember.Visible = false;
                }
                catch (SoapException)
                {
                    myErr = string.Format("Member ID: {0} could not be converted from Juvenile to Adult.", txtMemberID.Text);
                    Label lbl = (Label)Page.Master.FindControl("lblStatus");
                    lbl.Text = myErr;
                }
                catch (WebException)
                {
                    Label lbl = (Label)Page.Master.FindControl("lblStatus");
                    lbl.Text      = "Web service is not responding, please try again later.";
                    lbl.ForeColor = Color.Red;
                }
            }
        }
    }