private void CreateLineSeries(ChartValues <double> values, bool isBuyer, string name)
 {
     dispatcher.InvokeAsync(() =>
     {
         SolidColorBrush brush = Brushes.Red;
         if (isBuyer)
         {
             brush = Brushes.Green;
         }
         if (!Series.Any(x => x.Title == name))
         {
             Series.Add(new LineSeries()
             {
                 Values          = values,
                 StrokeThickness = 1,
                 Stroke          = brush,
                 PointGeometry   = null,
                 StrokeDashArray = new DoubleCollection()
                 {
                     4
                 },
                 Fill  = Brushes.Transparent,
                 Title = name
             });
         }
     });
 }
示例#2
0
        public async Task <ServiceResult <IEnumerable <Series> > > GetSeriesAsync(bool force = false)
        {
            using (logger.BeginScope("Get Series"))
            {
                logger.LogInformation($"Fetching Series");

                if (Series == null || !Series.Any() || force)
                {
                    var seriesRequest = await RequestSeries();

                    if (seriesRequest.Success)
                    {
                        applicationService.Series = seriesRequest.Results;
                    }
                    else
                    {
                        return(seriesRequest);
                    }
                }

                if (!string.IsNullOrWhiteSpace(SeriesFilter))
                {
                    return(new(true, FilterSeries(Series.JsonClone().AsQueryable(), SeriesFilter, SeriesFilterValues)));
                }

                return(new(true, Series));
            }
        }
示例#3
0
        /// <summary>
        /// Collection of collections of colors for usage in DstChart.
        /// </summary>
        private List <Color> getColorCollection()
        {
            var colors = new List <Color>();

            if (!Series.Any(x => PxChartExtensions.ChartTypesStacked.Contains(x.ChartType)))
            {
                for (int i = 0; i < ColorCollections.Max(x => x.Count()); i++)
                {
                    foreach (var c in ColorCollections)
                    {
                        if (c.Count() > i)
                        {
                            colors.Add(c[i]);
                        }
                    }
                }
            }
            else
            {
                int cpc = (int)Math.Ceiling(Convert.ToDecimal(Series.Count) / Convert.ToDecimal(ColorCollections.Count));

                colors.AddRange(
                    ColorCollections.SelectMany(x => x.Take(cpc))
                    );
            }

            return(colors.Distinct().ToList());
        }
        public Series AddSeries(Series series)
        {
            series.SeriesId = Series.Any() ? Series.Max(s => s.SeriesId) + 1 : 1;
            Series.Add(series);

            return(series);
        }
示例#5
0
        public int GetSum(ResultType resultType, int range)
        {
            int sum = 0;

            if (Series == null || !Series.Any())
            {
                return(0);
            }

            foreach (var serie in Series)
            {
                sum += GetValue(resultType, serie, range);
            }

            return(sum);
        }
示例#6
0
        public int GetSum(ResultType resultType, int countingShots)
        {
            int sum = 0;

            if (Series == null || !Series.Any())
            {
                return(0);
            }

            foreach (var serie in Series)
            {
                sum += GetValue(resultType, countingShots, serie);
            }

            return(sum);
        }
示例#7
0
文件: PxChart.cs 项目: trygu/PxWeb
        private void adjust()
        {
            if (AsPopulationPyramid)
            {
                return;
            }

            SaveImage(Stream.Null, ChartImageFormat.Png);

            adjustAxis(ChartAreas["Main"].AxisX);
            adjustAxis(ChartAreas["Main"].AxisY);

            if (Series.Any(x => x.YAxisType == AxisType.Secondary))
            {
                adjustAxis(ChartAreas["Main"].AxisY2);
            }
        }
示例#8
0
        private async Task HomePageAppears()
        {
            Loading.IsRunning = true;
            var Mainapp = Application.Current as App;

            var movieList = await itemViewModel.GetMovies(Mainapp.Email);

            var serieList = await itemViewModel.GetSeries(Mainapp.Email);

            var gameList = await itemViewModel.GetGames(Mainapp.Email);

            //List reversed to show people last items.
            Movies.Reverse();
            Series.Reverse();
            Games.Reverse();
            foreach (var item in movieList)
            {
                if (!Movies.Any((arg) => arg.ItemID == item.ItemID && arg.PublisherEmail == Mainapp.Email))
                {
                    Movies.Add(item);
                }
            }
            foreach (var item in serieList)
            {
                if (!Series.Any((arg) => arg.ItemID == item.ItemID && arg.PublisherEmail == Mainapp.Email))
                {
                    Series.Add(item);
                }
            }
            foreach (var item in gameList)
            {
                if (!Games.Any((arg) => arg.ItemID == item.ItemID && arg.PublisherEmail == Mainapp.Email))
                {
                    Games.Add(item);
                }
            }

            Loading.IsRunning = false;
        }
示例#9
0
        public async Task <ServiceResult <List <string> > > GetValuesForPropertyAsync(string property)
        {
            using (logger.BeginScope("Get Values for Property"))
            {
                logger.LogDebug($"Property name: {property}");

                if (Series.Any())
                {
                    var        selectManySplit = property.Split("|");
                    IQueryable series          = Series.AsQueryable();

                    for (int i = 0; i < selectManySplit.Length - 1; i++)
                    {
                        series = series.SelectMany(selectManySplit[i]);
                    }

                    return(new ServiceResult <List <string> >(true, series.GroupBy(selectManySplit.Last()).OrderBy("Count() desc").ThenBy("Key").Select("Key").ToDynamicArray <string>().Where(x => !string.IsNullOrEmpty(x)).ToList()));
                }

                var seriesResult = await RequestSeries();

                return(new ServiceResult <List <string> >(seriesResult.Success, seriesResult.ErrorCode, seriesResult.ErrorMessage));
            }
        }
示例#10
0
        internal override string GenerarFiltrosColumnas()
        {
            var sb   = new StringBuilder();
            var flag = true;

            ValoresParametros.Clear();
            Condiciones.Clear();
            sb.Append(" p.empresa = '" + Empresa + "' ");

            if (Series?.Any() ?? false)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                foreach (var item in Series)
                {
                    ValoresParametros.Add(item, item);
                }

                sb.Append(" p.fkseries in ( " + string.Join(", ", Series.ToArray().Select(f => "@" + f)) + " ) ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.SeriesListado, string.Join(", ", Series.ToArray())));
                flag = true;
            }

            if (Estados?.Any() ?? false)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                sb.Append(" p.fkestados in ( " + string.Join(", ", Estados.ToArray().Select(f => "'" + f + "'")) + " ) ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.Estado, string.Join(", ", Estados.Select(f => ListEstados.First(j => j.CampoId == f).Descripcion))));
                flag = true;
            }

            if (FechaDesde.HasValue)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fechadesde", FechaDesde.Value);
                sb.Append(" p.fechadocumento>=@fechadesde ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.FechaDesde, FechaDesde));
                flag = true;
            }

            if (FechaHasta.HasValue)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fechahasta", FechaHasta.Value);
                sb.Append(" p.fechadocumento<=@fechahasta ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.FechaHasta, FechaHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(CuentaDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("cuentadesde", CuentaDesde);
                sb.AppendFormat(" p.{0}>=@cuentadesde ", _columnatercero);
                Condiciones.Add(string.Format("{0}: {1}", Rcuentas.CuentaDesde, CuentaDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(CuentaHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("cuentahasta", CuentaHasta);
                sb.AppendFormat(" p.{0}<=@cuentahasta ", _columnatercero);
                Condiciones.Add(string.Format("{0}: {1}", Rcuentas.CuentaHasta, CuentaHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkarticulosDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkarticulosdesde", FkarticulosDesde);
                sb.Append(" pl.fkarticulos >= @fkarticulosdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.FkarticulosDesde, FkarticulosDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkarticulosHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkarticuloshasta", FkarticulosHasta);
                sb.Append(" pl.fkarticulos <= @fkarticuloshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.FkarticulosHasta, FkarticulosHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Fkfamiliasmateriales))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }
                AppService = new ApplicationHelper(Context);
                ValoresParametros.Add("fkfamiliasmateriales", Fkfamiliasmateriales);
                sb.Append("  exists(select mm.* from materiales as mm where mm.id=Substring(pl.fkarticulos,3,3) and mm.fkfamiliamateriales=@fkfamiliasmateriales)  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.FamiliaMateriales, AppService.GetListFamiliaMateriales().SingleOrDefault(f => f.Valor == Fkfamiliasmateriales).Descripcion));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkfamiliasDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkfamiliasdesde", FkfamiliasDesde);
                sb.Append(" Substring(pl.fkarticulos,0,3) >= @fkfamiliasdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.FamiliaDesde, FkfamiliasDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkfamiliasHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkfamiliashasta", FkfamiliasHasta);
                sb.Append(" Substring(pl.fkarticulos,0,3) <= @fkfamiliashasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.FamiliaHasta, FkfamiliasHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkmaterialesDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkmaterialesdesde", FkmaterialesDesde);
                sb.Append(" Substring(pl.fkarticulos,3,3) >= @fkmaterialesdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.MaterialesDesde, FkmaterialesDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkmaterialesHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkmaterialeshasta", FkmaterialesHasta);
                sb.Append(" Substring(pl.fkarticulos,3,3) <= @fkmaterialeshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.MaterialesHasta, FkmaterialesHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkcaracteristicasDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkcaracteristicasdesde", FkcaracteristicasDesde);
                sb.Append(" Substring(pl.fkarticulos,6,2) >= @fkcaracteristicasdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.CaracteristicasDesde, FkcaracteristicasDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkcaracteristicasHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkcaracteristicashasta", FkcaracteristicasHasta);
                sb.Append(" Substring(pl.fkarticulos,6,2) <= @fkcaracteristicashasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.CaracteristicasHasta, FkcaracteristicasHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkgrosoresDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkgrosoresdesde", FkgrosoresDesde);
                sb.Append(" Substring(pl.fkarticulos,8,2) >= @fkgrosoresdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.GrosoresDesde, FkgrosoresDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkgrosoresHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkgrosoreshasta", FkgrosoresHasta);
                sb.Append(" Substring(pl.fkarticulos,8,2) <= @fkgrosoreshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.GrosoresHasta, FkgrosoresHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkacabadosDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkacabadosdesde", FkacabadosDesde);
                sb.Append(" Substring(pl.fkarticulos,10,2) >= @fkacabadosdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.AcabadosDesde, FkacabadosDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkacabadosHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkacabadoshasta", FkacabadosHasta);
                sb.Append(" Substring(pl.fkarticulos,10,2) <= @fkacabadoshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RAlbaranes.AcabadosHasta, FkacabadosHasta));
                flag = true;
            }



            return(sb.ToString());
        }
示例#11
0
        ///<inheritdoc/>
        public override void Redraw(Rect bounds)
        {
            if (CellSize.X == 0 || CellSize.Y == 0)
            {
                throw new Exception($"{nameof(CellSize)} cannot be 0");
            }

            SetDriverColorToGraphColor();

            Move(0, 0);

            // clear all old content
            for (int i = 0; i < Bounds.Height; i++)
            {
                Move(0, i);
                Driver.AddStr(new string (' ', Bounds.Width));
            }

            // If there is no data do not display a graph
            if (!Series.Any() && !Annotations.Any())
            {
                return;
            }

            // Draw 'before' annotations
            foreach (var a in Annotations.Where(a => a.BeforeSeries))
            {
                a.Render(this);
            }

            SetDriverColorToGraphColor();

            AxisY.DrawAxisLine(this);
            AxisX.DrawAxisLine(this);

            AxisY.DrawAxisLabels(this);
            AxisX.DrawAxisLabels(this);

            // Draw a cross where the two axis cross
            var axisIntersection = new Point(AxisY.GetAxisXPosition(this), AxisX.GetAxisYPosition(this));

            if (AxisX.Visible && AxisY.Visible)
            {
                Move(axisIntersection.X, axisIntersection.Y);
                AddRune(axisIntersection.X, axisIntersection.Y, '\u253C');
            }

            SetDriverColorToGraphColor();

            // The drawable area of the graph (anything that isn't in the margins)
            Rect       drawBounds = new Rect((int)MarginLeft, 0, Bounds.Width - ((int)MarginLeft), Bounds.Height - (int)MarginBottom);
            RectangleF graphSpace = ScreenToGraphSpace(drawBounds);

            foreach (var s in Series)
            {
                s.DrawSeries(this, drawBounds, graphSpace);

                // If a series changes the graph color reset it
                SetDriverColorToGraphColor();
            }

            SetDriverColorToGraphColor();

            // Draw 'after' annotations
            foreach (var a in Annotations.Where(a => !a.BeforeSeries))
            {
                a.Render(this);
            }
        }
示例#12
0
 private bool ColorIsBusy(OxyColor color)
 {
     return(Series.Any(series => ((ColumnSeries)series).FillColor.Equals(color)));
 }
        internal override string GenerarFiltrosColumnas()
        {
            var sb = new StringBuilder();
            var flag = true;
            ValoresParametros.Clear();
            Condiciones.Clear();
            sb.Append(" fa.empresa = '" + Empresa + "' ");
            

            if (Series?.Any() ?? false)
            {
                if (flag)
                    sb.Append(" AND ");

                foreach (var item in Series)
                    ValoresParametros.Add(item, item);

                sb.Append(" fa.fkseries in ( " + string.Join(", ", Series.ToArray().Select(f => "@" + f)) + " ) ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.SeriesListado, string.Join(", ", Series.ToArray())));
                flag = true;
            }
            if (!string.IsNullOrEmpty(Estado) && !Estado.Equals("0-"))
            {
                if (flag)
                    sb.Append(" AND ");

                ValoresParametros.Add("estado", Estado);
                sb.Append(" fa.fkestados=@estado ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.Estado, Estados?.First(f => f.CampoId == Estado).Descripcion??string.Empty));
                flag = true;
            }
            if (FechaDesde.HasValue)
            {
                if (flag)
                    sb.Append(" AND ");

                ValoresParametros.Add("fechadesde", FechaDesde.Value);
                sb.Append(" fa.fechadocumento>=@fechadesde ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FechaDesde, FechaDesde));
                flag = true;
            }

            if (FechaHasta.HasValue)
            {
                if (flag)
                    sb.Append(" AND ");

                ValoresParametros.Add("fechahasta", FechaHasta.Value);
                sb.Append(" fa.fechadocumento<=@fechahasta ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FechaHasta, FechaHasta));
                flag = true;
            }

            var tipocuenta = Tipo == TipoComision.Agentes ? "fkagentes" : "fkcomerciales";

            if (!string.IsNullOrEmpty(CuentaDesde))
            {
                if (flag)
                    sb.Append(" AND ");

                ValoresParametros.Add("cuentadesde", CuentaDesde);
                sb.AppendFormat(" fa.{0}>=@cuentadesde ", tipocuenta);
                Condiciones.Add(string.Format("{0}: {1}", Funciones.GetEnumByStringValueAttribute(Tipo), CuentaDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(CuentaHasta))
            {
                if (flag)
                    sb.Append(" AND ");

                ValoresParametros.Add("cuentahasta", CuentaHasta);
                sb.AppendFormat(" fa.{0}<=@cuentahasta ", tipocuenta);
                Condiciones.Add(string.Format("{0}: {1}", Funciones.GetEnumByStringValueAttribute(Tipo), CuentaHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(SituacionComision))
            {
                if (flag)
                    sb.Append(" AND ");

                ValoresParametros.Add("situacioncomision", SituacionComision);
                sb.AppendFormat(" fa.fksituacioncomision=@situacioncomision ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.Fksituacioncomision, SituacionComision));
                flag = true;
            }
            if (flag)
                    sb.Append(" AND ");
                sb.AppendFormat(" (fa.{0} is not null and fa.{0} <>'' )", tipocuenta);
                flag = true;
            
            return sb.ToString();
        }
示例#14
0
        public List <string> CalculateValidSeriesForRange(RangeViewModel rangeViewModel)
        {
            if (Series == null || !Series.Any())
            {
                return(new List <string>());
            }

            ValidSeries = new List <string>();

            foreach (var serie in Series)
            {
                string rawSerie = serie;
                if (string.IsNullOrEmpty(rawSerie))
                {
                    ValidSeries.Add(string.Empty);
                }
                else
                {
                    if (rangeViewModel.DoubleRange)
                    {
                        int totlen = rangeViewModel.CountingShoots;
                        if (rawSerie.Length < totlen)
                        {
                            totlen = rawSerie.Length;
                        }

                        string rawserie = rawSerie.Substring(0, totlen);

                        int    numeachSerie = rangeViewModel.CountingShoots / 2;
                        string serie1       = string.Empty;
                        string serie2       = string.Empty;
                        if (totlen < numeachSerie)
                        {
                            serie1 = rawserie.Substring(0, totlen);
                            if (totlen < numeachSerie)
                            {
                                int padLen = totlen;
                                //Pad 0
                                while (padLen < numeachSerie)
                                {
                                    serie1 = serie1 + "0";
                                    padLen++;
                                }
                            }
                        }
                        else
                        {
                            serie1 = rawserie.Substring(0, numeachSerie);
                            int len2 = totlen - numeachSerie;
                            if (len2 > 0)
                            {
                                serie2 = rawserie.Substring(numeachSerie, len2);
                            }
                            int s2len = serie2.Length;
                            while (s2len < numeachSerie)
                            {
                                serie2 = serie2 + "0";
                                s2len++;
                            }
                        }

                        ValidSeries.Add(serie1);
                        ValidSeries.Add(serie2);
                    }
                    else
                    {
                        int len = rangeViewModel.CountingShoots;

                        if (rawSerie.Length < rangeViewModel.CountingShoots)
                        {
                            len = rawSerie.Length;
                        }
                        string serieSingle = rawSerie.Substring(0, len);
                        int    slen        = serieSingle.Length;
                        while (slen < rangeViewModel.CountingShoots)
                        {
                            serieSingle = serieSingle + "0";
                            slen++;
                        }

                        ValidSeries.Add(serieSingle);
                    }
                }
            }

            return(ValidSeries);
        }
示例#15
0
        internal override string GenerarFiltrosColumnas()
        {
            var sb   = new StringBuilder();
            var flag = true;

            ValoresParametros.Clear();
            Condiciones.Clear();
            sb.Append(" p.empresa = '" + Empresa + "' ");

            if (Series?.Any() ?? false)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                foreach (var item in Series)
                {
                    ValoresParametros.Add(item, item);
                }

                sb.Append(" p.fkseries in ( " + string.Join(", ", Series.ToArray().Select(f => "@" + f)) + " ) ");
                Condiciones.Add(string.Format("{0}: {1}", RPresupuestosCompras.SeriesListado, string.Join(", ", Series.ToArray())));
                flag = true;
            }
            if (!string.IsNullOrEmpty(Estado) && !Estado.Equals("0-"))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("estado", Estado);
                sb.Append(" p.fkestados=@estado ");
                Condiciones.Add(string.Format("{0}: {1}", RPresupuestosCompras.Estado, Estados.First(f => f.CampoId == Estado).Descripcion));
                flag = true;
            }

            if (FechaDesde.HasValue)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fechadesde", FechaDesde.Value);
                sb.Append(" p.fechadocumento>=@fechadesde ");
                Condiciones.Add(string.Format("{0}: {1}", RPresupuestosCompras.FechaDesde, FechaDesde));
                flag = true;
            }

            if (FechaHasta.HasValue)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fechahasta", FechaHasta.Value);
                sb.Append(" p.fechadocumento<=@fechahasta ");
                Condiciones.Add(string.Format("{0}: {1}", RPresupuestosCompras.FechaHasta, FechaHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(CuentaDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("cuentadesde", CuentaDesde);
                sb.Append(" p.fkproveedores>=@cuentadesde ");
                Condiciones.Add(string.Format("{0}: {1}", Rcuentas.CuentaDesde, CuentaDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(CuentaHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("cuentahasta", CuentaHasta);
                sb.Append(" p.fkproveedores<=@cuentahasta ");
                Condiciones.Add(string.Format("{0}: {1}", Rcuentas.CuentaHasta, CuentaHasta));
                flag = true;
            }


            if (!string.IsNullOrEmpty(Fkfamiliacliente))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkfamiliacliente", Fkfamiliacliente);
                sb.Append(" c.fkfamiliaproveedor=@fkfamiliacliente ");
                Condiciones.Add(string.Format("{0}: {1}", RProveedores.Fkfamiliaproveedor, Fkfamiliacliente));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Fkzonacliente))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkzonacliente", Fkzonacliente);
                sb.Append(" c.fkzonaproveedor=@fkzonacliente ");
                Condiciones.Add(string.Format("{0}: {1}", RProveedores.Fkzonaproveedor, Fkzonacliente));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Agente))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("agente", Agente);
                sb.Append(" p.fkagentes = @agente ");
                Condiciones.Add(string.Format("{0}: {1}", RClientes.Fkcuentasagente, Agente));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Comercial))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("comercial", Comercial);
                sb.Append(" p.fkcomerciales = @comercial ");
                Condiciones.Add(string.Format("{0}: {1}", RClientes.Fkcuentascomercial, Comercial));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Fkpais))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }
                AppService = new ApplicationHelper(Context);
                ValoresParametros.Add("pais", Fkpais);
                sb.Append(" di.fkpais  =@pais ");
                Condiciones.Add(string.Format("{0}: {1}", RDireccion.Fkpais, AppService.GetListPaises().SingleOrDefault(f => f.Valor == Fkpais).Descripcion));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Fkmonedas))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }
                var serviceMonedas = FService.Instance.GetService(typeof(MonedasModel), Context);

                ValoresParametros.Add("Fkmonedas", Fkmonedas);
                sb.Append(" p.fkmonedas  =@Fkmonedas ");
                Condiciones.Add(string.Format("{0}: {1}", RPresupuestosCompras.Fkmonedas, serviceMonedas.getAll().Select(f => (MonedasModel)f).SingleOrDefault(f => f.Id == int.Parse(Fkmonedas)).Descripcion));
                flag = true;
            }

            return(sb.ToString());
        }
示例#16
0
        private void UpdateGroupedSeries()
        {
            // data validation
            Exceptions.Clear();

            // ensure that caption of series is not null, otherwise all other series would be ignored (data from the same series are collection to the same datapointgroup)
            if (Series.Any(series => string.IsNullOrEmpty(series.SeriesTitle)))
            {
                Exceptions.Add("Series with empty caption cannot be used.");
            }

            //ensure that each series has a different name
            if (Series.GroupBy(series => series.SeriesTitle).Any(group => group.Count() > 1))
            {
                Exceptions.Add("Series with duplicate name cannot be used.");
            }

            if (!HasExceptions)
            {
                List <DataPointGroup> result = new List <DataPointGroup>();
                try
                {
                    if (GetIsRowColumnSwitched())
                    {
                        ///sammle erst alle Gruppen zusammen
                        foreach (ChartSeries initialSeries in Series)
                        {
                            int itemIndex = 0;
                            foreach (var seriesItem in initialSeries.Items)
                            {
                                string         seriesItemCaption = GetPropertyValue(seriesItem, initialSeries.DisplayMember); //Security
                                DataPointGroup dataPointGroup    = result.Where(group => group.Caption == seriesItemCaption).FirstOrDefault();
                                if (dataPointGroup == null)
                                {
                                    dataPointGroup = new DataPointGroup(this, seriesItemCaption, Series.Count > 1 ? true : false);
                                    dataPointGroup.PropertyChanged += dataPointGroup_PropertyChanged;
                                    result.Add(dataPointGroup);

                                    CreateDataPointGroupBindings(dataPointGroup);

                                    int seriesIndex = 0;
                                    foreach (ChartSeries allSeries in Series)
                                    {
                                        DataPoint datapoint = new DataPoint(this);
                                        datapoint.SeriesCaption    = allSeries.SeriesTitle;
                                        datapoint.ValueMember      = allSeries.ValueMember;
                                        datapoint.DisplayMember    = allSeries.DisplayMember;
                                        datapoint.ItemBrush        = Series.Count == 1 ? GetItemBrush(itemIndex) : GetItemBrush(seriesIndex); //if only one series, use different color for each datapoint, if multiple series we use different color for each series
                                        datapoint.PropertyChanged += groupdItem_PropertyChanged;

                                        CreateDataPointBindings(datapoint, dataPointGroup);

                                        dataPointGroup.DataPoints.Add(datapoint);
                                        seriesIndex++;
                                    }
                                    itemIndex++;
                                }
                            }
                        }

                        ///gehe alle Series durch (Security, Naming etc.)
                        foreach (ChartSeries series in Series)
                        {
                            foreach (var seriesItem in series.Items)
                            {
                                string seriesItemCaption = GetPropertyValue(seriesItem, series.DisplayMember); //Security

                                //finde die gruppe mit dem Namen
                                DataPointGroup addToGroup = result.Where(group => group.Caption == seriesItemCaption).FirstOrDefault();

                                //finde in der Gruppe
                                DataPoint groupdItem = addToGroup.DataPoints.Where(item => item.SeriesCaption == series.SeriesTitle).FirstOrDefault();
                                groupdItem.ReferencedObject = seriesItem;
                            }
                        }
                    }
                    else
                    {
                        foreach (ChartSeries initialSeries in Series)
                        {
                            //erstelle für jede Series einen DataPointGroup, darin wird dann für jedes Item in jeder Serie ein DataPoint angelegt
                            DataPointGroup dataPointGroup = new DataPointGroup(this, initialSeries.SeriesTitle, Series.Count > 1 ? true : false);
                            dataPointGroup.PropertyChanged += dataPointGroup_PropertyChanged;
                            result.Add(dataPointGroup);

                            CreateDataPointGroupBindings(dataPointGroup);

                            //stelle nun sicher, dass alle DataPointGruppen die gleichen Datapoints hat
                            foreach (ChartSeries allSeries in Series)
                            {
                                int seriesIndex = 0;
                                foreach (var seriesItem in allSeries.Items)
                                {
                                    string    seriesItemCaption = GetPropertyValue(seriesItem, initialSeries.DisplayMember); //Security
                                    DataPoint existingDataPoint = dataPointGroup.DataPoints.Where(datapoint => datapoint.SeriesCaption == seriesItemCaption).FirstOrDefault();
                                    if (existingDataPoint == null)
                                    {
                                        DataPoint datapoint = new DataPoint(this);
                                        datapoint.SeriesCaption    = seriesItemCaption;
                                        datapoint.ValueMember      = allSeries.ValueMember;
                                        datapoint.DisplayMember    = allSeries.DisplayMember;
                                        datapoint.ItemBrush        = GetItemBrush(seriesIndex);
                                        datapoint.PropertyChanged += groupdItem_PropertyChanged;

                                        CreateDataPointBindings(datapoint, dataPointGroup);

                                        dataPointGroup.DataPoints.Add(datapoint);
                                    }
                                    seriesIndex++;
                                }
                            }
                        }

                        ///gehe alle Series durch (Security, Naming etc.)
                        foreach (ChartSeries series in Series)
                        {
                            foreach (var seriesItem in series.Items)
                            {
                                //finde die gruppe mit dem Namen
                                DataPointGroup addToGroup = result.Where(group => group.Caption == series.SeriesTitle).FirstOrDefault();

                                //finde in der Gruppe das richtige Element
                                string seriesItemCaption = GetPropertyValue(seriesItem, series.DisplayMember); //Security

                                DataPoint groupdItem = addToGroup.DataPoints.Where(item => item.SeriesCaption == seriesItemCaption).FirstOrDefault();
                                groupdItem.ReferencedObject = seriesItem;
                            }
                        }
                    }
                }
                catch
                {
                }

                //finished, copy all to the array
                groupedSeries.Clear();
                foreach (var item in result)
                {
                    groupedSeries.Add(item);
                }

                UpdateColorsOfDataPoints();

                chartLegendItems.Clear();
                DataPointGroup firstgroup = groupedSeries.FirstOrDefault();
                if (firstgroup != null)
                {
                    foreach (DataPoint dataPoint in firstgroup.DataPoints)
                    {
                        ChartLegendItemViewModel legendItem = new ChartLegendItemViewModel();

                        var captionBinding = new Binding();
                        captionBinding.Source = dataPoint;
                        captionBinding.Mode   = BindingMode.OneWay;
                        captionBinding.Path   = new PropertyPath("SeriesCaption");
                        BindingOperations.SetBinding(legendItem, ChartLegendItemViewModel.CaptionProperty, captionBinding);

                        var brushBinding = new Binding();
                        brushBinding.Source = dataPoint;
                        brushBinding.Mode   = BindingMode.OneWay;
                        brushBinding.Path   = new PropertyPath("ItemBrush");
                        BindingOperations.SetBinding(legendItem, ChartLegendItemViewModel.ItemBrushProperty, brushBinding);

                        chartLegendItems.Add(legendItem);
                    }
                }
                RecalcSumOfDataPointGroup();
            }
        }
示例#17
0
 private bool ColorIsBusy(OxyColor color)
 {
     return(Series.Any(series => ((LineSeries)series).Color.Equals(color)));
 }