Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Request.QueryString["Page"] == null)
            {
                flstPreviousOperator.Attributes.Remove("style");
                flstPreJoiningExp.Attributes.Remove("style");
                flstPreJoiningExpInterview.Attributes.Remove("style");
            }

            TodayDateFormat = UDFLib.DateFormatMessage();
            DateFormat      = UDFLib.GetDateFormat();

            if (!IsPostBack)
            {
                if (GetSessionUserID() == 0)
                {
                    lblMsg.Text = "Session Expired!! Log-out and log-in again.";
                }
                else
                {
                    CalendarExtender4.Format = CalendarExtender3.Format = DateFormat;

                    AjaxControlToolkit4.CalendarExtender calEx = GridView_PreJoiningExp.FindControl("CalendarExtender6") as AjaxControlToolkit4.CalendarExtender;

                    if (calEx != null)
                    {
                        calEx.Format = DateFormat;
                    }

                    UserAccessValidation();
                    int CrewID = UDFLib.ConvertToInteger(Request.QueryString["ID"]);

                    if (objUA.View == 1)
                    {
                        pnlView_PreJoining.Visible       = true;
                        pnlView_PreviousContacts.Visible = true;
                        Load_PreJoiningExpFromInterview(CrewID);
                        Load_CrewPreviousContactDetails(CrewID);
                        Load_CrewPersonalDetails(CrewID);
                    }

                    DataTable dtVesselType = objVessel.Get_VesselTypeList();
                    ddlPJVesselType.DataSource     = dtVesselType;
                    ddlPJVesselType.DataTextField  = "VesselTypes";
                    ddlPJVesselType.DataValueField = "VesselTypes";
                    ddlPJVesselType.DataBind();
                    ddlPJVesselType.Items.Insert(0, new ListItem("-SELECT-", "0"));
                    ddlPJVesselType.SelectedIndex = 0;

                    int       UserCompanyID = UDFLib.ConvertToInteger(getSessionString("USERCOMPANYID"));
                    DataTable dtvessels     = objVessel.Get_VesselListPreJoining(UserCompanyID);
                    ViewState["DtVessel"]    = dtvessels;
                    ddlVessel.DataSource     = dtvessels;
                    ddlVessel.DataTextField  = "VESSEL_NAME";
                    ddlVessel.DataValueField = "VESSEL_ID";
                    ddlVessel.DataBind();
                    ddlVessel.Items.Insert(0, new ListItem("-SELECT-", "0"));
                    ddlVessel.SelectedIndex = 0;

                    Session["VesselManager"] = Convert.ToString(dtvessels.Rows[0]["VesselManager"]);
                    hdnVesselManager.Value   = Convert.ToString(dtvessels.Rows[0]["VesselManager"]);
                }
                if (Session["UTYPE"].ToString() == "MANNING AGENT")
                {
                    chkCurrentOperator.Visible = false;
                }
                else
                {
                    chkCurrentOperator.Visible = true;
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }