/// <summary> /// Method Name:BindData /// Description:Fill the Data in Dropdownlist from Database table /// Author:Bhumi /// Created On:10/7/2015 /// </summary> public void BindData() { try { strBrSelectQuery = new StringBuilder("SELECT Name "); strBrSelectQuery.Append(" FROM EmployeeDetail"); objfunction = new CommonFunction(); DdlEmployee.DataSource = objfunction.ConnectionGenerate(strBrSelectQuery.ToString()); DdlEmployee.DataValueField = "Name"; DdlEmployee.DataTextField = "Name"; DdlEmployee.DataBind(); Cache.Insert("EmployeeName", objfunction.ConnectionGenerate(strBrSelectQuery.ToString()), null, DateTime.Now.AddSeconds(15), System.Web.Caching.Cache.NoSlidingExpiration); } catch (Exception) { objconst = new ConstantMessages(); Response.Redirect(objconst.strErrorPage, false); } finally { strBrSelectQuery = null; objfunction = null; } }
/// <summary> /// Method Name:BindData /// Description:Fill the Data in Dropdownlist from Database table /// Author:Bhumi /// Created On:10/7/2015 /// </summary> public void BindData() { try { if (Cache["EmployeeName"] == null) { LblCacheStatus.Visible = true; } else { DdlEmployee.DataSource = Cache["EmployeeName"]; DdlEmployee.DataValueField = "Name"; DdlEmployee.DataTextField = "Name"; DdlEmployee.DataBind(); } } catch (Exception) { objconst = new ConstantMessages(); Response.Redirect(objconst.strErrorPage, false); } finally { strBrSelectQuery = null; objfunction = null; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); IList <WattsALoanServiceReference.Employee> employees = client.GetEmployees(); DataTable employeeTable = new DataTable(); employeeTable.Columns.Add(new DataColumn("EmployeeNameField", typeof(string))); employeeTable.Columns.Add(new DataColumn("EmployeeIDField", typeof(int))); foreach (WattsALoanServiceReference.Employee employee in employees) { employeeTable.Rows.Add(CreateDataRow(employee.FirstName + " " + employee.LastName, employee.EmployeeID, employeeTable)); } DdlEmployee.DataSource = employeeTable; DdlEmployee.DataTextField = "EmployeeNameField"; DdlEmployee.DataValueField = "EmployeeIDField"; DdlEmployee.DataBind(); IList <WattsALoanServiceReference.Customer> customers = client.GetCustomers(); DataTable customerTable = new DataTable(); customerTable.Columns.Add(new DataColumn("CustomerNameField", typeof(string))); customerTable.Columns.Add(new DataColumn("CustomerIDField", typeof(int))); foreach (WattsALoanServiceReference.Customer customer in customers) { customerTable.Rows.Add(CreateDataRow(customer.FullName, customer.CustomerID, customerTable)); } DdlCustomer.DataSource = customerTable; DdlCustomer.DataTextField = "CustomerNameField"; DdlCustomer.DataValueField = "CustomerIDField"; DdlCustomer.DataBind(); IList <WattsALoanServiceReference.LoanType> loanTypes = client.GetLoanTypes(); DataTable loanTypeTable = new DataTable(); loanTypeTable.Columns.Add(new DataColumn("LoanTypeNameField", typeof(string))); loanTypeTable.Columns.Add(new DataColumn("LoanTypeIDField", typeof(int))); foreach (WattsALoanServiceReference.LoanType loanType in loanTypes) { loanTypeTable.Rows.Add(CreateDataRow(loanType.LoanTypeName, loanType.LoanTypeID, loanTypeTable)); } DdlLoanType.DataSource = loanTypeTable; DdlLoanType.DataTextField = "LoanTypeNameField"; DdlLoanType.DataValueField = "LoanTypeIDField"; DdlLoanType.DataBind(); client.Close(); } }
public void BindData() { try { if (Cache["EmployeeName"] == null) { LblCacheStatus.Visible = true; } else { DdlEmployee.DataSource = Cache["EmployeeName"]; DdlEmployee.DataValueField = "FirstName"; DdlEmployee.DataTextField = "FirstName"; DdlEmployee.DataBind(); } } catch (Exception) { mess = new ConstantMessages(); // Response.Redirect(mess.strErrorPage, false); } }
/// <summary> /// Method Name:BindData /// Description:Fill the Data in Dropdownlist from Database table /// Author:Bhumi /// Created On:10/7/2015 /// </summary> public void BindData() { try { strBrSelectQuery = new StringBuilder("SELECT Name "); strBrSelectQuery.Append(" FROM EmployeeDetail"); objfunction = new CommonFunction(); DdlEmployee.DataSource = objfunction.ConnectionGenerate(strBrSelectQuery.ToString()); DdlEmployee.DataValueField = "Name"; DdlEmployee.DataTextField = "Name"; DdlEmployee.DataBind(); } catch (Exception) { objconst = new ConstantMessages(); Response.Redirect(objconst.strErrorPage, false); } finally { strBrSelectQuery = null; objfunction = null; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); IList <WattsALoanServiceReference.Employee> employees = client.GetEmployees(); DataTable employeeTable = new DataTable(); employeeTable.Columns.Add(new DataColumn("EmployeeNameField", typeof(string))); employeeTable.Columns.Add(new DataColumn("EmployeeIDField", typeof(int))); foreach (WattsALoanServiceReference.Employee employee in employees) { employeeTable.Rows.Add(CreateDataRow(employee.FirstName + " " + employee.LastName, employee.EmployeeID, employeeTable)); } DdlEmployee.DataSource = employeeTable; DdlEmployee.DataTextField = "EmployeeNameField"; DdlEmployee.DataValueField = "EmployeeIDField"; DdlEmployee.DataBind(); IList <WattsALoanServiceReference.Customer> customers = client.GetCustomers(); DataTable customerTable = new DataTable(); customerTable.Columns.Add(new DataColumn("CustomerNameField", typeof(string))); customerTable.Columns.Add(new DataColumn("CustomerIDField", typeof(int))); foreach (WattsALoanServiceReference.Customer customer in customers) { customerTable.Rows.Add(CreateDataRow(customer.FullName, customer.CustomerID, customerTable)); } DdlCustomer.DataSource = customerTable; DdlCustomer.DataTextField = "CustomerNameField"; DdlCustomer.DataValueField = "CustomerIDField"; DdlCustomer.DataBind(); if (loanTypeNames == null) { LoadTypeNames_Init(); } IList <WattsALoanServiceReference.LoanAllocation> loanAllocations = client.GetLoanAllocations(int.Parse(DdlCustomer.SelectedValue)); DataTable allocationTable = new DataTable(); allocationTable.Columns.Add(new DataColumn("LoanAllocationNameField", typeof(string))); allocationTable.Columns.Add(new DataColumn("LoanAllocationIDField", typeof(int))); foreach (WattsALoanServiceReference.LoanAllocation loanAllocation in loanAllocations) { allocationTable.Rows.Add(CreateDataRow(loanTypeNames[loanAllocation.LoanTypeID] + " Amount:" + loanAllocation.LoanAmount + " Rate:" + loanAllocation.InterestRate + " Periods:" + loanAllocation.Periods, loanAllocation.LoanAllocationID, allocationTable)); } DdlLoanAllocation.DataSource = allocationTable; DdlLoanAllocation.DataTextField = "LoanAllocationNameField"; DdlLoanAllocation.DataValueField = "LoanAllocationIDField"; DdlLoanAllocation.DataBind(); client.Close(); } }