Пример #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]);
                }
            }
        }
Пример #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}'.");
        }
Пример #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);
        }
Пример #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);
        }
Пример #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.");
        }
Пример #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.");
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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);
            }
        }
Пример #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());
            }
        }
Пример #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]);
                }
            }
        }
Пример #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");
        }
Пример #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());
        }
Пример #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());
        }
Пример #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());
                }
            }
        }
Пример #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());
                }
            }
        }
Пример #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());
            }
        }
Пример #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);
        }
Пример #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());
            }
        }
Пример #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.");
        }
Пример #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());
            }
        }
Пример #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.");
        }
Пример #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}'.");
        }
Пример #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;
        }
Пример #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;
        }
Пример #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");
        }
Пример #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());
                }
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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);
            }
        }
Пример #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());
            }
        }
Пример #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());
                }
            }
        }
Пример #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;
        }
Пример #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());
            }
        }
Пример #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());
        }
Пример #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());
        }