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");
    }
    public PersistDoctorResponse PersistDoctor(PersistDoctorRequest request)
    {
        PersistDoctorResponse response = new PersistDoctorResponse();

        // Set correlation Id

        response.CorrelationId = request.RequestId;

        try
        {
            // Call persistence request via Customer Facade.
            DoctorFacade facade = new DoctorFacade();

            switch (request.PersistAction)
            {
                case PersistType.Insert:
                    {
                        Doctor doctor = new Doctor();
                        doctor.fName = request.Doctor.fName;
                        doctor.LName = request.Doctor.LName;
                        doctor.Phone = request.Doctor.phone;
                        doctor.UserID = request.Doctor.user;
                        doctor.email = request.Doctor.email;
                        doctor.SecQues = request.Doctor.secQu;
                        doctor.SecAns = request.Doctor.answer;
                        doctor.Password = request.Doctor.pass;
                        doctor.City = request.Doctor.city;
                        doctor.DateOfBirth = request.Doctor.dOBirth;
                        doctor.gender = request.Doctor.gender;
                        doctor.License_Type = request.Doctor.LicType;
                        doctor.National_PrvID = request.Doctor.NatProvID;
                        doctor.officeAdr = request.Doctor.officeAdr;
                        doctor.Primary_spl = request.Doctor.PrmSpl;
                        doctor.Title = request.Doctor.title;
                        doctor.zip = request.Doctor.zip;
                        doctor.State = request.Doctor.state;

                        facade.AddDoctor(doctor);

                        response.Doctor = request.Doctor;
                        response.Doctor.docID = doctor.DoctorID;

                        break;
                    }
                //case PersistType.Update:
                //    {
                //        Customer customer = new Customer();

                //        customer.CustomerId = DecryptId(request.Customer.CustomerId);
                //        customer.Company = request.Customer.Company;
                //        customer.City = request.Customer.City;
                //        customer.Country = request.Customer.Country;

                //        facade.UpdateCustomer(customer);

                //        response.Customer = request.Customer;
                //        break;
                //    }
                //case PersistType.Delete:
                //    {
                //        int customerId = DecryptId(request.Customer.CustomerId);
                //        int rowsAffected = facade.DeleteCustomer(customerId);
                //        if (rowsAffected == 0)
                //            throw new Exception("Customer has orders and therefore cannot be deleted. ");

                //        break;
                //    }
            }

        }
        catch (Exception ex)
        {
            response.Acknowledge = AcknowledgeType.Failure;
            response.Message = ex.Message;
        }

        return response;
    }