Пример #1
0
        public BarChartMissingIssueCount GetBarChartData(List <int> publisherId)
        {
            BarChartMissingIssueCount barChartMissingIssueCount = new BarChartMissingIssueCount();

            using (SqlConnection con = new SqlConnection(constring))
            {
                foreach (int id in publisherId)
                {
                    try
                    {
                        SqlCommand missingCommand = new SqlCommand("select count(i.id) as count, p.name as publisher from issue i join volume v on i.volume_id = v.id join publisher p on p.id = v.publisher_id where p.id = @id and i.collected = 0 group by p.name", con);
                        missingCommand.Parameters.Add("@id", SqlDbType.Int).Value = id;
                        SqlDataAdapter missingad = new SqlDataAdapter(missingCommand);
                        DataSet        missingds = new DataSet("issueMissingCount");
                        missingad.Fill(missingds);
                        if (missingds.Tables[0].Rows.Count != 0)
                        {
                            int iMissingIssueCount = 0;
                            Int32.TryParse(missingds.Tables[0].Rows[0]["count"].ToString(), out iMissingIssueCount);
                            string strPublisher = missingds.Tables[0].Rows[0]["publisher"].ToString();
                            barChartMissingIssueCount.MissingIssueCountList.Add(new KeyValuePair <string, int>(strPublisher, iMissingIssueCount));
                        }
                    }
                    catch (Exception ex)
                    {
                        string message = ex.Message;
                    }
                }
            }
            return(barChartMissingIssueCount);
        }
Пример #2
0
        public ComicHoarderViewModel()
        {
            repository     = new RepositoryService();
            webDataService = new WebDataService(repository.GetSetting("ComicVineKey"));

            Publishers = new ObservableCollection <Publisher>(repository.GetPublishers());
            if (Publishers.Count() > 0)
            {
                selectedPublisher = Publishers[0].id; //select first publisher
            }

            if (selectedPublisher != 0)                                                                //no publisher selected
            {
                Volumes = new ObservableCollection <Volume>(repository.GetVolumes(selectedPublisher)); //get volumes from selected publisher
                if (Volumes.Count() > 0)
                {
                    selectedVolume = Volumes[0].id; //select first volume
                }
            }
            else
            {
                Volumes = new ObservableCollection <Volume>(); //empty volumes
            }

            if (selectedVolume != 0)
            {
                Issues = new ObservableCollection <Issue>(repository.GetIssues(selectedVolume));
                if (Issues.Count() > 0)
                {
                    selectedIssue = Issues[0].id;
                }
            }
            else
            {
                Issues = new ObservableCollection <Issue>();
            }

            MissingIssues = new ObservableCollection <MissingIssue>(repository.GetMissingIssues(selectedPublisher));

            PieChartRatios = ReloadPieChart(SelectedPublisher);

            BarChartRatios = new ObservableCollection <KeyValuePair <string, int> >();
            List <int> publisherIds = (from p in Publishers
                                       where p.enabled == true
                                       select p.id).ToList();
            BarChartMissingIssueCount barratios = repository.GetBarChartData(publisherIds);

            foreach (KeyValuePair <string, int> barratio in barratios.MissingIssueCountList)
            {
                BarChartRatios.Add(barratio);
            }
            //TODO move default path to config file
            Path = @"D:\Incoming\";
        }
Пример #3
0
        public BarChartMissingIssueCount GetBarChartData(List <int> publisherId)
        {
            BarChartMissingIssueCount barratios = new BarChartMissingIssueCount();

            barratios.MissingIssueCountList.Add(new KeyValuePair <string, int>("Marvel", 5638));
            barratios.MissingIssueCountList.Add(new KeyValuePair <string, int>("Atlas", 2235));
            barratios.MissingIssueCountList.Add(new KeyValuePair <string, int>("Timely", 1244));
            barratios.MissingIssueCountList.Add(new KeyValuePair <string, int>("Icon", 1508));
            barratios.MissingIssueCountList.Add(new KeyValuePair <string, int>("Amalgam", 1007));
            barratios.MissingIssueCountList.Add(new KeyValuePair <string, int>("MAX", 500));
            return(barratios);
        }