protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         DataSet ds = new DataSet();
         AcmeServiceReference.AcmeServiceClient client = new AcmeServiceReference.AcmeServiceClient();
         ds = client.GetEmployees();
         grdEmployees.DataSource = ds;
         grdEmployees.DataBind();
     }
 }
Пример #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! ";
            }
        }