123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using InABox.Core;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Comal.Classes;
- using InABox.Clients;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- using System.IO;
- using comal.timesheets.QAForms;
- namespace comal.timesheets
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class MyHRHome : ContentPage
- {
- #region Constructor and appearing
- ImageSource imageSource;
- public MyHRHome()
- {
- InitializeComponent();
- LoadScreen();
- }
- protected override void OnAppearing()
- {
- LoadButtons();
- base.OnAppearing();
- }
- private async void LoadScreen()
- {
- await Task.Run(() =>
- {
- LoadNames();
- });
- }
- private async void LoadButtons()
- {
- await Task.Run(() =>
- {
- if (GlobalVariables.UpdateHRItemsNeedingAttention())
- {
- Device.BeginInvokeOnMainThread(() =>
- {
- if (GlobalVariables.QualificationsNeedingAttention > 0)
- {
- //qualificationsBtn.Text = "Qualifications (" + GlobalVariables.QualificationsNeedingAttention + ")"
- //+ System.Environment.NewLine + "!";
- //qualificationsBtn.BackgroundColor = Color.Orange;
- //qualificationsBtn.Padding = new Thickness(60, 10, 10, 10);
- }
- else
- {
- //qualificationsBtn.Text = "Qualifications";
- //qualificationsBtn.BackgroundColor = Color.FromHex("#15C7C1");
- }
- if (GlobalVariables.EmployeeFormsToDo > 0)
- {
-
- //employeeFormsBtn.BackgroundColor = Color.Orange;
- }
- else
- {
- //employeeFormsBtn.Text = "Employee Forms";
- //employeeFormsBtn.BackgroundColor = Color.FromHex("#15C7C1");
- }
- });
- }
- });
-
- }
- private void LoadNames()
- {
- string teamName = "";
- CoreTable table = new Client<EmployeeTeam>().Query
- (
- new Filter<EmployeeTeam>(x => x.EmployeeLink.ID).IsEqualTo(GlobalVariables.EmpID),
- new Columns<EmployeeTeam>(x => x.TeamLink.Name)
- );
- if (table.Rows.Any())
- {
- foreach (CoreRow row in table.Rows)
- {
- List<object> list = row.Values;
- if (list[0] == null) { list[0] = ""; }
- if (!string.IsNullOrWhiteSpace(list[0].ToString()))
- {
- if (list[0].ToString() != "All Staff")
- {
- teamName = list[0].ToString();
- }
- }
- }
- }
- Device.BeginInvokeOnMainThread(() =>
- {
- employeeNameLbl.Text = GlobalVariables.EmpName;
- employeeTeamLbl.Text = teamName;
- });
- }
- #endregion
- #region Buttons
- private void QualificationsBtn_Clicked(object sender, EventArgs e)
- {
- QualificationList qualificationsPage = new QualificationList();
- Navigation.PushAsync(qualificationsPage);
- }
- private void EmployeeFormsBtn_Clicked(object sender, EventArgs e)
- {
- EmployeeFormPicker employeeFormPicker = new EmployeeFormPicker();
- Navigation.PushAsync(employeeFormPicker);
- }
- private void LeaveBtn_Clicked(object sender, EventArgs e)
- {
- LeaveRequestList leaveRequestList = new LeaveRequestList();
- Navigation.PushAsync(leaveRequestList);
- }
- private void TimesheetsBtn_Clicked(object sender, EventArgs e)
- {
- var timesheetsForm = new Timesheets() { EmployeeID = GlobalVariables.EmpID };
- Navigation.PushAsync(timesheetsForm);
- }
- private void MyDetails_Clicked(object sender, EventArgs e)
- {
- MyDetailsPage page = new MyDetailsPage();
- Navigation.PushAsync(page);
- }
- #endregion
- }
- }
|