Exemplo n.º 1
0
        public void EmployeeUpdateByFirst()
        {
            EmployeeDto employeeDto = new EmployeeDto
            {
                TCompany = new CompanyDto
                {
                    CompanyID = 2,
                    Name      = "Hillgate"
                },
                UserName = "******",
                Password = "******"
            };


            var employee = ServiceEmployee.FindByUserName(employeeDto);

            if (employee != null)
            {
                System.Diagnostics.Debug.WriteLine(String.Format("Id: {0} -> Name: {1} ", employee.EmployeeID, employee.FirstName + " " + employee.LastName));
                employee.LastName = "Almeida Tereza";

                ServiceEmployee.UpdateEmployee(employee);

                foreach (EmployeeDto employeeLoop in ServiceEmployee.GetAllEmployee(new EmployeeDto
                {
                    TCompany = new CompanyDto
                    {
                        CompanyID = 2,
                        Name = "Hillgate"
                    }
                }))
                {
                    System.Diagnostics.Debug.WriteLine("Employees:" + employeeLoop.EmployeeID + "-" + employeeLoop.FirstName + " " + employeeLoop.LastName);
                }
            }
            else
            {
                System.Diagnostics.Debug.WriteLine(String.Format("None with name: {0} ", employeeDto.UserName));
                //Assert.Fail("Vazio");
            }
        }
Exemplo n.º 2
0
        public void EmployeeDelete()
        {
            EmployeeDto employeeDto = new EmployeeDto
            {
                TCompany = new CompanyDto {
                    CompanyID = 2
                },
                UserName = "******",
                Password = "******"
            };


            var employee = ServiceEmployee.FindByUserName(employeeDto);

            if (employee != null)
            {
                System.Diagnostics.Debug.WriteLine(String.Format("Id: {0} -> Name: {1} ", employee.EmployeeID,
                                                                 employee.FirstName + " " + employee.LastName));

                ServiceEmployee.DeleteEmployee(employee);
            }
        }