Ejemplo n.º 1
2
        private async static Task DisplayTabluarData(int employeeId, BambooHrTableType tableType)
        {
            var bambooHrClient = new BambooHrClient();

            var data = await bambooHrClient.GetTabularData(employeeId.ToString(), tableType);

            foreach (var row in data)
            {
                foreach (var key in row.Keys)
                {
                    Console.WriteLine(row[key]);
                }
            }
        }
Ejemplo n.º 2
0
        private static void DisplayEmployeePhotoUrl(string workEmail)
        {
            var bambooHrClient = new BambooHrClient();

            var photoUrl = bambooHrClient.GetEmployeePhotoUrl(workEmail);

            Console.WriteLine($"The photo URL for {workEmail} is '{photoUrl}'.");
        }
Ejemplo n.º 3
0
        private async static Task <bool> UpdateEmployee(BambooHrEmployee bambooHrEmployee)
        {
            var bambooHrClient = new BambooHrClient();
            await bambooHrClient.UpdateEmployee(bambooHrEmployee);

            Console.WriteLine($"Updated employee with ID {bambooHrEmployee.Id}");

            return(true);
        }
Ejemplo n.º 4
0
        private async static Task <BambooHrEmployee> GetEmployee(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();
            var employee       = await bambooHrClient.GetEmployee(employeeId);

            Console.WriteLine($"Got employee with ID {employee.Id}");

            return(employee);
        }
Ejemplo n.º 5
0
        private async static Task DownloadEmployeePhoto(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var fileData = await bambooHrClient.GetEmployeePhoto(employeeId);

            File.WriteAllBytes(@"C:\test.jpeg", fileData);

            Console.WriteLine("Photo downloaded.");
        }
Ejemplo n.º 6
0
        private async static Task UploadloadEmployeePhoto(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var binaryData = File.ReadAllBytes(@"C:\test.jpeg");

            var fileData = await bambooHrClient.UploadEmployeePhoto(employeeId, binaryData, "test.jpeg");

            Console.WriteLine("Photo uploaded.");
        }
Ejemplo n.º 7
0
        private async static Task DisplayWhosOut()
        {
            var bambooHrClient = new BambooHrClient();

            var whosOut = await bambooHrClient.GetWhosOut();

            foreach (var whosOutInfo in whosOut)
            {
                Console.WriteLine(whosOutInfo.PropsToString());
            }
        }
Ejemplo n.º 8
0
        private async static Task DisplayFields()
        {
            var bambooHrClient = new BambooHrClient();

            var fields = await bambooHrClient.GetFields();

            foreach (var field in fields)
            {
                Console.WriteLine(field.PropsToString());
            }
        }
Ejemplo n.º 9
0
        private async static Task DisplayAssignedTimeOffPolicies(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var timeOffPolicies = await bambooHrClient.GetAssignedTimeOffPolicies(employeeId);

            foreach (var timeOffPolicy in timeOffPolicies)
            {
                Console.WriteLine(timeOffPolicy.PropsToString());
            }
        }
Ejemplo n.º 10
0
        public async static Task DisplayTimeOffPolicies()
        {
            var bambooHrClient = new BambooHrClient();

            var timeOffPolicies = await bambooHrClient.GetTimeOffPolicies();

            foreach (var timeOffPolicy in timeOffPolicies)
            {
                Console.WriteLine(timeOffPolicy.PropsToString());
            }
        }
Ejemplo n.º 11
0
        public async static Task DisplayUsers()
        {
            var bambooHrClient = new BambooHrClient();

            var users = await bambooHrClient.GetUsers();

            foreach (var user in users)
            {
                Console.WriteLine(user.PropsToString());
            }
        }
Ejemplo n.º 12
0
        public async static Task DisplayLastChangedInfo()
        {
            var bambooHrClient = new BambooHrClient();

            var users = await bambooHrClient.GetLastChangedInfo(DateTime.Now.AddDays(-7));

            foreach (var user in users)
            {
                Console.WriteLine(user.PropsToString());
            }
        }
Ejemplo n.º 13
0
        public async static void ListHolidays()
        {
            var bambooHrClient = new BambooHrClient();

            var holidays = await bambooHrClient.GetHolidays(DateTime.Now, DateTime.Now.AddYears(1));

            foreach (var holiday in holidays)
            {
                Console.WriteLine("{0} {1} {2}", holiday.Id, holiday.Start.ToString(Constants.BambooHrDateFormat), holiday.Name);
            }
        }
Ejemplo n.º 14
0
        private async static Task DisplayFutureTimeOffBalanceEstimates(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var estimates = await bambooHrClient.GetFutureTimeOffBalanceEstimates(employeeId);

            foreach (var estimate in estimates)
            {
                Console.WriteLine(estimate.PropsToString());
            }
        }
Ejemplo n.º 15
0
        private async static Task DisplayTabluarData(int employeeId, BambooHrTableType tableType)
        {
            var bambooHrClient = new BambooHrClient();

            var data = await bambooHrClient.GetTabularData(employeeId.ToString(), tableType);

            foreach (var row in data)
            {
                foreach (var key in row.Keys)
                {
                    Console.WriteLine(row[key]);
                }
            }
        }
Ejemplo n.º 16
0
        private async static Task AddOrUpdateListValues(int listId)
        {
            var values = new List <BambooHrListFieldOption>
            {
                new BambooHrListFieldOption {
                    Value = "New Option"
                }
            };

            var bambooHrClient = new BambooHrClient();

            var results = await bambooHrClient.AddOrUpdateListValues(listId, values);

            Console.WriteLine("List values added/updated");
        }
Ejemplo n.º 17
0
        private async static void DisplayEmployeeInfos()
        {
            var bambooHrClient = new BambooHrClient();

            var employees = await bambooHrClient.GetEmployees();

            foreach (var employee in employees)
            {
                Console.WriteLine(employee.LastFirst);
            }

            // Display the details of the last employee in the list to compare to the regular GetEmployee call
            Console.WriteLine();
            Console.WriteLine(employees.Last().PropsToString());
        }
Ejemplo n.º 18
0
        private async static void AddEmployee(string firstName, string lastName, string workEmail)
        {
            var bambooHrClient = new BambooHrClient();

            var bambooHrEmployee = new BambooHrEmployee
            {
                FirstName = firstName,
                LastName  = lastName,
                WorkEmail = workEmail
            };

            var url = await bambooHrClient.AddEmployee(bambooHrEmployee);

            Console.WriteLine($"Employee created at {url}");
            Console.WriteLine(bambooHrEmployee.PropsToString());
        }
Ejemplo n.º 19
0
        private async static Task DisplayTabularFields()
        {
            var bambooHrClient = new BambooHrClient();

            var tables = await bambooHrClient.GetTabularFields();

            foreach (var table in tables)
            {
                Console.WriteLine();
                Console.WriteLine(table.Alias);

                foreach (var field in table.Fields)
                {
                    Console.WriteLine(field.PropsToString());
                }
            }
        }
Ejemplo n.º 20
0
        private async static Task DisplayListFieldDetails()
        {
            var bambooHrClient = new BambooHrClient();

            var fields = await bambooHrClient.GetListFieldDetails();

            foreach (var field in fields)
            {
                Console.WriteLine();
                Console.WriteLine(field.PropsToString());

                foreach (var option in field.Options)
                {
                    Console.WriteLine(option.PropsToString());
                }
            }
        }
Ejemplo n.º 21
0
        public async static Task DisplayTimeOffTypesByPermissions()
        {
            var bambooHrClient = new BambooHrClient();

            var timeOffInfo = await bambooHrClient.GetTimeOffTypes("request");

            Console.WriteLine("Time Off Types:");
            foreach (var timeOffType in timeOffInfo.TimeOffTypes)
            {
                Console.WriteLine(timeOffType.PropsToString());
            }

            Console.WriteLine("Default Hours:");
            foreach (var defaultHour in timeOffInfo.DefaultHours)
            {
                Console.WriteLine(defaultHour.PropsToString());
            }
        }
