Example #1
0
        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();
            }
        }
Example #2
0
 /// <summary>
 /// provide a datasource for customer dropdownlist
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!this.IsPostBack)
         {
             this._presenter.OnViewInitialized();
             ViewState[FirstNewRowVS]   = null;
             ViewState[OrderIdVS]       = null;
             DdlCustomer.DataSource     = _presenter.GetAllCustomers();
             DdlCustomer.DataTextField  = CustomerNameField;
             DdlCustomer.DataValueField = CustomerIdField;
             DdlCustomer.DataBind();
         }
         this._presenter.OnViewLoaded();
     }
     catch (Exception ex)
     {
         this.ShowErrorMessage(ex);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ConfigurationManager.AppSettings["access"].ToString() != ConfigurationManager.AppSettings["accessok"].ToString())
        {
            string page = Request.Url.Segments[Request.Url.Segments.Length - 1].ToString();
            if (Session["Role"] != null)
            {
                if (!Other.Get_UserAccess(page, Session["Role"].ToString()))
                {
                    Response.Redirect("dashboard.aspx");
                }
            }
        }
        EmpCode = Convert.ToString(Session["UserName"]);
        DataSet ds = new DataSet();

        ds = Customer_cs.GetSchool_Names(EmpCode);
        DdlCustomer.DataSource = ds;
        DdlCustomer.DataBind();
        DdlCustomer.Items.Insert(0, new ListItem("-Select-", "0"));
    }
        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();
            }
        }