private void ChangeCollectionForDiagramm(ObservableCollection <Costs> cCollect, ObservableCollection <Income> iCollect)
        {
            var noduplicatesCosts   = cCollect.Distinct();
            var noduplicatesIncomes = iCollect.Distinct();

            costsStructListNoDuplicates   = new List <CostsStruct>();
            costsStructListAll            = new List <CostsStruct>();
            incomesStructListNoDuplicates = new List <IncomesStruct>();
            incomesStructListAll          = new List <IncomesStruct>();

            /* не повторяющиеся */
            foreach (Costs c in noduplicatesCosts)
            {
                CostsStruct st = new CostsStruct();
                st.Id                 = c.Id;
                st.Summa              = c.Summa;
                st.DateOperation      = c.DateOperation;
                st.PurseId            = c.PurseId;
                st.CostCategoriesId   = c.CostCategoriesId;
                st.CostCategoriesName = c.CostCategories.Name;
                st.Comment            = c.Comment;
                st.CurrencyId         = c.CurrencyId;
                st.CurrencyRate       = c.Currency.Rate;
                st.CurrencyScale      = c.Currency.CurScale;

                costsStructListNoDuplicates.Add(st);
            }
            foreach (Income c in noduplicatesIncomes)
            {
                IncomesStruct st = new IncomesStruct();
                st.Id                   = c.Id;
                st.Summa                = c.Summa;
                st.DateOperation        = c.DateOperation;
                st.PurseId              = c.PurseId;
                st.IncomeCategoriesId   = c.SourceOfIncomeId;
                st.IncomeCategoriesName = c.SourceOfIncome.Name;
                st.Comment              = c.Comment;
                st.CurrencyId           = c.CurrencyId;
                st.CurrencyRate         = c.Currency.Rate;
                st.CurrencyScale        = c.Currency.CurScale;

                incomesStructListNoDuplicates.Add(st);
            }

            /* Все */
            foreach (Costs c in cCollect)
            {
                CostsStruct st = new CostsStruct();
                st.Id                 = c.Id;
                st.Summa              = c.Summa;
                st.DateOperation      = c.DateOperation;
                st.PurseId            = c.PurseId;
                st.CostCategoriesId   = c.CostCategoriesId;
                st.CostCategoriesName = c.CostCategories.Name;
                st.Comment            = c.Comment;
                st.CurrencyId         = c.CurrencyId;
                st.CurrencyRate       = c.Currency.Rate;
                st.CurrencyScale      = c.Currency.CurScale;

                costsStructListAll.Add(st);
            }
            foreach (Income c in iCollect)
            {
                IncomesStruct st = new IncomesStruct();
                st.Id                   = c.Id;
                st.Summa                = c.Summa;
                st.DateOperation        = c.DateOperation;
                st.PurseId              = c.PurseId;
                st.IncomeCategoriesId   = c.SourceOfIncomeId;
                st.IncomeCategoriesName = c.SourceOfIncome.Name;
                st.Comment              = c.Comment;
                st.CurrencyId           = c.CurrencyId;
                st.CurrencyRate         = c.Currency.Rate;
                st.CurrencyScale        = c.Currency.CurScale;

                incomesStructListAll.Add(st);
            }

            //не повторяющие в BYN
            for (int i = 0; i < costsStructListNoDuplicates.Count; i++)
            {
                double summa = 0;
                summa = costsStructListNoDuplicates[i].Summa * costsStructListNoDuplicates[i].CurrencyRate / costsStructListNoDuplicates[i].CurrencyScale;
                costsStructListNoDuplicates[i] = new CostsStruct(costsStructListNoDuplicates[i].Id, summa, costsStructListNoDuplicates[i].DateOperation,
                                                                 costsStructListNoDuplicates[i].PurseId, costsStructListNoDuplicates[i].CostCategoriesId, costsStructListNoDuplicates[i].CostCategoriesName, costsStructListNoDuplicates[i].Comment,
                                                                 costsStructListNoDuplicates[i].CurrencyId, costsStructListNoDuplicates[i].CurrencyRate, costsStructListNoDuplicates[i].CurrencyScale);
            }
            for (int i = 0; i < incomesStructListNoDuplicates.Count; i++)
            {
                double summa = 0;
                summa = incomesStructListNoDuplicates[i].Summa * incomesStructListNoDuplicates[i].CurrencyRate / incomesStructListNoDuplicates[i].CurrencyScale;
                incomesStructListNoDuplicates[i] = new IncomesStruct(incomesStructListNoDuplicates[i].Id, summa, incomesStructListNoDuplicates[i].DateOperation,
                                                                     incomesStructListNoDuplicates[i].PurseId, incomesStructListNoDuplicates[i].IncomeCategoriesId, incomesStructListNoDuplicates[i].IncomeCategoriesName, incomesStructListNoDuplicates[i].Comment,
                                                                     incomesStructListNoDuplicates[i].CurrencyId, incomesStructListNoDuplicates[i].CurrencyRate, incomesStructListNoDuplicates[i].CurrencyScale);
            }
            /* Все в BYN */
            for (int i = 0; i < costsStructListAll.Count; i++)
            {
                double summa = 0;
                summa = costsStructListAll[i].Summa * costsStructListAll[i].CurrencyRate / costsStructListAll[i].CurrencyScale;
                costsStructListAll[i] = new CostsStruct(costsStructListAll[i].Id, summa, costsStructListAll[i].DateOperation,
                                                        costsStructListAll[i].PurseId, costsStructListAll[i].CostCategoriesId, costsStructListAll[i].CostCategoriesName, costsStructListAll[i].Comment,
                                                        costsStructListAll[i].CurrencyId, costsStructListAll[i].CurrencyRate, costsStructListAll[i].CurrencyScale);
            }
            for (int i = 0; i < incomesStructListAll.Count; i++)
            {
                double summa = 0;
                summa = incomesStructListAll[i].Summa * incomesStructListAll[i].CurrencyRate / incomesStructListAll[i].CurrencyScale;
                incomesStructListAll[i] = new IncomesStruct(incomesStructListAll[i].Id, summa, incomesStructListAll[i].DateOperation,
                                                            incomesStructListAll[i].PurseId, incomesStructListAll[i].IncomeCategoriesId, incomesStructListAll[i].IncomeCategoriesName, incomesStructListAll[i].Comment,
                                                            incomesStructListAll[i].CurrencyId, incomesStructListAll[i].CurrencyRate, incomesStructListAll[i].CurrencyScale);
            }

            /* Сумирование одинаковых категорий */
            for (int i = 0; i < costsStructListNoDuplicates.Count; i++)
            {
                for (int j = 0; j < costsStructListAll.Count; j++)
                {
                    if (costsStructListNoDuplicates[i].Id != costsStructListAll[j].Id)
                    {
                        if (costsStructListNoDuplicates[i].CostCategoriesId == costsStructListAll[j].CostCategoriesId)
                        {
                            double tempSumma = costsStructListAll[j].Summa + costsStructListNoDuplicates[i].Summa;
                            costsStructListNoDuplicates[i] = new CostsStruct(costsStructListNoDuplicates[i].Id, tempSumma, costsStructListNoDuplicates[i].DateOperation,
                                                                             costsStructListNoDuplicates[i].PurseId, costsStructListNoDuplicates[i].CostCategoriesId, costsStructListNoDuplicates[i].CostCategoriesName, costsStructListNoDuplicates[i].Comment,
                                                                             costsStructListNoDuplicates[i].CurrencyId, costsStructListNoDuplicates[i].CurrencyRate, costsStructListNoDuplicates[i].CurrencyScale);
                        }
                    }
                }
            }
            for (int i = 0; i < incomesStructListNoDuplicates.Count; i++)
            {
                for (int j = 0; j < incomesStructListAll.Count; j++)
                {
                    if (incomesStructListNoDuplicates[i].Id != incomesStructListAll[j].Id)
                    {
                        if (incomesStructListNoDuplicates[i].IncomeCategoriesId == incomesStructListAll[j].IncomeCategoriesId)
                        {
                            double tempSumma = incomesStructListAll[j].Summa + incomesStructListNoDuplicates[i].Summa;
                            incomesStructListNoDuplicates[i] = new IncomesStruct(incomesStructListNoDuplicates[i].Id, tempSumma, incomesStructListNoDuplicates[i].DateOperation,
                                                                                 incomesStructListNoDuplicates[i].PurseId, incomesStructListNoDuplicates[i].IncomeCategoriesId, incomesStructListNoDuplicates[i].IncomeCategoriesName, incomesStructListNoDuplicates[i].Comment,
                                                                                 incomesStructListNoDuplicates[i].CurrencyId, incomesStructListNoDuplicates[i].CurrencyRate, incomesStructListNoDuplicates[i].CurrencyScale);
                        }
                    }
                }
            }
            List <CostsIncomeStatistic> statistic = new List <CostsIncomeStatistic>();

            statistic.Add(new CostsIncomeStatistic()
            {
                Name = "Расходы", Summa = GetSumma(costsStructListNoDuplicates)
            });
            statistic.Add(new CostsIncomeStatistic()
            {
                Name = "Доходы", Summa = GetSumma(incomesStructListNoDuplicates)
            });
            (PieChart.Series[0] as PieSeries).ItemsSource       = statistic;
            (ColumnChart.Series[0] as ColumnSeries).ItemsSource = statistic;
        }
        private void ChangeCollectionForDiagramm(ObservableCollection <Income> collect)
        {
            ObservableCollection <Income> incomeCollectionCopy = new ObservableCollection <Income>(collect);
            var noduplicates = incomeCollectionCopy.Distinct();

            incomesStructListNoDuplicates = new List <IncomesStruct>();
            incomesStructListAll          = new List <IncomesStruct>();

            /* не повторяющиеся */
            foreach (Income c in noduplicates)
            {
                IncomesStruct st = new IncomesStruct();
                st.Id                   = c.Id;
                st.Summa                = c.Summa;
                st.DateOperation        = c.DateOperation;
                st.PurseId              = c.PurseId;
                st.IncomeCategoriesId   = c.SourceOfIncomeId;
                st.IncomeCategoriesName = c.SourceOfIncome.Name;
                st.Comment              = c.Comment;
                st.CurrencyId           = c.CurrencyId;
                st.CurrencyRate         = c.Currency.Rate;
                st.CurrencyScale        = c.Currency.CurScale;

                incomesStructListNoDuplicates.Add(st);
            }
            /* Все */
            foreach (Income c in incomeCollectionCopy)
            {
                IncomesStruct st = new IncomesStruct();
                st.Id                   = c.Id;
                st.Summa                = c.Summa;
                st.DateOperation        = c.DateOperation;
                st.PurseId              = c.PurseId;
                st.IncomeCategoriesId   = c.SourceOfIncomeId;
                st.IncomeCategoriesName = c.SourceOfIncome.Name;
                st.Comment              = c.Comment;
                st.CurrencyId           = c.CurrencyId;
                st.CurrencyRate         = c.Currency.Rate;
                st.CurrencyScale        = c.Currency.CurScale;

                incomesStructListAll.Add(st);
            }

            //не повторяющие в BYN
            for (int i = 0; i < incomesStructListNoDuplicates.Count; i++)
            {
                double summa = 0;
                summa = incomesStructListNoDuplicates[i].Summa * incomesStructListNoDuplicates[i].CurrencyRate / incomesStructListNoDuplicates[i].CurrencyScale;
                incomesStructListNoDuplicates[i] = new IncomesStruct(incomesStructListNoDuplicates[i].Id, summa, incomesStructListNoDuplicates[i].DateOperation,
                                                                     incomesStructListNoDuplicates[i].PurseId, incomesStructListNoDuplicates[i].IncomeCategoriesId, incomesStructListNoDuplicates[i].IncomeCategoriesName, incomesStructListNoDuplicates[i].Comment,
                                                                     incomesStructListNoDuplicates[i].CurrencyId, incomesStructListNoDuplicates[i].CurrencyRate, incomesStructListNoDuplicates[i].CurrencyScale);
            }
            /* Все в BYN */
            for (int i = 0; i < incomesStructListAll.Count; i++)
            {
                double summa = 0;
                summa = incomesStructListAll[i].Summa * incomesStructListAll[i].CurrencyRate / incomesStructListAll[i].CurrencyScale;
                incomesStructListAll[i] = new IncomesStruct(incomesStructListAll[i].Id, summa, incomesStructListAll[i].DateOperation,
                                                            incomesStructListAll[i].PurseId, incomesStructListAll[i].IncomeCategoriesId, incomesStructListAll[i].IncomeCategoriesName, incomesStructListAll[i].Comment,
                                                            incomesStructListAll[i].CurrencyId, incomesStructListAll[i].CurrencyRate, incomesStructListAll[i].CurrencyScale);
            }

            for (int i = 0; i < incomesStructListNoDuplicates.Count; i++)
            {
                for (int j = 0; j < incomesStructListAll.Count; j++)
                {
                    if (incomesStructListNoDuplicates[i].Id != incomesStructListAll[j].Id)
                    {
                        if (incomesStructListNoDuplicates[i].IncomeCategoriesId == incomesStructListAll[j].IncomeCategoriesId)
                        {
                            double tempSumma = incomesStructListAll[j].Summa + incomesStructListNoDuplicates[i].Summa;
                            incomesStructListNoDuplicates[i] = new IncomesStruct(incomesStructListNoDuplicates[i].Id, tempSumma, incomesStructListNoDuplicates[i].DateOperation,
                                                                                 incomesStructListNoDuplicates[i].PurseId, incomesStructListNoDuplicates[i].IncomeCategoriesId, incomesStructListNoDuplicates[i].IncomeCategoriesName, incomesStructListNoDuplicates[i].Comment,
                                                                                 incomesStructListNoDuplicates[i].CurrencyId, incomesStructListNoDuplicates[i].CurrencyRate, incomesStructListNoDuplicates[i].CurrencyScale);
                        }
                    }
                }
            }
            (PieChartIncome.Series[0] as PieSeries).ItemsSource       = incomesStructListNoDuplicates;
            (ColumnChartIncome.Series[0] as ColumnSeries).ItemsSource = incomesStructListNoDuplicates;
        }