Ejemplo n.º 22
0
        public async static Task <int> CreateTimeOffRequest()
        {
            var userId    = 5;
            var reason    = "vacation";
            var startDate = DateTime.Now;
            var endDate   = DateTime.Now.AddDays(1);

            var timeOffTypeId = GetTimeOffTypeId(reason);

            var bambooHrClient = new BambooHrClient();

            var employee = bambooHrClient.GetEmployee(userId);

            var result = await bambooHrClient.CreateTimeOffRequest(employee.Id, timeOffTypeId, startDate, endDate);

            Console.WriteLine($"Result: {result}");

            return(result);
        }
Ejemplo n.º 23
0
        private async static Task DisplayFutureTimeOffBalanceEstimates(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var estimates = await bambooHrClient.GetFutureTimeOffBalanceEstimates(employeeId);

            foreach (var estimate in estimates)
            {
                Console.WriteLine(estimate.PropsToString());
            }
        }
Ejemplo n.º 24
0
        private async static Task DownloadEmployeePhoto(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var fileData = await bambooHrClient.GetEmployeePhoto(employeeId);

            File.WriteAllBytes(@"C:\test.jpeg", fileData);

            Console.WriteLine("Photo downloaded.");
        }
Ejemplo n.º 25
0
        private async static Task DisplayWhosOut()
        {
            var bambooHrClient = new BambooHrClient();

            var whosOut = await bambooHrClient.GetWhosOut();

            foreach (var whosOutInfo in whosOut)
            {
                Console.WriteLine(whosOutInfo.PropsToString());
            }
        }
Ejemplo n.º 26
0
        private async static Task UploadloadEmployeePhoto(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var binaryData = File.ReadAllBytes(@"C:\test.jpeg");

            var fileData = await bambooHrClient.UploadEmployeePhoto(employeeId, binaryData, "test.jpeg");

            Console.WriteLine("Photo uploaded.");
        }
Ejemplo n.º 27
0
        private static void DisplayEmployeePhotoUrl(string workEmail)
        {
            var bambooHrClient = new BambooHrClient();

            var photoUrl = bambooHrClient.GetEmployeePhotoUrl(workEmail);

            Console.WriteLine($"The photo URL for {workEmail} is '{photoUrl}'.");
        }
Ejemplo n.º 28
0
        private async static Task<BambooHrEmployee> GetEmployee(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();
            var employee = await bambooHrClient.GetEmployee(employeeId);

            Console.WriteLine($"Got employee with ID {employee.Id}");

            return employee;
        }
Ejemplo n.º 29
0
        public async static Task<int> CreateTimeOffRequest()
        {
            var userId = 5;
            var reason = "vacation";
            var startDate = DateTime.Now;
            var endDate = DateTime.Now.AddDays(1);

            var timeOffTypeId = GetTimeOffTypeId(reason);

            var bambooHrClient = new BambooHrClient();

            var employee = bambooHrClient.GetEmployee(userId);

            var result = await bambooHrClient.CreateTimeOffRequest(employee.Id, timeOffTypeId, startDate, endDate);

            Console.WriteLine($"Result: {result}");

            return result;
        }
Ejemplo n.º 30
0
        private async static Task AddOrUpdateListValues(int listId)
        {
            var values = new List<BambooHrListFieldOption>
            {
                new BambooHrListFieldOption { Value="New Option" }
            };

            var bambooHrClient = new BambooHrClient();

            var results = await bambooHrClient.AddOrUpdateListValues(listId, values);

            Console.WriteLine("List values added/updated");
        }
Ejemplo n.º 31
0
        private async static Task DisplayListFieldDetails()
        {
            var bambooHrClient = new BambooHrClient();

            var fields = await bambooHrClient.GetListFieldDetails();

            foreach (var field in fields)
            {
                Console.WriteLine();
                Console.WriteLine(field.PropsToString());

                foreach (var option in field.Options)
                {
                    Console.WriteLine(option.PropsToString());
                }
            }
        }
Ejemplo n.º 32
0
        public async static Task DisplayTimeOffPolicies()
        {
            var bambooHrClient = new BambooHrClient();

            var timeOffPolicies = await bambooHrClient.GetTimeOffPolicies();

            foreach (var timeOffPolicy in timeOffPolicies)
            {
                Console.WriteLine(timeOffPolicy.PropsToString());
            }
        }
