示例#1
0
        private void btnDeleteEmployee_Click(object sender, EventArgs e)
        {
            if (txtEmployeeId.Text != string.Empty)
            {
                EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient();
                int employeeIdToDelete = Convert.ToInt32(txtEmployeeId.Text);

                if (employeeIdToDelete > 0)
                {
                    client.DeleteEmployee(employeeIdToDelete);
                    MessageBox.Show("Employee Deleted...");
                }
            }
        }
示例#2
0
        private void btnGetEmployee_Click(object sender, EventArgs e)
        {
            EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient();
            Employee emp = client.GetEmployeeById(Convert.ToInt32(txtEmployeeId.Text));

            if (emp != null)
            {
                txtEmployeeName.Text            = emp.EmployeeName;
                txtDesignation.Text             = emp.Designation;
                ddlEmploymentType.SelectedIndex = emp.EmployeeType.EmployeeTypeId - 1;
                lblBonusRate.Text = emp.BonusRate.ToString();
                lblHourlyPay.Text = emp.HourlyPay.ToString();
            }
        }
示例#3
0
        private void btnSaveEmployee_Click(object sender, EventArgs e)
        {
            EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient();
            Employee emp = new Employee()
            {
                EmployeeName = txtEmployeeName.Text,
                Designation  = txtDesignation.Text,
                EmployeeType = new EmployeeType()
                {
                    EmployeeTypeId   = ddlEmploymentType.SelectedIndex + 1,
                    EmployeeTypeName = ddlEmploymentType.SelectedItem.ToString()
                }
            };

            int id = client.SaveEmployee(emp);

            txtEmployeeId.Text = id.ToString();
            MessageBox.Show("Employee Saved...");
        }