private void lbDataSeries_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbDataSeries.SelectedIndex > -1)
     {
         si = (SeriesItem)lbDataSeries.SelectedItem;
         txtDataValue.Text     = si.Data;
         txtLabelValue.Text    = si.Label;
         txtSeriesName.Text    = si.Name;
         chkShowLabels.Checked = si.ShowLabel;
         cbPlotType.Text       = si.PlotType;
         chkMarker.Checked     = !si.NoMarker;
         cbLine.Text           = si.LineSize;
         if (txtX.Enabled)
         {
             txtX.Text = si.Xplot;
         }
         if (si.YAxis == "Right")
         {
             chkRight.Checked = true;
         }
         else
         {
             chkLeft.Checked = true;
         }
     }
 }
Beispiel #2
0
            protected override DragDropOption PerformDropForeignItems(IList <IGalleryItem> droppingItems, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers)
            {
                SeriesItem     series = (SeriesItem)targetItem;
                DragDropOption action = DragDropOption.None;

                foreach (IGalleryItem droppingItem in droppingItems)
                {
                    if (droppingItem is ImageItem)
                    {
                        ImageItem image = (ImageItem)droppingItem;
                        if (modifiers == ModifierFlags.None)
                        {
                            if (!series.Images.Contains(image))
                            {
                                series.Images.Add(image.Copy());
                                action = DragDropOption.Move;
                            }
                        }
                        else if (modifiers == ModifierFlags.Shift)
                        {
                            series.Images.Add(image.Copy());
                            action = DragDropOption.Copy;
                        }
                    }
                }
                return(action);
            }
        protected void Page_Load(object sender, EventArgs e)
        {
            SeriesItem Pagado = new SeriesItem(20);

            Pagado.Name     = "Pagado";
            Pagado.Exploded = true;

            SeriesItem PorPagar = new SeriesItem(80);

            PorPagar.Name = "PorPagar";

            PieSeries ps = new PieSeries();

            ps.Items.Add(Pagado);
            ps.Items.Add(PorPagar);

            ps.LabelsAppearance.Position           = Telerik.Web.UI.HtmlChart.PieLabelsPosition.Column;
            ps.LabelsAppearance.DataFormatString   = "{0} %";
            ps.TooltipsAppearance.Visible          = false;
            ps.TooltipsAppearance.DataFormatString = "{0} %";


            RadHtmlChart.PlotArea.Series.Add(ps);
            RadHtmlChart.DataBind();
        }
Beispiel #4
0
        private SeriesItem MapDictionaryToSeriesItem(Dictionary <string, string> seriesItemPairs)
        {
            SeriesItem item = new SeriesItem();

            item.Title = seriesItemPairs["Title"];

            if (seriesItemPairs.ContainsKey("Distributor"))
            {
                string distName = seriesItemPairs["Distributor"];
                if (distName.Contains("Bandai Ent", StringComparison.OrdinalIgnoreCase))
                {
                    distName = "Bandai Visual";
                }

                Distributor distributor = _distributors.Find(x => x.DistributorName.Contains(distName, StringComparison.OrdinalIgnoreCase));
                item.Distributors = new List <Distributor>
                {
                    distributor
                };
            }

            if (seriesItemPairs.ContainsKey("Run Time"))
            {
                item.Length = seriesItemPairs["Run Time"];
            }

            if (seriesItemPairs.ContainsKey("Release Date"))
            {
                DateTime.TryParse(seriesItemPairs["Release Date"], out DateTime releaseDate);
                item.ReleaseDate = releaseDate;
            }

            return(item);
        }
        private void SetFanArtType()
        {
            SeriesFilterItem series = SelectedItem as SeriesFilterItem;

            if (series != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.Series;
                FanArtName      = series.SimpleTitle;
                return;
            }
            SeriesItem episode = SelectedItem as SeriesItem;

            if (episode != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.Series;
                FanArtName      = episode.Series;
                ItemDescription = episode.StoryPlot;
                return;
            }
            MovieItem movie = SelectedItem as MovieItem;

            if (movie != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.Movie;
                FanArtName      = movie.MovieName;
                ItemDescription = movie.StoryPlot;
                return;
            }
            FanArtMediaType = FanArtConstants.FanArtMediaType.Undefined;
            FanArtName      = string.Empty;
            ItemDescription = string.Empty;
        }
