Beispiel #1
0
 private void GetDesignTimeData()
 {
     AllProjects      = projects;
     Activities       = observableCollectionActivities;
     SelectedProjects = new ProjectsCollection(projects);
     SelectedProjects.Add(projects[0]);
 }
        /// <summary Get Collection>
        /// Get collection of emails. If no records to return, EmailCollection will be null.
        /// </summary>
        /// <returns></returns>
        public static ProjectsCollection GetCollection()
        {
            ProjectsCollection tempList = null;

            using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("usp_GetProjects", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollection);

                    myConnection.Open();

                    using (SqlDataReader myReader = myCommand.ExecuteReader())
                    {
                        if (myReader.HasRows)
                        {
                            tempList = new ProjectsCollection();

                            while (myReader.Read())
                            {
                                tempList.Add(FillDataRecord(myReader));
                            }
                        }
                        myReader.Close();
                    }
                }
            }
            return tempList;
        }
Beispiel #3
0
 private void AddNewProject(Project project)
 {
     if (SelectedTile != null)
     {
         // There is a tile selected so add this new project to it's collection of sub projects
         SelectedTile.SubItems.Add(project);
     }
     else
     {
         // No selected tile so project must be top level
         ProjectsCollection.Add(project);
     }
 }
Beispiel #4
0
        private void RefreshData()
        {
            GetRunTimeData();
            var selected = new ProjectsCollection();

            foreach (var oldProject in SelectedProjects)
            {
                //Check if New Project List contains Selected Project
                //Check if New Activity List contains Selected Project Activity
                if (AllProjects.Contains(oldProject) && Activities.Contains(oldProject.Activity))
                {
                    //Get Project from the server(In case Name or other data were changed)
                    var newProject = AllProjects[AllProjects.IndexOf(oldProject)];
                    //Add Project to selected List only if Project and Activity are still available
                    selected.Add(newProject);
                }
            }

            SelectedProjects = selected;
        }
 public static ProjectsCollection GetAll() {
     resourceSchema.Dal.Projects dbo = null;
     try {
         dbo = new resourceSchema.Dal.Projects();
         System.Data.DataSet ds = dbo.Projects_Select_All();
         ProjectsCollection collection = new ProjectsCollection();
         if (GlobalTools.IsSafeDataSet(ds)) {
             for (int i = 0; (i < ds.Tables[0].Rows.Count); i = (i + 1)) {
                 Projects obj = new Projects();
                 obj.Fill(ds.Tables[0].Rows[i]);
                 if ((obj != null)) {
                     collection.Add(obj);
                 }
             }
         }
         return collection;
     }
     catch (System.Exception ) {
         throw;
     }
     finally {
         if ((dbo != null)) {
             dbo.Dispose();
         }
     }
 }