protected void Page_Load(object sender, EventArgs e) { Int64 forCarePlanId = 0; if (MercuryApplication == null) { return; } if ((!MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.CarePlanReview)) && (!MercuryApplication.HasEnvironmentPermission(Mercury.Server.EnvironmentPermissions.CarePlanManage))) { Response.Redirect("/PermissionDenied.aspx", true); return; } if (!Page.IsPostBack) { #region Initial Page Load if (Request.QueryString["CarePlanId"] != null) { forCarePlanId = Int64.Parse(Request.QueryString["CarePlanId"]); } if (forCarePlanId != 0) { carePlan = MercuryApplication.CarePlanGet(forCarePlanId, false); if (carePlan == null) { carePlan = new Mercury.Client.Core.Individual.CarePlan(MercuryApplication); } } else { carePlan = new Mercury.Client.Core.Individual.CarePlan(MercuryApplication); } InitializeAll(); Session[SessionCachePrefix + "CarePlan"] = carePlan; Session[SessionCachePrefix + "CarePlanUnmodified"] = carePlan.Copy(); #endregion } // Initial Page Load else // Postback { carePlan = (Mercury.Client.Core.Individual.CarePlan)Session[SessionCachePrefix + "CarePlan"]; } ApplySecurity(); if (!String.IsNullOrEmpty(carePlan.Name)) { Page.Title = "Care Plan - " + carePlan.Name; } else { Page.Title = "Care Plan"; } return; }