Beispiel #6
0
        private void SetFanArtType()
        {
            PlayableMediaItem playableMediaItem = SelectedItem as PlayableMediaItem;

            if (playableMediaItem != null)
            {
                MediaItem = playableMediaItem.MediaItem;
            }

            SeriesFilterItem series = SelectedItem as SeriesFilterItem;

            if (series != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.Series;
                FanArtName      = series.SimpleTitle;
                ItemDescription = null;
                return;
            }
            SeriesItem episode = SelectedItem as SeriesItem;

            if (episode != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.Series;
                FanArtName      = episode.Series;
                ItemDescription = episode.StoryPlot;
                return;
            }
            MovieFilterItem movieCollection = SelectedItem as MovieFilterItem;

            if (movieCollection != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.MovieCollection;
                FanArtName      = movieCollection.SimpleTitle;
                ItemDescription = null;
                return;
            }
            MovieItem movie = SelectedItem as MovieItem;

            if (movie != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.Movie;
                // Fanart loading now depends on the MediaItemId to support local fanart
                FanArtName      = movie.MediaItem.MediaItemId.ToString();
                ItemDescription = movie.StoryPlot;
                return;
            }
            VideoItem video = SelectedItem as VideoItem;

            if (video != null)
            {
                FanArtMediaType = FanArtConstants.FanArtMediaType.Movie;
                // Fanart loading now depends on the MediaItemId to support local fanart
                FanArtName      = video.MediaItem.MediaItemId.ToString();
                ItemDescription = video.StoryPlot;
                return;
            }
            FanArtMediaType = FanArtConstants.FanArtMediaType.Undefined;
            FanArtName      = string.Empty;
            ItemDescription = string.Empty;
        }
        public SeriesItem GetSeriesItemById(int seriesItemId)
        {
            SeriesItem seriesItem = new SeriesItem();

            string SERIES_ITEM_SELECT = @"SELECT se.SeriesId 
, se.Title AS 'SeriesTitle'
, ca.Id AS 'CreatorAuthorId'
, ca.FirstName
, ca.LastName
, si.Id AS 'SeriesItemId'
, si.Title AS 'SeriesItemTitle'
, si.Description
, si.ProductionId
, ps.ProductionStudioName
, si.DistributorId
, di.DistributorName
, si.CreatorAuthorId
, si.FormatId
, fo.FormatName
FROM Series se
INNER JOIN SeriesCreators sc ON sc.SeriesId = se.SeriesId
INNER JOIN CreatorAuthors ca ON ca.Id = sc.CreatorId
INNER JOIN SeriesItems si ON si.SeriesId = se.SeriesId
INNER JOIN ProductionStudios ps ON ps.Id = si.ProductionId
INNER JOIN Distributors di ON di.Id = si.DistributorId
INNER JOIN Formats fo ON fo.FormatId = si.FormatId
WHERE si.id = @ID";

            try
            {
                using (SqlConnection connection = new SqlConnection(_appSettings.ConnectionStrings.DefaultConnection))
                {
                    connection.Open();

                    SqlCommand sqlCommand = new SqlCommand(SERIES_ITEM_SELECT, connection);

                    // http://www.dbdelta.com/addwithvalue-is-evil/
                    sqlCommand.Parameters.Add("@ID", SqlDbType.Int);
                    sqlCommand.Parameters["@ID"].Value = seriesItemId;

                    using (SqlDataReader reader = sqlCommand.ExecuteReader())
                    {
                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                seriesItem = MapRowToSeriesItem(reader);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"There was a general exception retrieving series: {seriesItemId}. {ex.Message}");
            }

            return(seriesItem);
        }
Beispiel #8
0
 int IComparable <SeriesItem <T> > .CompareTo(SeriesItem <T> other)
 {
     if (other.Ordinal == Ordinal)
     {
         return(0);
     }
     return(Ordinal < other.Ordinal ? -1 : 1);
 }
Beispiel #9
0
            protected override DragDropOption PerformDropForeignItems(IList <IGalleryItem> droppingItems, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers)
            {
                StudyItem      study  = (StudyItem)targetItem;
                DragDropOption action = DragDropOption.None;

                foreach (IGalleryItem droppingItem in droppingItems)
                {
                    if (droppingItem is SeriesItem)
                    {
                        SeriesItem series = (SeriesItem)droppingItem;
                        if (modifiers == ModifierFlags.None)
                        {
                            if (!study.Series.Contains(series))
                            {
                                study.Series.Add(series.Copy());
                                action = DragDropOption.Move;
                            }
                        }
                        else if (modifiers == ModifierFlags.Shift)
                        {
                            study.Series.Add(series.Copy());
                            action = DragDropOption.Copy;
                        }
                    }
                    else if (droppingItem is ImageItem)
                    {
                        ImageItem image = (ImageItem)droppingItem;
                        if (modifiers == ModifierFlags.None)
                        {
                            SeriesNode seriesNode = (SeriesNode)GetNodeAncestor(image.Node, 1);
                            StudyNode  studyNode  = (StudyNode)GetNodeAncestor(seriesNode, 1);
                            if (study.Node != studyNode)
                            {
                                SeriesItem series = new SeriesItem(seriesNode.Copy(false));
                                series.Images.Add(image.Copy());
                                series.UpdateIcon();
                                study.Series.Add(series);
                                action = DragDropOption.Move;
                            }
                        }
                        else if (modifiers == ModifierFlags.Shift)
                        {
                            SeriesNode seriesNode = (SeriesNode)GetNodeAncestor(image.Node, 1);
                            SeriesItem series     = new SeriesItem(seriesNode.Copy(false));
                            series.Images.Add(image.Copy());
                            series.UpdateIcon();
                            study.Series.Add(series);
                            action = DragDropOption.Copy;
                        }
                    }
                }
                return(action);
            }
Beispiel #10
0
        protected void grdVendedor_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                Response.Redirect("~/Security/frmCerrar.aspx");
            }

            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();
            int count = 0;

            rhcProdVendedor.PlotArea.Series[0].Items.Clear();
            rhcProdVendedor.PlotArea.Series[1].Items.Clear();
            rhcProdVendedor.PlotArea.XAxis.Items.Clear();
            try
            {
                DateTime primerDia = new DateTime(((DateTime)ViewState["periodo"]).Year, ((DateTime)ViewState["periodo"]).Month, 1);

                List <gsDocVenta_ReporteVenta_MarcaProducto_InatecResult> lstProducto = objReporteVentaWCF.DocVenta_ReporteVenta_MarcaProductoInatec(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, int.Parse(grdVendedor.SelectedItems[0].Cells[10].Text.ToString()), int.Parse(grdVendedor.SelectedItems[0].Cells[11].Text.ToString()),
                                                                                                                                                     null, primerDia, primerDia.AddMonths(1).AddDays(-1)).ToList();

                foreach (gsDocVenta_ReporteVenta_MarcaProducto_InatecResult producto in lstProducto)
                {
                    if (producto.Descripcion.Length > 30)
                    {
                        rhcProdVendedor.PlotArea.XAxis.Items.Add(producto.Descripcion.Substring(0, 30).Replace("'", string.Empty));
                    }
                    else
                    {
                        rhcProdVendedor.PlotArea.XAxis.Items.Add(producto.Descripcion.Replace("'", string.Empty));
                    }

                    SeriesItem item = new SeriesItem();

                    item        = new SeriesItem();
                    item.Name   = producto.Descripcion.Replace("'", string.Empty);
                    item.YValue = Math.Round((decimal)producto.ValorVenta / 1000, 2);
                    this.rhcProdVendedor.PlotArea.Series[0].Items.Add(item);

                    item        = new SeriesItem();
                    item.Name   = producto.Descripcion.Replace("'", string.Empty);
                    item.YValue = Math.Round((decimal)producto.ValorPlanificado / 1000, 2);
                    this.rhcProdVendedor.PlotArea.Series[1].Items.Add(item);
                    count++;
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
Beispiel #11
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            SeriesItem si = new SeriesItem();

            si.Data      = "";
            si.Name      = "<New Series>";
            si.ShowLabel = false;
            si.Label     = "";
            si.PlotType  = "Auto";
            si.YAxis     = "Left";// 20022008 AJM GJL
            lbDataSeries.Items.Add(si);
            lbDataSeries.SelectedItem = si;
        }
Beispiel #12
0
            protected override DragDropOption CheckDropForeignItems(IList <IGalleryItem> droppingItems, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers)
            {
                StudyItem study   = (StudyItem)targetItem;
                bool      allowed = true;

                foreach (IGalleryItem droppingItem in droppingItems)
                {
                    if (droppingItem is SeriesItem)
                    {
                        SeriesItem series = (SeriesItem)droppingItem;
                        if (modifiers == ModifierFlags.None)
                        {
                            allowed &= !(study.Series.Contains(series));                             // disallow moves where the item is already in the target tree
                        }
                        else if (modifiers == ModifierFlags.Shift)
                        {
                            allowed &= true;
                        }
                    }
                    else if (droppingItem is ImageItem)
                    {
                        ImageItem image = (ImageItem)droppingItem;
                        if (modifiers == ModifierFlags.None)
                        {
                            allowed &= (study.Node != GetNodeAncestor(image.Node, 2));                             // disallow moves where the item is already in the target tree
                        }
                        else if (modifiers == ModifierFlags.Shift)
                        {
                            allowed &= true;
                        }
                    }
                    else
                    {
                        allowed &= false;
                    }
                }

                if (allowed)
                {
                    if (modifiers == ModifierFlags.None)
                    {
                        return(DragDropOption.Move);
                    }
                    else if (modifiers == ModifierFlags.Shift)
                    {
                        return(DragDropOption.Copy);
                    }
                }
                return(DragDropOption.None);
            }
        private void ReporteLetra_Cargar()
        {
            LetrasEmitidasWCFClient objLetrasWCF = new LetrasEmitidasWCFClient();
            int count = 0;

            rhcProducto.PlotArea.Series[0].Items.Clear();
            rhcProducto.PlotArea.Series[1].Items.Clear();
            rhcProducto.PlotArea.XAxis.Items.Clear();


            try
            {
                List <USP_SEL_Porcentaje_Avance_Letras_ZonasResult> lstLetra = objLetrasWCF.Porcentaje_Avance_Letras_Lista_x_Zonas(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                                   ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario).ToList();

                List <USP_SEL_Porcentaje_Avance_LetrasResult> listLetras_total = objLetrasWCF.Porcentaje_Avance_Letras_Lista(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario).ToList();


                foreach (USP_SEL_Porcentaje_Avance_Letras_ZonasResult Letra in lstLetra)
                {
                    rhcProducto.PlotArea.XAxis.Items.Add(Letra.Nombre.Replace("'", string.Empty));
                    SeriesItem item = new SeriesItem();
                    //item = new SeriesItem();
                    //item.Name = Letra.Nombre.Replace("'", string.Empty);
                    //item.YValue = Letra.PORCENTAJE_ZONA;
                    //this.rhcProducto.PlotArea.Series[0].Items.Add(item);

                    item        = new SeriesItem();
                    item.Name   = Letra.Nombre.Replace("'", string.Empty);
                    item.YValue = Letra.PORCENTAJE;
                    this.rhcProducto.PlotArea.YAxis.MaxValue = Convert.ToDecimal(listLetras_total[0].PORCENTAJE.ToString());
                    this.rhcProducto.PlotArea.Series[0].Items.Add(item);


                    item        = new SeriesItem();
                    item.Name   = Letra.Nombre.Replace("'", string.Empty);
                    item.YValue = Letra.PORCENTAJE_MANUAL;
                    this.rhcProducto.PlotArea.YAxis.MaxValue = Convert.ToDecimal(listLetras_total[0].PORCENTAJE.ToString());
                    this.rhcProducto.PlotArea.Series[1].Items.Add(item);



                    count++;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #14
0
        private IEnumerable <SeriesItem> GerarSeriesItem(Series series)
        {
            SeriesItem item = new SeriesItem
            {
                Series      = series,
                SeriesId    = series.Id,
                Id          = GerarNumero(),
                Name        = GerarTexto(),
                ResourceURI = GerarTexto()
            };

            return(new List <SeriesItem> {
                item
            });
        }
Beispiel #15
0
        private void GetNewValue()
        {
            if (ValueExpression.Length == 0)
            {
                return;
            }
            EvaluateClearExpression();
            bool   changeserie  = EvaluateChangeSerieExpression();
            string seriecaption = "";

            if (changeserie)
            {
                seriecaption = EvaluateSerieCaption().ToString();
            }

            string newcaption = "";

            if (this.CaptionExpression.Length > 0)
            {
                newcaption = EvaluateText(CaptionExpression);
                SeriesItem nitem = FSeries.SeriesItems[FSeries.SeriesItems.Count - 1];
                nitem.ValueCaptions[nitem.ValueCaptions.Count - 1] = newcaption;
            }
            NewValue(EvaluateText(ValueExpression), changeserie, newcaption, seriecaption);

            if (SerieColorExpression.Length > 0)
            {
                int newcolor = EvaluateText(SerieColorExpression);
                if (newcolor != 0)
                {
                    FSeries.SeriesItems[FSeries.SeriesItems.Count - 1].Color = newcolor;
                }
            }
            if (this.ColorExpression.Length > 0)
            {
                int newcolor = EvaluateText(ColorExpression);
                if (newcolor != 0)
                {
                    SeriesItem nitem = FSeries.SeriesItems[FSeries.SeriesItems.Count - 1];
                    nitem.Colors[nitem.Colors.Count - 1] = newcolor;
                }
            }
        }
Beispiel #16
0
        public void NewValue(double newvalue, bool seriechange, string valuecaption, string seriecaption)
        {
            bool       firstserie = false;
            SeriesItem aserie     = null;

            if (FSeries.SeriesItems.Count < 1)
            {
                aserie                   = new SeriesItem();
                aserie.ChartStyle        = this.ChartStyle;
                aserie.Caption           = seriecaption;
                firstserie               = true;
                FSeries.FontSize         = FontSize;
                FSeries.Resolution       = Resolution;
                FSeries.ShowLegend       = ShowLegend;
                FSeries.MultiBar         = MultiBar;
                FSeries.MarkStyle        = MarkStyle;
                FSeries.HorzFontRotation = HorzFontRotation;
                FSeries.VertFontRotation = VertFontRotation;

                FSeries.ShowHint = ShowHint;
                FSeries.Effect3D = this.View3d;

                FSeries.SeriesItems.Add(aserie);
            }
            else
            {
                aserie = FSeries.SeriesItems[FSeries.SeriesItems.Count - 1];
            }

            if (seriechange)
            {
                if (!firstserie)
                {
                    aserie            = new SeriesItem();
                    aserie.ChartStyle = this.ChartStyle;
                    aserie.Caption    = seriecaption;
                    FSeries.SeriesItems.Add(aserie);
                }
            }
            aserie.Values.Add(newvalue);
            aserie.ValueCaptions.Add(valuecaption);
            aserie.Colors.Add(aserie.Color);
        }
        private SeriesItem MapRowToSeriesItem(SqlDataReader reader)
        {
            SeriesItem seriesItem = new SeriesItem
            {
                Id          = Convert.ToInt32(reader["SeriesItemId"]),
                SeriesId    = Convert.ToInt32(reader["SeriesId"]),
                Title       = Convert.ToString(reader["SeriesItemTitle"]),
                Description = Convert.ToString(reader["Description"]),
                Series      = new Series()
                {
                    SeriesId = Convert.ToInt32(reader["SeriesId"]),
                    Title    = Convert.ToString(reader["SeriesTitle"])
                },
                ProductionStudio = new ProductionStudio
                {
                    Id = Convert.ToInt32(reader["ProductionId"]),
                    ProductionStudioName = Convert.ToString(reader["ProductionStudioName"]),
                    // Country = Convert.ToString(reader["ProductionStudioCountry"])
                },
                Distributor = new Distributor
                {
                    Id = Convert.ToInt32(reader["DistributorId"]),
                    DistributorName = Convert.ToString(reader["DistributorName"]),
                    // Country = Convert.ToString(reader["DistributorCountry"])
                },
                // Length = Convert.ToString(reader["SeriesItemLength"]),
                CreatorAuthors = new CreatorAuthor()
                {
                    Id        = Convert.ToInt32(reader["CreatorAuthorId"]),
                    FirstName = Convert.ToString(reader["FirstName"]),
                    LastName  = Convert.ToString(reader["LastName"])
                },
                Format = new Format
                {
                    FormatId   = Convert.ToInt32(reader["FormatId"]),
                    FormatName = Convert.ToString(reader["FormatName"])
                },
                // ReleaseDate = DateTime.Parse(Convert.ToString(reader["ReleaseDate"]))
            };

            return(seriesItem);
        }
        //public List<Series> GetSeriesByGenre(int genreId)
        //{
        //    List<Series> seriesByGenre = new List<Series>();

        //    try
        //    {
        //        using (SqlConnection connection = new SqlConnection(_appSettings.ConnectionStrings.DefaultConnection))
        //        {
        //            connection.Open();

        //            SqlCommand sqlCommand = new SqlCommand("SELECT * FROM Series WHERE GenreId = @genreId");
        //            sqlCommand.Parameters.AddWithValue("seriesId", genreId);
        //            SqlDataReader reader = sqlCommand.ExecuteReader();

        //            while (reader.Read())
        //            {
        //                seriesByGenre.Add(MapRowToSeries(reader));
        //            }
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine($"There was a general exception retrieving series: {genreId}. {ex.Message}");
        //    }

        //    return seriesByGenre;
        //}

        private Series MapRowToSeries(SqlDataReader reader)
        {
            Series tempSeries = new Series
            {
                SeriesId       = Convert.ToInt32(reader["SeriesId"]),
                Title          = Convert.ToString(reader["Title"]),
                SeriesCreators = new List <SeriesCreator>(),
                SeriesItems    = new List <SeriesItem>()
            };

            SeriesCreator seriesCreator = new SeriesCreator
            {
                CreatorAuthor = new CreatorAuthor
                {
                    Id        = Convert.ToInt32(reader["CreatorAuthorId"]),
                    FirstName = Convert.ToString(reader["FirstName"]),
                    LastName  = Convert.ToString(reader["LastName"]),
                }
            };

            tempSeries.SeriesCreators.Add(seriesCreator);

            // TODO: Add the objects to seriesItem for the associated IDs?
            //SeriesItem seriesItem = new SeriesItem
            //{
            //    Id = Convert.ToInt32(reader["Id"]), // TODO: fill in this collumn
            //    SeriesId = Convert.ToInt32("SeriesId"),
            //    Title = Convert.ToString(reader["Title"]),
            //    Description = Convert.ToString(reader["Description"]),
            //    ProductionId = Convert.ToInt32(reader["ProductionId"]),
            //    DistributorId = Convert.ToInt32(reader["DistrobutionId"]),
            //    CreatorAuthorId = Convert.ToInt32(reader["CreatorAuthorId"]),
            //    Length = Convert.ToString(reader["Length"]),
            //    FormatId = Convert.ToInt32(reader["FormatId"]),
            //    ReleaseDate = Convert.ToDateTime(reader["ReleaseDate"])
            //};
            SeriesItem seriesItem = MapRowToSeriesItem(reader);

            tempSeries.SeriesItems.Add(seriesItem);

            return(tempSeries);
        }
Beispiel #19
0
 private void lbDataSeries_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbDataSeries.SelectedIndex > -1)
     {
         si = (SeriesItem)lbDataSeries.SelectedItem;
         txtDataValue.Text     = si.Data;
         txtLabelValue.Text    = si.Label;
         txtSeriesName.Text    = si.Name;
         chkShowLabels.Checked = si.ShowLabel;
         cbPlotType.Text       = si.PlotType;
         chkMarker.Checked     = !si.NoMarker;
         cbLine.Text           = si.LineSize;
         if (txtX.Enabled)
         {
             txtX.Text = si.Xplot;
         }
         if (si.YAxis == "Right")
         {
             chkRight.Checked = true;
         }
         else
         {
             chkLeft.Checked = true;
         }
         if (!String.IsNullOrEmpty(si.Colour))
         {
             colorPicker1.SelectedItem = si.Colour;
             foreach (string s in colorPicker1.Items)
             {
                 if (s.ToLower().Equals(si.Colour.ToLower()))
                 {
                     colorPicker1.SelectedItem = s; break;
                 }
             }
         }
     }
 }
Beispiel #20
0
        public void Run()
        {
            try
            {
                foreach (WebsiteToParse siteToParse in _appSettings.Value.WebsitesToParse)
                {
                    if (!Directory.Exists(siteToParse.Path))
                    {
                        throw new DirectoryNotFoundException($"The directory = { siteToParse.Path } does not exist.");
                    }

                    _distributors = _dataAccess.GetDistributorsFromDb();

                    string[] filesToParse = Directory.GetFiles(siteToParse.Path, "*.html", SearchOption.AllDirectories);

                    _log.LogInformation($"The directory = { siteToParse.Path } contained { filesToParse.Length } files.");

                    if (filesToParse.Length < 1)
                    {
                        _log.LogInformation("There were no files to parse.");
                    }
                    else
                    {
                        string previousSeriesTitle = "NotStarted";

                        foreach (string file in filesToParse)
                        {
                            if (siteToParse.FilenameWordsToSkip.Any(x => file.Contains(x, StringComparison.OrdinalIgnoreCase)))
                            {
                                continue;
                            }

                            // TODO: For each new Title (folder) add new Series to List<Series>

                            // TODO: parse files
                            HtmlDocument htmlDoc = new HtmlDocument();
                            htmlDoc.Load(file);

                            if (htmlDoc.DocumentNode != null)
                            {
                                HtmlNode baseContainerNode = htmlDoc.DocumentNode.SelectSingleNode("//" + siteToParse.BaseContainerTag);
                                if (baseContainerNode == null)
                                {
                                    _log.LogWarning($"The file = { file } is missing the expected <table> tag.  Skipping file.");
                                    continue;
                                }

                                HtmlNode titleNode = baseContainerNode.SelectSingleNode("//" + siteToParse.InnerTitleTag);
                                if (titleNode == null)
                                {
                                    _log.LogWarning($"The file = { file } is missing the expected <h2> tag.  Skipping file.");
                                    continue;
                                }

                                HtmlNode imageNode = baseContainerNode.SelectSingleNode("//" + siteToParse.InnerImageTag);
                                if (imageNode == null)
                                {
                                    _log.LogWarning($"The file = { file } is missing the expected <img> tag.  Skipping file.");
                                    continue;
                                }

                                string title = titleNode.InnerText;

                                string imagePath    = imageNode.GetAttributeValue("src", string.Empty);
                                string imageCaption = imageNode.GetAttributeValue("alt", title);

                                string pNodeOne = string.Empty;
                                string pNodeTwo = string.Empty;

                                var pNodes = baseContainerNode.SelectNodes("//" + siteToParse.InnerTextTag);
                                if (pNodes != null && pNodes.Count > 1)
                                {
                                    if (pNodes.Count == 2)
                                    {
                                        pNodeOne = pNodes[0].InnerText.Trim();
                                        pNodeTwo = pNodes[1].InnerText.Trim();
                                    }
                                    else if (pNodes.Count > 2)
                                    {
                                        if (pNodes[0] != null && pNodes[1].InnerText.Contains("Details", StringComparison.OrdinalIgnoreCase))
                                        {
                                            pNodeOne = pNodes[1].InnerText.Trim();
                                            pNodeTwo = pNodes[2].InnerText.Trim();
                                        }
                                        else
                                        {
                                            pNodeOne = pNodes[0].InnerText.Trim();
                                            StringBuilder sb = new StringBuilder();

                                            for (int i = 1; i < pNodes.Count; i++)
                                            {
                                                var tempNode = pNodes[i].ChildNodes; // TODO: Fix this.  Some pages have <p> << | Main | >> </p> navigation that is being captured
                                                _log.LogInformation("Checking HtmlNode", tempNode);

                                                if (pNodes[i].HasChildNodes)
                                                {
                                                    if (pNodes[i].SelectSingleNode("//h4") != null || pNodes[i].SelectSingleNode("//h4//a") != null)
                                                    {
                                                        continue;
                                                    }
                                                }
                                                string modifiedString = Regex.Replace(pNodes[i].InnerText.Trim(), @"\r\n?|\n", string.Empty);

                                                sb.AppendLine(modifiedString);
                                            }

                                            pNodeTwo = sb.ToString();
                                        }
                                    }
                                }

                                Series series = new Series
                                {
                                    Title = title
                                };

                                if (title != previousSeriesTitle)
                                {
                                    _series.Add(series);
                                    previousSeriesTitle = title;
                                    _log.LogInformation($"Added Series { title } to the Series List.");
                                }

                                SeriesItem seriesItem = MapDictionaryToSeriesItem(DictionaryFromString(pNodeOne, '\n'));
                                seriesItem.SeriesItemImages = new List <Image>
                                {
                                    new Image
                                    {
                                        ImagePath    = imagePath,
                                        ImageCaption = imageCaption
                                    }
                                };
                                seriesItem.CollectionNumber = GetCollectionNumberFromFilename(file, title);
                                seriesItem.Description      = pNodeTwo;

                                _seriesItems.Add(seriesItem);
                                _log.LogInformation($"Added { seriesItem.Title } to the SeriesItem List.");
                            }
                        }
                    }
                }
            }
            catch (IOException ie)
            {
                _log.LogError(ie.Message, ie);
            }
            catch (Exception ex)
            {
                _log.LogError(ex.Message, ex);
            }
        }
Beispiel #21
0
        private void ReporteVenta_Cliente(string ID_Vendedor, DateTime fechaInico, DateTime fechaFinal)
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();

            rhcParticipacion.PlotArea.Series[0].Items.Clear();
            try
            {
                #region Venta de productos
                List <gsDocVenta_ReporteVenta_ProductoResult> lstProductos = objReporteVentaWCF.DocVenta_ReporteVenta_Producto(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                               ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal).ToList();

                grdProducto.DataSource = lstProductos;
                grdProducto.DataBind();

                ViewState["lstProductos"] = JsonHelper.JsonSerializer(lstProductos);
                #endregion

                #region Venta al 80% y 20%
                List <gsDocVenta_ReporteVenta_ClienteResult> lst = objReporteVentaWCF.DocVenta_ReporteVenta_Cliente(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                    ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal, null).ToList().OrderByDescending(x => x.ValorVenta).ToList();

                decimal sum = (decimal)lst.Sum(i => i.ValorVenta);
                //decimal sumPlanif = (decimal)lst.Sum(i => i.ValorPlanificado);
                decimal acumulado = 0;
                bool    paso80    = false;

                foreach (var cliente in lst)
                {
                    SeriesItem item = new SeriesItem();
                    if (sum > 0)
                    {
                        if (((int)((cliente.ValorVenta / sum) * 100)) > 0)
                        {
                            item.YValue = ((int)((cliente.ValorVenta / sum) * 100));
                            item.Name   = string.Format("{0}<br/>Valor Venta:${1}K<br/>Presupuesto:${2}K<br/>Avance:{3}%<br/>Participación:{4}%",
                                                        cliente.ID_Cliente + " - " + cliente.Cliente.Replace("'", string.Empty),
                                                        Math.Round((decimal)cliente.ValorVenta / 1000, 2),
                                                        Math.Round((decimal)cliente.ValorPlanificado / 1000, 2),
                                                        cliente.Avance,
                                                        item.YValue);
                            rhcParticipacion.PlotArea.Series[0].Items.Add(item);
                        }
                    }

                    if (cliente.ValorVenta > 0)
                    {
                        acumulado = acumulado + (decimal)cliente.ValorVenta;
                        if (!paso80)
                        {
                            if (cliente.Cliente.Length > 30)
                            {
                                rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty));
                            }
                            else
                            {
                                rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty));
                            }

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorVenta / 1000, 2);
                            this.rhcCliente80.PlotArea.Series[0].Items.Add(item);

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorPlanificado / 1000, 2);
                            this.rhcCliente80.PlotArea.Series[1].Items.Add(item);
                        }
                        else
                        {
                            if (cliente.Cliente.Length > 30)
                            {
                                rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty));
                            }
                            else
                            {
                                rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty));
                            }

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorVenta / 1000, 2);
                            this.rhcCliente20.PlotArea.Series[0].Items.Add(item);

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ValorPlanificado / 1000, 2);
                            this.rhcCliente20.PlotArea.Series[1].Items.Add(item);
                        }

                        if (acumulado / sum * 100 >= 80)
                        {
                            paso80 = true;
                        }
                    }
                }
                #endregion

                #region Datos principales
                //Datos principales de la venta
                gsDocVenta_ReporteVenta_VendedorResult rv = objReporteVentaWCF.DocVenta_ReporteVenta_Vendedor(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                                                                                                              ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal).ToList().Single();
                rrgAvance.Pointer.Value = rv.Avance;
                lblPronostico.Text      = string.Format("${0}", Math.Round((decimal)rv.ValorPlanificado, 0).ToString("#,#", CultureInfo.InvariantCulture));
                lblValorVenta.Text      = string.Format("${0}", Math.Round((decimal)rv.ValorVenta, 0).ToString("#,#", CultureInfo.InvariantCulture));
                lblDiferencia.Text      = string.Format("${0}", Math.Round((decimal)rv.Diferencia, 0).ToString("#,#", CultureInfo.InvariantCulture));
                lblAvance.Text          = "Avance: " + Math.Round((decimal)rv.Avance, 0).ToString() + "%";
                lblCantTotal.Text       = lst.Count.ToString();
                lblCantVenta.Text       = lst.FindAll(x => x.ValorVenta > 0).Count.ToString();
                lblCantNoVenta.Text     = lst.FindAll(x => x.ValorVenta <= 0).Count.ToString();
                #endregion

                #region Cliente sin venta
                grdCliente.DataSource = lst.FindAll(x => x.ValorVenta <= 0).OrderByDescending(x => x.ValorPlanificado);
                grdCliente.DataBind();
                #endregion

                #region Venta diaria
                List <gsDocVenta_ReporteVenta_FechaResult> lstFecha = objReporteVentaWCF.DocVenta_ReporteVenta_Fecha(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Vendedor, fechaInico, fechaFinal).ToList();

                acumulado = 0;
                for (DateTime day = fechaInico; DateTime.Compare(day, fechaFinal) <= 0; day = day.AddDays(1))
                {
                    AxisItem xitem = new AxisItem();
                    xitem.LabelText = day.ToString("dd/MM/yyyy");
                    rhcDiario.PlotArea.XAxis.Items.Add(xitem);

                    gsDocVenta_ReporteVenta_FechaResult objVFecha = lstFecha.Find(x => x.Fecha == day);
                    SeriesItem serie1 = new SeriesItem();
                    if (objVFecha != null)
                    {
                        acumulado     = acumulado + (decimal)objVFecha.ValorVenta;
                        serie1.YValue = Math.Round((decimal)objVFecha.ValorVenta / 1000, 2);
                    }
                    else
                    {
                        serie1.YValue = 0;
                    }

                    rhcDiario.PlotArea.Series[0].Items.Add(serie1);
                    SeriesItem serie2 = new SeriesItem();
                    serie2.YValue = Math.Round(acumulado / (decimal)rv.ValorPlanificado * 100, 0);
                    rhcDiario.PlotArea.Series[1].Items.Add(serie2);
                }
                //rhcDiario.PlotArea.Series[1].AxisName = "AdditionalAxis";
                #endregion

                lblTitulo.Text = "Reporte " + fechaInico.Year.ToString() + "-" + fechaInico.Month.ToString() + " de " + rv.Vendedor;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #22
