protected void AddLabOrderDetailButton_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["ID"] == null)
        {
            // do nothing
        }
        else
        {
            // get lab order belong to this visit
            var laborders = new DataClassesDataContext().LabOrders.Where(l => l.VisitID == long.Parse(Request.QueryString["ID"]));
            if (laborders.Count() == 0)
            {
                // display the alert that user need to add lab order first
                Session[RedirectConstants.RedirectVisitDetailAddLabOrderDetailSessionName] = "yes";

                // redirect to itself
                Response.Redirect("/UserAccess/Visits/ViewVisitDetails.aspx?ID=" + Request.QueryString["ID"]);
            }
            else
            {
                // redirect to to add new lab order detail page
                Response.Redirect("/UserAccess/LabOrders/AddNewLabOrderDetail.aspx?LabOrderID=" + laborders.First().ID);
            }
        }
    }
    protected void AddNewPrescriptionDetailButton_Click(object sender, EventArgs e)
    {
        if (Request.QueryString["ID"] == null)
        {
            // do nothing
        }
        else
        {
            // get prescription belong to this visit
            var prescriptions = new DataClassesDataContext().Prescriptions.Where(p => p.VisitID == long.Parse(Request.QueryString["ID"]));
            if (prescriptions.Count() == 0)
            {
                // display the alert that user need to add prescription first
                Session[RedirectConstants.RedirectVisitDetailAddPrescriptionDetailSessionName] = "yes";

                // redirect to itself
                Response.Redirect("/UserAccess/Visits/ViewVisitDetails.aspx?ID=" + Request.QueryString["ID"]);
            }
            else
            {
                // redirect to to add new prescription detail page
                Response.Redirect("/UserAccess/Prescriptions/AddNewPrescriptionDetail.aspx?PrescriptionID=" + prescriptions.First().ID);
            }
        }
    }
Пример #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     // redirect if error happens
     if (Request.QueryString["VisitID"] == null)
     {
         // redirect
         Session[RedirectConstants.RedirectAddNewPrescriptionSessionName] = "yes";
         Response.Redirect("/UserAccess/Visits/ViewAllVisits.aspx");
     }
     else
     {
         var visit = new DataClassesDataContext().Visits.Where(v => v.ID == long.Parse(Request.QueryString["VisitID"]));
         if (visit.Count() == 0)
         {
             // redirect
             Session[RedirectConstants.RedirectAddNewPrescriptionSessionName] = "yes";
             Response.Redirect("/UserAccess/Visits/ViewAllVisits.aspx");
         }
         else if (visit.First().Prescriptions.Count() > 0)
         {
             // redirect
             Session[RedirectConstants.RedirectAddNewPrescriptionExistSessionName] = "yes";
             Response.Redirect("/UserAccess/Visits/ViewAllVisits.aspx");
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        // redirect if no query string found
        if (Request.QueryString["ID"] == null)
        {
            RedirectToViewAllVisits();
        }
        else
        {
            long temp;
            // redirect if cannot parse
            if (long.TryParse(Request.QueryString["ID"], out temp))
            {
                var visits = new DataClassesDataContext().Visits.Where(v => v.ID == long.Parse(Request.QueryString["ID"]));
                // redirect if ID not found
                if (visits.Count() == 0)
                {
                    RedirectToViewAllVisits();
                }
                else
                {
                    // OK, store the patient ID for later redirect
                    PatientID = visits.First().PatientID;
                }
            }
            else
            {
                RedirectToViewAllVisits();
            }
        }

        Dictionary <string, string> successDictionary = new Dictionary <string, string>();

        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessAddNewPrescription,
                              "Prescription inserted successfully!");
        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessAddPrescriptionDetail,
                              "Prescription Detail inserted successfully!");
        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessDeletePrescription,
                              "Prescription deleted successfully!");
        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessDeletePrescriptionDetail,
                              "Prescription Detail deleted successfully!");
        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessAddLabOrder,
                              "Lab Order inserted successfully!");
        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessAddLabOrderDetail,
                              "Lab Order Detail inserted successfuly!");
        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessDeleteLabOrderDetail,
                              "Lab Order Detail deleted successfully!");
        successDictionary.Add(RedirectSuccessConstants.RedirectSuccessDeleteLabOrder,
                              "Lab Order deleted successfully!");
        RedirectSuccessAlert.SetAlert(successDictionary);

        Dictionary <string, string> infoDictionary = new Dictionary <string, string>();

        infoDictionary.Add(RedirectConstants.RedirectVisitDetailAddLabOrderDetailSessionName,
                           "You need to add Lab Order before adding Lab Order Detail");
        infoDictionary.Add(RedirectConstants.RedirectVisitDetailAddPrescriptionDetailSessionName,
                           "You need to add Prescription before adding Prescription Detail");
        RedirectAlert.SetAlert(infoDictionary);
    }