protected void DDLCompany_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DataTable dtVessel;

            if (DDLCompany.SelectedValue == "-- ALL --")
            {
                dtVessel = objVsl.Get_VesselList(UDFLib.ConvertToInteger(DDLFleetP.SelectedValue), 0, 0, "", 0);
            }
            else
            {
                dtVessel = objVsl.Get_VesselList(UDFLib.ConvertToInteger(DDLFleetP.SelectedValue), 0, Convert.ToInt32(DDLCompany.SelectedValue), "", Convert.ToInt32(DDLCompany.SelectedValue));
            }
            DDLVesselP.Items.Clear();
            DDLVesselP.DataSource     = dtVessel;
            DDLVesselP.DataTextField  = "Vessel_name";
            DDLVesselP.DataValueField = "Vessel_id";
            DDLVesselP.DataBind();
            ListItem li = new ListItem("-- Select --", "0");
            DDLVesselP.Items.Insert(0, li);

            DataTable dtSup = objInsp.TEC_WL_Get_Supritendent_UsersByCompanyID(DDLCompany.SelectedIndex == 0 ? null : UDFLib.ConvertIntegerToNull(DDLCompany.SelectedValue), null);
            DDLInspectorP.DataSource     = dtSup;
            DDLInspectorP.DataTextField  = "Name";
            DDLInspectorP.DataValueField = "UserID";
            DDLInspectorP.DataBind();
            DDLInspectorP.Items.Insert(0, new ListItem("-- Select --", null));
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    protected void DDLFleetP_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DataTable dtVessel = objVsl.Get_VesselList(UDFLib.ConvertToInteger(DDLFleetP.SelectedValue), 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString()));
            DDLVesselP.Items.Clear();
            DDLVesselP.DataSource     = dtVessel;
            DDLVesselP.DataTextField  = "Vessel_name";
            DDLVesselP.DataValueField = "Vessel_id";
            DDLVesselP.DataBind();
            ListItem li = new ListItem("-- Select --", "0");
            DDLVesselP.Items.Insert(0, li);

            DataTable dtSup = objInsp.Get_Supritendent_Users(DDLFleetP.SelectedIndex == 0 ? null : UDFLib.ConvertIntegerToNull(DDLFleetP.SelectedValue), null);
            DDLInspectorP.DataSource     = dtSup;
            DDLInspectorP.DataTextField  = "Name";
            DDLInspectorP.DataValueField = "UserID";
            DDLInspectorP.DataBind();
            DDLInspectorP.Items.Insert(0, new ListItem("-- Select --", null));
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
    protected void DDLVessselP_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            DataTable dtSup = objInsp.Get_Supritendent_Users(DDLFleetP.SelectedIndex == 0 ? null : UDFLib.ConvertIntegerToNull(DDLFleetP.SelectedValue), DDLVesselP.SelectedIndex == 0 ? null : UDFLib.ConvertIntegerToNull(DDLVesselP.SelectedValue));
            DDLInspectorP.DataSource     = dtSup;
            DDLInspectorP.DataTextField  = "Name";
            DDLInspectorP.DataValueField = "UserID";
            DDLInspectorP.DataBind();
            DDLInspectorP.Items.Insert(0, new ListItem("-- Select --", null));

            grvChecklist.DataSource = null;
            grvChecklist.DataBind();


            if (ViewState["AddEditFlag"].ToString() == "Edit")
            {
                DataTable dtchecklist = objBllChecklist.Get_ChecklistsEdit(DDLVesselP.SelectedIndex == 0 ? null : UDFLib.ConvertIntegerToNull(DDLVesselP.SelectedValue), Convert.ToInt32(ViewState["ScheduleID"].ToString()));
                ViewState["ChecklistCount"] = dtchecklist.Rows.Count;
                if (dtchecklist.Rows.Count > 0)
                {
                    grvChecklist.DataSource     = dtchecklist;
                    grvChecklist.DataTextField  = "CheckList_Name";
                    grvChecklist.DataValueField = "Checklist_ID";
                    grvChecklist.DataBind();
                    //grvChecklist.Visible = true;
                    tblChecklist.Visible = true;


                    for (int i = 0; i < grvChecklist.Items.Count; i++)
                    {
                        if (dtchecklist.Rows[i]["Active_Status"].ToString() == "1")
                        {
                            grvChecklist.Items[i].Selected = true;
                        }
                    }
                }
            }
            else if (ViewState["AddEditFlag"].ToString() == "Add")//if (hdnScheduleID.Value == "Add")
            {
                DataTable dtchecklist = objBllChecklist.Get_Checklists(DDLVesselP.SelectedIndex == 0 ? null : UDFLib.ConvertIntegerToNull(DDLVesselP.SelectedValue));

                ViewState["ChecklistCount"] = dtchecklist.Rows.Count;
                if (dtchecklist.Rows.Count > 0)
                {
                    int count = 0;

                    grvChecklist.DataSource     = dtchecklist;
                    grvChecklist.DataTextField  = "CheckList_Name";
                    grvChecklist.DataValueField = "Checklist_ID";
                    grvChecklist.DataBind();
                    tblChecklist.Visible = true;
                }
                else
                {
                    tblChecklist.Visible = false;
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }