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;
        }
    }
    private void PostSchedule(System.DateTime dateDayToLoad)
    {
        // get selected date's schedule
        if (!string.IsNullOrEmpty(txtDate.Text))
            apptTransfer.date = Convert.ToDateTime(this.txtDate.Text);
        else
        {
            apptTransfer.date = DateTime.Now;
            txtDate.Text = DateTime.Now.ToShortDateString();
        }
        apptTransfer.doctorID = Convert.ToInt32(Session["DocID"]);
        aRequest.date = apptTransfer.date;
        aRequest.docID = apptTransfer.doctorID;
        System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
        proxy = new WebRef.Service();

        // Proxy must accept and hold cookies
        //   proxy.CookieContainer = new System.Net.CookieContainer();
        proxy.Url = new Uri(proxy.Url).AbsoluteUri;
        AppointmentResponse aResponse = proxy.GetDocSchedule(aRequest);
        dsSchedule = aResponse.ds;
        Session["day"] = adap.GetData(DateTime.Now.Day, DateTime.Now.Month, Convert.ToInt32(Session["DocID"]));

        try
        {
            // For each time slot
            for (int x = 0; x < 19; ++x)
            {
                // If value is available, unavailable, or in class.
                if (dsSchedule.Tables[1].Rows[0][x + 8].ToString() == "Yes" || dsSchedule.Tables[1].Rows[0][x + 8].ToString() == "No")
                {
                    cmbArray[x].SelectedValue = dsSchedule.Tables[1].Rows[0][x + 8].ToString();
                }

                // If value is a student appointment
                if (dsSchedule.Tables[1].Rows[0][x + 8].ToString().StartsWith("P"))
                {
                    System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
                    proxy = new WebRef.Service();

                    // Proxy must accept and hold cookies
                    //   proxy.CookieContainer = new System.Net.CookieContainer();
                    proxy.Url = new Uri(proxy.Url).AbsoluteUri;

                    PatientRequest pRequest = new PatientRequest();
                    pRequest.PatientID = Convert.ToInt32(dsSchedule.Tables[1].Rows[0][x + 8].ToString().Substring(3));

                    PatientResponse pResponse = proxy.GetPatient(pRequest);

                    //dsStudent = new DataSet();
                    //// Get student ID
                    //strStudentID = dsSchedule.Tables[0].Rows[0][x+8].ToString().Substring(3);

                    //// Set up SQL query to retrieve student's name
                    //string[] strSelect = new string[2] {"First_Name", "Last_Name"};
                    //string[] strWhere = new string [2] {"PAT", strStudentID};

                    //// Execute query
                    //dsStudent = dbMangler.SelectQuery("SDT", strSelect, strWhere);

                    //// Build student's name
                    //strStudentName = dsStudent.Tables[0].Rows[0][0] + " " + dsStudent.Tables[0].Rows[0][1];

                    //// Add and display student's name to combo box
                    cmbArray[x].Items.Add(new ListItem(pResponse.Name, "PAT" + pRequest.PatientID));
                    cmbArray[x].SelectedValue = "PAT" + pRequest.PatientID;
                }

            }
        }
        catch (Exception ex)
        {
            lblMessage.Text = ex.ToString();
        }

        //btnSubmit.Enabled = true;
        btnFlip.Enabled = true;
    }
    private void Page_Load(object sender, System.EventArgs e)
    {
        if (!Page.IsPostBack)
            Master.DataFromPageLabelControl("Doctor");
        // Load array elements
        cmbArray[0] = cmb8;
        cmbArray[1] = cmb830;
        cmbArray[2] = cmb9;
        cmbArray[3] = cmb930;
        cmbArray[4] = cmb10;
        cmbArray[5] = cmb1030;
        cmbArray[6] = cmb11;
        cmbArray[7] = cmb1130;
        cmbArray[8] = cmb12;
        cmbArray[9] = cmb1230;
        cmbArray[10] = cmb13;
        cmbArray[11] = cmb1330;
        cmbArray[12] = cmb14;
        cmbArray[13] = cmb1430;
        cmbArray[14] = cmb15;
        cmbArray[15] = cmb1530;
        cmbArray[16] = cmb16;
        cmbArray[17] = cmb1630;
        cmbArray[18] = cmb17;
        if (!Page.IsPostBack)
        {

            // MultiView1.ActiveViewIndex = 0;
            System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
            proxy = new WebRef.Service();
            // Proxy must accept and hold cookies
            //   proxy.CookieContainer = new System.Net.CookieContainer();
            proxy.Url = new Uri(proxy.Url).AbsoluteUri;

            //txtHiddenDate.Text = System.DateTime.Now.ToString();
            PostSchedule(System.DateTime.Now);
            //Calendar1.SelectedDate = System.DateTime.Now;
        }
        else
        {
            proxy = new WebRef.Service();

            // Proxy must accept and hold cookies
            //   proxy.CookieContainer = new System.Net.CookieContainer();
            proxy.Url = new Uri(proxy.Url).AbsoluteUri;
            apptTransfer.date = Convert.ToDateTime(this.txtDate.Text);
            apptTransfer.doctorID = Convert.ToInt32(Session["DocID"]);
            aRequest.date = apptTransfer.date;
            aRequest.docID = apptTransfer.doctorID;
            AppointmentResponse aResponse = proxy.GetDocSchedule(aRequest);
            dsSchedule = aResponse.ds;
            dt = adap.GetData(DateTime.Now.Day, DateTime.Now.Month, Convert.ToInt32(Session["DocID"]));
            Session["day"] = dt;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            MultiView1.ActiveViewIndex = 0;
            // Master.DataFromPageLabelControl("Doctor");
         //   System.Net.ServicePointManager.CertificatePolicy = new MyPolicy();
            proxy = new WebRef.Service();

            // Proxy must accept and hold cookies
            //   proxy.CookieContainer = new System.Net.CookieContainer();
            proxy.Url = new Uri(proxy.Url).AbsoluteUri;
        }
    }
    /// <summary>
    /// Gets an instructors schedule
    /// </summary>
    /// <param name="strInsID">A string value with a numeric integer representing 
    /// an instructor.</param>
    /// <remarks>
    /// Pseudocode follows below
    /// <code>
    /// Begin
    ///    Get Day_ID for selected date and instructor
    ///    Get Schedule for selected Day_ID    
    /// End
    /// </code>
    /// </remarks>
    private void GetDocSchedule(string strDocID)
    {
        try
        {
            proxy = new WebRef.Service();

            // Proxy must accept and hold cookies
            //   proxy.CookieContainer = new System.Net.CookieContainer();
            proxy.Url = new Uri(proxy.Url).AbsoluteUri;
            AppointmentRequest aRequest = new AppointmentRequest();
            AppointmentTransferObject aTransferObject = new AppointmentTransferObject();
            aTransferObject.date = Convert.ToDateTime(txtDate.Text);
            aTransferObject.doctorID = Convert.ToInt32(strDocID);
            aRequest.date = aTransferObject.date;
            aRequest.docID = aTransferObject.doctorID;

            AppointmentResponse aResponse = proxy.GetDocSchedule(aRequest);

            dsDay = aResponse.ds.Tables[0];
            dsSchedule = aResponse.ds.Tables[1];

            Session["dsSchedule"] = dsSchedule;

            //  lblDay.Text = dsDay.Rows[0][1].ToString();

            // Get schedule

        }
        catch (Exception ex)
        {
            lblMessage.ForeColor = Color.Black;
            lblMessage.BackColor = Color.Red;
            lblMessage.Text = ex.ToString();
        }
    }
    protected void btnSubmit_Click(object sender, System.EventArgs e)
    {
        string[] strSet = new string[2];
        Session["PATID"] = Session["PatientID"];

        for (int x = 0; x < 19; ++x)
        {
            int Time = -1;
            switch (x)
            {
                case 0:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_0800", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 1:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_0830", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 2:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_0900", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 3:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_0930", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 4:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_1000", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 5:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_1030", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 6:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_1100", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 7:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "AM_1130", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 8:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_1200", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 9:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_1230", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 10:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0100", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 11:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0130", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 12:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0200", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 13:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0230", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 14:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0300", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 15:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0330", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 16:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0400", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 17:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0430", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
                case 18:
                    if (radArray[x].Checked)
                    {
                        strSet = new string[2] { "PM_0500", "'PAT" + Session["PATID"].ToString() + "'" };
                        Time = x;
                    }
                    break;
            }

            if (Time != -1)
            {
                proxy = new WebRef.Service();

                // Proxy must accept and hold cookies
                //   proxy.CookieContainer = new System.Net.CookieContainer();
                proxy.Url = new Uri(proxy.Url).AbsoluteUri;
                PersistAppointmentRequest aRequest = new PersistAppointmentRequest();
                aRequest.PersistAction = PersistType.Insert;
                aRequest.Date = Convert.ToDateTime(txtDate.Text);
                aRequest.DoctorID = Convert.ToInt32(lstInstructors.SelectedValue);
                aRequest.patientID = Convert.ToInt32(Session["PATID"]);
                aRequest.strSet = strSet;
                aRequest.TimeID = Time;
                PersistAppointmentResponse aResponse = proxy.PersistAppt(aRequest);
                if (aResponse.Acknowledge == AcknowledgeType.Success)
                    Response.Write("Success");
            }
        }
    }