protected void ButtonSubmit_Click(object sender, EventArgs e) { WattsALoanServiceReference.Employee employee = new WattsALoanServiceReference.Employee(); employee.EmployeeID = int.Parse(TbxEmployeeID.Text); employee.EmployeeNumber = TbxEmployeeNumber.Text; employee.FirstName = TbxFirstName.Text; employee.LastName = TbxLastName.Text; employee.Titles = TbxTitles.Text; employee.HourlySalary = float.Parse(TbxHourlySalary.Text); WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); bool result = client.UpdateEmployee(employee); client.Close(); string script = @"alert(""Edit employee " + TbxEmployeeNumber.Text; if (result) { script += @" success."");"; } else { script += @" failed."");"; } ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { WattsALoanServiceReference.Customer customer = new WattsALoanServiceReference.Customer(); customer.CustomerID = int.Parse(TbxCustomerID.Text); customer.DateCreated = DateTime.Now; customer.FullName = TbxFullName.Text; customer.BillingAddress = TbxAddress.Text; customer.BillingCity = TbxCity.Text; customer.BillingState = TbxState.Text; customer.BillingZIPCide = TbxZipCide.Text; customer.EmailAddress = TbxEmail.Text; WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); bool result = client.UpdateCustomer(customer); client.Close(); string script = @"alert(""Edit customer " + TbxFullName.Text; if (result) { script += @" success."");"; } else { script += @" failed."");"; } ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { WattsALoanServiceReference.Payment payment = new WattsALoanServiceReference.Payment(); payment.PaymentDate = DateTime.Now; payment.EmployeeID = int.Parse(DdlEmployee.SelectedValue); payment.LoanAllocationID = int.Parse(DdlLoanAllocation.SelectedValue); payment.PaymentAmount = double.Parse(TbxPaymentAmount.Text); WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); bool result = client.RecordPayment(payment); client.Close(); string script = @"alert(""Record payment " + DdlEmployee.SelectedItem.Text + " " + DdlLoanAllocation.SelectedItem.Text; if (result) { script += @" success."");"; DdlEmployee.SelectedIndex = 0; DdlCustomer.SelectedIndex = 0; TbxPaymentAmount.Text = ""; } else { script += @" failed."");"; } ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); }
protected void DdlCustomer_SelectedIndexChanged(object sender, EventArgs e) { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); 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(); }
public IList <WattsALoanServiceReference.Customer> GetCustomers() { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); IList <WattsALoanServiceReference.Customer> customers = client.GetCustomers(); client.Close(); return(customers); }
public IList <WattsALoanServiceReference.Employee> GetEmployees() { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); IList <WattsALoanServiceReference.Employee> employees = client.GetEmployees(); client.Close(); return(employees); }
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(); } }
protected void LoadTypeNames_Init() { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); IList <WattsALoanServiceReference.LoanType> types = client.GetLoanTypes(); loanTypeNames = new Dictionary <int, string>(); foreach (WattsALoanServiceReference.LoanType type in types) { loanTypeNames.Add(type.LoanTypeID, type.LoanTypeName); } client.Close(); }
protected void ListView_ItemCommand(object sender, ListViewCommandEventArgs e) { if (e.CommandName == "Remove") { e.Item.Visible = false; WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); client.DeleteEmployee(int.Parse(e.CommandArgument.ToString())); client.Close(); } else if (e.CommandName == "Edit") { string url = "~/Employee/Edit?id=" + e.CommandArgument; Response.Redirect(url); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); WattsALoanServiceReference.Employee employee = client.GetEmployee(int.Parse(Request.QueryString["id"])); client.Close(); TbxEmployeeID.Text = employee.EmployeeID.ToString(); TbxEmployeeNumber.Text = employee.EmployeeNumber; TbxFirstName.Text = employee.FirstName; TbxLastName.Text = employee.LastName; TbxTitles.Text = employee.Titles; TbxHourlySalary.Text = employee.HourlySalary.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); WattsALoanServiceReference.Customer customer = client.GetCustomer(int.Parse(Request.QueryString["id"])); client.Close(); TbxCustomerID.Text = customer.CustomerID.ToString(); TbxFullName.Text = customer.FullName; TbxAddress.Text = customer.BillingAddress; TbxCity.Text = customer.BillingCity; TbxState.Text = customer.BillingState; TbxZipCide.Text = customer.BillingZIPCide; TbxEmail.Text = customer.EmailAddress; } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { WattsALoanServiceReference.LoanType loanType = new WattsALoanServiceReference.LoanType(); loanType.LoanTypeName = TbxLoanType.Text; WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); bool result = client.InsertLoanType(loanType); client.Close(); string script = @"alert(""Add loan type " + TbxLoanType.Text; if (result) { script += @" success."");"; TbxLoanType.Text = ""; } else { script += @" failed."");"; } ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); }
protected void ButtonSubmit_Click(object sender, EventArgs e) { WattsALoanServiceReference.LoanAllocation loanAllocation = new WattsALoanServiceReference.LoanAllocation(); loanAllocation.DatePrepared = DateTime.Now; loanAllocation.EmployeeID = int.Parse(DdlEmployee.SelectedValue); loanAllocation.CustomerID = int.Parse(DdlCustomer.SelectedValue); loanAllocation.AccountNumber = TbxAccountNumber.Text; loanAllocation.LoanTypeID = int.Parse(DdlLoanType.SelectedValue); loanAllocation.LoanAmount = double.Parse(TbxLoanAmount.Text); loanAllocation.InterestRate = double.Parse(TbxInterestRate.Text); loanAllocation.Periods = double.Parse(TbxPeriods.Text); WattsALoanServiceReference.WattsALoanServiceClient client = new WattsALoanServiceReference.WattsALoanServiceClient(); bool result = client.InsertLoanAllocation(loanAllocation); client.Close(); string script = @"alert(""Add customer " + DdlEmployee.SelectedItem.Text + " " + DdlLoanType.SelectedItem.Text + " loan allocation"; if (result) { script += @" success."");"; DdlEmployee.SelectedIndex = 0; DdlCustomer.SelectedIndex = 0; TbxAccountNumber.Text = ""; DdlLoanType.SelectedIndex = 0; TbxLoanAmount.Text = ""; TbxInterestRate.Text = ""; TbxPeriods.Text = ""; } else { script += @" failed."");"; } ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true); }
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(); } }