Ejemplo n.º 1
0
        /// <summary>
        /// On tapped in visits data
        /// </summary>
        /// <param name="s"></param>
        /// <param name="e"></param>
        private async void Visits_Tapped(object s, ItemTappedEventArgs e)
        {
            try
            {
                if (_isExecute)
                {
                    _isExecute = false;
                    var data = e.Item as CreateVisitsList;
                    AppData.PropertyModel.SelectedVisit = null;
                    var iMap = AppData.PropertyModel.SelectedRecord.IndexMap;
                    if (data != null)
                    {
                        iMap = new IndexMapping(iMap.Property, iMap.RequestGroup, iMap.Record, 0, data.VisitListIndex);

                        var details = AppData.PropertyModel.SelectedRecord.Record.Record.Inspections[0].Visits[data.VisitListIndex];
                        //Details.Status = SyncStatus.New;
                        AppData.PropertyModel.SelectedVisit = new SelectedVisit(details, iMap, false);
                    }
                    //await SplitView.Instace().Navigation.PushModalAsync(new VisitActionPage(),true);
                    PageNavigation.PushMainPage(new VisitActionPage());
                    _isExecute = true;
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Public Functions
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        /// Name        LoadActionForm
        /// ------------------------------------------------------------------------------------------------
        /// <summary>
        /// Sets the selected action and displays the actions edit form.
        /// </summary>
        /// <param name="selectedAction">Selected action.</param>
        ///
        /// ------------------------------------------------------------------------------------------------
        ///
        public async Task LoadActionsForm(SelectedAction selectedAction)
        {
            try
            {
                AppData.PropertyModel.SelectedAction = selectedAction;
                // Create the action edit view with a dismiss action
                //  await Navigation.PushModalAsync(new VisitActionDetailsPage());
                PageNavigation.PushMainPage(new VisitActionDetailsPage());
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Ejemplo n.º 3
0
        /// ------------------------------------------------------------------------------------------------

        /// ------------------------------------------------------------------------------------------------
        #region Private functions
        /// <summary>
        /// Item tapped in visits list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ActionsItemTapped(object sender, ItemTappedEventArgs e)
        {
            try
            {
                if (_isExecute)
                {
                    _isExecute = false;
                    PopupContent.DismisPopup();
                    var           items = (GroupedListModel)e.Item;
                    SRiRecordMeta record;
                    record = AppData.PropertyModel.SelectedRecord.Record;
                    var entityKey = Guid.NewGuid().ToString();
                    AppData.PropertyModel.SelectedVisit = new SelectedVisit(new SRiVisitMeta()
                    {
                        Organisation = record.Organisation,
                        EntityMeta   = new SRiEntityMeta("entitykey", entityKey),
                        Received     = "2",
                        ID           = entityKey,
                        Version      = "",
                        Visit        = new SRiVisit()
                        {
                            EntityKey        = entityKey,
                            KeyVal           = OnSiteSettings.NewTempKey,
                            UVersion         = "",
                            InspectionKeyVal = record.Record.Inspections[0].KeyVal,
                            MDKeyVal         = record.Record.Inspections[0].MdKeyVal,
                            MDSubSys         = record.Record.Inspections[0].MdSubSys,
                            IdoxID           = AppData.MainModel.CurrentUser.IdoxId,
                            RecordEntityKey  = record.Record.EntityKey,
                            VisitType        = items.Code,
                            //Officer= AppData.MainModel.Environment!=OnSiteEnvironments.Sales? AppData.MainModel.CurrentUser.OfficerCode(record.Organisation):"Demo",
                        }
                    }, AppData.PropertyModel.SelectedRecord.NewVisitMapping(0), true);
                    AppData.PropertyModel.SelectedVisit.Visit.EntityMeta.StringFields.Add("str_idoxid", AppData.MainModel.CurrentUser.IdoxId);
                    AppData.PropertyModel.SelectedVisit.Visit.Visit.Status = SyncStatus.New;
                    //await SplitView.Instace().Navigation.PushModalAsync(new VisitActionPage(),true);
                    //App.Current.MainPage = new VisitActionPage();
                    PageNavigation.PushMainPage(new VisitActionPage());
                    _isExecute = true;
                }
            }
            catch (Exception ex)
            {
                LogTracking.LogTrace(ex.ToString());
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Displays the Lock screen if the app is idle.
 /// </summary>
 private void ShowLockScreen()
 {
     try
     {
         AppData.MainModel.CurrentUser.IsValidated = false;
         AppContext.AppContext.IsForLockScreen     = true;
         AppContext.AppContext.LoginPage           = new LoginPage();
         if (Device.OS != TargetPlatform.iOS)
         {
             Application.Current.MainPage.Navigation.PushModalAsync(AppContext.AppContext.LoginPage);
         }
         else
         {
             PageNavigation.PushMainPage(AppContext.AppContext.LoginPage);
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }
 ///
 /// ------------------------------------------------------------------------------------------------
 /// Name        ActionItemTapped
 /// ------------------------------------------------------------------------------------------------
 ///
 /// <summary>   Handles the event when action item is tapped
 /// </summary>
 /// ------------------------------------------------------------------------------------------------
 ///
 private async void AddActionsItemTapped(object sender, ItemTappedEventArgs e)
 {
     try
     {
         if (_isExecute)
         {
             _isExecute = false;
             var selectedItem  = ((VisitsActionData)e.Item);
             var selectedIndex = selectedItem.ActionIndex;
             AppData.PropertyModel.SelectedAction =
                 new SelectedAction(AppData.PropertyModel.SelectedVisit.Visit.Visit.Actions[selectedIndex],
                                    AppData.PropertyModel.SelectedVisit.MappingForAction(selectedIndex), false);
             // await Navigation.PushModalAsync(new VisitActionDetailsPage(), true);
             //App.Current.MainPage = new VisitActionDetailsPage();
             PageNavigation.PushMainPage(new VisitActionDetailsPage());
             _isExecute = true;
         }
     }
     catch (Exception ex)
     {
         LogTracking.LogTrace(ex.ToString());
     }
 }