Beispiel #1
0
 public EmployeeDTO(string name, List <int> subordinates, DTO.EmployeeDTO leader = null)
 {
     Name           = name;
     Leader         = leader;
     SubordinatesID = subordinates;
     TaskList       = new List <int>();
 }
 private AddLeaveApplicationCommand CreateDTO(AddLeaveCommandQuery request, DTO.EmployeeDTO employee)
 {
     return(new AddLeaveApplicationCommand
     {
         Comment = request.Comment,
         DateFrom = DateTime.Parse(request.DateFrom),
         DateTo = DateTime.Parse(request.DateTo),
         DaysTaken = request.DaysTaken,
         Description = request.Description,
         EmployeeId = employee.Id,
         LeaveStatus = LeaveStatus.InProgress,
         LeaveType = (LeaveType)Enum.Parse(typeof(LeaveType), request.LeaveType)
     });
 }
        public List <DTO.EmployeeDTO> GetData()
        {
            // DataTable dt = new DataTable();
            con.Open();
            //SqlCommand cmd = new SqlCommand("Insert into EmployeeDetails(EmployeeName,EmployeeAddress,EmployeeSalary) values('Nilesh','surat',10000)", con);
            SqlCommand cmd = new SqlCommand("Select EmployeeName,EmployeeAddress,EmployeeSalary from EmployeeDetails ", con);
            //SqlDataAdapter sda = new SqlDataAdapter(cmd);
            SqlDataReader          dr       = cmd.ExecuteReader();
            List <DTO.EmployeeDTO> employee = new List <DTO.EmployeeDTO>();

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    DTO.EmployeeDTO obj = new DTO.EmployeeDTO();
                    obj.Name    = dr.GetString(0);
                    obj.Address = dr.GetString(1);
                    employee.Add(obj);
                }
            }
            con.Close();
            return(employee);
        }