0
 public UserSeriesItemViewModel(SeriesItem userSeries)
 {
     _userSeries = userSeries;
 }
        public async Task <BotModel> Simulate(BotModel bot)
        {
            bot.TradeBook = new TradeBook()
            {
                Id           = 10,
                TradeEntries = new List <TradeEntry>(1000),
                Series       = new List <SeriesItem>(1000)
            };
            // gather needed data to execute trades against
            var tickerDetails = await IntrinioService.GetTickerDetails(bot.TargetTicker.TickerSymbol);

            var prices = await IntrinioService.GetTickerPrices(bot.TargetTicker.TickerSymbol, bot.StartDate.AddDays(-1), DateTime.UtcNow.Date);

            var priceLookup = prices.ToDictionary(k => k.Date.ToString("yyyyMMddHHmmss"), m => new NormalizedPriceItem()
            {
                High  = (int)(m.High * 100),
                Low   = (int)(m.Low * 100),
                Open  = (int)(m.Open * 100),
                Close = (int)(m.Close * 100),
                Date  = DateTime.SpecifyKind(m.Date, DateTimeKind.Utc)
            });

            // register data with the model so it can perform its analysis

            bot.Model.RegisterInputSources(IntrinioService.GetTickerPrices, bot.StartDate, DateTime.UtcNow);

            // run get signal over a time series of the target equity
            var idxDate       = bot.StartDate;
            var stopDate      = DateTime.UtcNow;
            var idxDateString = idxDate.ToString("yyyyMMddHHmmss");
            // Take the first time step and use it to setup initial portfolio

            NormalizedPriceItem currPrice;

            while (!priceLookup.ContainsKey(idxDateString))
            {
                idxDate       = idxDate.AddDays(1);
                idxDateString = idxDate.ToString("yyyyMMddHHmmss");
            }
            currPrice = priceLookup[idxDateString];
            var prevItem = new SeriesItem()
            {
                Signal         = Signal.Hold,
                Date           = idxDate,
                Open           = currPrice.Open,
                High           = currPrice.High,
                Low            = currPrice.Low,
                Close          = currPrice.Close,
                PortfolioValue = currPrice.Close,
                Position       = 0
            };

            bot.TradeBook.Series.Add(prevItem);
            idxDate       = idxDate.AddDays(1);
            idxDateString = idxDate.ToString("yyyyMMddHHmmss");
            while (idxDate < stopDate)
            {
                // make sure the date is included in our data set coming from the data provider (ie intrinio)
                // (ie skip weekends)
                if (priceLookup.ContainsKey(idxDateString))
                {
                    // set up calculations for this time-step
                    var(newSignal, multiplier) = await bot.Model.GetSignal(idxDate);

                    var tradeEntry = new TradeEntry()
                    {
                        Type          = "pin",
                        RollOverColor = blue
                    };
                    currPrice = priceLookup[idxDateString];

                    var seriesItem = new SeriesItem()
                    {
                        Date   = idxDate,
                        Open   = currPrice.Open,
                        High   = currPrice.High,
                        Low    = currPrice.Low,
                        Close  = currPrice.Close,
                        Signal = newSignal,
                    };

                    ///
                    /// ====================================================================
                    /// Determine if we want to alter our position based on the model signal
                    /// ====================================================================
                    ///
                    var positionChange = 0;
                    if (prevItem.Signal != newSignal)
                    {
                        switch (newSignal)
                        {
                        case Signal.Buy:

                            // if prev position is a short we want to reverse it
                            positionChange = (int)Math.Round(bot.OrderAmount * multiplier) - prevItem.Position;

                            tradeEntry.Position        = TradeType.Buy;
                            tradeEntry.Text            = "B";
                            tradeEntry.Date            = idxDate;
                            tradeEntry.Price           = seriesItem.Close;
                            seriesItem.Position        = positionChange + prevItem.Position;
                            tradeEntry.Description     = Math.Abs(positionChange) + " share(s) purchased @ $" + seriesItem.Close / 100.0;
                            tradeEntry.BackgroundColor = buyColor;
                            break;

                        case Signal.Sell:
                            // if long the prev position we want to reverse it
                            positionChange             = -1 * (int)Math.Round(bot.OrderAmount * multiplier) - prevItem.Position;
                            tradeEntry.Position        = TradeType.Sell;
                            tradeEntry.Text            = "S";
                            tradeEntry.Date            = idxDate;
                            tradeEntry.Price           = seriesItem.Close;
                            seriesItem.Position        = positionChange + prevItem.Position;
                            tradeEntry.Description     = Math.Abs(positionChange) + " share(s) sold @ $" + seriesItem.Close / 100.0;
                            tradeEntry.BackgroundColor = sellColor;
                            break;

                        case Signal.Hold:
                            // if long the prev position we want to reverse it
                            positionChange = -1 * prevItem.Position;

                            tradeEntry.Text     = "H";
                            tradeEntry.Date     = idxDate;
                            tradeEntry.Price    = seriesItem.Close;
                            seriesItem.Position = positionChange + prevItem.Position;
                            if (positionChange > 0)
                            {
                                tradeEntry.Description = Math.Abs(positionChange) + " share(s) bought @ $" + seriesItem.Close / 100.0 + " to flatten position.";
                                tradeEntry.Position    = TradeType.Buy;
                            }
                            else
                            {
                                tradeEntry.Description = Math.Abs(positionChange) + " share(s) sold @ $" + seriesItem.Close / 100.0 + " to flatten position.";
                                tradeEntry.Position    = TradeType.Sell;
                            }
                            tradeEntry.BackgroundColor = "#0075be";
                            break;

                        default:
                            throw new Exception("Unhandled signal '" + newSignal.ToString() + "'!!!");
                        }
                        bot.TradeBook.TradeEntries.Add(tradeEntry);
                    }
                    else
                    {
                        seriesItem.Position = prevItem.Position;
                    }
                    ///
                    /// ====================================================================
                    ///

                    ///
                    /// ====================================================================
                    /// Calculate portfolio value
                    ///     Use the previous indexes signal value / position and the current closed value
                    ///     to determine how the porfolio changed
                    /// ====================================================================
                    ///
                    if (prevItem.Position != 0)
                    {
                        seriesItem.PortfolioValue = prevItem.Position * (seriesItem.Close - prevItem.Close) + prevItem.PortfolioValue;
                    }
                    else if (prevItem.Position < 0)
                    {
                        seriesItem.PortfolioValue = prevItem.Position * (seriesItem.Close - prevItem.Close) + prevItem.PortfolioValue;
                    }
                    else
                    {
                        seriesItem.PortfolioValue = prevItem.PortfolioValue;
                    }

                    ///
                    /// ====================================================================
                    ///

                    prevItem = seriesItem;
                    bot.TradeBook.Series.Add(seriesItem);
                }
                idxDate       = idxDate.AddDays(1);
                idxDateString = idxDate.ToString("yyyyMMddHHmmss");
            }

            ///
            /// If we have an open position then lets go ahead and close it out
            ///

            if (prevItem.Position != 0)
            {
                var closeOutTradeEntry = new TradeEntry();
                var positionChange     = -1 * prevItem.Position;

                closeOutTradeEntry.Text  = "H";
                closeOutTradeEntry.Date  = prevItem.Date;
                closeOutTradeEntry.Price = prevItem.Close;
                prevItem.Position        = positionChange + prevItem.Position;
                if (positionChange > 0)
                {
                    closeOutTradeEntry.Description = Math.Abs(positionChange) + " share(s) bought @ $" + prevItem.Close / 100.0 + " to flatten position.";
                }
                else
                {
                    closeOutTradeEntry.Description = Math.Abs(positionChange) + " share(s) sold @ $" + prevItem.Close / 100.0 + " to flatten position.";
                }
                closeOutTradeEntry.BackgroundColor = "#0075be";
                bot.TradeBook.TradeEntries.Add(closeOutTradeEntry);
            }


            ///
            /// ====================================================================
            /// Calculate stats
            /// ====================================================================
            ///

            var stats = new TradingStats();

            var startingValue = bot.TradeBook.Series.First().PortfolioValue;
            var endingValue   = bot.TradeBook.Series.Last().PortfolioValue;

            stats.TotalPnL = endingValue - startingValue;
            var tradeProfits = new List <int>();

            for (int idx = 0; idx < bot.TradeBook.TradeEntries.Count - 1; idx += 2)
            {
                var entryTrade = bot.TradeBook.TradeEntries[idx];
                var exitTrade  = bot.TradeBook.TradeEntries[idx + 1];


                //think more about this need to get true profit
                if (entryTrade.Position == TradeType.Buy)
                {
                    tradeProfits.Add(exitTrade.Price - entryTrade.Price);
                }
                else
                {
                    tradeProfits.Add(entryTrade.Price - exitTrade.Price);
                }
            }
            stats.WinPct = 100 * tradeProfits.Count(k => k > 0) / tradeProfits.Count();

            bot.TradeBook.TradingStats = stats;
            bot.Model.Reset();
            return(bot);
        }
 private void lbDataSeries_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbDataSeries.SelectedIndex > -1)
     {
         si = (SeriesItem)lbDataSeries.SelectedItem;
         txtDataValue.Text = si.Data;
         txtLabelValue.Text = si.Label;
         txtSeriesName.Text = si.Name;
         chkShowLabels.Checked = si.ShowLabel;
         cbPlotType.Text = si.PlotType;
         chkMarker.Checked = !si.NoMarker;
         cbLine.Text = si.LineSize;
         if (txtX.Enabled)
         {
             txtX.Text = si.Xplot;
         }
         if (si.YAxis == "Right")
         { 
             chkRight.Checked = true; 
         }
         else
         { 
             chkLeft.Checked = true; 
         }
         if (!String.IsNullOrEmpty(si.Colour))
         {
             colorPicker1.SelectedItem = si.Colour;
             foreach (string s in colorPicker1.Items)
             {
                 if (s.ToLower().Equals(si.Colour.ToLower()))
                 { colorPicker1.SelectedItem = s; break; } 
             }
         }
     }                 
 }
 private void lbDataSeries_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbDataSeries.SelectedIndex > -1)
     {
         si = (SeriesItem)lbDataSeries.SelectedItem;
         txtDataValue.Text = si.Data;
         txtLabelValue.Text = si.Label;
         txtSeriesName.Text = si.Name;
         chkShowLabels.Checked = si.ShowLabel;
         cbPlotType.Text = si.PlotType;
         chkMarker.Checked = !si.NoMarker;
         cbLine.Text = si.LineSize;
         if (txtX.Enabled)
         {
             txtX.Text = si.Xplot;
         }
         if (si.YAxis == "Right")
         { 
             chkRight.Checked = true; 
         }
         else
         { 
             chkLeft.Checked = true; 
         }
     }                 
 }
        private void InitValues()
        {
            XmlNode node = _ReportItems[0];
            XmlNode nTyp = DesignXmlDraw.FindNextInHierarchy(node, "Type");
            XmlNode ncds = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings","SeriesGrouping","StaticSeries");
            ShowMe = ncds != null;

            txtX.Enabled = btnX.Enabled = nTyp.InnerXml == "Scatter";

            if (ShowMe)
            {                
                XmlNode cd;

                XmlNode cdo = DesignXmlDraw.FindNextInHierarchy(node, "ChartData");
                int i = 0;

                foreach (XmlNode ncd in ncds.ChildNodes)
                {
                    cd = cdo.ChildNodes[i];
                    XmlNode ndv = DesignXmlDraw.FindNextInHierarchy(ncd,"Label");
                    String nameValue = ndv == null? "": ndv.InnerText;

                    XmlNode ndv2 = DesignXmlDraw.FindNextInHierarchy(ncd,"Value");
                    String nameStaticValue = ndv2 == null ? "" : ndv2.InnerText;

                    //GJL 18092008
                    XmlNode cl = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:Color");
                    if (cl==null){cl = DesignXmlDraw.FindNextInHierarchy(cd, "Colour");}
                    String Colour;
                    if (cl == null)
                    {
                        Colour = "";
                    }
                    else
                    {
                        Colour = cl.InnerText;
                    }

                    XmlNode pt = DesignXmlDraw.FindNextInHierarchy(cd, "PlotType");
                    String PlotValue;
                    if (pt == null) 
                    {
                        PlotValue = "";
                    }
                    else
                    {
                        PlotValue = pt.InnerText;
                    }
					//GJL 14082008
                    XmlNode Nm = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:NoMarker");
                    if (Nm == null) {Nm = DesignXmlDraw.FindNextInHierarchy(cd, "NoMarker");}
                    bool NoMarker;
                    if (Nm == null)
                    {
                        NoMarker = false;
                    }
                    else
                    {
                        NoMarker = Boolean.Parse(Nm.InnerText);
                    }

                    XmlNode Ls = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:LineSize");
                    if (Ls == null) Ls = DesignXmlDraw.FindNextInHierarchy(cd, "LineSize");
                    String LineSize;
                    if (Ls== null)
                    {
                        LineSize = "Regular";
                    }
                    else
                    {
                        LineSize = Ls.InnerText;
                    }

                    // 20022008 AJM GJL
                    XmlNode ya = DesignXmlDraw.FindNextInHierarchy(cd, "YAxis");
                    String Yaxis;
                    if (ya == null)
                    { 
                        Yaxis = "Left"; 
                    }
                    else
                    { 
                        Yaxis = ya.InnerText;
                    }

                    XmlNode dv = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints","DataPoint","DataValues","DataValue","Value");
                    String dataValue = dv.InnerText;

                    XmlNode lv = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints","DataPoint","DataLabel","Visible");
                    bool showLabel = false;
                    if (lv != null)
                    {
                        showLabel = lv.InnerText.ToUpper().Equals("TRUE");
                    }              

                    XmlNode lva = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints","DataPoint","DataLabel","Value");
                    String labelValue = "";
                    if (lva != null)
                    {
                        labelValue = lva.InnerText;
                    }               

                    SeriesItem si = new SeriesItem();
                    si.Name = nameValue;
                    si.Label = labelValue;
                    si.ShowLabel = showLabel;
                    si.Data = nameStaticValue;
                    si.PlotType = PlotValue;
                    si.YAxis = Yaxis;// 20022008 AJM GJL
                    si.Xplot = dataValue; //Only for XY plots
                    si.NoMarker = NoMarker;//0206208 GJL
                    si.LineSize = LineSize;
                    si.Colour = Colour;


                    lbDataSeries.Items.Add(si);
                    
                    i++;
                }
            }  
        }
