private void LoadPolicy() { int UserID = UserContext.UserID; BusinessServices.User objUser = new BusinessServices.User(); DataTable dtUserProfiles = objUser.GetProfilePeriodList(UserID); int PolicyID = int.Parse(Request.QueryString["PolicyID"].ToString()); BusinessServices.Policy objPolicy = new BusinessServices.Policy(); // if the policy as not accepted, enable to checkbox if (!objPolicy.CheckAccepted(PolicyID, UserID)) { string ConfirmationMessage = objPolicy.GetConfirmationMessage(PolicyID); this.chkAgree.Text = ConfirmationMessage; } else { this.chkAgree.Enabled = false; this.chkAgree.Checked = true; string lastAccepted = objPolicy.GetLastAccepted(UserID, UserContext.UserData.OrgID, PolicyID); this.chkAgree.Text = ResourceManager.GetString("lblLastAccepted") + " " + lastAccepted; } string PolicyName = objPolicy.GetPolicyFileName(PolicyID, UserContext.UserData.OrgID); string PolicyDir = @"\General\Policy\" + UserContext.UserData.OrgID.ToString(); this.pdfFrame.Attributes["src"] = PolicyDir + @"\" + PolicyName; this.pdfFrame.Visible = true; }
protected void btnFinish_Click(object sender, System.EventArgs e) { int PolicyID = int.Parse(Request.QueryString["PolicyID"].ToString()); //int ProfileID = int.Parse(Request.QueryString["ProfileID"].ToString()); int UserID = UserContext.UserID; BusinessServices.User objUser = new BusinessServices.User(); DataTable dtUserProfiles = objUser.GetProfilePeriodList(UserID); BusinessServices.Policy objPolicy = new BusinessServices.Policy(); // Only want to do anything if user has read and understood the policy if (this.chkAgree.Checked) { // Check if policy marked as accepted // If not then mark user as accepted the policy if (!objPolicy.CheckAccepted(PolicyID, UserID)) { objPolicy.Accept(PolicyID, UserID); } // Check if points have already been assigned for this policy and user // If not then assign points for the policy to the user foreach (DataRow dr in dtUserProfiles.Rows) { int ProfileID = Int32.Parse(dr["ProfileID"].ToString()); if (!objPolicy.CheckPointsAssigned(PolicyID, UserID, ProfileID)) { if (objPolicy.CheckProfileExists(PolicyID, UserID, ProfileID)) { objPolicy.AssignPoints(PolicyID, UserID, ProfileID); } } } } Response.Redirect("/MyTraining.aspx"); //Response.Write("<script language='javascript'> {opener.location.reload(); self.close(); }</script>"); }