protected void ddlPatient_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (ddlPatient.SelectedValue != "Please select a patient")
     {
         int pID = Convert.ToInt32(ddlPatient.SelectedValue);
         txtMedInfo.Text    = new PatientDAO().getMedInfo(pID);
         txtMedInfo.Visible = true;
         DataTable dt = new TreatmentPlanningDAO().getTreatmentPlansByPatient(pID);
         if (dt.Rows.Count > 0)
         {
             lblMessage.Text = "";
         }
         else
         {
             lblMessage.Text      = "No dental history";
             lblMessage.ForeColor = System.Drawing.Color.Red;
         }
         gvPatientHistory.DataSource = dt;
         gvPatientHistory.DataBind();
     }
     else
     {
         gvPatientHistory.DataSource = null;
         gvPatientHistory.DataBind();
         lblMessage.Text    = "";
         txtMedInfo.Visible = false;
     }
 }
 protected void gvPatientHistory_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     lblMessageDV.Text      = "";
     lblMessageDV.ForeColor = System.Drawing.Color.Green;
     if (e.CommandName == "ReceivePayment")
     {
         int    tID   = Convert.ToInt32(e.CommandArgument);
         string tName = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).Cells[1].Text;
         Session["tName"] = tName;
         DataSet ds = new TreatmentPlanningDAO().getPlanforPayment(tName, tID);
         dvReceivePayment.DataSource = ds;
         dvReceivePayment.ChangeMode(DetailsViewMode.Edit);
         dvReceivePayment.DataBind();
         dvReceivePayment.Visible = true;
     }
 }
        protected void dvReceivePayment_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            //int tID = Convert.ToInt32(dvReceivePayment.SelectedValue); //this also works to get tID
            int    tID           = Convert.ToInt32(e.Keys["tID"]);
            int    paid          = Convert.ToInt32(e.NewValues["paid"]);
            string tName         = Session["tName"].ToString();
            bool   updateSuccess = new TreatmentPlanningDAO().updatePlanforPayment(tName, tID, paid);

            lblMessageDV.Text           = "Payment updated";
            lblMessageDV.ForeColor      = System.Drawing.Color.Green;
            dvReceivePayment.DataSource = null;
            dvReceivePayment.ChangeMode(DetailsViewMode.ReadOnly);
            dvReceivePayment.DataBind();
            dvReceivePayment.Visible = false;
            loadTreatmentPlansbyPatient();
            Session["tName"] = "";
        }
        private void loadTreatmentPlansbyPatient()
        {
            int       pID = Convert.ToInt32(ddlPatient.SelectedValue);
            DataTable dt  = new TreatmentPlanningDAO().getTreatmentPlansByPatient(pID);

            if (dt.Rows.Count > 0)
            {
                lblMessageGV.Text      = "";
                lblMessageGV.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lblMessageGV.Text      = "New patient or no treatments ever done";
                lblMessageGV.ForeColor = System.Drawing.Color.Red;
            }
            gvPatientHistory.DataSource = dt;
            gvPatientHistory.DataBind();
        }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int pID = Convert.ToInt32(Session["PatientID"]);
         txtMedInfo.Text    = new PatientDAO().getMedInfo(pID);
         txtMedInfo.Visible = true;
         DataTable dt = new TreatmentPlanningDAO().getTreatmentPlansByPatient(pID);
         if (dt.Rows.Count > 0)
         {
             lblMessage.Text = "";
         }
         else
         {
             lblMessage.Text      = "No dental history";
             lblMessage.ForeColor = System.Drawing.Color.Red;
         }
         gvPatientHistory.DataSource = dt;
         gvPatientHistory.DataBind();
     }
 }