コード例 #1
0
    protected void btnAddPatient_Click(object sender, EventArgs e)
    {
        CPatient patient = new CPatient();

        patient.name      = tbPatientName.Text;
        patient.idcard    = tbPatientIDCard.Text;
        patient.birthday  = calPatientBirthday.SelectedDate.Date;
        patient.photoPath = "pics/" + fuPatientPhoto.FileName;

        fuPatientPhoto.SaveAs(this.MapPath("pics\\") + fuPatientPhoto.FileName);

        patientFactory.addPatient(patient);
        Response.Redirect(Request.Url.ToString());
    }
コード例 #2
0
    protected void btnAddPatient_Click(object sender, EventArgs e)
    {
        CPatient patient = new CPatient();

        patient.name     = tbPatientName.Text;
        patient.idcard   = tbPatientIDCard.Text;
        patient.birthday = Convert.ToDateTime(tbPatientBirthday.Text);
        try
        {
            patient.photoPath = "pics/" + fuPatientPhoto.FileName;
            fuPatientPhoto.SaveAs(this.MapPath("..\\pics\\") + fuPatientPhoto.FileName);
        }
        catch
        {
            patient.photoPath = "pics/a.png";
        }
        patientFactory.addPatient(patient);
        Response.Redirect("patient.aspx");
    }