Ejemplo n.º 1
0
 private void LoadEmployee(EmployeeDto employee)
 {
     if (employee != null)
     {
         viewResources.SetRowCellValue(viewResources.FocusedRowHandle, viewResources.Columns["Code"], employee.Code);
         viewResources.SetRowCellValue(viewResources.FocusedRowHandle, viewResources.Columns["Name"], employee.Person.Name + employee.Person.LastName);
         viewResources.SetRowCellValue(viewResources.FocusedRowHandle, viewResources.Columns["Cost"], employee.SalaryByHour);
     }
 }
Ejemplo n.º 2
0
        // Add aditional results to the search
        public void SearchEmployee(EmployeeRequest request, EmployeeResponse response)
        {
            var maximunResultRows = Convert.ToInt32(Resources.MaximunSearchResults);

            // Apply the search with the pattern given
            var searchResults = Asgard._Foreing.PLA_EMPLEADOS
                                .Where(x => x.EMP_Nombre.ToUpper().Contains(request.SearchEmployeeQuery.ToUpper()) &&
                                            x.CIA_Codigo.Equals("01") &&
                                            x.EMP_Activo.Equals("S"))
                                .OrderBy(y => y.EMP_Nombre)
                                .Take(maximunResultRows)
                                .ToList();

            if (request.SearchEmployeeQuery == "") UpdateSalariesInSearch(response);

            // Fill the response with the result found
            foreach (var employee in searchResults) //Por cada empleada encontrado en DIALCOM
            {
                // Check if the employee is already binded
                var bindedEmployee = response.EmployeeList.Where(x => x.Code == Convert.ToString(employee.EMP_Numero)).FirstOrDefault();
                if (bindedEmployee == null)
                {
                    var employeeDto = new EmployeeDto
                                          {
                                              UserAccountId = 0,
                                              Code = Convert.ToString(employee.EMP_Numero),
                                              SalaryByHour = Convert.ToDecimal(employee.EMP_SalarioXHora),
                                              Person = new PersonDto
                                                           {
                                                               Name = employee.EMP_Nombre,
                                                               LastName = ""
                                                           }
                                          };
                    response.EmployeeList.Add(employeeDto);
                }
                else
                {
                    bindedEmployee.SalaryByHour = Convert.ToDecimal(employee.EMP_SalarioXHora);
                    //bindedEmployee.Person.Name = employee.EMP_Nombre;
                }
            }
        }
Ejemplo n.º 3
0
        private void FixupEmployee(EmployeeDto previousValue)
        {
            if (previousValue != null && previousValue.BudgetRequests.Contains(this))
            {
                previousValue.BudgetRequests.Remove(this);
            }

            if (Employee != null)
            {
                if (!Employee.BudgetRequests.Contains(this))
                {
                    Employee.BudgetRequests.Add(this);
                }
                if (EmployeeId != Employee.Id)
                {
                    EmployeeId = Employee.Id;
                }
            }
        }