public void BindPortCall() { try { BLL_VET_VettingLib objVet = new BLL_VET_VettingLib(); Session["FromDate"] = Convert.ToDateTime(txtFrom.Text.ToString()); DataSet ds = objPortCall.Get_PortCall_Search_DPL((DataTable)Session["sFleet"], (DataTable)Session["sVesselCode"], DateTime.Parse(txtFrom.Text)); DataTable dtVetting = objVet.VET_Get_VettingByPortCall(); DataTable dtVetToolTip = objVet.VET_Get_ToolTipForPortCall(); DataTable dtInspector = objVet.VET_Get_InspectorList(); ViewState["dtVetting"] = dtVetting; ViewState["dtVetToolTip"] = dtVetToolTip; ViewState["dtInspector"] = dtInspector; ds.Relations.Add(new DataRelation("NestedCat", ds.Tables[1].Columns["Vessel_ID"], ds.Tables[0].Columns["Vessel_ID"])); ds.Tables[1].TableName = "Members"; rpt1.DataSource = ds.Tables[1]; rpt1.DataBind(); } catch (Exception ex) { } }
/// <summary> /// Bind Vessel dropdown as per vessel assign to the specific user /// </summary> public void BindVesselDDL() { try { BLL_Infra_VesselLib objVsl = new BLL_Infra_VesselLib(); BLL_VET_VettingLib objBLLVetLib = new BLL_VET_VettingLib(); if (chkVesselAssign.Checked == true) { DataTable dtVessel = objVsl.Get_VesselList(0, 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString())); DDLVessel.DataTextField = "Vessel_name"; DDLVessel.DataValueField = "Vessel_id"; DDLVessel.DataSource = dtVessel; DDLVessel.DataBind(); DataTable dtUserVessel = objBLLVetLib.VET_Get_UserVesselList(0, 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString()), GetSessionUserID()); if (dtUserVessel.Rows.Count > 0) { CheckBoxList chk = (CheckBoxList)DDLVessel.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)DDLVessel.Controls[0].Controls[0].FindControl("CheckBoxListItems")).Items[j].Selected = true; break; } } } } } else { DataTable dtVessel = objVsl.Get_VesselList(0, 0, Convert.ToInt32(Session["USERCOMPANYID"].ToString()), "", Convert.ToInt32(Session["USERCOMPANYID"].ToString())); DDLVessel.DataTextField = "Vessel_name"; DDLVessel.DataValueField = "Vessel_id"; DDLVessel.DataSource = dtVessel; DDLVessel.DataBind(); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
protected void btnSave_Click(object sender, EventArgs e) { try { BLL_VET_VettingLib objBLvtst = new BLL_VET_VettingLib(); DataTable dtSave = new DataTable(); dtSave.Columns.Add("VID"); dtSave.Columns.Add("VTID"); dtSave.Columns.Add("STATUS"); foreach (GridViewRow rows in gvVslVtngStng.Rows) { DataRow dr = dtSave.NewRow(); int vslId = UDFLib.ConvertToInteger(((Label)rows.FindControl("lblVesselId")).Text); dr["VID"] = vslId; CheckBoxList chkList = (CheckBoxList)rows.FindControl("chkVTType"); for (int i = 0; i < chkList.Items.Count; i++) { dr = dtSave.NewRow(); dr["VID"] = vslId; dr["VTID"] = UDFLib.ConvertToInteger(chkList.Items[i].Value); if (chkList.Items[i].Selected) { dr["STATUS"] = 1; } else { dr["STATUS"] = 0; } dtSave.Rows.Add(dr); } } objBLvtst.VET_INS_VslStng(dtSave, Convert.ToInt32(Session["USERID"])); string js1 = "alert('Settings saved successfully.');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", js1, true); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind Inspector list /// </summary> public void VET_Get_InspectorListObs() { try { BLL_VET_VettingLib objBLLVetLib = new BLL_VET_VettingLib(); DataTable dt = objBLLVetLib.VET_Get_InspectorList(); DDLInspectorObs.DataSource = dt; DDLInspectorObs.DataTextField = "NAME"; DDLInspectorObs.DataValueField = "UserID"; DDLInspectorObs.DataBind(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind oil major list /// </summary> public void VET_Get_OilMajorList() { try { BLL_VET_VettingLib objBLLVetLib = new BLL_VET_VettingLib(); DataTable dtOilMajorNames = objBLLVetLib.VET_Get_OilMajorList(); DDLOilMajor.DataSource = dtOilMajorNames; DDLOilMajor.DataTextField = "Display_Name"; DDLOilMajor.DataValueField = "ID"; DDLOilMajor.DataBind(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// To display Vetting Type /// </summary> public void VET_Get_VettingTypeList() { try { BLL_VET_VettingLib objBLLVetLib = new BLL_VET_VettingLib(); DataTable dtVetType = objBLLVetLib.VET_Get_VettingTypeList(); DDLVetType.DataSource = dtVetType; DDLVetType.DataTextField = "Vetting_Type_Name"; DDLVetType.DataValueField = "Vetting_Type_ID"; DDLVetType.DataBind(); DDLVetType.Items.Insert(0, new ListItem("-Select-", "0")); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Bind Vetting Setting Grid /// </summary> public void BindGrid() { try { BLL_VET_VettingLib objBLvtst = new BLL_VET_VettingLib(); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = new DataSet(); ds = objBLvtst.VET_Get_VettingSetting(txtfilter.Text.Trim() != "" ? txtfilter.Text.Trim() : null, sortbycoloumn, sortdirection , ref Result); ViewState["Vessel"] = ds.Tables[0]; ViewState["dtAllVetType"] = ds.Tables[1]; ViewState["dtAppVetType"] = ds.Tables[2]; gvVslVtngStng.DataSource = ds.Tables[0]; gvVslVtngStng.DataBind(); if (ds.Tables[0].Rows.Count > 0) { ImgExpExcel.Enabled = true; btnSave.Enabled = true; } else { ImgExpExcel.Enabled = false; btnSave.Enabled = false; } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true); } }
/// <summary> /// Method is used to bind vetting type dropdown /// </summary> public void FillVettingTypeDropdown(int VesselID) { try { DataTable dtVettingType = new DataTable(); BLL_VET_VettingLib objVett = new BLL_VET_VettingLib(); if (VettingMode == "PV") { dtVettingType = objVett.VET_Get_VettingTypeList(); } else { dtVettingType = objVett.VET_Get_VettingType_BySetting(VesselID); } ViewState["VettingType"] = dtVettingType; uplCreateVetting.Update(); ddlType.Items.Clear(); if (dtVettingType.Rows.Count > 0) { ddlType.Items.Clear(); ddlType.DataSource = dtVettingType; ddlType.DataTextField = "Vetting_Type_Name"; ddlType.DataValueField = "Vetting_Type_ID"; ddlType.DataBind(); ddlType.Items.Insert(0, new ListItem("-SELECT-", "0")); } else { ddlType.Items.Clear(); ddlType.DataSource = null; ddlType.DataBind(); ddlType.Items.Insert(0, new ListItem("-SELECT-", "0")); } } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void ImgExpExcel_Click(object sender, EventArgs e) { try { BLL_VET_VettingLib objBLvtst = new BLL_VET_VettingLib(); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = new DataSet(); DataTable dtVessel = objBLvtst.VET_Get_VettingSetting(txtfilter.Text.Trim() != "" ? txtfilter.Text.Trim() : null, sortbycoloumn, sortdirection, ref Result).Tables[0]; DataTable dtAlltypes = (DataTable)ViewState["dtAllVetType"]; //Getting vetting types from viewstate DataTable dtExport = new DataTable(); //This DataTable is finally exporting dtExport.Columns.Add("Vesel Id"); dtExport.Columns.Add("Vessel Name"); for (int i = 0; i < dtAlltypes.Rows.Count; i++) { dtExport.Columns.Add(dtAlltypes.Rows[i][1].ToString()); //this will add all types as header in our export datatable } for (int i = 0; i < dtVessel.Rows.Count; i++) // This will add all vessels,id and vessel name in export datatable { DataRow dr = dtExport.NewRow(); dr[0] = dtVessel.Rows[i][0]; dr[1] = dtVessel.Rows[i][1]; dtExport.Rows.Add(dr); } for (int i = 0; i < dtExport.Rows.Count; i++) { for (int k = 2; k < dtExport.Columns.Count; k++) { int vessel_id = UDFLib.ConvertToInteger(dtExport.Rows[i][0]); DataTable dtCheckType = new DataTable(); dtCheckType = objBLvtst.GetSettingTypeByVessel(null, vessel_id); //This will get all types and active status of particular vessel if (dtCheckType != null && dtCheckType.Rows.Count > 0) { for (int j = 0; j < dtCheckType.Rows.Count; j++) { if (dtExport.Columns[j + 2].ToString() == dtCheckType.Rows[j][1].ToString() && dtCheckType.Rows[j][3].ToString() == "1") //dtExport.Columns[j + 2] will give type and comparing with checktype's type and active status { dtExport.Rows[i][j + 2] = "Yes"; } else { dtExport.Rows[i][j + 2] = "No"; } } } } } dtExport.Columns.Remove("Vesel Id"); // we dont want this column anymore . string[] columnNames; //to use export functionalites we need to supply coulmn name array columnNames = dtExport.Columns.Cast <DataColumn>() .Select(x => x.ColumnName) .ToArray(); GridViewExportUtil.ShowExcel(dtExport, columnNames, columnNames, "VettingSetting" + "_" + DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss"), "Vetting Setting", ""); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }