Esempio n. 1
0
        private void btnViewEmployee_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;
                combEmployeeTypes.SelectedIndex = emp.EmployeeType.EmployeeTypeId - 1;
                lalBonus.Text  = emp.BonusRate.ToString();
                lalHourly.Text = emp.HourlyPay.ToString();
            }
        }
Esempio n. 2
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...");
                }
            }
            txtEmployeeId.Text = "";
        }
Esempio n. 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   = combEmployeeTypes.SelectedIndex + 1,
                    EmployeeTypeName = combEmployeeTypes.SelectedItem.ToString()
                }
            };

            int id = client.SaveEmployee(emp);

            txtEmployeeId.Text = id.ToString();
            MessageBox.Show("Employee Saved...");
            txtEmployeeId.Text   = "";
            txtEmployeeName.Text = "";
            txtDesignation.Text  = "";
            lalBonus.Text        = "";
            lalHourly.Text       = "";
        }