Beispiel #27
0
        private void ReporteProducto_Cargar(int?ID_Marca)
        {
            ReporteVentaWCFClient objReporteVentaWCF = new ReporteVentaWCFClient();
            int count = 0;

            rhcProducto.PlotArea.Series[0].Items.Clear();
            rhcProducto.PlotArea.Series[1].Items.Clear();
            rhcProducto.PlotArea.XAxis.Items.Clear();

            rhcProdVendedor.PlotArea.Series[0].Items.Clear();
            rhcProdVendedor.PlotArea.Series[1].Items.Clear();
            rhcProdVendedor.PlotArea.XAxis.Items.Clear();

            rhcProdCliente.PlotArea.Series[0].Items.Clear();
            rhcProdCliente.PlotArea.Series[1].Items.Clear();
            rhcProdCliente.PlotArea.XAxis.Items.Clear();

            try {
                DateTime primerDia = new DateTime(((DateTime)ViewState["periodo"]).Year, ((DateTime)ViewState["periodo"]).Month, 1);

                List <gsDocVenta_ReporteVenta_MarcaProducto_InatecResult> lstProducto = objReporteVentaWCF.DocVenta_ReporteVenta_MarcaProductoInatec(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Marca, null, null, primerDia, primerDia.AddMonths(1).AddDays(-1)).ToList();

                foreach (gsDocVenta_ReporteVenta_MarcaProducto_InatecResult producto in lstProducto)
                {
                    if (count <= 20)
                    {
                        if (producto.Descripcion.Length > 30)
                        {
                            rhcProducto.PlotArea.XAxis.Items.Add(producto.Descripcion.Substring(0, 30).Replace("'", string.Empty));
                        }
                        else
                        {
                            rhcProducto.PlotArea.XAxis.Items.Add(producto.Descripcion.Replace("'", string.Empty));
                        }

                        SeriesItem item = new SeriesItem();

                        item        = new SeriesItem();
                        item.Name   = producto.Descripcion.Replace("'", string.Empty);
                        item.YValue = Math.Round((decimal)producto.ValorVenta / 1000, 2);
                        this.rhcProducto.PlotArea.Series[0].Items.Add(item);

                        item        = new SeriesItem();
                        item.Name   = producto.Descripcion.Replace("'", string.Empty);
                        item.YValue = Math.Round((decimal)producto.ValorPlanificado / 1000, 2);
                        this.rhcProducto.PlotArea.Series[1].Items.Add(item);
                        count++;
                    }
                    else
                    {
                        break;
                    }
                }

                if (ID_Marca != null)
                {
                    grdCliente.DataSource = objReporteVentaWCF.DocVenta_ReporteVenta_MarcaClienteInatec(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                        ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Marca, primerDia, primerDia.AddMonths(1).AddDays(-1));
                    grdCliente.DataBind();

                    grdVendedor.DataSource = objReporteVentaWCF.DocVenta_ReporteVenta_MarcaVendedorInatec(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                          ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, ID_Marca, primerDia, primerDia.AddMonths(1).AddDays(-1));
                    grdVendedor.DataBind();
                }
            }
            catch (Exception ex) {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
Beispiel #28
0
        private void turkishdrama_Load(object sender, EventArgs e)
        {
            String link = "https://www.turkishdrama.com/people/feed";
            //String link = "https://www.turkishdrama.com/tv-series/feed";

            string xml = GetContent(link);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);

            string json = JsonConvert.SerializeXmlNode(doc);

            Rootobject rssObject = (Rootobject)getObject(json);

            Item[] mc = rssObject.rss.channel.item;

            SeriesItem[] msis = new SeriesItem[190]; //people items count from site
            //SeriesItem[] msis = new SeriesItem[153]; //series items count from site

            int i = 0;

            foreach (Item item in mc)
            {
                msis[i]       = new SeriesItem();
                msis[i].title = item.title;
                msis[i].link  = item.link;
                //msis[i].article = item.description;
                i++;
            }

            for (int j = 0; j < msis.Length; j++)
            {
                String htmlcontent = GetContent(msis[j].link);
                //burdan devam htmlcontentten imageurl yi bul çek

                HtmlAgilityPack.HtmlDocument docx = new HtmlAgilityPack.HtmlDocument();

                docx.LoadHtml(htmlcontent);

                var seriesImage = docx.DocumentNode
                                  .Descendants("img")
                                  .Where(d =>
                                         d.Attributes.Contains("class")
                                         &&
                                         d.Attributes["class"].Value.Contains("alignleft wp-post-image")
                                         );
                var img = seriesImage.FirstOrDefault().Attributes["src"].Value;

                msis[j].imageUrl = img;

                var seriesArticle = docx.DocumentNode
                                    .Descendants("article")
                                    .Where(d =>
                                           d.Attributes.Contains("id")
                                           &&
                                           d.Attributes["id"].Value.Contains("the-post")
                                           );
                var article = seriesArticle.FirstOrDefault();

                msis[j].article = article.OuterHtml;
            }
            SeriesItems msits = new SeriesItems();

            msits.mSeriesItems = msis;
            String mJson = Newtonsoft.Json.JsonConvert.SerializeObject(msits);

            textBox1.Text = mJson;

            //Console.WriteLine(mJson);
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            // Load JObject from stream
            JObject  jObject = JObject.Load(reader);
            BaseItem obj;

            var type = jObject["Type"].ToString();

            switch (type)
            {
            case "CollectionFolder":
                obj = new CollectionFolderItem();
                break;

            case "Folder":
                obj = new FolderItem();
                break;

            case "Movie":
                obj = new MovieItem();
                break;

            case "Episode":
                obj = new EpisodeItem();
                break;

            case "Audio":
                obj = new AudioItem();
                break;

            case "Series":
                obj = new SeriesItem();
                break;

            case "Season":
                obj = new SeasonItem();
                break;

            case "MusicAlbum":
                obj = new MusicAlbumItem();
                break;

            case "BoxSet":
                obj = new BoxSetItem();
                break;

            case "Actor":
            case "Director":
            case "Writer":
            case "Producer":
            case "Person":
                obj = new Person();
                break;

            default:
                obj = new BaseItem();
                break;
            }

            serializer.Populate(jObject.CreateReader(), obj);
            return(obj);
        }
        private void Update()
        {
            PlayableMediaItem playableMediaItem = SelectedItem as PlayableMediaItem;

            if (playableMediaItem != null)
            {
                MediaItem   = playableMediaItem.MediaItem;
                SimpleTitle = playableMediaItem.SimpleTitle;
            }
            else
            {
                MediaItem   = null;
                SimpleTitle = string.Empty;
            }

            SeriesFilterItem series = SelectedItem as SeriesFilterItem;

            if (series != null)
            {
                SimpleTitle     = series.SimpleTitle;
                ItemDescription = null;
                return;
            }
            SeriesItem episode = SelectedItem as SeriesItem;

            if (episode != null)
            {
                SimpleTitle     = episode.Series;
                ItemDescription = episode.StoryPlot;
                return;
            }
            MovieFilterItem movieCollection = SelectedItem as MovieFilterItem;

            if (movieCollection != null)
            {
                SimpleTitle     = movieCollection.SimpleTitle;
                ItemDescription = null;
                return;
            }
            MovieItem movie = SelectedItem as MovieItem;

            if (movie != null)
            {
                SimpleTitle     = movie.SimpleTitle;
                ItemDescription = movie.StoryPlot;
                return;
            }
            VideoItem video = SelectedItem as VideoItem;

            if (video != null)
            {
                SimpleTitle     = video.SimpleTitle;
                ItemDescription = video.StoryPlot;
                return;
            }
            FilterItem filterItem = SelectedItem as FilterItem;

            if (filterItem != null)
            {
                SimpleTitle     = filterItem.SimpleTitle;
                ItemDescription = string.Empty;
                return;
            }
            ItemDescription = string.Empty;
        }
Beispiel #31
0
        private void ReporteVenta_Cliente(int periodo, int year, int mes, int id_zona, string id_sectorista)
        {
            int     Periodo;
            int     TotalDias         = 0;
            decimal EsperadoDia       = 0;
            decimal EsperadoAcumulado = 0;


            DateTime fechaInico;
            DateTime fechaFinal;

            fechaInico = Convert.ToDateTime(year + "-" + mes + "-" + "1");
            fechaFinal = fechaInico.AddMonths(1).AddDays(-1);
            TimeSpan ts = fechaFinal - fechaInico;

            TotalDias = ts.Days + 1;

            CobranzasWCFClient objCobranzasWCF = new CobranzasWCFClient();

            //rhcParticipacion.PlotArea.Series[0].Items.Clear();
            try
            {
                #region Venta al 80% y 20%
                List <gsReporteCobranzas_Poryectadas_Vendedor_DetalleResult> lst = objCobranzasWCF.Reporte_CobranzasProyectadasVendedorDetalle(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                                               ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, id_sectorista).ToList().OrderByDescending(x => x.ImporteCobrado).ToList();

                decimal sum = (decimal)lst.Sum(i => i.ImporteCobrado);

                decimal acumulado = 0;
                bool    paso80    = false;

                foreach (var cliente in lst)
                {
                    SeriesItem item = new SeriesItem();
                    if (sum > 0)
                    {
                        if (((int)((decimal.Parse(cliente.ImporteCobrado.ToString()) / sum) * 100)) > 0)
                        {
                            item.YValue = ((int)((decimal.Parse(cliente.ImporteCobrado.ToString()) / sum) * 100));
                            item.Name   = string.Format("{0}<br/>Valor Cobrado:${1}K<br/>Proyectado:${2}K<br/>Avance:{3}%<br/>Participación:{4}%",
                                                        cliente.Cliente + " - " + cliente.ImporteCobrado.ToString().Replace("'", string.Empty),
                                                        Math.Round(decimal.Parse(cliente.ImporteCobrado.ToString()) / 1000, 2),
                                                        Math.Round((decimal)cliente.ImporteProyectado / 1000, 2),
                                                        cliente.Avance,
                                                        item.YValue);
                            //rhcParticipacion.PlotArea.Series[0].Items.Add(item);
                        }
                    }

                    if (cliente.ImporteCobrado > 0)
                    {
                        acumulado = acumulado + (decimal)cliente.ImporteCobrado;
                        if (!paso80)
                        {
                            if (cliente.Cliente.Length > 30)
                            {
                                rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty));
                            }
                            else
                            {
                                rhcCliente80.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty));
                            }

                            item        = new SeriesItem();
                            item.Name   = cliente.Id_Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ImporteCobrado / 1000, 2);
                            this.rhcCliente80.PlotArea.Series[0].Items.Add(item);

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ImporteProyectado / 1000, 2);
                            this.rhcCliente80.PlotArea.Series[1].Items.Add(item);
                        }
                        else
                        {
                            if (cliente.Cliente.Length > 30)
                            {
                                rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Substring(0, 30).Replace("'", string.Empty));
                            }
                            else
                            {
                                rhcCliente20.PlotArea.XAxis.Items.Add(cliente.Cliente.Replace("'", string.Empty));
                            }

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)(cliente.ImporteCobrado) / 1000, 2);
                            this.rhcCliente20.PlotArea.Series[0].Items.Add(item);

                            item        = new SeriesItem();
                            item.Name   = cliente.Cliente.Replace("'", string.Empty);
                            item.YValue = Math.Round((decimal)cliente.ImporteProyectado / 1000, 2);
                            this.rhcCliente20.PlotArea.Series[1].Items.Add(item);
                        }

                        if (acumulado / sum * 100 >= 80)
                        {
                            paso80 = true;
                        }
                    }
                }
                #endregion

                #region Datos principales
                //Datos principales de la venta
                gsReporteCobranzas_Poryectadas_VendedorResult[] rvP = objCobranzasWCF.Reporte_CobranzasProyectadasVendedor(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                                                                                                                           ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, null);
                gsReporteCobranzas_Poryectadas_VendedorResult rv = new gsReporteCobranzas_Poryectadas_VendedorResult();

                if (rvP.Count() > 0)
                {
                    rv = rvP.ToList().Single();

                    rrgAvanceReal.Pointer.Value = decimal.Parse(rv.AvanceCobrado.ToString());
                    lblAvanceReal.Text          = "Avance Real: " + Math.Round((decimal)rv.AvanceCobrado, 0).ToString() + "%";

                    rrgAvanceEsperado.Pointer.Value = decimal.Parse(rv.AvanceEsperado.ToString());
                    lblAvanceEsperado.Text          = "Avance Esperado: " + Math.Round((decimal)rv.AvanceEsperado, 0).ToString() + "%";



                    //- Cuadro de periodos
                    //lblPronostico.Text = string.Format("${0}", Math.Round((decimal)rv.ImporteProyectado, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblValorVenta.Text = string.Format("${0}", Math.Round((decimal)rv.ImporteCobrado, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblDiferencia.Text = string.Format("${0}", Math.Round((decimal)rv.Diferencia, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblCantTotal.Text = lst.Count.ToString();
                    //lblCantVenta.Text = lst.FindAll(x => x.ImporteCobrado > 0).Count.ToString();
                    //lblCantNoVenta.Text = lst.FindAll(x => x.ImporteCobrado <= 0).Count.ToString();
                }



                gsReporteCancelados_ProyectadoResult[] rvCobradoP = objCobranzasWCF.Reporte_CobranzasProyectadas_Sectorista(((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).idEmpresa,
                                                                                                                            ((Usuario_LoginResult)HttpContext.Current.Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, id_sectorista);

                gsReporteCancelados_ProyectadoResult rvCobrado = new gsReporteCancelados_ProyectadoResult();
                if (rvCobradoP.Count() > 0)
                {
                    rvCobrado = rvCobradoP.ToList().Single();

                    //lblVencido01a30.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_01a30, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido31a60.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_31a60, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido61a120.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_61a120, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido121a360.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_121a360, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido361aMas.Text = string.Format("${0}", Math.Round((decimal)(rvCobrado.Importe_361a720 + rvCobrado.Importe_721amas), 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblNoVencido.Text = string.Format("${0}", Math.Round((decimal)rvCobrado.Importe_NoVencido, 0).ToString("#,#", CultureInfo.InvariantCulture));
                }
                else
                {
                    //lblVencido01a30.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido31a60.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido61a120.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido121a360.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblVencido361aMas.Text = string.Format("${0}", Math.Round((decimal)(0), 0).ToString("#,#", CultureInfo.InvariantCulture));
                    //lblNoVencido.Text = string.Format("${0}", Math.Round((decimal)0, 0).ToString("#,#", CultureInfo.InvariantCulture));
                }


                #endregion

                #region Cobro diario
                List <gsReporteCobranzas_Poryectadas_Vendedor_FechaResult> lstFecha = objCobranzasWCF.Reporte_CobranzasProyectadasVendedor_Fecha(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                                                                                 ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, mes, year, periodo, id_zona, null).ToList();

                acumulado = 0;


                EsperadoDia       = (decimal)rv.ImporteProyectado / TotalDias;
                EsperadoAcumulado = 0;


                for (DateTime day = fechaInico; DateTime.Compare(day, fechaFinal) <= 0; day = day.AddDays(1))
                {
                    AxisItem xitem = new AxisItem();
                    xitem.LabelText = day.ToString("dd/MM/yyyy");
                    rhcDiario.PlotArea.XAxis.Items.Add(xitem);

                    gsReporteCobranzas_Poryectadas_Vendedor_FechaResult objVFecha = lstFecha.Find(x => x.FechaCobranza == day);

                    //Completar linea 1
                    SeriesItem serie1 = new SeriesItem();
                    if (objVFecha != null)
                    {
                        acumulado     = acumulado + (decimal)objVFecha.ImporteCobrado;
                        serie1.YValue = Math.Round((decimal)objVFecha.ImporteCobrado / 1000, 2);
                    }
                    else
                    {
                        serie1.YValue = 0;
                    }
                    rhcDiario.PlotArea.Series[0].Items.Add(serie1);

                    //Completar linea 2
                    SeriesItem serie2 = new SeriesItem();
                    if (rv.ImporteProyectado == 0)
                    {
                        serie2.YValue = Math.Round(acumulado / 100 * 100, 0);
                    }
                    else
                    {
                        serie2.YValue = Math.Round(acumulado / (decimal)rv.ImporteProyectado * 100, 0);
                    }
                    rhcDiario.PlotArea.Series[1].Items.Add(serie2);

                    //Completar linea 3
                    SeriesItem serie3 = new SeriesItem();
                    EsperadoAcumulado = EsperadoAcumulado + EsperadoDia;
                    //serie3.YValue = Math.Round((decimal)EsperadoAcumulado / 1000, 2);

                    if (rv.ImporteProyectado == 0)
                    {
                        serie2.YValue = Math.Round((decimal)EsperadoAcumulado / 100 * 100, 0);
                    }
                    else
                    {
                        serie3.YValue = Math.Round((decimal)EsperadoAcumulado / (decimal)rv.ImporteProyectado * 100, 0);
                    }
                    rhcDiario.PlotArea.Series[2].Items.Add(serie3);
                }

                rhcDiario.PlotArea.Series[1].AxisName = "AdditionalAxis";
                rhcDiario.PlotArea.Series[2].AxisName = "AdditionalAxis";
                #endregion

                lblTitulo.Text = "Reporte " + year.ToString() + "-" + mes.ToString() + " de " + rv.Zona_nombre;
            }
            catch (Exception ex) {
                throw ex;
            }
        }
        private void BindChartData()
        {
            try
            {
                if (Session["LegendA"] != null)
                {
                    //   lblLegend.Text = "Cashflow for " + Session["LegendA"].ToString();
                    // Session.Remove("Legend");
                }
                if (Session["LegendB"] != null)
                {
                    //if (lblLegend.Text.Length == 0)
                    //    lblLegend.Text = "Cashflow for " + Session["LegendB"].ToString();
                    //else
                    //    lblLegend.Text = lblLegend.Text + "And " + Session["LegendB"].ToString();
                }
                if (Session["LegendC"] != null)
                {
                    //if (lblLegend.Text.Length == 0)
                    //    lblLegend.Text = "Cashflow for " + Session["LegendC"].ToString();
                    //else
                    //    lblLegend.Text = lblLegend.Text + "And " + Session["LegendC"].ToString();
                }

                DataTable dt = new DataTable();

                dt.Columns.Add("ID");
                dt.Columns.Add("EndDate");
                dt.Columns.Add("Notation");

                if (Session["LegendA"] != null)
                {
                    dt = GetCompactChartData(Session["LegendA"].ToString());
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        //        RadHtmlChart1.HttpHandlerUrl = ResolveUrl("ChartImage.axd");

                        AreaSeries chartLoanA = new AreaSeries();

                        chartLoanA.Name = Session["LegendA"].ToString();

                        object maxDate = dt.Compute("MAX(EndDate)", null);
                        // chartLoanA.PlotArea.XAxis.MaxValue = Convert.ToDouble(Convert.ToDateTime(maxDate).ToOADate());

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            var dr = (dt.Rows[i]).ItemArray;
                            SeriesItem item = new SeriesItem();

                            if (dr[1] != null && dr[2] != null)
                            {
                                CategorySeriesItem seriesItem = new CategorySeriesItem();
                                //item.ActiveRegion.Tooltip = "On Date" + Convert.ToDateTime(dr[1]) + "Fraction Value is" + Convert.ToDouble(dr[2]);
                                AxisItem axisItem = new AxisItem();
                                DateTime date = Convert.ToDateTime(dr[1]);
                                item.XValue = date.Ticks;
                                //axisItem.LabelText =
                                //RadHtmlChart1.PlotArea.XAxis.LabelsAppearance.RotationAngle = 60;
                                string month = date.Date.Month.ToString();
                                if (month.Length == 1)
                                {
                                    month = "0" + month;
                                }

                                string str = month + date.Date.Year.ToString();
                                RadHtmlChart1.PlotArea.XAxis.Items.Add(str);
                                item.YValue = Convert.ToDecimal(dr[2].ToString());
                                //chartLoanA.Items.Add(item);
                                seriesItem.Y = Convert.ToDecimal(dr[2].ToString());
                                chartLoanA.SeriesItems.Add(seriesItem);

                            }

                        }

                        chartLoanA.LabelsAppearance.Visible = false;
                        chartLoanA.LineAppearance.LineStyle = ExtendedLineStyle.Step;
                        RadHtmlChart1.PlotArea.Series.Add(chartLoanA);

                    }
                }

                if (Session["LegendB"] != null)
                {
                    dt = GetCompactChartData(Session["LegendB"].ToString());
                    if (dt != null && dt.Rows.Count > 0)
                    {

                        AreaSeries chartLoanB = new AreaSeries();

                        chartLoanB.Name = Session["LegendB"].ToString();

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            var dr = (dt.Rows[i]).ItemArray;
                            SeriesItem item = new SeriesItem();

                            if (dr[1] != null && dr[2] != null)
                            {
                                CategorySeriesItem seriesItem = new CategorySeriesItem();
                                DateTime date = Convert.ToDateTime(dr[1]);
                                //item.XValue = date.ToOADate();
                                //item.YValue = Convert.ToDouble(dr[2]);
                                item.YValue = Convert.ToDecimal(dr[2].ToString());
                                //chartLoanA.Items.Add(item);
                                string month = date.Date.Month.ToString();
                                if (month.Length == 1)
                                {
                                    month = "0" + month;
                                }

                                string str = month + date.Date.Year.ToString();
                                RadHtmlChart1.PlotArea.XAxis.Items.Add(str);
                                seriesItem.Y = Convert.ToDecimal(dr[2].ToString());
                                chartLoanB.SeriesItems.Add(seriesItem);
                            }

                        }
                        chartLoanB.LabelsAppearance.Visible = false;
                        chartLoanB.LineAppearance.LineStyle = ExtendedLineStyle.Step;
                        RadHtmlChart1.PlotArea.Series.Add(chartLoanB);
                    }
                }

                if (Session["LegendC"] != null)
                {
                    dt = GetCompactChartData(Session["LegendC"].ToString());
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        AreaSeries chartLoanC = new AreaSeries();

                        chartLoanC.Name = Session["LegendC"].ToString();

                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            var dr = (dt.Rows[i]).ItemArray;
                            SeriesItem item = new SeriesItem();
                            if (dr[1] != null && dr[2] != null)
                            {
                                CategorySeriesItem seriesItem = new CategorySeriesItem();
                                DateTime date = Convert.ToDateTime(dr[1]);
                                //item.XValue = date.ToOADate();
                                //item.YValue = Convert.ToDouble(dr[2]);
                                item.YValue = Convert.ToDecimal(dr[2].ToString());
                                //chartLoanA.Items.Add(item);
                                string month = date.Date.Month.ToString();
                                if (month.Length == 1)
                                {
                                    month = "0" + month;
                                }

                                string str = month + date.Date.Year.ToString();
                                RadHtmlChart1.PlotArea.XAxis.Items.Add(str);
                                seriesItem.Y = Convert.ToDecimal(dr[2].ToString());
                                chartLoanC.SeriesItems.Add(seriesItem);

                            }
                        }

                        chartLoanC.LabelsAppearance.Visible = false;
                        chartLoanC.LineAppearance.LineStyle = ExtendedLineStyle.Step;
                        RadHtmlChart1.PlotArea.Series.Add(chartLoanC);
                    }
                }
            }
            //RadHtmlChart1.DataSource = GetData();
            //RadHtmlChart1.DataBind();
            // tempCalculatedList = null;

            catch (Exception)
            {

            }
        }
