Exemple #1
0
        protected void btnApproveOrDeny_Click(object sender, EventArgs e)
        {
            lblAppOrDenyMsg.Text = string.Empty;
            string SPXML = string.Empty;
            List <PaperStudXML> oPaperStudXMLList = new List <PaperStudXML>();
            PaperStudXML        oPaperStudXML;
            StringBuilder       oStringBuilder1 = new StringBuilder();
            StringBuilder       oStringBuilder2 = new StringBuilder();

            //-------------
            List <ExamFormModifyXML> oExamFormModifyReq = new List <ExamFormModifyXML>();
            ExamFormModifyXML        ExamFormModifyReq;

            hidUniID.Value = Classes.clsGetSettings.UniversityID.ToString();
            //-------------

            for (int j = 0; j < GVPaperTLMAMAT.Rows.Count; j++)
            {
                if (((CheckBox)GVPaperTLMAMAT.Rows[j].Cells[4].FindControl("chkSelectStudents")).Checked)
                {
                    oPaperStudXML           = new PaperStudXML();
                    oPaperStudXML.StudentID = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Student_ID"].ToString());
                    oPaperStudXML.Year      = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Year"].ToString());
                    oPaperStudXML.TLM       = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[0]);
                    oPaperStudXML.AM        = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[1]);
                    oPaperStudXML.AT        = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[2]);
                    oPaperStudXML.Pk_Pp_PpHead_CrPrCh_ID = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Pp_PpHead_CrPrCh_ID"].ToString());
                    oPaperStudXML.FacID     = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Fac_ID"].ToString());
                    oPaperStudXML.CRID      = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Cr_ID"].ToString());
                    oPaperStudXML.MOLID     = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_MoLrn_ID"].ToString());
                    oPaperStudXML.PtrnID    = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Ptrn_ID"].ToString());
                    oPaperStudXML.BrnID     = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Brn_ID"].ToString());
                    oPaperStudXML.CrPrDetID = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_CrPr_Details_ID"].ToString());
                    oPaperStudXML.CrPrChtID = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_CrPrCh_ID"].ToString());
                    oPaperStudXML.UniID     = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Uni_ID"].ToString());

                    oPaperStudXMLList.Add(oPaperStudXML);

                    // hidStudentID.Value += GVPaperTLMAMAT.DataKeys[j]["pk_Student_ID"].ToString()+",";
                    oStringBuilder1.Append(GVPaperTLMAMAT.DataKeys[j]["pk_Student_ID"].ToString());
                    oStringBuilder1.Append(",");
                    //  hidYearID.Value += GVPaperTLMAMAT.DataKeys[j]["pk_Year"].ToString() + ",";
                    oStringBuilder2.Append(GVPaperTLMAMAT.DataKeys[j]["pk_Year"].ToString());
                    oStringBuilder2.Append(",");


                    //---------------
                    ExamFormModifyReq               = new ExamFormModifyXML();
                    ExamFormModifyReq.UniID         = int.Parse(hidUniID.Value);
                    ExamFormModifyReq.StudentID     = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Student_ID"].ToString());
                    ExamFormModifyReq.Year          = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Year"].ToString());
                    ExamFormModifyReq.AcYrID        = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["fk_AcademicYear_ID"].ToString());
                    ExamFormModifyReq.InstID        = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["Ref_InstReg_Institute_ID"].ToString());
                    ExamFormModifyReq.FacID         = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Fac_ID"].ToString());
                    ExamFormModifyReq.CrID          = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Cr_ID"].ToString());
                    ExamFormModifyReq.MoLrnID       = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_MoLrn_ID"].ToString());
                    ExamFormModifyReq.PtrnID        = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Ptrn_ID"].ToString());
                    ExamFormModifyReq.BrnID         = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_Brn_ID"].ToString());
                    ExamFormModifyReq.CrPrDetailsID = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_CrPr_Details_ID"].ToString());
                    ExamFormModifyReq.CrPrChID      = int.Parse(GVPaperTLMAMAT.DataKeys[j].Values["pk_CrPrCh_ID"].ToString());
                    ExamFormModifyReq.CreatedBy     = user.User_ID.ToString();
                    //ExamFormModifyReq.RequestDetails = createExamFormModifyXML(ExamFormModifyReq.StudentID, ExamFormModifyReq.Year);
                    oExamFormModifyReq.Add(ExamFormModifyReq);
                    //---------------
                }
            }

            hidStudentID.Value = oStringBuilder1.ToString();
            hidYearID.Value    = oStringBuilder2.ToString();

            //set hidden variables

            hidStudentID.Value     = oStringBuilder1.ToString();
            hidYearID.Value        = oStringBuilder2.ToString();
            hidFacID.Value         = GVPaperTLMAMAT.DataKeys[0]["pk_Fac_ID"].ToString();
            hidCrID.Value          = GVPaperTLMAMAT.DataKeys[0]["pk_Cr_ID"].ToString();
            hidMoLrnID.Value       = GVPaperTLMAMAT.DataKeys[0]["pk_MoLrn_ID"].ToString();
            hidPtrnID.Value        = GVPaperTLMAMAT.DataKeys[0]["pk_Ptrn_ID"].ToString();
            hidBrnID.Value         = GVPaperTLMAMAT.DataKeys[0]["pk_Brn_ID"].ToString();
            hidCrPrDetailsID.Value = GVPaperTLMAMAT.DataKeys[0]["pk_CrPr_Details_ID"].ToString();
            hidCrPrChID.Value      = GVPaperTLMAMAT.DataKeys[0]["pk_CrPrCh_ID"].ToString();
            hidUniID.Value         = GVPaperTLMAMAT.DataKeys[0]["pk_Uni_ID"].ToString();

            //******************************
            //commented old code
            //if (GVPaperTLMAMAT.DataKeys[0]["fk_ExEv_ID"].ToString().Equals("0") || GVPaperTLMAMAT.DataKeys[0]["fk_ExEv_ID"].ToString().Equals("-"))
            //{
            //    hidExamFormModifyReq.Value = "No";
            //}
            //else
            //{
            //    hidExamFormModifyReq.Value = "Yes";
            //}
            //******************************

            int    result = 0;
            string status = string.Empty;

            if (((Button)sender).ID == "btnApprove")
            {
                result = clsCollegeAdmissionReports.PaperExemptionApproveOrDeny(user.User_ID, 1, PaperStudXML.SerializeObject(oPaperStudXMLList));
                status = "Granted";
            }
            else if (((Button)sender).ID == "btnDeny")
            {
                result = clsCollegeAdmissionReports.PaperExemptionApproveOrDeny(user.User_ID, 2, PaperStudXML.SerializeObject(oPaperStudXMLList));
                status = "Denied";
            }
            if (result != 0)
            {
                divMsg.Style.Add("display", "block");

                lblAppOrDenyMsg.Text = "The Exemption claimed is " + status + " successfully for the selected student(s).";

                //--------------------------------
                //send exam for modify request
                string resStatus = clsPaperChange.SendExamFormModifyRequest_PaperExemptionApproval_MultipleStuds(ExamFormModifyXML.SerializeObject(oExamFormModifyReq)).ToString();

                if (resStatus != "U") //successful (resStatus gives the number of requests sent)
                {
                    //if (user.UserTypeCode != "2")
                    //{

                    //    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent for " + resStatus + " number of student(s).";
                    //}
                    //else if (user.UserTypeCode == "2")
                    //{
                    //    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent for " + resStatus + " number of student(s).";
                    //}

                    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent for " + resStatus + " number of student(s).";
                }

                else if (resStatus == "U") //unsuccessful
                {
                    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request could not be sent.";
                }
                //--------------------------------

                #region commented old code
                //***************************************************
                //commented old code
                //if (hidExamFormModifyReq.Value.Equals("Yes"))
                //{
                //    Hashtable HT = new Hashtable();
                //    HT.Add("UniID", hidUniID.Value);
                //    HT.Add("InstID", hidInstID.Value);
                //    HT.Add("FacID", hidFacID.Value);
                //    HT.Add("CrID", hidCrID.Value);
                //    HT.Add("MoLrnID", hidMoLrnID.Value);
                //    HT.Add("PtrnID", hidPtrnID.Value);
                //    HT.Add("BrnID", hidBrnID.Value);
                //    HT.Add("CrPrDetailsID", hidCrPrDetailsID.Value);
                //    HT.Add("CrPrChID", hidCrPrChID.Value);
                //    HT.Add("AcYrID", hid_fk_AcademicYr_ID.Value);
                //    HT.Add("CreatedBy", user.User_ID.ToString());
                //    HT.Add("RequestDetails", "'" + createExamFormModifyXML() + "'");

                //    if (clsPaperChange.SendExamFormModifyRequest(HT).Equals("S")) //successful
                //    {
                //        if (user.UserTypeCode != "2")
                //        {
                //            lblAppOrDenyMsg.Text = "<br>An Exam Form Modify Request has been sent. The results will also be re-processed.";
                //        }
                //        else if (user.UserTypeCode == "2")
                //        {
                //            lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                //        }
                //    }

                //    else
                //    {
                //        lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request could not be sent.";
                //    }

                //}
                //***************************************************
                #endregion

                //refill grid view
                //DT = clsCollegeAdmissionReports.PaperExemptionFetchStudentDetails(hidSelPaper.Value, hidInstID.Value, hid_fk_AcademicYr_ID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
                //          hidCrPrDetailsID.Value, hidCrPrChID.Value, hidTLMIDs.Value, hidAMIDs.Value, hidATIDs.Value);
                DT = clsCollegeAdmissionReports.PaperExemptionFetchStudentDetails(hidSelPaper.Value, hidInstID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
                                                                                  hidCrPrDetailsID.Value, hidCrPrChID.Value, hidTLMIDs.Value, hidAMIDs.Value, hidATIDs.Value);

                if (DT.Rows.Count > 0)
                {
                    divResultPageDetails.Style.Add("display", "block");
                    FillGridView(DT);
                    chkTLMAMAT.ClearSelection();
                    btnApprove.Style.Add("display", "block");
                    btnDeny.Style.Add("display", "block");
                }
                else
                {
                    btnApprove.Style.Add("display", "none");
                    btnDeny.Style.Add("display", "none");
                    divTLMAMATChoice.Style.Add("display", "none");
                    divPaperTLMAMAT.Style.Add("display", "none");
                    tblExportedDataMsg.Style.Add("display", "block");
                    //lblExportedData.Text = "No Record(s) found.";
                    divResultPageDetails.Style.Add("display", "none");
                }
            }
            else
            {
                divMsg.Style.Add("display", "block");
                lblAppOrDenyMsg.Text = "An error has occurred. Please try again later.";
            }

            if (oPaperStudXMLList != null)
            {
                oPaperStudXMLList = null;
            }
        }
        protected void btnDenyAll_Click(object sender, EventArgs e)
        {
            string resStatus = "";

            hidTLMIDs.Value = string.Empty;
            hidAMIDs.Value  = string.Empty;
            hidATIDs.Value  = string.Empty;
            List <PaperStudXML> oPaperStudXMLList = new List <PaperStudXML>();
            PaperStudXML        oPaperStudXML;

            //-------------
            List <ExamFormModifyXML> oExamFormModifyReq = new List <ExamFormModifyXML>();
            ExamFormModifyXML        ExamFormModifyReq;

            hidUniID.Value = Classes.clsGetSettings.UniversityID.ToString();
            //-------------

            foreach (ListItem li in chkTLMAMAT.Items)
            {
                if (li.Selected)
                {
                    hidSelTLMAmAt.Value += li.Value + "|" + li.Text + ",";
                    hidTLMIDs.Value     += li.Value.Split('-')[0].ToString() + ",";
                    hidAMIDs.Value      += li.Value.Split('-')[1].ToString() + ",";
                    hidATIDs.Value      += li.Value.Split('-')[2].ToString() + ",";
                }
            }
            hidTLMIDs.Value = hidTLMIDs.Value.TrimEnd(',');
            hidAMIDs.Value  = hidAMIDs.Value.TrimEnd(',');
            hidATIDs.Value  = hidATIDs.Value.TrimEnd(',');

            //DataTable DT = clsCollegeAdmissionReports.PaperExemptionFetchStudentDetails(hidSelPaper.Value, hidInstID.Value, hid_fk_AcademicYr_ID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
            //             hidCrPrDetailsID.Value, hidCrPrChID.Value, hidTLMIDs.Value, hidAMIDs.Value, hidATIDs.Value);
            DataTable DT = clsCollegeAdmissionReports.PaperExemptionFetchStudentDetails(hidSelPaper.Value, hidInstID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
                                                                                        hidCrPrDetailsID.Value, hidCrPrChID.Value, hidTLMIDs.Value, hidAMIDs.Value, hidATIDs.Value);

            if (DT.Rows.Count != 0)
            {
                for (int j = 0; j < DT.Rows.Count; j++)
                {
                    oPaperStudXML           = new PaperStudXML();
                    oPaperStudXML.StudentID = int.Parse(DT.Rows[j]["pk_Student_ID"].ToString());
                    oPaperStudXML.TLM       = int.Parse(DT.Rows[j]["TLM-AM-AT-ID"].ToString().Split('-')[0]);
                    oPaperStudXML.Year      = int.Parse(DT.Rows[j]["pk_Year"].ToString());
                    oPaperStudXML.AM        = int.Parse(DT.Rows[j]["TLM-AM-AT-ID"].ToString().Split('-')[1]);
                    oPaperStudXML.AT        = int.Parse(DT.Rows[j]["TLM-AM-AT-ID"].ToString().Split('-')[2]);
                    oPaperStudXML.FacID     = int.Parse(DT.Rows[j]["pk_Fac_ID"].ToString());
                    oPaperStudXML.Pk_Pp_PpHead_CrPrCh_ID = int.Parse(DT.Rows[j]["pk_Pp_PpHead_CrPrCh_ID"].ToString());
                    oPaperStudXML.CRID      = int.Parse(DT.Rows[j]["pk_Cr_ID"].ToString());
                    oPaperStudXML.MOLID     = int.Parse(DT.Rows[j]["pk_MoLrn_ID"].ToString());
                    oPaperStudXML.PtrnID    = int.Parse(DT.Rows[j]["pk_Ptrn_ID"].ToString());
                    oPaperStudXML.BrnID     = int.Parse(DT.Rows[j]["pk_Brn_ID"].ToString());
                    oPaperStudXML.CrPrDetID = int.Parse(DT.Rows[j]["pk_CrPr_Details_ID"].ToString());
                    oPaperStudXML.CrPrChtID = int.Parse(DT.Rows[j]["pk_CrPrCh_ID"].ToString());
                    oPaperStudXML.UniID     = int.Parse(DT.Rows[j]["pk_Uni_ID"].ToString());
                    oPaperStudXMLList.Add(oPaperStudXML);


                    //---------------
                    ExamFormModifyReq               = new ExamFormModifyXML();
                    ExamFormModifyReq.UniID         = int.Parse(hidUniID.Value);
                    ExamFormModifyReq.StudentID     = int.Parse(DT.Rows[j]["pk_Student_ID"].ToString());
                    ExamFormModifyReq.Year          = int.Parse(DT.Rows[j]["pk_Year"].ToString());
                    ExamFormModifyReq.AcYrID        = int.Parse(DT.Rows[j]["fk_AcademicYear_ID"].ToString());
                    ExamFormModifyReq.InstID        = int.Parse(DT.Rows[j]["Ref_InstReg_Institute_ID"].ToString());
                    ExamFormModifyReq.FacID         = int.Parse(DT.Rows[j]["pk_Fac_ID"].ToString());
                    ExamFormModifyReq.CrID          = int.Parse(DT.Rows[j]["pk_Cr_ID"].ToString());
                    ExamFormModifyReq.MoLrnID       = int.Parse(DT.Rows[j]["pk_MoLrn_ID"].ToString());
                    ExamFormModifyReq.PtrnID        = int.Parse(DT.Rows[j]["pk_Ptrn_ID"].ToString());
                    ExamFormModifyReq.BrnID         = int.Parse(DT.Rows[j]["pk_Brn_ID"].ToString());
                    ExamFormModifyReq.CrPrDetailsID = int.Parse(DT.Rows[j]["pk_CrPr_Details_ID"].ToString());
                    ExamFormModifyReq.CrPrChID      = int.Parse(DT.Rows[j]["pk_CrPrCh_ID"].ToString());
                    ExamFormModifyReq.CreatedBy     = user.User_ID.ToString();
                    //ExamFormModifyReq.RequestDetails = createExamFormModifyXML(ExamFormModifyReq.StudentID, ExamFormModifyReq.Year);
                    oExamFormModifyReq.Add(ExamFormModifyReq);
                    //---------------
                }
                int result = clsCollegeAdmissionReports.PaperExemptionApproveOrDeny(user.User_ID, 2, PaperStudXML.SerializeObject(oPaperStudXMLList));
                // int result = 1;

                if (result != 0)
                {
                    divMsg.Style.Add("display", "block");
                    lblAppOrDenyMsg.Text = "The Exemption claimed is denied successfully for the selected " + lblPaper.Text + "(s).";
                    btnDenyAll.Enabled   = false;
                    btnSelect.Enabled    = false;
                    resStatus            = clsPaperChange.SendExamFormModifyRequest_PaperExemptionApproval_MultipleStuds(ExamFormModifyXML.SerializeObject(oExamFormModifyReq)).ToString();

                    if (resStatus != "U") //successful (resStatus gives the number of requests sent)
                    {
                        //if (user.UserTypeCode != "2")
                        //{

                        //    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent for " + resStatus + " number of student(s).";
                        //}
                        //else if (user.UserTypeCode == "2")
                        //{
                        //    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent for " + resStatus + " number of student(s).";
                        //}

                        lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent for " + resStatus + " number of student(s).";
                    }

                    else if (resStatus == "U") //unsuccessful
                    {
                        lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request could not be sent.";
                    }
                }
                else
                {
                    divMsg.Style.Add("display", "block");
                    lblAppOrDenyMsg.Text = "An error has occurred. Please try again later.";
                }
            }
            else
            {
                divMsg.Style.Add("display", "block");
                lblAppOrDenyMsg.Text = "<br>Exemption Approval decision has already been taken for selected " + lblPaper.Text + "(s) and selected assessment type.";
            }

            //refill grid view

            if (hidInstID.Value == "")
            {
                //DT = clsCollegeAdmissionReports.ListStudentCountForPaperExemptionApprovalSelectedCourse(hid_fk_AcademicYr_ID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
                //    hidCrPrDetailsID.Value, hidCrPrChID.Value);
                DT = clsCollegeAdmissionReports.ListStudentCountForPaperExemptionApprovalSelectedCourse(hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, Convert.ToString(Session["BranchID"]),
                                                                                                        hidCrPrDetailsID.Value, hidCrPrChID.Value);
            }
            else
            {
                //DT = clsCollegeAdmissionReports.ListStudentCountForPaperExemptionApprovalSelectedCollege(hid_fk_AcademicYr_ID.Value, hidInstID.Value);
                DT = clsCollegeAdmissionReports.ListStudentCountForPaperExemptionApprovalSelectedCollege(hidInstID.Value);
            }
            if (DT.Rows.Count > 0)
            {
                GVPapers.DataSource = DT;
                GVPapers.DataBind();
                divPapers.Style.Add("display", "block");
                btnPaperNext.Style.Add("display", "block");
            }
            else
            {
                tblExportedDataMsg.Style.Add("display", "block");
                lblExportedData.Text = "No Record(s) found.";
                divPapers.Style.Add("display", "none");
                btnPaperNext.Style.Add("display", "none");
            }
        }
