private async void CreateBinding() { try { var theStaffSource = GetDataFromDB.GetDataCompanyStaff(CompId).Result; var theStaffSourceList = theStaffSource.StaffList; if (theStaffSourceList != null) { LstStaff.ItemsSource = theStaffSourceList; } var theDeptSource = GetDataFromDB.GetDataCompanyDepartments(CompId).Result; var theDeptSourceList = theDeptSource.DepartmentList; departments = new List <string>(); departmentIds = new List <int>(); if (theDeptSourceList != null) { foreach (var item in theDeptSourceList) { departments.Add(item.DepartmentName); departmentIds.Add(item.DepartmentId); } cmbDeptName.ItemsSource = departments; } } catch (Exception ex) { MessageDialog msg = new MessageDialog(ex.Message); //await msg.ShowAsync(); } }
private void CreateBinding() { try { ResponseMessage theAppointmentSource = new ResponseMessage(); List <AppointmentGlobal> theAppointmentSourceList = new List <AppointmentGlobal>(); ResponseMessage theStaffSource = new ResponseMessage(); List <StaffGlobal> theStaffSourceList = new List <StaffGlobal>(); theStaffSource = GetDataFromDB.GetDataCompanyStaff(CompId).Result; if (_activePage.UserStaffRole.ToUpper() == "ADMIN") { theAppointmentSource = GetDataFromDB.GetDataCompanyAppointment(CompId).Result; //theStaffSource = GetDataFromDB.GetDataCompanyStaff(CompId).Result; //Only admin get to see all staff } else { var thisStaffId = _activePage.UserStaffId; //theStaffSource = GetDataFromDB.GetDataThisStaff(thisStaffId).Result; //Only theAppointmentSource = GetDataFromDB.GetDataStaffAppointment(thisStaffId).Result; //staffId = thisStaffId; //stackHostName.Visibility = Visibility.Collapsed; } theStaffSourceList = theStaffSource.StaffList; theAppointmentSourceList = theAppointmentSource.AppointmentList; if (theAppointmentSourceList != null) { LstAppointment.ItemsSource = theAppointmentSourceList; } //theStaffSource = GetDataFromDB.GetDataCompanyStaff(CompId).Result; //theStaffSourceList = theStaffSource.StaffList; var theLocationSource = GetDataFromDB.GetDataCompanySecureLocation(CompId).Result; var theLocationSourceList = theLocationSource.SecureLocationList; staffIdNumber = new List <string>(); staffIds = new List <int>(); Locations = new List <string>(); LocationIds = new List <int>(); FloorNumber = new List <int>(); if (theStaffSourceList != null) { foreach (var item in theStaffSourceList) { staffIdNumber.Add(item.StaffIdNumber); staffIds.Add(item.StaffId); } //THis is probably LAME!!! but that's teh ay to get teh cmbobox to have the IDs in ascending order foreach (var item in theStaffSourceList.OrderBy(x => x.StaffIdNumber)) { staffIdNumberOrdered.Add(item.StaffIdNumber); } //staffIdNumber = staffIdNumber.OrderBy(); cmbstaffIdNumber.ItemsSource = null; cmbstaffIdNumber.ItemsSource = staffIdNumberOrdered; } if (theLocationSourceList != null) { foreach (var item in theLocationSourceList) { Locations.Add(item.LocationName); LocationIds.Add(item.LocationId); FloorNumber.Add(item.FloorNumber); } cmbMeetingLocation.ItemsSource = null; cmbMeetingLocation.ItemsSource = Locations; } lastRefreshed(); } catch (Exception ex) { checkInternet(); MessageDialog msgErr = new MessageDialog(ex.Message, "Error!"); } }