Example #1
0
        protected void btnGetEmployee_Click(object sender, EventArgs e)
        {
            EmployeeService.IEmployeeService client = new
                                                      EmployeeService.EmployeeServiceClient();

            EmployeeService.EmployeeRequest request = new EmployeeService.EmployeeRequest();
            request.LicenseKey = "SuperSecret123!!";
            request.EmployeeId = Convert.ToInt32(txtId.Text);


            EmployeeService.EmployeeInfo employee = client.GetEmployee(request);

            txtName.Text                = employee.Name;
            txtGender.Text              = employee.Gender;
            txtDateOfBirth.Text         = employee.DoB.ToShortDateString();
            DropDownList1.SelectedValue = ((int)employee.Type).ToString();
            if (employee.Type == EmployeeService.EmployeeType.FullTimeEmployee)
            {
                txtMonthlySalary.Text   = employee.MonthlySalary.ToString();
                trMonthlySalary.Visible = true;
                trHourlyPay.Visible     = false;
                trHoursWorked.Visible   = false;
            }
            else
            {
                txtHourlyPay.Text       = employee.HourlyPay.ToString();
                txtHoursWorked.Text     = employee.HoursWorked.ToString();
                trMonthlySalary.Visible = false;
                trHourlyPay.Visible     = true;
                trHoursWorked.Visible   = true;
            }

            lblMessage.Text = "Employee retrieved";
        }
        protected void btnGetEmployee_Click(object sender, EventArgs e)
        {
            EmployeeService.EmployeeServiceClient client = new
                                                           EmployeeService.EmployeeServiceClient();

            EmployeeService.Employee employee = client.GetEmployee(Convert.ToInt32(txtId.Text));
            txtName.Text                = employee.Name;
            txtGender.Text              = employee.Gender;
            txtDateOfBirth.Text         = employee.DateOfBirth.ToShortDateString();
            DropDownList1.SelectedValue = ((int)employee.Type).ToString();
            if (employee.Type == EmployeeService.EmployeeType.FullTimeEmployee)
            {
                txtMonthlySalary.Text   = ((EmployeeService.FullTimeEmployee)employee).MonthlySalary.ToString();
                trMonthlySalary.Visible = true;
                trHourlyPay.Visible     = false;
                trHoursWorked.Visible   = false;
            }
            else
            {
                txtHourlyPay.Text       = ((EmployeeService.PartTimeEmployee)employee).HourlyPay.ToString();
                txtHoursWorked.Text     = ((EmployeeService.PartTimeEmployee)employee).HoursWorked.ToString();
                trMonthlySalary.Visible = false;
                trHourlyPay.Visible     = true;
                trHoursWorked.Visible   = true;
            }

            lblMessage.Text = "Employee retrieved";
        }
        protected void btnGetEmployee_Click(object sender, EventArgs e)
        {
            EmployeeService.EmployeeServiceClient client = new
                                                           EmployeeService.EmployeeServiceClient();
            EmployeeService.Employee employee = client.GetEmployee(Convert.ToInt32(txtId.Text));
            txtName.Text        = employee.Name;
            txtGender.Text      = employee.Gender;
            txtDateOfBirth.Text = employee.DateOfBirth.ToShortDateString();

            lblMessage.Text = "Employee retrieved";
        }