Exemple #3
0
        protected void btnProceed_Click(object sender, EventArgs e)
        {
            lblNote.Text = string.Empty;

            /* Call SP for changing decision here*/
            string SPXML = string.Empty;
            List <PaperStudXML> oPaperStudXMLList = new List <PaperStudXML>();
            PaperStudXML        oPaperStudXML;

            for (int j = 0; j < GVPapersNew.Rows.Count; j++)
            {
                if (((((RadioButton)GVPapersNew.Rows[j].Cells[2].FindControl("RDBtn_Approve")).Enabled && ((RadioButton)GVPapersNew.Rows[j].Cells[2].FindControl("RDBtn_Approve")).Checked)) || (((RadioButton)GVPapersNew.Rows[j].Cells[3].FindControl("RDBtn_Deny")).Enabled && ((RadioButton)GVPapersNew.Rows[j].Cells[3].FindControl("RDBtn_Deny")).Checked))
                {
                    oPaperStudXML           = new PaperStudXML();
                    oPaperStudXML.UniID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Uni_ID"].ToString());
                    oPaperStudXML.Year      = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Year"].ToString());
                    oPaperStudXML.StudentID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Student_ID"].ToString());
                    oPaperStudXML.TLM       = int.Parse(GVPapersNew.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[0]);
                    oPaperStudXML.AM        = int.Parse(GVPapersNew.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[1]);
                    oPaperStudXML.AT        = int.Parse(GVPapersNew.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[2]);
                    oPaperStudXML.Pk_Pp_PpHead_CrPrCh_ID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Pp_PpHead_CrPrCh_ID"].ToString());
                    oPaperStudXML.FacID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Fac_ID"].ToString());
                    oPaperStudXML.CRID      = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Cr_ID"].ToString());
                    oPaperStudXML.MOLID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_MoLrn_ID"].ToString());
                    oPaperStudXML.PtrnID    = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Ptrn_ID"].ToString());
                    oPaperStudXML.BrnID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Brn_ID"].ToString());
                    oPaperStudXML.CrPrDetID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_CrPr_Details_ID"].ToString());
                    oPaperStudXML.CrPrChtID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_CrPrCh_ID"].ToString());
                    oPaperStudXMLList.Add(oPaperStudXML);
                }
            }

            //set hidden variables
            hidpkFacID.Value       = GVPapersNew.DataKeys[0]["pk_Fac_ID"].ToString();
            hidpkCrID.Value        = GVPapersNew.DataKeys[0]["pk_Cr_ID"].ToString();
            hidpkMoLrnID.Value     = GVPapersNew.DataKeys[0]["pk_MoLrn_ID"].ToString();
            hidpkPtrnID.Value      = GVPapersNew.DataKeys[0]["pk_Ptrn_ID"].ToString();
            hidpkBrnID.Value       = GVPapersNew.DataKeys[0]["pk_Brn_ID"].ToString();
            hidpkCrPrDetails.Value = GVPapersNew.DataKeys[0]["pk_CrPr_Details_ID"].ToString();
            hidpkCrPrChID.Value    = GVPapersNew.DataKeys[0]["pk_CrPrCh_ID"].ToString();
            hidStudentID.Value     = GVPapersNew.DataKeys[0]["pk_Student_ID"].ToString();
            hidAcademicYear.Value  = GVPapersNew.DataKeys[0]["fk_AcademicYear_ID"].ToString();
            hidInstID.Value        = GVPapersNew.DataKeys[0]["Ref_InstReg_Institute_ID"].ToString();
            hidYearID.Value        = GVPapersNew.DataKeys[0]["pk_Year"].ToString();
            hidUniID.Value         = GVPapersNew.DataKeys[0]["pk_Uni_ID"].ToString();

            int result = 0;

            result = clsCollegeAdmissionReports.ChangeExemptionDecisionForSelectedPapers(user.User_ID, PaperStudXML.SerializeObject(oPaperStudXMLList));

            if (result != 0)
            {
                //divMsg.Style.Add("display", "block");
                lblMsg.Text = "The Exemption Approval Decision has been successfully changed for the Selected " + lblPaper.Text + "(s).";

                //send exam for modify request
                Hashtable HT = new Hashtable();
                HT.Add("UniID", hidUniID.Value);
                HT.Add("StudentID", hidStudentID.Value);
                HT.Add("Year", hidYearID.Value);
                HT.Add("InstID", hidInstID.Value);
                HT.Add("FacID", hidpkFacID.Value);
                HT.Add("CrID", hidpkCrID.Value);
                HT.Add("MoLrnID", hidpkMoLrnID.Value);
                HT.Add("PtrnID", hidpkPtrnID.Value);
                HT.Add("BrnID", hidpkBrnID.Value);
                HT.Add("CrPrDetailsID", hidpkCrPrDetails.Value);
                HT.Add("CrPrChID", hidpkCrPrChID.Value);
                HT.Add("AcYrID", hidAcademicYear.Value);
                HT.Add("CreatedBy", user.User_ID.ToString());
                HT.Add("RequestDetails", createExamFormModifyXML());

                if (clsPaperChange.SendExamFormModifyRequest_PaperExemptionApproval(HT).Equals("S")) //successful
                {
                    if (user.UserTypeCode != "2")
                    {
                        lblMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                    }
                    else if (user.UserTypeCode == "2")
                    {
                        lblMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                    }
                }

                else
                {
                    lblMsg.Text += "<br>An Exam Form Modify Request could not be sent.";
                }

                #region commented old code
                //***********************************************
                //if (hidExamFormModifyReq.Value.Equals("Yes"))
                //{
                //    Hashtable HT = new Hashtable();
                //    HT.Add("UniID", hidUniID.Value);
                //    HT.Add("InstID", hidInstID.Value);
                //    HT.Add("FacID", hidpkFacID.Value);
                //    HT.Add("CrID", hidpkCrID.Value);
                //    HT.Add("MoLrnID", hidpkMoLrnID.Value);
                //    HT.Add("PtrnID", hidpkPtrnID.Value);
                //    HT.Add("BrnID", hidpkBrnID.Value);
                //    HT.Add("CrPrDetailsID", hidpkCrPrDetails.Value);
                //    HT.Add("CrPrChID", hidpkCrPrChID.Value);
                //    HT.Add("AcYrID", hidAcademicYear.Value);
                //    HT.Add("CreatedBy", user.User_ID.ToString());
                //    HT.Add("RequestDetails", "'" + createExamFormModifyXML() + "'");

                //    string status = clsPaperChange.SendExamFormModifyRequest(HT);

                //    if (status.Equals("S")) //successful
                //    {
                //        if (user.UserTypeCode != "2")
                //        {
                //            lblMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                //        }
                //        else if (user.UserTypeCode == "2")
                //        {
                //            lblMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                //        }
                //    }

                //    else
                //    {
                //        lblMsg.Text += "<br>An Exam Form Modify Request could not be sent.";
                //    }

                //}
                //********************************************
                #endregion

                //refill grid view
                dt = ElgClasses.clsCollegeAdmissionReports.ListCrPrTermwisePapers_ChangeExemptionDecision(hidUniID.Value, hidYearID.Value, hidStudentID.Value, hidpkFacID.Value, hidpkCrID.Value, hidpkMoLrnID.Value, hidpkPtrnID.Value, hidpkBrnID.Value, hidpkCrPrDetails.Value, hidpkCrPrChID.Value);

                if (dt.Rows.Count > 0)
                {
                    GVPapersNew.DataSource = dt;
                    GVPapersNew.DataBind();
                }
                else
                {
                    tblExportedDataMsg.Style.Add("display", "block");
                    lblExportedData.Text = "No Record(s) found.";
                }
            }

            else
            {
                //divMsg.Style.Add("display", "block");
                lblMsg.Text = "An error has occurred. Please try again later.";
            }

            if (oPaperStudXMLList != null)
            {
                oPaperStudXMLList = null;
            }
            lblMsg.Style.Add("display", "block");
        }
        protected void btnApproveOrDeny_Click(object sender, EventArgs e)
        {
            string SPXML = string.Empty;
            List <PaperStudXML> oPaperStudXMLList = new List <PaperStudXML>();
            PaperStudXML        oPaperStudXML;

            for (int j = 0; j < GVPapersNew.Rows.Count; j++)
            {
                if (((CheckBox)GVPapersNew.Rows[j].Cells[2].FindControl("chkSelectStudents")).Checked)
                {
                    oPaperStudXML           = new PaperStudXML();
                    oPaperStudXML.StudentID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Student_ID"].ToString());
                    oPaperStudXML.Year      = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Year"].ToString());
                    oPaperStudXML.TLM       = int.Parse(GVPapersNew.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[0]);
                    oPaperStudXML.AM        = int.Parse(GVPapersNew.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[1]);
                    oPaperStudXML.AT        = int.Parse(GVPapersNew.DataKeys[j].Values["TLM-AM-AT-ID"].ToString().Split('-')[2]);
                    oPaperStudXML.Pk_Pp_PpHead_CrPrCh_ID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Pp_PpHead_CrPrCh_ID"].ToString());
                    oPaperStudXML.FacID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Fac_ID"].ToString());
                    oPaperStudXML.CRID      = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Cr_ID"].ToString());
                    oPaperStudXML.MOLID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_MoLrn_ID"].ToString());
                    oPaperStudXML.PtrnID    = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Ptrn_ID"].ToString());
                    oPaperStudXML.BrnID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Brn_ID"].ToString());
                    oPaperStudXML.CrPrDetID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_CrPr_Details_ID"].ToString());
                    oPaperStudXML.CrPrChtID = int.Parse(GVPapersNew.DataKeys[j].Values["pk_CrPrCh_ID"].ToString());
                    oPaperStudXML.UniID     = int.Parse(GVPapersNew.DataKeys[j].Values["pk_Uni_ID"].ToString());
                    oPaperStudXMLList.Add(oPaperStudXML);
                }
            }

            //set hidden variables
            hidFacID.Value             = GVPapersNew.DataKeys[0]["pk_Fac_ID"].ToString();
            hidCrID.Value              = GVPapersNew.DataKeys[0]["pk_Cr_ID"].ToString();
            hidMoLrnID.Value           = GVPapersNew.DataKeys[0]["pk_MoLrn_ID"].ToString();
            hidPtrnID.Value            = GVPapersNew.DataKeys[0]["pk_Ptrn_ID"].ToString();
            hidBrnID.Value             = GVPapersNew.DataKeys[0]["pk_Brn_ID"].ToString();
            hidCrPrDetailsID.Value     = GVPapersNew.DataKeys[0]["pk_CrPr_Details_ID"].ToString();
            hidCrPrChID.Value          = GVPapersNew.DataKeys[0]["pk_CrPrCh_ID"].ToString();
            hidStudentID.Value         = GVPapersNew.DataKeys[0]["pk_Student_ID"].ToString();
            hid_fk_AcademicYr_ID.Value = GVPapersNew.DataKeys[0]["fk_AcademicYear_ID"].ToString();
            hidInstID.Value            = GVPapersNew.DataKeys[0]["Ref_InstReg_Institute_ID"].ToString();
            hidYearID.Value            = GVPapersNew.DataKeys[0]["pk_Year"].ToString();
            hidUniID.Value             = GVPapersNew.DataKeys[0]["pk_Uni_ID"].ToString();


            //******************************
            //if (GVPapersNew.DataKeys[0]["fk_ExEv_ID"].ToString().Equals("0") || GVPapersNew.DataKeys[0]["fk_ExEv_ID"].ToString().Equals("-"))
            //{
            //    hidExamFormModifyReq.Value = "No";
            //}
            //else
            //{
            //    hidExamFormModifyReq.Value = "Yes";
            //}
            //******************************

            int    result = 0;
            string status = string.Empty;

            if (((Button)sender).ID == "btnApprove")
            {
                result = clsCollegeAdmissionReports.PaperExemptionApproveOrDeny(user.User_ID, 1, PaperStudXML.SerializeObject(oPaperStudXMLList));
                status = "Granted";
            }
            else if (((Button)sender).ID == "btnDeny")
            {
                result = clsCollegeAdmissionReports.PaperExemptionApproveOrDeny(user.User_ID, 2, PaperStudXML.SerializeObject(oPaperStudXMLList));
                status = "Denied";
            }
            if (result != 0)
            {
                divMsg.Style.Add("display", "block");

                lblAppOrDenyMsg.Text = "The Exemption claimed is " + status + " successfully for the selected " + lblPaper.Text + "(s).";

                //send exam for modify request

                //if (hidExamFormModifyReq.Value.Equals("Yes"))
                //{
                Hashtable HT = new Hashtable();
                HT.Add("UniID", hidUniID.Value);
                HT.Add("StudentID", hidStudentID.Value);
                HT.Add("Year", hidYearID.Value);
                HT.Add("InstID", hidInstID.Value);
                HT.Add("FacID", hidFacID.Value);
                HT.Add("CrID", hidCrID.Value);
                HT.Add("MoLrnID", hidMoLrnID.Value);
                HT.Add("PtrnID", hidPtrnID.Value);
                HT.Add("BrnID", hidBrnID.Value);
                HT.Add("CrPrDetailsID", hidCrPrDetailsID.Value);
                HT.Add("CrPrChID", hidCrPrChID.Value);
                HT.Add("AcYrID", hid_fk_AcademicYr_ID.Value);
                HT.Add("CreatedBy", user.User_ID.ToString());
                HT.Add("RequestDetails", createExamFormModifyXML());

                if (clsPaperChange.SendExamFormModifyRequest_PaperExemptionApproval(HT).Equals("S"))     //successful
                {
                    //if (user.UserTypeCode != "2")
                    //{
                    //    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                    //}
                    //else if (user.UserTypeCode == "2")
                    //{
                    //    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                    //}

                    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request has been sent.";
                }

                else
                {
                    lblAppOrDenyMsg.Text += "<br>An Exam Form Modify Request could not be sent.";
                }
                //}

                //refill grid view
                DT = clsCollegeAdmissionReports.FetchPaperTLMAMATForSimpleStudentSearch(hidUniID.Value, hidYearID.Value, hidStudentID.Value, hidFacID.Value, hidCrID.Value, hidMoLrnID.Value, hidPtrnID.Value, hidBrnID.Value,
                                                                                        hidCrPrDetailsID.Value, hidCrPrChID.Value);
                if (DT.Rows.Count > 0)
                {
                    GVPapersNew.DataSource = DT;
                    GVPapersNew.DataBind();

                    chkTLMAMAT.ClearSelection();
                }
                else
                {
                    btnApprove.Style.Add("display", "none");
                    btnDeny.Style.Add("display", "none");
                    divTLMAMATChoice.Style.Add("display", "none");
                    divPapers.Style.Add("display", "none");
                    //tblExportedDataMsg.Style.Add("display", "block");
                    //lblExportedData.Text = "No Record(s) found.";
                }
            }
            else
            {
                divMsg.Style.Add("display", "block");
                lblAppOrDenyMsg.Text = "An error has occurred. Please try again later.";
            }

            if (oPaperStudXMLList != null)
            {
                oPaperStudXMLList = null;
            }
        }