コード例 #1
0
        protected void btnSaveEmployeeContract_Click(object sender, EventArgs e)
        {
            EmployeeService.IEmployeeService client = new
                                                      EmployeeService.EmployeeServiceClient();
            EmployeeService.EmployeeInfo employeeInfo = new EmployeeService.EmployeeInfo();

            if (ddlEmployeeType.SelectedValue == "-1")
            {
                lblMessage.Text = "Please select Employee Type";
            }
            else
            {
                if (((EmployeeService.EmployeeType)Convert.ToInt32(ddlEmployeeType.SelectedValue))
                    == EmployeeService.EmployeeType.FullTime)
                {
                    employeeInfo.AnnualSalary = Convert.ToInt32(txtAnnualSalary.Text);
                    employeeInfo.Type         = EmployeeService.EmployeeType.FullTime;
                }
                else if (((EmployeeService.EmployeeType)Convert.ToInt32(ddlEmployeeType.SelectedValue))
                         == EmployeeService.EmployeeType.PartTime)
                {
                    employeeInfo.HourlyPay   = Convert.ToInt32(txtHourlyPay.Text);
                    employeeInfo.HoursWorked = Convert.ToInt32(txtHoursWorked.Text);
                    employeeInfo.Type        = EmployeeService.EmployeeType.PartTime;
                }

                employeeInfo.ID     = Convert.ToInt32(txtID.Text);
                employeeInfo.Name   = txtName.Text;
                employeeInfo.Gender = txtGender.Text;
                employeeInfo.DOB    = Convert.ToDateTime(txtDateOfBirth.Text);

                client.SaveEmployeeMessageContract(employeeInfo);
                lblMessage.Text = "Employee saved";
            }
        }
コード例 #2
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";
        }
コード例 #3
0
        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";
        }
コード例 #4
0
        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";
        }
コード例 #5
0
        protected void btnSaveEmployee_Click(object sender, EventArgs e)
        {
            EmployeeService.Employee employee = new EmployeeService.Employee();
            employee.ID          = Convert.ToInt32(txtId.Text);
            employee.Name        = txtName.Text;
            employee.Gender      = txtGender.Text;
            employee.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text);

            EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient();
            client.SaveEmployee(employee);

            lblMessage.Text = "Employee saved";
        }
コード例 #6
0
        protected void btnSaveEmployee_Click(object sender, EventArgs e)
        {
            if (DropDownList1.SelectedValue == "-1")
            {
                lblMessage.Text = "Please select Employee Type";
            }
            else
            {
                EmployeeService.EmployeeServiceClient client = new
                                                               EmployeeService.EmployeeServiceClient();
                EmployeeService.Employee employee = null;


                if (((EmployeeService.EmployeeType)Convert.ToInt32(DropDownList1.SelectedValue))
                    == EmployeeService.EmployeeType.FullTimeEmployee)
                {
                    employee = new EmployeeService.FullTimeEmployee
                    {
                        Type          = EmployeeService.EmployeeType.FullTimeEmployee,
                        MonthlySalary = Convert.ToInt32(txtMonthlySalary.Text)
                    };
                }
                else if (((EmployeeService.EmployeeType)Convert.ToInt32(DropDownList1.SelectedValue))
                         == EmployeeService.EmployeeType.PartTimeEmployee)
                {
                    employee = new EmployeeService.PartTimeEmployee
                    {
                        Type        = EmployeeService.EmployeeType.PartTimeEmployee,
                        HourlyPay   = Convert.ToInt32(txtHourlyPay.Text),
                        HoursWorked = Convert.ToInt32(txtHoursWorked.Text)
                    };
                }
                employee.ID          = Convert.ToInt32(txtId.Text);
                employee.Name        = txtName.Text;
                employee.Gender      = txtGender.Text;
                employee.DateOfBirth = Convert.ToDateTime(txtDateOfBirth.Text);


                client.SaveEmployee(employee);

                lblMessage.Text = "Employee saved";
            }
        }