protected void Page_Load(object sender, EventArgs e)
    {
        calEvaDate.Format = UDFLib.GetDateFormat();

        if (Session["USERFULLNAME"] == null)
        {
            Response.Redirect("~/Account/Login.aspx");
        }

        if (!IsPostBack)
        {
            int CrewID        = UDFLib.ConvertToInteger(Request.QueryString["CrewID"].ToString());
            int Evaluation_ID = UDFLib.ConvertToInteger(Request.QueryString["EID"].ToString());

            try
            {
                lblMonth.Text = UDFLib.ConvertUserDateFormat(Convert.ToString(Request.QueryString["M"]));
            }
            catch
            {
                lblMonth.Text = Request.QueryString["M"];
            }


            Load_CrewPersonalDetails(CrewID);

            DataTable dtEval = BLL_Crew_Evaluation.Get_Evaluations(Evaluation_ID);
            if (dtEval.Rows.Count > 0)
            {
                lblEvalName.Text = dtEval.Rows[0]["Evaluation_Name"].ToString();
            }
            DataTable dt1 = objUser.Get_UserDetails(Convert.ToInt32(Session["USERID"].ToString()));
            if (dt1.Rows.Count > 0)
            {
                int       LoggedInUserCrewId = UDFLib.ConvertToInteger(dt1.Rows[0]["CrewId"].ToString());
                DataTable dt = objBLLCrew.Get_CrewPersonalDetailsByID(LoggedInUserCrewId);
                if (dt.Rows.Count > 0)
                {
                    string rank      = dt.Rows[0]["Rank_Short_Name"].ToString() == "" ? "" : dt.Rows[0]["Rank_Short_Name"].ToString() + "-";
                    string staffCode = dt.Rows[0]["Staff_Code"].ToString() == "" ? "" : dt.Rows[0]["Staff_Code"].ToString() + "-";
                    lnkEvaluator.Text        = rank + staffCode + Session["USERFULLNAME"].ToString();
                    lnkEvaluator.NavigateUrl = "~/Crew/CrewDetails.aspx?ID=" + dt.Rows[0]["ID"].ToString();
                    EvalLibRank         = rank;
                    Evaluator_CrewDtlID = dt.Rows[0]["ID"].ToString();
                    //Evaluator_CrewDtlID = dt.Rows[0]["Evaluator_CrewDtlID"].ToString();
                }
            }
            if (Request.QueryString["DtlID"] != null)
            {
                string Dtl_Evaluation_ID = Request.QueryString["DtlID"].ToString();

                Bind_EvaluationResult();
                string Office_ID = hdnOffice_ID.Value.ToString();
                string Vessel_ID = hdnVessel_ID.Value.ToString();


                btnSaveEvaluation.Enabled = false;

                if (Dtl_Evaluation_ID != "" && Office_ID != "" && Vessel_ID != "")
                {
                    if (BLL_Crew_Evaluation.Get_CrewEvaluation_FeedbackCount(GetSessionUserID(), Convert.ToInt32(Dtl_Evaluation_ID), Convert.ToInt32(Office_ID), Convert.ToInt32(Vessel_ID)) > 0)
                    {
                        lnkReqFeedBk.BackColor = System.Drawing.Color.Yellow;
                    }
                    DataSet ds = BLL_Crew_Evaluation.Get_CrewEvaluation_Verification(UDFLib.ConvertToInteger(CrewID), UDFLib.ConvertToInteger(Dtl_Evaluation_ID), UDFLib.ConvertToInteger(Office_ID), UDFLib.ConvertToInteger(Vessel_ID));
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            if (ds.Tables[0].Rows[0]["VerifiedBy"].ToString() != "")
                            {
                                btnSaveFollowUpAndClose.Visible = false;
                                txtMessage.Text     = ds.Tables[0].Rows[0]["VerificationComment"].ToString();
                                txtMessage.ReadOnly = true;
                            }
                            else
                            {
                                btnSaveFollowUpAndClose.Enabled = true;
                                txtMessage.ReadOnly             = false;
                            }
                        }
                        else
                        {
                            btnSaveFollowUpAndClose.Visible = false;
                            txtMessage.Visible             = false;
                            txtVerificationComment.Visible = false;
                        }
                    }
                    else
                    {
                        btnSaveFollowUpAndClose.Visible = false;
                        txtMessage.Visible             = false;
                        txtVerificationComment.Visible = false;
                    }


                    string Show_Dashboard = String.Format("AsyncFeedbackHistory();");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "", Show_Dashboard, true);

                    dvEvalutionFooter.Visible   = true;
                    dvEvalutionFooter.InnerHtml = GetEvaluationSignatureDetails(UDFLib.ConvertToInteger(Request.QueryString["SchID"].ToString()), Evaluation_ID);
                    if (Request.QueryString.ToString().Contains("DshBrd"))
                    {
                        if (Request.QueryString["DshBrd"].ToString() != null)
                        {
                            InsertDel_ActionDetails(CrewID, UDFLib.ConvertToInteger(Request.QueryString["SchID"].ToString()), 0);
                        }
                    }

                    return;
                }
            }
            else
            {
                Bind_AssignedCriteria();
                txtEvaDate.Text                 = UDFLib.ConvertUserDateFormat(Convert.ToString(DateTime.Today));
                lnkReqFeedBk.Visible            = false;
                lnkAddFeedBk.Visible            = false;
                lnkHide.Visible                 = false;
                lnkShow.Visible                 = false;
                btnSaveFollowUpAndClose.Visible = false;
                txtMessage.Visible              = false;
                txtVerificationComment.Visible  = false;
            }

            if (Request.QueryString.ToString().Contains("DshBrd"))
            {
                if (Request.QueryString["DshBrd"].ToString() != null)
                {
                    InsertDel_ActionDetails(CrewID, UDFLib.ConvertToInteger(Request.QueryString["SchID"].ToString()), 0);
                }
            }
        }
    }