public EditProjectGrantAllocationRequestsViewData(ProjectSimple project,
                                                   List <GrantAllocationSimple> allGrantAllocations)
     : this(new List <ProjectSimple> {
     project
 }, allGrantAllocations, project.ProjectID, null)
 {
 }
 public EditProjectGrantAllocationExpendituresViewData(ProjectSimple project,
                                                       List <GrantAllocationSimple> allGrantAllocationSimples, List <int> calendarYearRangeForExpenditures,
                                                       bool showNoExpendituresExplanation)
     : this(new List <ProjectSimple> {
     project
 }, allGrantAllocationSimples, project.ProjectID, null, calendarYearRangeForExpenditures, showNoExpendituresExplanation)
 {
 }
        public bool CanExecute(object parameter)
        {
            if (parameter == null)
            {
                return(false);
            }
            ProjectSimple proj          = parameter as ProjectSimple;
            bool          existsAlready = Project.LocalProjectExists(proj.projectId);

            return(!App.Busy && (existsAlready || App.IsConnected));
        }
        public bool CanExecute(object parameter)
        {
            if (parameter == null)
            {
                return(false);
            }
            ProjectSimple proj          = parameter as ProjectSimple;
            bool          existsAlready = Project.LocalProjectExists(proj.projectId);

            return(existsAlready);
        }
 public EditProjectFundingSourceBudgetViewData(ProjectSimple project,
                                               IEnumerable <FundingType> fundingTypes,
                                               List <FundingSourceSimple> allFundingSources,
                                               int?planningDesignStartYear, int?completionYear)
 {
     AllProjects = new List <ProjectSimple> {
         project
     };
     FundingTypes            = fundingTypes.ToSelectList(x => x.FundingTypeID.ToString(CultureInfo.InvariantCulture), y => y.FundingTypeDisplayName);
     AllFundingSources       = allFundingSources;
     ProjectID               = project.ProjectID;
     PlanningDesignStartYear = planningDesignStartYear;
     CompletionYear          = completionYear;
     UseFiscalYears          = MultiTenantHelpers.UseFiscalYears();
 }
        public async void Execute(object parameter)
        {
            ProjectSimple proj          = parameter as ProjectSimple;
            bool          existsAlready = Project.LocalProjectExists(proj.projectId);

            if (existsAlready == true)
            {
                App.SetProject(proj.projectId);
                MessagingCenter.Send <SyncListProjectCommand, ProjectSimple>(this, "ProjectSelected", proj);
            }
            else
            {
                Debug.WriteLine("Syncing: ");
                await Project.DownloadProjectData(proj.projectId);
            }
            App.ZoomMapOut = true;
        }
        /// <summary>
        /// Check whether the project is available locally
        /// </summary>
        /// <param name="project"></param>
        /// <returns>true/false</returns>
        public async Task <bool> CheckProjectStatusAsync(ProjectSimple project)
        {
            string projectId = project.projectId.ToString();
            bool   exists    = Project.LocalProjectExists(projectId);

            if (!exists)
            {
                await Project.DownloadProjectData(project.projectId);
            }
            else
            {
                if (projectId == App.CurrentProjectId)
                {
                    this.SetProject(project.projectId);
                }
            }
            return(true);
        }
        /// <summary>
        /// Delete the project given the simple project (that returned by the user call to the connector api) definition
        /// </summary>
        /// <param name="project"></param>
        /// <returns>Delete successful</returns>
        public static bool DeleteProject(ProjectSimple project)
        {
            try
            {
                Project existingProject = FetchProjectWithChildren(project.projectId);
                if (existingProject != null)
                {
                    using (SQLiteConnection conn = new SQLiteConnection(Preferences.Get("databaseLocation", "")))
                    {
                        conn.Delete(existingProject, true);
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
        public void Execute(object parameter)
        {
            ProjectSimple proj = parameter as ProjectSimple;

            Device.BeginInvokeOnMainThread(async() =>
            {
                var response = await App.Current.MainPage.DisplayActionSheet("Möchten Sie dieses Projekt vom Gerät entfernen?", "Abbrechen", "Entfernen");
                if (response == "Entfernen")
                {
                    Debug.WriteLine("Deleting ");
                    bool success = Project.DeleteProject(proj.projectId);

                    if (App.CurrentProjectId == proj.projectId)
                    {
                        App.SetProject(String.Empty);
                        Preferences.Set("FilterGeometry", String.Empty);
                    }

                    MessagingCenter.Send <Application>(App.Current, "RefreshProjectList");
                }
            });
        }
        /// <summary>
        /// Delete a specific project
        /// </summary>
        /// <param name="project"></param>
        /// <returns>success</returns>
        public bool DeleteProject(ProjectSimple project)
        {
            bool success = Project.DeleteProject(project);

            return(success);
        }