| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using System;
- using System.Collections.Generic;
- using InABox.Core;
- using Xamarin.Forms;
- using InABox.Clients;
- using Comal.Classes;
- using System.Threading.Tasks;
- using System.Linq;
- using InABox.Mobile;
- namespace PRS.Mobile
- {
- public partial class TimeSheetNotePage
- {
- TimeSheet timeSheet = new TimeSheet();
- protected void SaveTimeSheetCallback(TimeSheet entity, Exception e)
- {
- if (e != null)
- Device.BeginInvokeOnMainThread(() => { DisplayAlert("Error Adding Note", "Unable to Save Note\n\n" + e.Message, "OK"); });
- }
- public TimeSheetNotePage(TimeSheet _timeSheet)
- {
- InitializeComponent();
- timeSheet = _timeSheet;
- notesLbl.Text = _timeSheet.Notes;
- }
-
- private void SaveNewNotes()
- {
- try
- {
- string notesLableText = notesLbl.Text + "\n";
- if (string.IsNullOrWhiteSpace(notesLbl.Text))
- {
- notesLableText = "";
- }
- if (!string.IsNullOrWhiteSpace(notesEdt.Text))
- {
- timeSheet.Notes = notesLableText +
- notesEdt.Text + " (Added by " + App.Data.Me.Name + " at " + DateTime.Now + ")";
- new Client<TimeSheet>().Save(timeSheet, "Updated Note from Mobile");
- DisplayAlert("Success", "Note Saved", "OK");
- }
- }
- catch { }
- }
- private void Save_Clicked(object sender, MobileMenuButtonClickedEventArgs args)
- {
- SaveNewNotes();
- Navigation.PopAsync();
- }
- }
- }
|