示例#1
0
 private Employee CreateSampleEmployee2()
 {
     Employee emp = new Employee(2, "Sam", "Jones", "DBA");
     emp._addressList.Add((object)new EmployeeAddress(AddressType.Home, "222 Hill Street", "Redmond", "WA", "98052"));
     return emp;
 }
示例#2
0
 private Employee CreateSampleEmployee()
 {
     Employee emp = new Employee(1, "Jeffrey", "Jones", "SYSTEMS ANALYST");
     emp._addressList.Add((object)new EmployeeAddress(AddressType.Home, "111 Oak", "Redmond", "WA", "98052"));
     emp._addressList.Add((object)new EmployeeAddress(AddressType.Work, "1111 North Corporate Road", 
         "Redmond", "WA", "98052")); 
     return emp;
 }
示例#3
0
        private void buttonPersistMultipleEmployees_Click(object sender, System.EventArgs e)
        {   
            Employee[] employees = null;
            Employee[] employeesToPersist = new Employee[2];            
            // add a sample employee to fetch and then update
            _repository.PersistEmployee(CreateSampleEmployee());
            employees = _repository.GetEmployee("Jones");
            employees.CopyTo(employeesToPersist,0);
            employeesToPersist[0]._addressList.RemoveAt(0);  //remove an address
            employeesToPersist[0].Title = "Director"; //update the title
            
            // create a new employee
            employeesToPersist[1] = CreateSampleEmployee3();
            
            //now persist updated and inserted employees            
            _repository.PersistEmployees(employeesToPersist);

            _repository.CleanDatabase();
        }
示例#4
0
 protected virtual void buttonCreateEmployee_Click(object sender, System.EventArgs e)
 {
     _emp = new Employee(-1, string.Empty, string.Empty, string.Empty);
     _emp._addressList.Add(new EmployeeAddress(AddressType.Home, string.Empty, string.Empty, string.Empty, string.Empty));
     _emp._addressList.Add(new EmployeeAddress(AddressType.Work, string.Empty, string.Empty, string.Empty, string.Empty));
     _emp._addressList.Add(new EmployeeAddress(AddressType.Other, string.Empty, string.Empty, string.Empty, string.Empty));
     ClearBindings();
     BindEmployee();
 }
示例#5
0
 private void buttonClear_Click(object sender, System.EventArgs e)
 {
     ClearBindings();
     _emp = null;
 }
示例#6
0
 protected virtual void buttonFetchEmployee_Click(object sender, System.EventArgs e)
 {
     Employee[] emps = _repository.GetEmployee(textBoxEmployeeLastName.Text);
     ClearBindings(); 
     if (emps != null && emps.Length > 0)
     {
         _emp = emps[0];
         BindEmployee();
     }
     else
     {
         _emp = null;   
     }       
 }