Exemplo n.º 1
0
        private void Delete()
        {
            AcmeServiceReference.Employee employee = new AcmeServiceReference.Employee
            {
                EmployeeId = int.Parse(txtSearch.Text.Trim())
            };

            string result = client.DeleteEmployee(employee);

            if (result == "Record Deleted Successfully!")
            {
                BindGridData();
                lblSearchResult.Text = "Employee ID: " + txtSearch.Text.Trim() + "Deleted Successfully!";
            }
            else
            {
                lblSearchResult.Text = "Employee ID: " + txtSearch.Text.Trim() + "Not Found!";
            }
        }
Exemplo n.º 2
0
        private void InsertEmployee()
        {
            try
            {
                AcmeServiceReference.Employee employee = new AcmeServiceReference.Employee
                {
                    FirstName      = txtFirstName.Text,
                    LastName       = txtLastName.Text,
                    BirthDate      = cldBirthDate.SelectedDate,
                    EmployedDate   = cldBirthDate.SelectedDate,
                    EmployeeNumber = txtEmployeeNumber.Text,
                    TerminatedDate = cldTerminatedDate.SelectedDate
                };

                AcmeServiceReference.AcmeServiceClient client = new AcmeServiceReference.AcmeServiceClient();
                lblMsg.Text = "Employee: " + employee.EmployeeNumber + ", " + client.AddEmployee(employee);
            }
            catch (Exception)
            {
                lblMsg.Text = "Employee ID must be unique! ";
            }
        }