/// <summary> /// Date Created: 04/10/2011 /// Created By: Josephine Gad /// (description) Get Vessel list /// --------------------------------------------- /// Date Modified: 14/02/2011 /// Modified By: Josephine Gad /// (description) Use class VesselDTOList.VesselList instead of calling function VesselBLL.GetVessel again /// --------------------------------------------- /// </summary> /// <param name="vesselID"></param> private void GetVessel(string vesselID) { List <VesselDTO> vesselList = null; try { //VesselDTOList.VesselList uoDropDownListVessel.Items.Clear(); uoDropDownListVessel.Items.Add(new ListItem("--SELECT SHIP--", "0")); if (VesselDTOList.VesselList != null) { vesselList = VesselDTOList.VesselList; } else { vesselList = VesselBLL.GetVesselList(GlobalCode.Field2String(Session["UserName"]), uoTextBoxDate.Text, uoTextBoxDate.Text, "0", "0", "0", "0", uoHiddenFieldRole.Value, false); } var listVessel = (from a in vesselList select new { VesselName = a.VesselNameString, VesselID = a.VesselIDString } ).ToList(); uoDropDownListVessel.DataSource = listVessel; uoDropDownListVessel.DataTextField = "VesselName"; uoDropDownListVessel.DataValueField = "VesselID"; uoDropDownListVessel.DataBind(); uoDropDownListVessel.SelectedValue = vesselID; } catch (Exception ex) { throw ex; } finally { if (vesselList != null) { vesselList = null; } } }
/// <summary> /// Date Created: 30/09/2011 /// Created By: Josephine Gad /// (description) Get vessel list /// --------------------------------------------------------------------------- /// </summary> private void GetVessel() { //DataTable VesselDataTable = null; List <VesselDTO> vesselList = null; try { string sDateTo = GlobalCode.Field2String(Session["DateTo"]); if (sDateTo == "") { sDateTo = GlobalCode.Field2DateTime(uoHiddenFieldDate.Value).AddDays(double.Parse(uoHiddenFieldDateRange.Value)).ToString("MM/dd/yyyy"); } vesselList = VesselBLL.GetVesselList(uoHiddenFieldUser.Value, uoHiddenFieldDate.Value, sDateTo, GlobalCode.Field2String(Session["Region"]), GlobalCode.Field2String(Session["Country"]), GlobalCode.Field2String(Session["City"]), GlobalCode.Field2String(Session["Port"]), uoHiddenFieldRole.Value, false); uoDropDownListVessel.Items.Clear(); ListItem item = new ListItem("--Select Ship--", "0"); uoDropDownListVessel.Items.Add(item); var listVessel = (from a in vesselList select new { VesselName = a.VesselNameString, VesselID = a.VesselIDString }).ToList(); uoDropDownListVessel.DataSource = listVessel; uoDropDownListVessel.DataTextField = "VesselName"; uoDropDownListVessel.DataValueField = "VesselID"; uoDropDownListVessel.DataBind(); } catch (Exception ex) { throw ex; } finally { if (vesselList != null) { vesselList = null; } } }