protected void savePriorityDetails(object sender, EventArgs e)
        {
            string caseId = "";
                priorityDetail detail = new priorityDetail();
                priorityDetail existingDetail;
                if (ViewState["caseId"] != null)
                {
                    caseId = ViewState["caseId"].ToString();
                    //detail.caseId =caseId ;
                }

                string actv = "";
                if (ViewState["activity"] != null)
                {
                    actv = ViewState["activity"].ToString();
                }

                if (priorityNeed1.Text != null || priorityNeed1.Text != "")
                    detail.protection1 = priorityNeed1.Text.Trim();

                if (priorityNeed2.Text != null || priorityNeed2.Text != "")
                    detail.protection2 = priorityNeed2.Text.Trim();

                if (priorityNeed3.Text != null || priorityNeed3.Text != "")
                    detail.protection3 = priorityNeed3.Text.Trim();

                if (priorityNeed4.Text != null || priorityNeed4.Text != "")
                    detail.savings1 = priorityNeed4.Text.Trim();

                if (priorityNeed5.Text != null || priorityNeed5.Text != "")
                    detail.savings2 = priorityNeed5.Text.Trim();

                if (priorityNeed6.Text != null || priorityNeed6.Text != "")
                    detail.savings3 = priorityNeed6.Text.Trim();

                if (priorityNeed7.Text != null || priorityNeed7.Text != "")
                    detail.protection4 = priorityNeed7.Text.Trim();

                if (priorityNeed8.Text != null || priorityNeed8.Text != "")
                    detail.protection5 = priorityNeed8.Text.Trim();

                detail.caseid = caseId;

                PriorityDetailsDAO dao = new PriorityDetailsDAO();

                existingDetail = dao.getPriorityDetails(caseId);

                if (existingDetail == null)
                {
                    dao.savePriorityDetails(detail);
                }
                else
                {
                    dao.updatePriorityDetails(detail);
                }

                string status = activityStatusCheck.getPriorityDetailStatus(detail);
                activityStatusDao.saveOrUpdateActivityStatus(caseId, actv, status);

                markStatusOnTab(caseId);

                string caseStatus = activityStatusCheck.getZPlanStatus(caseId);

                string url = Server.MapPath("~/_layouts/Zurich/Printpages/");
                pdfData = activityStatusCheck.sendDataToSalesPortal(caseId, caseStatus, url, sendPdf);
                /*if (st == 1)
                {
                    lblStatusSubmitted.Visible = false;
                }
                else
                {
                    lblStatusSubmissionFailed.Visible = true;
                }*/

                populatePriorityDetails(detail, caseId);
                lblPdSummarySaveSuccess.Visible = true;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            activity = activityStatusDao.getActivity(2);
            ViewState["activity"] = activity;

            lblPdSummarySaveSuccess.Visible = false;
            lblPdSummarySaveFailed.Visible = false;

            if (!IsPostBack)
            {
                string nextCaseId = Request.Form["caseid"];
                string menuCaseId = Request.QueryString["caseid"];
                string helperUsed = Request.Form["helperUsed"];

                if (nextCaseId != null && nextCaseId != "")
                {
                    caseId = nextCaseId;
                }

                if (menuCaseId != null && menuCaseId != "")
                {
                    caseId = menuCaseId;
                }

                if (Session["fnacaseid"] != null)
                {
                    caseId = Session["fnacaseid"].ToString();
                }

                ViewState["caseId"] = caseId;
                if (caseId != null || caseId != "")
                {
                    PriorityDetailsDAO dao = new PriorityDetailsDAO();
                    priorityDetail detail=new priorityDetail();

                        detail = dao.getPriorityDetails(caseId);
                        populatePriorityDetails(detail, caseId);
                }
            }
            markStatusOnTab(caseId);
        }