Ejemplo n.º 33
0
        public async static Task DisplayTimeOffTypesByPermissions()
        {
            var bambooHrClient = new BambooHrClient();

            var timeOffInfo = await bambooHrClient.GetTimeOffTypes("request");

            Console.WriteLine("Time Off Types:");
            foreach (var timeOffType in timeOffInfo.TimeOffTypes)
            {
                Console.WriteLine(timeOffType.PropsToString());
            }

            Console.WriteLine("Default Hours:");
            foreach (var defaultHour in timeOffInfo.DefaultHours)
            {
                Console.WriteLine(defaultHour.PropsToString());
            }
        }
Ejemplo n.º 34
0
        public async static Task DisplayUsers()
        {
            var bambooHrClient = new BambooHrClient();

            var users = await bambooHrClient.GetUsers();

            foreach (var user in users)
            {
                Console.WriteLine(user.PropsToString());
            }
        }
Ejemplo n.º 35
0
        public async static Task DisplayLastChangedInfo()
        {
            var bambooHrClient = new BambooHrClient();

            var users = await bambooHrClient.GetLastChangedInfo(DateTime.Now.AddDays(-7));

            foreach (var user in users)
            {
                Console.WriteLine(user.PropsToString());
            }
        }
Ejemplo n.º 36
0
        public async static void ListHolidays()
        {
            var bambooHrClient = new BambooHrClient();

            var holidays = await bambooHrClient.GetHolidays(DateTime.Now, DateTime.Now.AddYears(1));

            foreach (var holiday in holidays)
            {
                Console.WriteLine("{0} {1} {2}", holiday.Id, holiday.Start.ToString(Constants.BambooHrDateFormat), holiday.Name);
            }
        }
Ejemplo n.º 37
0
        private async static Task DisplayAssignedTimeOffPolicies(int employeeId)
        {
            var bambooHrClient = new BambooHrClient();

            var timeOffPolicies = await bambooHrClient.GetAssignedTimeOffPolicies(employeeId);

            foreach (var timeOffPolicy in timeOffPolicies)
            {
                Console.WriteLine(timeOffPolicy.PropsToString());
            }
        }
Ejemplo n.º 38
0
        private async static Task DisplayTabularFields()
        {
            var bambooHrClient = new BambooHrClient();

            var tables = await bambooHrClient.GetTabularFields();

            foreach (var table in tables)
            {
                Console.WriteLine();
                Console.WriteLine(table.Alias);

                foreach (var field in table.Fields)
                {
                    Console.WriteLine(field.PropsToString());
                }
            }
        }
Ejemplo n.º 39
0
        private async static Task<bool> UpdateEmployee(BambooHrEmployee bambooHrEmployee)
        {
            var bambooHrClient = new BambooHrClient();
            await bambooHrClient.UpdateEmployee(bambooHrEmployee);

            Console.WriteLine($"Updated employee with ID {bambooHrEmployee.Id}");

            return true;
        }
Ejemplo n.º 40
0
        private async static Task DisplayFields()
        {
            var bambooHrClient = new BambooHrClient();

            var fields = await bambooHrClient.GetFields();

            foreach (var field in fields)
            {
                Console.WriteLine(field.PropsToString());
            }
        }
Ejemplo n.º 41
0
        private async static void DisplayEmployeeInfos()
        {
            var bambooHrClient = new BambooHrClient();

            var employees = await bambooHrClient.GetEmployees();

            foreach (var employee in employees)
            {
                Console.WriteLine(employee.LastFirst);
            }

            // Display the details of the last employee in the list to compare to the regular GetEmployee call
            Console.WriteLine();
            Console.WriteLine(employees.Last().PropsToString());
        }
Ejemplo n.º 42
0
        private async static void AddEmployee(string firstName, string lastName, string workEmail)
        {
            var bambooHrClient = new BambooHrClient();

            var bambooHrEmployee = new BambooHrEmployee
            {
                FirstName = firstName,
                LastName = lastName,
                WorkEmail = workEmail
            };

            var url = await bambooHrClient.AddEmployee(bambooHrEmployee);

            Console.WriteLine($"Employee created at {url}");
            Console.WriteLine(bambooHrEmployee.PropsToString());
        }