コード例 #1
0
ファイル: WebForm1.aspx.cs プロジェクト: mkejeiri/WCF
        protected void btnGetEmployee_Click(object sender, EventArgs e)
        {
            EmployeeServiceRef.EmployeeServiceClient client = new EmployeeServiceRef.EmployeeServiceClient();
            EmployeeServiceRef.Employee employee            = client.GetEmployee(Convert.ToInt32(txtID.Text));
            txtName.Text        = employee.Name;
            txtGender.Text      = employee.Gender;
            txtDateOfBirth.Text = employee.DateOfBirth.ToShortDateString();

            if (employee.Type == EmployeeServiceRef.EmployeeType.FullTimeEmployee)
            {
                txtAnnualSalary.Text   = ((EmployeeServiceRef.FullTimeEmployee)employee).AnnualSalary.ToString();
                trAnnualSalary.Visible = true;
                trHourlPay.Visible     = false;
                trHoursWorked.Visible  = false;
            }
            else
            {
                txtHourlyPay.Text   = ((EmployeeServiceRef.PartTimeEmployee)employee).HourlyPay.ToString();
                txtHoursWorked.Text =
                    ((EmployeeServiceRef.PartTimeEmployee)employee).HoursWorked.ToString();
                trAnnualSalary.Visible = false;
                trHourlPay.Visible     = true;
                trHoursWorked.Visible  = true;
            }
            ddlEmployeeType.SelectedValue = ((int)employee.Type).ToString();

            lblMessage.Text = "Employee retrieved";
        }
コード例 #2
0
ファイル: WebForm1.aspx.cs プロジェクト: mkejeiri/WCF
        protected void btnGetEmployee_Click(object sender, EventArgs e)
        {
            EmployeeServiceRef.EmployeeServiceClient client = new EmployeeServiceRef.EmployeeServiceClient();
            EmployeeServiceRef.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";
        }