/// <summary> /// Date Created: 26/June/2015 /// Created By: Josephine monteza /// (description) Get Seafarer list /// --------------------------------------------- /// </summary> private void BindSeafarer() { List <SeafarerListDTO> list = new List <SeafarerListDTO>(); if (uoDropDownListReportBy.SelectedValue == "1" || uoDropDownListReportBy.SelectedValue == "2") { list = SeafarerBLL.GetSeafarerListByFilter(uoDropDownListReportBy.SelectedValue, uoTextBoxSearch.Text.Trim()); } uoDropDownListFilter.Items.Clear(); uoDropDownListFilter.DataSource = list; uoDropDownListFilter.DataTextField = "Name"; uoDropDownListFilter.DataValueField = "SFID"; uoDropDownListFilter.DataBind(); ListItem item = new ListItem("--SELECT SEAFARER--", "0"); uoDropDownListFilter.Items.Insert(0, item); if (list.Count == 1) { uoDropDownListFilter.SelectedValue = list[0].SFID; } else { uoDropDownListFilter.SelectedValue = "0"; } }
//protected void uoDropDownListAirport_SelectedIndexChanged(object sender, EventArgs e) //{ // GetHotelBranch(); //} #endregion #region "Procedures" #region "Binding Objects" /// <summary> /// Date Created: 04/10/2011 /// Created By: Josephine Gad /// (description) Get Seafarer list /// --------------------------------------------- /// Date Modified: 17/12/2012 /// Modified By: Josephine Gad /// (description) Change Datatable to List /// --------------------------------------------- /// </summary> private void GetSeafarer() { List <SeafarerListDTO> list = null; try { list = SeafarerBLL.GetSeafarerListByFilter(uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim()); ListItem item = new ListItem("--SELECT SEAFARER--", "0"); uoDropDownListSeafarer.Items.Clear(); uoDropDownListSeafarer.Items.Add(item); var listSeafarer = (from a in list select new { Name = a.Name, SFID = a.SFID }).ToList(); uoDropDownListSeafarer.DataSource = listSeafarer; uoDropDownListSeafarer.DataTextField = "Name"; uoDropDownListSeafarer.DataValueField = "SFID"; uoDropDownListSeafarer.DataBind(); if (listSeafarer.Count == 1) { uoDropDownListSeafarer.SelectedIndex = 1; } else { ClearSeafererDetails(); if (GlobalCode.Field2String(Request.QueryString["sfId"]) != "") { uoDropDownListSeafarer.SelectedValue = GlobalCode.Field2String(Request.QueryString["sfId"]); GetSeafarerDetails(uoDropDownListSeafarer.SelectedValue); } } } catch (Exception ex) { throw ex; } finally { if (list != null) { list = null; } } //DataTable dt = null; //try //{ // dt = SeafarerBLL.GetSeafarerByFilter(uoDropDownListFilterBy.SelectedValue, uoTextBoxFilter.Text.Trim()); // ListItem item = new ListItem("--SELECT SEAFARER--", "0"); // uoDropDownListSeafarer.Items.Clear(); // uoDropDownListSeafarer.Items.Add(item); // uoDropDownListSeafarer.DataSource = dt; // uoDropDownListSeafarer.DataTextField = "Name"; // uoDropDownListSeafarer.DataValueField = "SFID"; // uoDropDownListSeafarer.DataBind(); // if (dt.Rows.Count == 1) // { // uoDropDownListSeafarer.SelectedIndex = 1; // GetSeafarerDetails(uoDropDownListSeafarer.SelectedValue); // } // else // { // ClearSeafererDetails(); // } //} //catch (Exception ex) //{ // throw ex; //} //finally //{ // if (dt != null) // { // dt.Dispose(); // } //} }