示例#1
0
    /// <summary>
    /// Bind Vessel list as per fleet selection
    /// </summary>
    public void BindVesselDDLByFleet()
    {
        try
        {
            BLL_Infra_VesselLib objVsl = new BLL_Infra_VesselLib();

            if (chkVesselAssign.Checked == true)
            {
                DataTable dtVessel = objVsl.Get_VesselList(UDFLib.ConvertToInteger(DDLFleet.SelectedValue), 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString()));

                DDLVesselObs.DataTextField  = "Vessel_name";
                DDLVesselObs.DataValueField = "Vessel_id";
                DDLVesselObs.DataSource     = dtVessel;
                DDLVesselObs.DataBind();
                BLL_VET_VettingLib objBLLVetLib = new BLL_VET_VettingLib();
                DataTable          dtUserVessel = objBLLVetLib.VET_Get_UserVesselList(UDFLib.ConvertToInteger(DDLFleet.SelectedValue), 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString()), GetSessionUserID());
                if (dtUserVessel.Rows.Count > 0)
                {
                    CheckBoxList chk = (CheckBoxList)DDLVesselObs.Controls[0].Controls[0].FindControl("CheckBoxListItems");
                    for (int j = 0; j < chk.Items.Count; j++)
                    {
                        for (int i = 0; i < dtUserVessel.Rows.Count; i++)
                        {
                            if (chk.Items[j].Value == dtUserVessel.Rows[i]["Vessel_ID"].ToString())
                            {
                                ((CheckBoxList)DDLVesselObs.Controls[0].Controls[0].FindControl("CheckBoxListItems")).Items[j].Selected = true;
                            }
                        }
                    }
                }
            }
            else
            {
                DataTable dtVessel = objVsl.Get_VesselList(UDFLib.ConvertToInteger(DDLFleet.SelectedValue), 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString()));

                DDLVesselObs.DataTextField  = "Vessel_name";
                DDLVesselObs.DataValueField = "Vessel_id";
                DDLVesselObs.DataSource     = dtVessel;
                DDLVesselObs.DataBind();
            }
        }

        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
示例#2
0
    protected void btnClearAllFilter_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            DDLQuestionnaire.ClearSelection();
            DDLSection.ClearSelection();
            DDLQuestion.ClearSelection();
            rbtnType.SelectedValue = "0";
            DDLFleet.SelectedValue = "0";
            DDLVesselObs.ClearSelection();
            DDLOilMajorObs.ClearSelection();
            DDLInspectorObs.ClearSelection();
            txtObservationVessel.Text = "";
            DDLCategories.ClearSelection();
            DDLRiskLevel.ClearSelection();
            txtLObsFromDate.Text    = "";
            txtLObsToDate.Text      = "";
            chkVesselAssign.Checked = true;
            BindVesselDDLByFleet();
            UpdAdvFltrObs.Update();
            Bind_ObservationIndex();

            if (hfAdv.Value == "o")
            {
                String tgladvsearchClr = String.Format("toggleOnSearchClearFilter(advText,'" + hfAdv.Value + "');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "tgladvsearchClr", tgladvsearchClr, true);
            }
            else
            {
                String tgladvsearchClr1 = String.Format("toggleOnSearchClearFilter(advText,'" + hfAdv.Value + "');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "tgladvsearchClr1", tgladvsearchClr1, true);
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }