1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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<Employee>().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<Employee>().Query(new Filter<Employee>(x => x.ID).IsEqualTo(GlobalVariables.EmpID),
- new Columns<Employee>(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<Employee>();
- mobileEnt.Text = emp.Mobile;
- emailEnt.Text = emp.Email;
- }
- }
- }
|