|
@@ -13,6 +13,19 @@ using Xamarin.Essentials;
|
|
|
|
|
|
namespace PRS.Mobile
|
|
|
{
|
|
|
+
|
|
|
+ public class DeliveryCompletedConverter : UtilityConverter<DeliveryShell?, String>
|
|
|
+ {
|
|
|
+ protected override string Convert(DeliveryShell? value)
|
|
|
+ {
|
|
|
+ return value == null
|
|
|
+ ? ""
|
|
|
+ : value.Delivered.IsEmpty()
|
|
|
+ ? "Mark as Delivered"
|
|
|
+ : "Clear Delivery Flag";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public delegate void DeliverySaved();
|
|
|
public partial class DeliveryEditDetailsView
|
|
|
{
|
|
@@ -31,539 +44,23 @@ namespace PRS.Mobile
|
|
|
public DeliveryEditDetailsView()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public override void Refresh()
|
|
|
- {
|
|
|
- RefreshPage();
|
|
|
}
|
|
|
|
|
|
- private void RefreshPage()
|
|
|
+ public override void Refresh()
|
|
|
{
|
|
|
- // JobName.Text = ViewModel.Item.Job
|
|
|
- // TypeLbl.Text = _delivery.Type.Description;
|
|
|
- // ContactNameLbl.Text = _delivery.Contact.Name;
|
|
|
- // streetEdt.Text = _delivery.Address.Street;
|
|
|
- // cityEdt.Text = _delivery.Address.City;
|
|
|
- // statePicker.SelectedIndex = SelectState();
|
|
|
- // postCodeEdt.Text = _delivery.Address.PostCode;
|
|
|
- // EmployeeName.Text = _delivery.Employee.Name;
|
|
|
- // deliveryNotesEdt.Text = _delivery.Notes;
|
|
|
- // dueDate.Date = !_delivery.Due.IsEmpty()
|
|
|
- // ? _delivery.Due
|
|
|
- // : DateTime.Today;
|
|
|
- //
|
|
|
- // convertToTaskBtn.Text = _delivery.KanbanNumber != 0
|
|
|
- // ? "Saved To Task " + _delivery.KanbanNumber
|
|
|
- // : "Create Task";
|
|
|
- // convertToTaskBtn.IsEnabled = (_delivery.ID != Guid.Empty) && (_delivery.KanbanNumber == 0);
|
|
|
- //
|
|
|
- // convertToTaskBtn.IsEnabled = _delivery.ID != Guid.Empty;
|
|
|
- //
|
|
|
- // CompleteDeliveryButton.IsEnabled = !_delivery.Delivered.IsEmpty() && (_delivery.ID != Guid.Empty);
|
|
|
- //
|
|
|
- // streetEdt.Text = _delivery.Contact.Address.Street;
|
|
|
- // cityEdt.Text = _delivery.Contact.Address.City;
|
|
|
- // postCodeEdt.Text = _delivery.Contact.Address.PostCode;
|
|
|
- // ContactNameLbl.Text = _delivery.Contact.Name;
|
|
|
- //
|
|
|
- // EmployeeName.Text = _delivery.Employee.Name;
|
|
|
- //
|
|
|
- // if (_delivery.Location.Longitude != 0 && _delivery.Location.Latitude != 0)
|
|
|
- // {
|
|
|
- // DeliveredFlagFrame.IsVisible = true;
|
|
|
- // DeliveredLbl.IsVisible = true;
|
|
|
- // DeliveredDetails.Text = "Loading Delivered Flag Details";
|
|
|
- // if (string.IsNullOrWhiteSpace(_delivery.Location.Address))
|
|
|
- // {
|
|
|
- // GetLocationFromDetails();
|
|
|
- // }
|
|
|
- // else
|
|
|
- // ShowDeliveredDetails(false);
|
|
|
- // }
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- #region Create Delivery or add delivered flag
|
|
|
-
|
|
|
- // async void CreateDelivery()
|
|
|
- // {
|
|
|
- // try
|
|
|
- // {
|
|
|
- // using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Saving Delivery"))
|
|
|
- // {
|
|
|
- // _delivery.Due = dueDate.Date; //unable to make duedate changed event without crashing the screen on startup....
|
|
|
- // new Client<Delivery>().Save(_delivery, "Updated From Mobile Device");
|
|
|
- //
|
|
|
- // if (newPhotoDocuments.Count != 0)
|
|
|
- // {
|
|
|
- // new Client<Document>().Save(newPhotoDocuments, "Photo Taken on Device");
|
|
|
- //
|
|
|
- // ObservableList<DeliveryDocument> newDeliveryDocuments = new ObservableList<DeliveryDocument>();
|
|
|
- // foreach (Document doc in newPhotoDocuments)
|
|
|
- // {
|
|
|
- // var deliveryDocument = new DeliveryDocument();
|
|
|
- // deliveryDocument.EntityLink.ID = _delivery.ID;
|
|
|
- // deliveryDocument.DocumentLink.ID = doc.ID;
|
|
|
- // deliveryDocument.DocumentLink.FileName = doc.FileName;
|
|
|
- // newDeliveryDocuments.Add(deliveryDocument);
|
|
|
- // }
|
|
|
- // new Client<DeliveryDocument>().Save(newDeliveryDocuments, "Photo Taken on Device");
|
|
|
- // newPhotoDocuments.Clear();
|
|
|
- // }
|
|
|
- // }
|
|
|
- // string successMessage = "Delivery Created" + System.Environment.NewLine + "Delivery Number: " + _delivery.Number;
|
|
|
- // }
|
|
|
- // catch (Exception ex)
|
|
|
- // {
|
|
|
- // await MaterialDialog.Instance.AlertAsync("Error creating delivery", ex.Message, "OK");
|
|
|
- // }
|
|
|
- // OnDeliverySaved?.Invoke();
|
|
|
- // await Navigation.PopAsync();
|
|
|
- // }
|
|
|
- //
|
|
|
- // private async void CompleteDelivery()
|
|
|
- // {
|
|
|
- // try
|
|
|
- // {
|
|
|
- // using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Getting Location..Please wait"))
|
|
|
- // {
|
|
|
- // LocationServices locationServices = new LocationServices();
|
|
|
- // locationServices.OnLocationFound += LocationFound;
|
|
|
- // locationServices.OnLocationError += LocationError;
|
|
|
- // locationServices.GetLocation();
|
|
|
- // Thread.Sleep(1000); //"Getting Location" notification disappears too quickly on some devices - ensures a minimum of 1 second while location tasks execute on other threads
|
|
|
- // }
|
|
|
- // }
|
|
|
- // catch { }
|
|
|
- //
|
|
|
- // }
|
|
|
- //
|
|
|
- // private async void LocationFound(LocationServices sender)
|
|
|
- // {
|
|
|
- // try
|
|
|
- // {
|
|
|
- // using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Getting Location..Please wait"))
|
|
|
- // {
|
|
|
- // _delivery.Location.Latitude = sender.Latitude;
|
|
|
- // _delivery.Location.Longitude = sender.Longitude;
|
|
|
- // _delivery.Location.Timestamp = DateTime.Now;
|
|
|
- // _delivery.Location.Address = sender.Address;
|
|
|
- // _delivery.DeliveredBy.ID = App.Data.Me.ID;
|
|
|
- // _delivery.DeliveredBy.Name = App.Data.Me.Name;
|
|
|
- // address = sender.Address;
|
|
|
- // _delivery.Delivered = DateTime.Now;
|
|
|
- //
|
|
|
- // await Task.Run(() =>
|
|
|
- // {
|
|
|
- // new Client<Delivery>().Save(_delivery, "Updated From Mobile Device");
|
|
|
- // });
|
|
|
- // }
|
|
|
- // await MaterialDialog.Instance.AlertAsync("Success", "Delivered: " + _delivery.Delivered.ToString("hh:mm:ss tt dd-MMM-yy")
|
|
|
- // + System.Environment.NewLine + "Location Now: " + address
|
|
|
- // , "OK");
|
|
|
- // ShowDeliveredDetails();
|
|
|
- // }
|
|
|
- // catch { }
|
|
|
- // }
|
|
|
- //
|
|
|
- // private async void LocationError(LocationServices sender, Exception error)
|
|
|
- // {
|
|
|
- // await MaterialDialog.Instance.AlertAsync("GPS Error", error.Message, "OK");
|
|
|
- // }
|
|
|
- #endregion
|
|
|
-
|
|
|
-
|
|
|
- #region Load Screen values from Database
|
|
|
-
|
|
|
-
|
|
|
- // public IEnumerable<Placemark> Addresses
|
|
|
- // {
|
|
|
- // get { return addresses; }
|
|
|
- // set { addresses = value; ShowDeliveredDetails(); }
|
|
|
- // }
|
|
|
- //
|
|
|
- // private void ShowDeliveredDetails(bool wait = true)
|
|
|
- // {
|
|
|
- // Task.Run(() =>
|
|
|
- // {
|
|
|
- // if (wait)
|
|
|
- // {
|
|
|
- // Thread.Sleep(5000);
|
|
|
- // }
|
|
|
- // Device.BeginInvokeOnMainThread(() =>
|
|
|
- // {
|
|
|
- // CompleteDeliveryButton.IsEnabled = false;
|
|
|
- // DeliveredFlagFrame.IsVisible = true;
|
|
|
- // DeliveredLbl.IsVisible = true;
|
|
|
- // if (string.IsNullOrWhiteSpace(address))
|
|
|
- // {
|
|
|
- // if (!string.IsNullOrWhiteSpace(_delivery.Location.Address))
|
|
|
- // address = _delivery.Location.Address;
|
|
|
- // else
|
|
|
- // address = "(Address service failed). Driver was at Latitude: " + _delivery.Location.Latitude + " Longitude: " + _delivery.Location.Longitude;
|
|
|
- // }
|
|
|
- // DeliveredDetails.Text = address + " at " + _delivery.Delivered.ToString("hh:mm:ss tt dd MMM yy") + System.Environment.NewLine
|
|
|
- // + "by: " + _delivery.DeliveredBy.Name;
|
|
|
- // openMapBtn.IsEnabled = true;
|
|
|
- // });
|
|
|
- // });
|
|
|
- //
|
|
|
- // }
|
|
|
-
|
|
|
- // private async void GetLocationFromDetails()
|
|
|
- // {
|
|
|
- // await Task.Run(async () =>
|
|
|
- // {
|
|
|
- // try
|
|
|
- // {
|
|
|
- // Addresses = await Geocoding.GetPlacemarksAsync(_delivery.Location.Latitude, _delivery.Location.Longitude);
|
|
|
- // Placemark placemark = null;
|
|
|
- // foreach (var cur in Addresses)
|
|
|
- // {
|
|
|
- // placemark = cur;
|
|
|
- // if (placemark != null)
|
|
|
- // {
|
|
|
- // address = String.Format("{0} {1} {2}", placemark.SubThoroughfare, placemark.Thoroughfare, placemark.Locality);
|
|
|
- // _delivery.Location.Address = address;
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- // }
|
|
|
- // catch
|
|
|
- // {
|
|
|
- // address = "Longitude: " + _delivery.Location.Longitude + "Latitude: " + _delivery.Location.Latitude + " Address service failed to load address";
|
|
|
- // }
|
|
|
- // });
|
|
|
- // }
|
|
|
- //
|
|
|
- // private async void OpenMapBtn_Clicked(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // var location = new Xamarin.Essentials.Location(_delivery.Location.Latitude, _delivery.Location.Longitude);
|
|
|
- // var options = new MapLaunchOptions { };
|
|
|
- // await Map.OpenAsync(location, options);
|
|
|
- // }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region Values Changed Events
|
|
|
-
|
|
|
- // private async void SelectType_Clicked(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // try
|
|
|
- // {
|
|
|
- // Dictionary<string, Guid> deliveryTypePairs = new Dictionary<string, Guid>();
|
|
|
- // List<string> _deliveryTypes = new List<string>();
|
|
|
- // var table = new Client<DeliveryType>().Query(new Filter<DeliveryType>(x => x.Description).IsNotEqualTo(string.Empty));
|
|
|
- // foreach (CoreRow row in table.Rows)
|
|
|
- // {
|
|
|
- // DeliveryType _deliveryType = row.ToObject<DeliveryType>();
|
|
|
- // _deliveryTypes.Add(_deliveryType.Description);
|
|
|
- // deliveryTypePairs.Add(_deliveryType.Description, _deliveryType.ID);
|
|
|
- // }
|
|
|
- // if (_deliveryTypes.Count != 0)
|
|
|
- // {
|
|
|
- // int choice = await MaterialDialog.Instance.SelectChoiceAsync("Choose Delivery Type", _deliveryTypes);
|
|
|
- // if (choice != -1)
|
|
|
- // {
|
|
|
- // _delivery.Type.Description = _deliveryTypes[choice];
|
|
|
- // TypeLbl.Text = _deliveryTypes[choice];
|
|
|
- // _delivery.Type.ID = deliveryTypePairs[_deliveryTypes[choice]];
|
|
|
- // }
|
|
|
- // }
|
|
|
- // }
|
|
|
- // catch { }
|
|
|
- // }
|
|
|
-
|
|
|
- // private void SelectJob_Clicked(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- //
|
|
|
- // _selectionpage = new JobSelectionPage(
|
|
|
- // (job) =>
|
|
|
- // {
|
|
|
- // _delivery.Job.ID = job.ID;
|
|
|
- // _delivery.Job.Name = job.Name;
|
|
|
- // _delivery.Job.JobNumber = job.JobNumber;
|
|
|
- // JobName.Text = _delivery.Job.Name + " (" + _delivery.Job.JobNumber + ")";
|
|
|
- // }
|
|
|
- // );
|
|
|
- // Navigation.PushAsync(_selectionpage);
|
|
|
- // }
|
|
|
-
|
|
|
- #region Address
|
|
|
-
|
|
|
- // private void StreetEdt_Changed(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _delivery.Address.Street = streetEdt.Text;
|
|
|
- // }
|
|
|
- //
|
|
|
- // private void CityEdt_Changed(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _delivery.Address.City = cityEdt.Text;
|
|
|
- // }
|
|
|
- // private void StatePicker_Changed(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _delivery.Address.State = statePicker.SelectedItem.ToString();
|
|
|
- // }
|
|
|
- // private void PostCode_Changed(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _delivery.Address.PostCode = postCodeEdt.Text;
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- //
|
|
|
- // private int SelectState()
|
|
|
- // {
|
|
|
- // int state = 0;
|
|
|
- // switch (_delivery.Address.State)
|
|
|
- // {
|
|
|
- // case "Western Australia":
|
|
|
- // state = 0;
|
|
|
- // break;
|
|
|
- // case "Victoria":
|
|
|
- // state = 1;
|
|
|
- // break;
|
|
|
- // case "South Australia":
|
|
|
- // state = 2;
|
|
|
- // break;
|
|
|
- // case "New South Wales":
|
|
|
- // state = 3;
|
|
|
- // break;
|
|
|
- // case "Queensland":
|
|
|
- // state = 4;
|
|
|
- // break;
|
|
|
- // case "Tasmania":
|
|
|
- // state = 5;
|
|
|
- // break;
|
|
|
- // default:
|
|
|
- // state = 0;
|
|
|
- // break;
|
|
|
- // }
|
|
|
- // return state;
|
|
|
- // }
|
|
|
-
|
|
|
- #endregion Address
|
|
|
-
|
|
|
- // private async void SelectContact_Clicked(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _selectionpage = new ContactSelectionPage(
|
|
|
- // (contact) =>
|
|
|
- // {
|
|
|
- // if (contact != null)
|
|
|
- // {
|
|
|
- // _delivery.Contact.Address.Street = contact.Street;
|
|
|
- // _delivery.Contact.Address.City = contact.City;
|
|
|
- // _delivery.Contact.Address.PostCode = contact.PostCode;
|
|
|
- // _delivery.Contact.Address.State = contact.State;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // );
|
|
|
- // Navigation.PushAsync(_selectionpage);
|
|
|
- // }
|
|
|
- //
|
|
|
- // private void SelectCustomerPage()
|
|
|
- // {
|
|
|
- // //if (_searching)
|
|
|
- // // return;
|
|
|
- // //else
|
|
|
- // //{
|
|
|
- // // _searching = true;
|
|
|
- // // GenericSelectionPage page = new GenericSelectionPage
|
|
|
- // // (
|
|
|
- // // "Select Customer",
|
|
|
- // // new SelectionViewModel<CustomerContact>
|
|
|
- // // (
|
|
|
- // // new Filter<CustomerContact>(x => x.Contact.ID).IsNotEqualTo(Guid.Empty).And(x => x.Contact.Address.Street).IsNotEqualTo(string.Empty),
|
|
|
- // // new Expression<Func<CustomerContact, object>>[] { x => x.Contact.Name, x => x.Contact.Address.Street, x => x.Contact.Address.City },
|
|
|
- // // new Expression<Func<CustomerContact, object>>[] { x => x.Contact.Address.PostCode, x => x.Contact.ID, x => x.Contact },
|
|
|
- // // new SortOrder<CustomerContact>(x => x.Contact.Name)
|
|
|
- // // ));
|
|
|
- // // page.OnItemSelected += (row) =>
|
|
|
- // // {
|
|
|
- // // var customerContact = row.ToObject<CustomerContact>();
|
|
|
- // // _delivery.Contact.Address.Street = customerContact.Contact.Address.Street;
|
|
|
- // // _delivery.Contact.Address.City = customerContact.Contact.Address.City;
|
|
|
- // // _delivery.Contact.Address.PostCode = customerContact.Contact.Address.PostCode;
|
|
|
- // // _delivery.Contact.Address.State = customerContact.Contact.Address.State;
|
|
|
- // // Device.BeginInvokeOnMainThread(() =>
|
|
|
- // // {
|
|
|
- // // streetEdt.Text = _delivery.Contact.Address.Street;
|
|
|
- // // cityEdt.Text = _delivery.Contact.Address.City;
|
|
|
- // // postCodeEdt.Text = _delivery.Contact.Address.PostCode;
|
|
|
- // // ContactNameLbl.Text = _delivery.Contact.Name;
|
|
|
- // // });
|
|
|
- // // };
|
|
|
- // // Navigation.PushAsync(page);
|
|
|
- // //}
|
|
|
- // }
|
|
|
- //
|
|
|
- // private void SelectSupplierPage()
|
|
|
- // {
|
|
|
- // //if (_searching)
|
|
|
- // // return;
|
|
|
- // //else
|
|
|
- // //{
|
|
|
- // // _searching = true;
|
|
|
- // // GenericSelectionPage page = new GenericSelectionPage
|
|
|
- // // (
|
|
|
- // // "Select Supplier",
|
|
|
- // // new SelectionViewModel<SupplierContact>
|
|
|
- // // (
|
|
|
- // // new Filter<SupplierContact>(x => x.Contact.ID).IsNotEqualTo(Guid.Empty).And(x =>x.Contact.Address.Street).IsNotEqualTo(string.Empty),
|
|
|
- // // new Expression<Func<SupplierContact, object>>[] { x => x.Contact.Name, x => x.Contact.Address.Street, x => x.Contact.Address.City },
|
|
|
- // // new Expression<Func<SupplierContact, object>>[] { x => x.Contact.Address.PostCode, x => x.Contact.ID, x => x.Contact },
|
|
|
- // // new SortOrder<SupplierContact>(x => x.Contact.Name)
|
|
|
- // // ));
|
|
|
- // // page.OnItemSelected += (row) =>
|
|
|
- // // {
|
|
|
- // // SupplierContact supplierContact = row.ToObject<SupplierContact>();
|
|
|
- // // _delivery.Contact.ID = supplierContact.Contact.ID;
|
|
|
- // // _delivery.Contact.Address.Street = supplierContact.Contact.Address.Street;
|
|
|
- // // _delivery.Contact.Address.City = supplierContact.Contact.Address.City;
|
|
|
- // // _delivery.Contact.Address.PostCode = supplierContact.Contact.Address.PostCode;
|
|
|
- // // _delivery.Contact.Address.State = supplierContact.Contact.Address.State;
|
|
|
- // // Device.BeginInvokeOnMainThread(() =>
|
|
|
- // // {
|
|
|
- // // streetEdt.Text = _delivery.Contact.Address.Street;
|
|
|
- // // cityEdt.Text = _delivery.Contact.Address.City;
|
|
|
- // // postCodeEdt.Text = _delivery.Contact.Address.PostCode;
|
|
|
- // // ContactNameLbl.Text = _delivery.Contact.Name;
|
|
|
- // // });
|
|
|
- //
|
|
|
- // // };
|
|
|
- // // Navigation.PushAsync(page);
|
|
|
- // //}
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- // private void SelectEmployee_Clicked(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _selectionpage = new EmployeeSelectionPage(
|
|
|
- // (employee) =>
|
|
|
- // {
|
|
|
- // if (employee != null)
|
|
|
- // {
|
|
|
- // _delivery.Employee.ID = employee.ID;
|
|
|
- // _delivery.Employee.Name = employee.Name;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // );
|
|
|
- // Navigation.PushAsync(_selectionpage);
|
|
|
- // }
|
|
|
- //
|
|
|
- // private void DeliveryNotes_Completed(object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _delivery.Notes = deliveryNotesEdt.Text;
|
|
|
- // }
|
|
|
- #endregion
|
|
|
-
|
|
|
- #region last row buttons
|
|
|
- // void ConvertToTaskBtn_Clicked(Object sender, EventArgs e)
|
|
|
- // {
|
|
|
- // _selectionpage = new EmployeeSelectionPage(
|
|
|
- // (employee) =>
|
|
|
- // {
|
|
|
- // if (employee != null)
|
|
|
- // {
|
|
|
- // Kanban kanban = new Kanban();
|
|
|
- // kanban.EmployeeLink.ID = employee.ID;
|
|
|
- // ConfirmPerson(employee.Name, kanban);
|
|
|
- // }
|
|
|
- // }
|
|
|
- // );
|
|
|
- // Navigation.PushAsync(_selectionpage);
|
|
|
- // }
|
|
|
- //
|
|
|
- // async void ConfirmPerson(string name, Kanban kanban)
|
|
|
- // {
|
|
|
- // var confirm = await MaterialDialog.Instance.ConfirmAsync("Confirm send to " + name);
|
|
|
- // if (confirm == true)
|
|
|
- // CreateKanban(kanban);
|
|
|
- // }
|
|
|
-
|
|
|
- // async void CreateKanban(Kanban kanban)
|
|
|
- // {
|
|
|
- // try
|
|
|
- // {
|
|
|
- // convertToTaskBtn.Text = "Saving..";
|
|
|
- // convertToTaskBtn.IsEnabled = false;
|
|
|
- // await Task.Run(() =>
|
|
|
- // {
|
|
|
- // kanban.ManagerLink.ID = App.Data.Me.ID;
|
|
|
- // kanban.Title = "Delivery " + _delivery.Number + System.Environment.NewLine +
|
|
|
- // "Delivery Type: " + _delivery.Type.Description + System.Environment.NewLine +
|
|
|
- // App.Data.Me.Name + " converted to Task for further action";
|
|
|
- // kanban.DueDate = DateTime.Today;
|
|
|
- // kanban.Category = "Open";
|
|
|
- // if (!_delivery.Job.ID.Equals(Guid.Empty)) kanban.JobLink.ID = _delivery.Job.ID;
|
|
|
- // kanban.Description = _delivery.Notes;
|
|
|
- //
|
|
|
- // new Client<Kanban>().Save(kanban, "Kanban Created from Deliveries Module");
|
|
|
- // _delivery.KanbanNumber = kanban.Number;
|
|
|
- // new Client<Delivery>().Save(_delivery, "Updated From Mobile Device");
|
|
|
- //
|
|
|
- // List<KanbanDocument> kanbanDocuments = new List<KanbanDocument>();
|
|
|
- //
|
|
|
- // if (existingDocumentIDs.Count != 0)
|
|
|
- // {
|
|
|
- // foreach (Guid id in existingDocumentIDs)
|
|
|
- // {
|
|
|
- // KanbanDocument kanbanDocument = new KanbanDocument();
|
|
|
- // kanbanDocument.DocumentLink.ID = id;
|
|
|
- // kanbanDocument.EntityLink.ID = kanban.ID;
|
|
|
- // kanbanDocuments.Add(kanbanDocument);
|
|
|
- // }
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- // if (kanbanDocuments.Count != 0)
|
|
|
- // {
|
|
|
- // new Client<KanbanDocument>().Save(kanbanDocuments, "Updated from mobile device");
|
|
|
- // }
|
|
|
- //
|
|
|
- //
|
|
|
- //
|
|
|
- // List<KanbanSubscriber> subscribers = new List<KanbanSubscriber>();
|
|
|
- //
|
|
|
- // KanbanSubscriber sub1 = new KanbanSubscriber();
|
|
|
- // sub1.Kanban.ID = kanban.ID;
|
|
|
- // sub1.Employee.ID = kanban.EmployeeLink.ID;
|
|
|
- // sub1.Assignee = true;
|
|
|
- // subscribers.Add(sub1);
|
|
|
- //
|
|
|
- // //KanbanSubscriber sub2 = new KanbanSubscriber();
|
|
|
- // //sub2.Kanban.ID = kanban.ID;
|
|
|
- // //sub2.Employee.ID = kanban.ManagerLink.ID;
|
|
|
- // //sub2.Manager = true;
|
|
|
- // //if (sub2.Employee.ID != sub1.Employee.ID)
|
|
|
- // // subscribers.Add(sub2);
|
|
|
- //
|
|
|
- // new Client<KanbanSubscriber>().Save(subscribers, "Updated from mobile device");
|
|
|
- //
|
|
|
- // Device.BeginInvokeOnMainThread(() =>
|
|
|
- // {
|
|
|
- // convertToTaskBtn.Text = "Saved To Task " + kanban.Number;
|
|
|
- // });
|
|
|
- // });
|
|
|
- //
|
|
|
- // //save kanban - return kanban ID
|
|
|
- // //load list of photos - save as kanbandocs
|
|
|
- // //save subscribers
|
|
|
- // }
|
|
|
- // catch { }
|
|
|
- // }
|
|
|
- //
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
- private void MobileButton_OnClicked(object sender, MobileButtonClickEventArgs args)
|
|
|
+ private void Complete_Clicked(object sender, MobileButtonClickEventArgs args)
|
|
|
{
|
|
|
-
|
|
|
+ if (ViewModel.Item == null)
|
|
|
+ return;
|
|
|
+ ViewModel.Item.Delivered = ViewModel.Item.Delivered.IsEmpty()
|
|
|
+ ? DateTime.Now
|
|
|
+ : DateTime.MinValue;
|
|
|
+ (sender as MobileButton).BindingContext = null;
|
|
|
+ (sender as MobileButton).BindingContext = ViewModel;
|
|
|
+ DoChanged(nameof(ViewModel.Item.Delivered));
|
|
|
}
|
|
|
|
|
|
|