protected void Button3_Click(object sender, EventArgs e)
    {
        PersistDoctorRequest dRequest = new PersistDoctorRequest();
        Doctor doc = new Doctor();
        dRequest.SecurityToken = "ABC123";
        dRequest.PersistAction = PersistType.Insert;
        proxy = new WebRef.Service();
        proxy.Url = new Uri(proxy.Url).AbsoluteUri;
        // Package customer data in customer transfer object
        DoctorTransferObject doctorTransfer = new DoctorTransferObject();

        doctorTransfer.fName = this.txtFName.Text;
        doctorTransfer.LName = this.txtLName.Text;
        doctorTransfer.phone = this.txtPhone.Text + "@" + ddlProvider.SelectedValue.ToString();
        doctorTransfer.email = this.Email.Text;
        doctorTransfer.user = this.UserName.Text;
        doctorTransfer.pass = Session["Pass"].ToString();
        doctorTransfer.secQu = this.Question.Text;
        doctorTransfer.answer = this.Answer.Text;
        doctorTransfer.city = this.txtCity.Text;
        doctorTransfer.dOBirth = this.txtDoB.Text;
        doctorTransfer.gender = rdGender.Text;
        doctorTransfer.LicType = ddlLic.Text;
        doctorTransfer.NatProvID = txtProvID.Text;
        doctorTransfer.officeAdr = this.txtAddr.Text;
        doctorTransfer.PrmSpl = this.ddlPrmSpl.Text;
        doctorTransfer.state = this.txtState.Text;
        doctorTransfer.title = "Mr.";
        doctorTransfer.zip = this.txtZip.Text;
        dRequest.Doctor = doctorTransfer;
        // Issue customer list request to web service

        PersistDoctorResponse dResponse = proxy.PersistDoctor(dRequest);

        if (dResponse.Acknowledge == AcknowledgeType.Success)
        {
            Session["DocID"] = dResponse.Doctor.docID.ToString();

        }
        else
            Literal2.Text = "Failure to add the user";
        Server.Transfer("~/General/Login.aspx");
    }
Exemplo n.º 2
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        proxy = new WebRef.Service();
        // Proxy must accept and hold cookies
        //   proxy.CookieContainer = new System.Net.CookieContainer();

        System.Data.DataSet dsDoctors = new DataSet();

        DoctorRequest dRequest = new DoctorRequest();
        DoctorTransferObject dTransObject = new DoctorTransferObject();
        dTransObject.LName = txtSearchValue.Text;

        dRequest.lastName = dTransObject.LName;
        //   X509Certificate x509 = X509Certificate.(@"c:\certificateSJSU.cer");
        proxy.Url = new Uri(proxy.Url).AbsoluteUri;

        //  proxy.ClientCertificates.Add(x509);
        DoctorResponse dResponse = proxy.GetDoctors(dRequest);

        // Get instructors that match last name
        dsDoctors = dResponse.ds;

        // If there are no results inform user
        if (dsDoctors.Tables[0].Rows.Count < 1)
        {
            lblMessage.ForeColor = Color.Black;
            lblMessage.BackColor = Color.Red;
            lblMessage.Text = "No doctor's match the given Last Name";
        }
        else
        {
            // Populate list box with results
            for (int x = 0; x < dsDoctors.Tables[0].Rows.Count; ++x)
            {
                this.lstInstructors.Items.Add(new ListItem(dsDoctors.Tables[0].Rows[x][1].ToString() + " " + dsDoctors.Tables[0].Rows[x][2].ToString(), dsDoctors.Tables[0].Rows[x][0].ToString()));
            }
            lstInstructors.Visible = true;
            //  btnGo.Visible = true;
        }
    }