using Comal.Classes; using InABox.Clients; using InABox.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; using Xamarin.Forms.Xaml; namespace comal.timesheets { [XamlCompilation(XamlCompilationOptions.Compile)] public partial class MyDetailsPage : ContentPage { public MyDetailsPage() { InitializeComponent(); NavigationPage.SetHasBackButton(this, false); } private void ExitBtn_Clicked(object sender, EventArgs e) { Navigation.PopAsync(); } protected override void OnAppearing() { base.OnAppearing(); LoadDetails(); } private void SaveBtn_Clicked(object sender, EventArgs e) { try { Employee emp = new Employee { ID = GlobalVariables.EmpID, Email = emailEnt.Text, Mobile = mobileEnt.Text }; new Client().Save(emp, "Email and mobile updated from Mobile My HR module"); DisplayAlert("Success", "Employee Details Saved", "OK"); } catch { } } void MySignature_Clicked(object sender, EventArgs e) { var signature = new SignatureSaver(); signature.OnSignatureSaved += (() => { DisplayAlert("Success", "Signature Saved", "OK"); }); Navigation.PushAsync(signature); } private void LoadDetails() { try { CoreTable table = new Client().Query(new Filter(x => x.ID).IsEqualTo(GlobalVariables.EmpID), new Columns(x => x.ID, x => x.Email, x => x.Mobile)); if (table.Rows.Any()) PopulateScreen(table.Rows.FirstOrDefault()); } catch { } } private void PopulateScreen(CoreRow row) { var emp = row.ToObject(); mobileEnt.Text = emp.Mobile; emailEnt.Text = emp.Email; } } }