Beispiel #33
0
        private void InitValues()
        {
            XmlNode node = _ReportItems[0];
            XmlNode nTyp = DesignXmlDraw.FindNextInHierarchy(node, "Type");
            XmlNode ncds = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings", "SeriesGrouping", "StaticSeries");

            ShowMe = ncds != null;

            txtX.Enabled = btnX.Enabled = nTyp.InnerXml == "Scatter";

            if (ShowMe)
            {
                XmlNode cd;

                XmlNode cdo = DesignXmlDraw.FindNextInHierarchy(node, "ChartData");
                int     i   = 0;

                foreach (XmlNode ncd in ncds.ChildNodes)
                {
                    cd = cdo.ChildNodes[i];
                    XmlNode ndv       = DesignXmlDraw.FindNextInHierarchy(ncd, "Label");
                    String  nameValue = ndv == null? "": ndv.InnerText;

                    XmlNode ndv2            = DesignXmlDraw.FindNextInHierarchy(ncd, "Value");
                    String  nameStaticValue = ndv2 == null ? "" : ndv2.InnerText;

                    //GJL 18092008
                    XmlNode cl = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:Color");
                    if (cl == null)
                    {
                        cl = DesignXmlDraw.FindNextInHierarchy(cd, "Colour");
                    }
                    String Colour;
                    if (cl == null)
                    {
                        Colour = "";
                    }
                    else
                    {
                        Colour = cl.InnerText;
                    }

                    XmlNode pt = DesignXmlDraw.FindNextInHierarchy(cd, "PlotType");
                    String  PlotValue;
                    if (pt == null)
                    {
                        PlotValue = "";
                    }
                    else
                    {
                        PlotValue = pt.InnerText;
                    }
                    //GJL 14082008
                    XmlNode Nm = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:NoMarker");
                    if (Nm == null)
                    {
                        Nm = DesignXmlDraw.FindNextInHierarchy(cd, "NoMarker");
                    }
                    bool NoMarker;
                    if (Nm == null)
                    {
                        NoMarker = false;
                    }
                    else
                    {
                        NoMarker = Boolean.Parse(Nm.InnerText);
                    }

                    XmlNode Ls = DesignXmlDraw.FindNextInHierarchy(cd, "fyi:LineSize");
                    if (Ls == null)
                    {
                        Ls = DesignXmlDraw.FindNextInHierarchy(cd, "LineSize");
                    }
                    String LineSize;
                    if (Ls == null)
                    {
                        LineSize = "Regular";
                    }
                    else
                    {
                        LineSize = Ls.InnerText;
                    }

                    // 20022008 AJM GJL
                    XmlNode ya = DesignXmlDraw.FindNextInHierarchy(cd, "YAxis");
                    String  Yaxis;
                    if (ya == null)
                    {
                        Yaxis = "Left";
                    }
                    else
                    {
                        Yaxis = ya.InnerText;
                    }

                    XmlNode dv        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataValues", "DataValue", "Value");
                    String  dataValue = dv.InnerText;

                    XmlNode lv        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataLabel", "Visible");
                    bool    showLabel = false;
                    if (lv != null)
                    {
                        showLabel = lv.InnerText.ToUpper().Equals("TRUE");
                    }

                    XmlNode lva        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataLabel", "Value");
                    String  labelValue = "";
                    if (lva != null)
                    {
                        labelValue = lva.InnerText;
                    }

                    SeriesItem si = new SeriesItem();
                    si.Name      = nameValue;
                    si.Label     = labelValue;
                    si.ShowLabel = showLabel;
                    si.Data      = nameStaticValue;
                    si.PlotType  = PlotValue;
                    si.YAxis     = Yaxis;     // 20022008 AJM GJL
                    si.Xplot     = dataValue; //Only for XY plots
                    si.NoMarker  = NoMarker;  //0206208 GJL
                    si.LineSize  = LineSize;
                    si.Colour    = Colour;


                    lbDataSeries.Items.Add(si);

                    i++;
                }
            }
        }
 private void btnAdd_Click(object sender, EventArgs e)
 {
     SeriesItem si = new SeriesItem();
     si.Data = "";
     si.Name = "<New Series>";
     si.ShowLabel = false;
     si.Label = "";
     si.PlotType = "Auto";
     si.NoMarker = false;
     si.LineSize = "Regular";
     si.YAxis = "Left";// 20022008 AJM GJL
     si.Colour = "";
     lbDataSeries.Items.Add(si);
     lbDataSeries.SelectedItem = si;
 }
