protected void BindProduct() { ddlProduct.Items.Clear(); if (ddlProduct.SelectedIndex == 0) { return; } DataTable dtProd = boCommon.GetProductList(); if (dtProd == null) { return; } if (dtProd.Rows.Count > 0) { ddlProduct.DataSource = dtProd; ddlProduct.DataValueField = dtProd.Columns["PAG_AssetGroupCode"].ToString(); ddlProduct.DataTextField = dtProd.Columns["PAG_AssetGroupName"].ToString(); ddlProduct.DataBind(); } ddlProduct.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--SELECT--", "0")); ddlProduct.SelectedIndex = 0; ddlProduct.SelectedIndex = 14; ddlProduct.Enabled = false; }
//<summary> // Gets the personal settings. //</summary> //<param name="personalSettingsRequest"> The personal settings request. </param> //<returns> Personal Settings Response. </returns> #endregion #region IWerpCommonLookupContract Members //<summary> // Gets the list of Products //</summary> //<param name="ProductRequest"> The personal settings request. </param> //<returns> ProductAmcLookupResponse </returns> ProductLookupResponse IWerpCommonLookupContract.GetProductList(ProductLookupRequest ProductRequest) { ProductLookupResponse response = new ProductLookupResponse(); try { DataTable dtProductList; if (string.IsNullOrEmpty(ProductRequest.ProductCode)) { dtProductList = BoCommonLookup.GetProductList(); } else { dtProductList = BoCommonLookup.GetProductList(ProductRequest.ProductCode.Trim()); } foreach (DataRow row in dtProductList.Rows) { response.ProductListResponse.ProductList.Add(new KeyValuePair <string, string>(row["PAG_AssetGroupCode"].ToString(), row["PAG_AssetGroupName"].ToString())); } response.SetServiceResult(true, WerpErrorDto.E_SUCCESS, null); } catch (FormatException ex) { response.SetServiceResult(false, WerpErrorDto.E_INVALID_INPUT, ex.Message); } catch (DataException ex) { response.SetServiceResult(false, WerpErrorDto.E_DATABASE, ex.Message); } catch (Exception ex) { response.SetServiceResult(false, WerpErrorDto.E_GENERIC, ex.Message); } finally { } return(response); }