Exemplo n.º 1
0
        public static List <ProjectCount> GetProjectNoteCounts()
        {
            List <ProjectCount> projectNoteCountList = new List <ProjectCount>();
            string       query = @"SELECT projectID, COUNT(*) AS noteCount 
                                FROM notedb.notes
                                GROUP BY projectID";
            MySqlCommand com   = new MySqlCommand(query);

            com.CommandType = System.Data.CommandType.Text;
            DataTable dt = RunNotesQuery(com);

            foreach (DataRow r in dt.Rows)
            {
                ProjectCount pc = new ProjectCount();
                if (!DBNull.Value.Equals(r[0]))
                {
                    pc.projectID = Convert.ToInt32(r[0].ToString());
                }
                else
                {
                    pc.projectID = -1; //No projectID
                }
                pc.noteCount = Convert.ToInt32(r[1].ToString());
                projectNoteCountList.Add(pc);
            }

            return(projectNoteCountList);
        }
Exemplo n.º 2
0
        //   private MobileServiceCollection<, Project> items;



        private async void getProjects()
        {
            items = await projectTable.Where(Project => Project.Owner == Global.GetRepositoryValue("userName").ToString()).ToCollectionAsync();


            foreach (var project in items)
            {
                Debug.Write(project.Id);
                bids = await bidTable.Where(Bid => Bid.ProjectId == project.Id.ToString()).ToCollectionAsync();

                Debug.Write("    count " + bids.Count + "    ");
                var count = new ProjectCount {
                    Project = project, BidCount = (int)bids.Count, Bids = bids.ToList()
                };
                projectCount.Add(count);
            }
            //gridView.ItemsSource = items;
            //  Global.SetRepositoryValue("MyPost", projectCount);
        }
Exemplo n.º 3
0
 private void _ProjectCount_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     SumAll = ProjectCount.Sum();
 }