Beispiel #35
0
        private void InitValues()
        {
            XmlNode node = _ReportItems[0];
            XmlNode nTyp = DesignXmlDraw.FindNextInHierarchy(node, "Type");
            XmlNode ncds = DesignXmlDraw.FindNextInHierarchy(node, "SeriesGroupings", "SeriesGrouping", "StaticSeries");

            ShowMe = ncds != null;

            txtX.Enabled = btnX.Enabled = nTyp.InnerXml == "Scatter";

            if (ShowMe)
            {
                XmlNode cd;

                XmlNode cdo = DesignXmlDraw.FindNextInHierarchy(node, "ChartData");
                int     i   = 0;

                foreach (XmlNode ncd in ncds.ChildNodes)
                {
                    cd = cdo.ChildNodes[i];
                    XmlNode ndv       = DesignXmlDraw.FindNextInHierarchy(ncd, "Label");
                    String  nameValue = ndv == null? "": ndv.InnerText;

                    XmlNode ndv2            = DesignXmlDraw.FindNextInHierarchy(ncd, "Value");
                    String  nameStaticValue = ndv2 == null ? "" : ndv2.InnerText;

                    XmlNode pt = DesignXmlDraw.FindNextInHierarchy(cd, "PlotType");
                    String  PlotValue;
                    if (pt == null)
                    {
                        PlotValue = "";
                    }
                    else
                    {
                        PlotValue = pt.InnerText;
                    }
                    // 20022008 AJM GJL
                    XmlNode ya = DesignXmlDraw.FindNextInHierarchy(cd, "YAxis");
                    String  Yaxis;
                    if (ya == null)
                    {
                        Yaxis = "Left";
                    }
                    else
                    {
                        Yaxis = ya.InnerText;
                    }

                    XmlNode dv        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataValues", "DataValue", "Value");
                    String  dataValue = dv.InnerText;

                    XmlNode lv        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataLabel", "Visible");
                    bool    showLabel = false;
                    if (lv != null)
                    {
                        showLabel = lv.InnerText.ToUpper().Equals("TRUE");
                    }

                    XmlNode lva        = DesignXmlDraw.FindNextInHierarchy(cd, "DataPoints", "DataPoint", "DataLabel", "Value");
                    String  labelValue = "";
                    if (lva != null)
                    {
                        labelValue = lva.InnerText;
                    }

                    SeriesItem si = new SeriesItem();
                    si.Name      = nameValue;
                    si.Label     = labelValue;
                    si.ShowLabel = showLabel;
                    si.Data      = nameStaticValue;
                    si.PlotType  = PlotValue;
                    si.YAxis     = Yaxis;     // 20022008 AJM GJL
                    si.Xplot     = dataValue; //Only for XY plots


                    lbDataSeries.Items.Add(si);

                    i++;
                }
            }
        }
        private void BindQuotesAndTradesChart()
        {
            List<Browser> browsers = new List<Browser>();

            LoansBLL loansBLL = new LoansBLL();
            DataSet ds = new DataSet();
            ds = loansBLL.GetLoanCountryGraphDetails();
            if (ds.Tables[1].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[1].Rows)
                {
                    browsers.Add(new Browser("Trades", Convert.ToDouble(dr["Trades"]), false));
                    browsers.Add(new Browser("Quotes", Convert.ToDouble(dr["Quotes"]), false));
                }

            }
            PieSeries ps = new PieSeries();
            foreach (var item in browsers)
            {
                SeriesItem s1 = new SeriesItem();
                s1.Name = item.Name;
                s1.Exploded = item.IsExploded;
                s1.YValue = Convert.ToDecimal(item.MarketShare);
                ps.Items.Add(s1);
            }

            // ps.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieLabelsPosition.Column;
            // removed by Nik 20 03 after upgrade version
            //  ps.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieLabelsPosition.Column;

            PieChart2.PlotArea.Series.Add(ps);
            PieChart2.DataBind();
            BindNuberofCounterPartyChar();
        }