Exemple #1
0
 public Tile Parse(string s)
 {
     return(new Tile(ColorTranslator.FromHtml(s)));
 }
Exemple #2
0
 private void txtColor_TextChanged(object sender, EventArgs e)
 {
     txtColor.BackColor = ColorTranslator.FromHtml(txtColor.Text);
 }
        private void btnSaveFilter_Click(object sender, RoutedEventArgs e)
        {
            Filter selected = (Filter)lstFilters.SelectedItem;

            string originalName = selected.Name;
            //if (selected != null && selected.Name != f.Name)
            //    originalName = selected.Name;

            Filter f        = new Filter();
            int    priority = 0;

            int.TryParse(txtFilterPriority.Text.Trim(), out priority);
            f.Priority = priority;

            f.Name = txtFilterName.Text.Trim();
            if (f.Name.Contains(" "))
            {
                MessageBox.Show("Spaces not allowed for filter name.");
                txtFilterName.Focus();
                return;
            }

            if (string.IsNullOrWhiteSpace(f.Name))
            {
                MessageBox.Show("You must supply a name.");
                txtFilterName.Focus();
                return;
            }
            f.SearchTokens   = txtFilterSearchTokens.Text.Trim();
            f.HighlightColor = txtFilterHighlightColor.Text.Trim();

            try
            {
                System.Drawing.Color myColor = ColorTranslator.FromHtml(f.HighlightColor);
            }
            catch (Exception ex)
            {
                MessageBox.Show("You must supply a valid html color. " + ex.Message);
                return;
            }



            if (!_filterManager.SaveFilter(originalName, f))
            {
                return;
            }

            LoadFilters();

            // just refresh this shit, theres a bug in the treeview item if you try to update the tag with a period in the string like myfilter.test
            //
            tvwSearchResults.Items.Clear();
            _filterManager.Filters.Remove(selected);
            List <Filter> sortedFilters = _filterManager.Filters.OrderBy(ob => ob.Priority).ToList();

            foreach (Filter filter in sortedFilters)
            {
                TreeViewItem node = new TreeViewItem();
                node.Header = filter.Name;
                node.Tag    = filter.Name; //note: this could be used to hold the object.
                tvwSearchResults.Items.Add(node);
            }
        }
Exemple #4
0
        private static void LoadStylesFromTimedText10(Subtitle subtitle, string title, string header, string headerNoStyles, StringBuilder sb)
        {
            try
            {
                var lines = new List <string>();
                foreach (string s in subtitle.Header.Replace(Environment.NewLine, "\n").Split('\n'))
                {
                    lines.Add(s);
                }
                var tt  = new TimedText10();
                var sub = new Subtitle();
                tt.LoadSubtitle(sub, lines, string.Empty);

                var xml = new XmlDocument();
                xml.LoadXml(subtitle.Header);
                var nsmgr = new XmlNamespaceManager(xml.NameTable);
                nsmgr.AddNamespace("ttml", "http://www.w3.org/ns/ttml");
                XmlNode head          = xml.DocumentElement.SelectSingleNode("ttml:head", nsmgr);
                int     stylexmlCount = 0;
                var     ttStyles      = new StringBuilder();
                foreach (XmlNode node in head.SelectNodes("//ttml:style", nsmgr))
                {
                    string name = null;
                    if (node.Attributes["xml:id"] != null)
                    {
                        name = node.Attributes["xml:id"].Value;
                    }
                    else if (node.Attributes["id"] != null)
                    {
                        name = node.Attributes["id"].Value;
                    }
                    if (name != null)
                    {
                        stylexmlCount++;

                        string fontFamily = "Arial";
                        if (node.Attributes["tts:fontFamily"] != null)
                        {
                            fontFamily = node.Attributes["tts:fontFamily"].Value;
                        }

                        string fontWeight = "normal";
                        if (node.Attributes["tts:fontWeight"] != null)
                        {
                            fontWeight = node.Attributes["tts:fontWeight"].Value;
                        }

                        string fontStyle = "normal";
                        if (node.Attributes["tts:fontStyle"] != null)
                        {
                            fontStyle = node.Attributes["tts:fontStyle"].Value;
                        }

                        string color = "#ffffff";
                        if (node.Attributes["tts:color"] != null)
                        {
                            color = node.Attributes["tts:color"].Value.Trim();
                        }
                        Color c = Color.White;
                        try
                        {
                            if (color.StartsWith("rgb(", StringComparison.Ordinal))
                            {
                                string[] arr = color.Remove(0, 4).TrimEnd(')').Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                                c = Color.FromArgb(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]));
                            }
                            else
                            {
                                c = ColorTranslator.FromHtml(color);
                            }
                        }
                        catch
                        {
                        }

                        string fontSize = "20";
                        if (node.Attributes["tts:fontSize"] != null)
                        {
                            fontSize = node.Attributes["tts:fontSize"].Value.Replace("px", string.Empty).Replace("em", string.Empty);
                        }
                        int fSize;
                        if (!int.TryParse(fontSize, out fSize))
                        {
                            fSize = 20;
                        }

                        const string styleFormat = "Style: {0},{1},{2},{3},65535,65535,-2147483640,-1,0,1,3,0,2,10,10,10,0,1";

                        ttStyles.AppendLine(string.Format(styleFormat, name, fontFamily, fSize, c.ToArgb()));
                    }
                }

                if (stylexmlCount > 0)
                {
                    sb.AppendLine(string.Format(headerNoStyles, title, ttStyles));
                    subtitle.Header = sb.ToString();
                }
                else
                {
                    sb.AppendLine(string.Format(header, title));
                }
            }
            catch
            {
                sb.AppendLine(string.Format(header, title));
            }
        }
        // ******************** BUDGET ANALYSIS CHARTS ********************
        public ActionResult Charts(int?id)
        {
            BudgetUser u = new BudgetUser();

            // return list of budgets specific to one user
            u = db.BudgetUsers.Where(user => user.BudgetUserId == id).SingleOrDefault();

            var total = from e in db.Budgets where e.BudgetUserId == id select e;

            int size = total.Count();

            // System.Diagnostics.Debug.WriteLine("size: " + size);

            // DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart")
            object[] income = new object[size];
            int      c1     = 0;

            foreach (var item in total)
            {
                income[c1] = item.TotalIncome;
                c1++;
            }

            String[] budgetNames = new string[size];
            int      c2          = 0;

            foreach (var item in total)
            {
                budgetNames[c2] = item.BudgetName;
                c2++;
            }
            int        value = 0;
            Highcharts chart = new Highcharts("chart")


                               .InitChart(new Chart
            {
                DefaultSeriesType = ChartTypes.Line,
                MarginRight       = 130,
                MarginBottom      = 25,
                ClassName         = "chart"
            })

                               .SetTitle(new Title
            {
                Text = "Monthly Budget Analysis Charts "
            })

                               .SetSubtitle(new Subtitle
            {
                Text = " Total Income Analysis Chart "
            })

                               .SetXAxis(new XAxis
            {
                Categories = budgetNames
                             //Categories = new[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }
            })

                               .SetYAxis(new YAxis
            {
                Title = new YAxisTitle
                {
                    Text = "Total Income in €"
                },
                PlotLines = new[]
                {
                    new YAxisPlotLines
                    {
                        Value = 0,
                        Width = 1,
                        Color = ColorTranslator.FromHtml("#808080")
                    }
                }
            })

                               .SetTooltip(new Tooltip
            {
                Crosshairs = new Crosshairs(true, true)
            })

                               .SetLegend(new Legend
            {
                Layout        = Layouts.Vertical,
                Align         = HorizontalAligns.Right,
                VerticalAlign = VerticalAligns.Top,
                X             = -10,
                Y             = 100,
                BorderWidth   = 0
            })

                               //.SetSeries(new Series
                               .SetSeries(new []
            {
                new Series {
                    Name = "Total Income", Data = new Data(income)
                }
                //Data = new Data(new object[] { 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4 })
            })

                               .SetCredits(new Credits
            {
                Enabled = false
            }); // remove hyperlink for highchart

            return(View(chart));
        }
Exemple #6
0
 /// <summary>
 /// Colours from hexadecimal.
 /// </summary>
 /// <param name="hexadecimalCode">The hexadecimal code.</param>
 /// <returns></returns>
 public static Color ColourFromHexadecimal(string hexadecimalCode) => ColorTranslator.FromHtml($"#{ hexadecimalCode }");
        private void AddTextToRichTextBox(RichTextBox rtb, bool bold, bool italic, bool underline, string color, string text)
        {
            if (text.Length > 0)
            {
                int length = rtb.Text.Length;
                richTextBoxPreview.Text += text;

                _colorList.Add(new EffectKaraoke.ColorEntry {
                    Start = length, Length = text.Length, Color = string.IsNullOrWhiteSpace(color) ? Color.White : ColorTranslator.FromHtml(color)
                });

                var fontStyle = new FontStyle();
                if (underline)
                {
                    fontStyle |= FontStyle.Underline;
                }
                if (italic)
                {
                    fontStyle |= FontStyle.Italic;
                }
                if (bold)
                {
                    fontStyle |= FontStyle.Bold;
                }
                _fontList.Add(new EffectKaraoke.FontEntry {
                    Start = length, Length = text.Length, Font = new Font(rtb.Font.FontFamily, rtb.Font.Size, fontStyle)
                });
            }
        }
Exemple #8
0
        public ActionResult Index()
        {
            Highcharts columnChart = new Highcharts("columnchart");

            columnChart.InitChart(new Chart()
            {
                Type            = DotNet.Highcharts.Enums.ChartTypes.Column,
                BackgroundColor = new BackColorOrGradient(System.Drawing.Color.AliceBlue),
                Style           = "fontWeight: 'bold', fontSize: '17px'",
                BorderColor     = System.Drawing.Color.LightBlue,
                BorderRadius    = 0,
                BorderWidth     = 2
            });

            columnChart.SetTitle(new Title()
            {
                Text = "Test Title"
            });

            columnChart.SetSubtitle(new Subtitle()
            {
                Text = "Subtitle"
            });


            columnChart.SetXAxis(new XAxis()
            {
                Type  = AxisTypes.Category,
                Title = new XAxisTitle()
                {
                    Text = "Years", Style = "fontWeight: 'bold', fontSize: '17px'"
                },
                Categories = new[] { "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012" }
            });

            columnChart.SetYAxis(new YAxis()
            {
                Title = new YAxisTitle()
                {
                    Text  = "Runs",
                    Style = "fontWeight: 'bold', fontSize: '17px'"
                },
                ShowFirstLabel = true,
                ShowLastLabel  = true,
                Min            = 0
            });

            columnChart.SetLegend(new Legend
            {
                Enabled         = true,
                BorderColor     = System.Drawing.Color.CornflowerBlue,
                BorderRadius    = 6,
                BackgroundColor = new BackColorOrGradient(ColorTranslator.FromHtml("#FFADD8E6"))
            });

            columnChart.SetSeries(new Series[]
            {
                new Series {
                    Name = "Sachin Tendulkar",
                    Data = new Data(new object[] { 812, 412, 628, 1425, 460, 972, 204, 513, 315 })
                },
                new Series()
                {
                    Name = "M S Dhoni",
                    Data = new Data(new object[] { 19, 895, 821, 1103, 1097, 1198, 600, 764, 524, })
                }
            }
                                  );

            return(View(columnChart));
        }
Exemple #9
0
        private void editProgram()
        {
            StroopProgram program = new StroopProgram();

            try
            {
                program.readProgramFile(path + "/prg/" + editPrgName + ".prg");

                prgNameTextBox.Text       = program.ProgramName;
                numExpo.Value             = program.NumExpositions;
                expoTime.Value            = program.ExpositionTime;
                rndExpoCheck.Checked      = program.ExpositionRandom;
                intervalTime.Value        = program.IntervalTime;
                rndIntervalCheck.Checked  = program.IntervalTimeRandom;
                audioCaptureCheck.Checked = program.AudioCapture;
                wordSizeNumeric.Value     = Convert.ToInt32(program.FontWordLabel);
                expandImgCheck.Checked    = program.ExpandImage;
                subsRndCheckBox.Checked   = program.RndSubtitlePlace;

                if (program.WordsListFile.ToLower() == "false")
                {
                    openWordListButton.Enabled = false;
                }
                else
                {
                    openWordListButton.Enabled = true; openWordListButton.Text = program.WordsListFile;
                }

                if (program.ColorsListFile.ToLower() == "false")
                {
                    openColorListButton.Enabled = false;
                }
                else
                {
                    openColorListButton.Enabled = true; openColorListButton.Text = program.ColorsListFile;
                }

                if (program.ImagesListFile.ToLower() == "false")
                {
                    openImgListButton.Enabled = false;
                }
                else
                {
                    openImgListButton.Enabled = true; openImgListButton.Text = program.ImagesListFile;
                }

                if (program.AudioListFile.ToLower() == "false")
                {
                    openAudioListButton.Enabled = false;
                }
                else
                {
                    openAudioListButton.Enabled = true; openAudioListButton.Text = program.AudioListFile;
                }

                if (program.BackgroundColor.ToLower() == "false")
                {
                    bgColorPanel.BackColor = Color.White;
                    bgColorButton.Text     = "escolher";
                }
                else
                {
                    if ((Validations.isHexPattern(program.BackgroundColor)))
                    {
                        bgColorButton.Text     = program.BackgroundColor;
                        bgColorPanel.BackColor = ColorTranslator.FromHtml(program.BackgroundColor);
                    }
                }

                if (program.FixPointColor.ToLower() == "false")
                {
                    fixPointColorPanel.BackColor = ColorTranslator.FromHtml("#D01C1F");
                    fixPointColorButton.Text     = "#D01C1F";
                }
                else
                {
                    if ((Validations.isHexPattern(program.FixPointColor)))
                    {
                        fixPointColorButton.Text     = program.FixPointColor;
                        fixPointColorPanel.BackColor = ColorTranslator.FromHtml(program.FixPointColor);
                    }
                    else
                    {
                        throw new Exception("Deu errado no match");
                    }
                }


                delayTime.Value = program.DelayTime;

                switch (program.RotateImage)
                {
                case 45:
                    rotateImgComboBox.SelectedIndex = 1;
                    break;

                case 90:
                    rotateImgComboBox.SelectedIndex = 2;
                    break;

                case 135:
                    rotateImgComboBox.SelectedIndex = 3;
                    break;

                case 180:
                    rotateImgComboBox.SelectedIndex = 4;
                    break;

                case 225:
                    rotateImgComboBox.SelectedIndex = 5;
                    break;

                case 270:
                    rotateImgComboBox.SelectedIndex = 6;
                    break;

                case 315:
                    rotateImgComboBox.SelectedIndex = 7;
                    break;

                default:
                    rotateImgComboBox.SelectedIndex = 0;
                    break;
                }

                if (program.FixPoint == "+")
                {
                    fixPointCross.Checked  = true;
                    fixPointCircle.Checked = false;
                }
                else
                {
                    if (program.FixPoint == "o")
                    {
                        fixPointCross.Checked  = false;
                        fixPointCircle.Checked = true;
                    }
                    else
                    {
                        fixPointCross.Checked  = false;
                        fixPointCircle.Checked = false;
                    }
                }
                chooseFixPointType();

                if (program.InstructionText != null) // lê instrução se houver
                {
                    instructionsBox.ForeColor = Color.Black;
                    instructionsBox.Text      = program.InstructionText[0];
                    for (int i = 1; i < program.InstructionText.Count; i++)
                    {
                        instructionsBox.AppendText(Environment.NewLine + program.InstructionText[i]);
                    }
                }
                else
                {
                    instructionsBox.Text = instructionBoxText;
                }

                switch (program.ExpositionType)
                {
                case "txt":
                    chooseExpoType.SelectedIndex = 0;
                    openWordListButton.Enabled   = true;
                    openColorListButton.Enabled  = true;
                    openImgListButton.Enabled    = false;
                    openAudioListButton.Enabled  = false;
                    break;

                case "img":
                    chooseExpoType.SelectedIndex = 1;
                    openWordListButton.Enabled   = false;
                    openColorListButton.Enabled  = false;
                    openImgListButton.Enabled    = true;
                    openAudioListButton.Enabled  = false;
                    break;

                case "imgtxt":
                    chooseExpoType.SelectedIndex = 2;
                    openWordListButton.Enabled   = true;
                    openColorListButton.Enabled  = false;
                    openImgListButton.Enabled    = true;
                    openAudioListButton.Enabled  = false;
                    break;

                case "txtaud":
                    chooseExpoType.SelectedIndex = 3;
                    openWordListButton.Enabled   = true;
                    openColorListButton.Enabled  = true;
                    openImgListButton.Enabled    = false;
                    openAudioListButton.Enabled  = true;
                    break;

                case "imgaud":
                    chooseExpoType.SelectedIndex = 4;
                    openWordListButton.Enabled   = false;
                    openColorListButton.Enabled  = false;
                    openImgListButton.Enabled    = true;
                    openAudioListButton.Enabled  = true;
                    break;
                }

                if (program.SubtitleShow)
                {
                    activateSubsCheck.Checked = true;
                    enableSubsItens(true);
                    selectSubDirectionNumber(program.SubtitlePlace);
                    if (program.SubtitlesListFile.ToLower() != "false")
                    {
                        openSubsListButton.Text = program.SubtitlesListFile;
                    }
                    else
                    {
                        openSubsListButton.Text = "escolher";
                    }

                    if (Validations.isHexPattern(program.SubtitleColor))
                    {
                        subColorButton.Text     = program.SubtitleColor;
                        subColorPanel.BackColor = ColorTranslator.FromHtml(program.SubtitleColor);
                    }
                    else
                    {
                        subColorButton.Text     = "escolher";
                        subColorPanel.BackColor = Color.White;
                    }
                }
                else
                {
                    activateSubsCheck.Checked = false;
                    enableSubsItens(false);
                }

                wordColorButton.Text     = program.WordColor;
                wordColorPanel.BackColor = ColorTranslator.FromHtml(program.WordColor);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Dispose();
                Close();
            }
        }
Exemple #10
0
        private void LoadStyle(string styleName)
        {
            XmlNode head = _xml.DocumentElement.SelectSingleNode("ttml:head", _nsmgr);

            foreach (XmlNode node in head.SelectNodes("//ttml:style", _nsmgr))
            {
                string name = "default";
                if (node.Attributes["xml:id"] != null)
                {
                    name = node.Attributes["xml:id"].Value;
                }
                else if (node.Attributes["id"] != null)
                {
                    name = node.Attributes["id"].Value;
                }

                if (name == styleName)
                {
                    string fontFamily = "Arial";
                    if (node.Attributes["tts:fontFamily"] != null)
                    {
                        fontFamily = node.Attributes["tts:fontFamily"].Value;
                    }

                    string fontWeight = "normal";
                    if (node.Attributes["tts:fontWeight"] != null)
                    {
                        fontWeight = node.Attributes["tts:fontWeight"].Value;
                    }

                    string fontStyle = "normal";
                    if (node.Attributes["tts:fontStyle"] != null)
                    {
                        fontStyle = node.Attributes["tts:fontStyle"].Value;
                    }

                    string fontColor = "white";
                    if (node.Attributes["tts:color"] != null)
                    {
                        fontColor = node.Attributes["tts:color"].Value;
                    }

                    string fontSize = "100%";
                    if (node.Attributes["tts:fontSize"] != null)
                    {
                        fontSize = node.Attributes["tts:fontSize"].InnerText;
                    }

                    textBoxStyleName.Text = name;
                    comboBoxFontName.Text = fontFamily;

                    textBoxFontSize.Text = fontSize;

                    // normal | italic | oblique
                    comboBoxFontStyle.SelectedIndex = 0;
                    if (fontStyle.Equals("italic", StringComparison.OrdinalIgnoreCase))
                    {
                        comboBoxFontStyle.SelectedIndex = 1;
                    }
                    if (fontStyle.Equals("oblique", StringComparison.OrdinalIgnoreCase))
                    {
                        comboBoxFontStyle.SelectedIndex = 2;
                    }

                    // normal | bold
                    comboBoxFontWeight.SelectedIndex = 0;
                    if (fontWeight.Equals("bold", StringComparison.OrdinalIgnoreCase))
                    {
                        comboBoxFontWeight.SelectedIndex = 1;
                    }

                    Color color = Color.White;
                    try
                    {
                        if (fontColor.StartsWith("rgb(", StringComparison.Ordinal))
                        {
                            string[] arr = fontColor.Remove(0, 4).TrimEnd(')').Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            color = Color.FromArgb(int.Parse(arr[0]), int.Parse(arr[1]), int.Parse(arr[2]));
                        }
                        else
                        {
                            color = ColorTranslator.FromHtml(fontColor);
                        }
                    }
                    catch (Exception exception)
                    {
                        MessageBox.Show("Unable to read color: " + fontColor + " - " + exception.Message);
                    }
                    panelFontColor.BackColor = color;
                }
            }
        }
Exemple #11
0
 private void _09Message_Load(object sender, EventArgs e)
 {
     Services.opened   = true;
     button2.BackColor = ColorTranslator.FromHtml("#4ebfed");
     panel1.BackColor  = ColorTranslator.FromHtml("#fff");
 }
        // Charts for Corps Member Experience View
        public ActionResult CorpMemberExperience()
        {
            Highcharts retentionChart = new Highcharts("retentionChart");



            retentionChart.InitChart(new Chart()
            {
                Type            = DotNet.Highcharts.Enums.ChartTypes.Column,
                BackgroundColor = new BackColorOrGradient(System.Drawing.Color.White),
                Style           = "fontWeight: 'bold', fontSize: '17px'",
                BorderColor     = System.Drawing.Color.Gray,
                BorderRadius    = 0,
                BorderWidth     = 2
            });

            retentionChart.SetTitle(new Title()
            {
                Text = "AMERICORPS RETENTION"
            });


            // Create objects for X - Axis
            object[] Q1Goal         = Q1GoalsRetention().Cast <object>().ToArray();
            object[] Q1Actual       = Q1ActualsRetention().Cast <object>().ToArray();
            object[] Q2Goal         = Q2GoalsRetention().Cast <object>().ToArray();
            object[] Q2Actual       = Q2ActualsRetention().Cast <object>().ToArray();
            object[] Q3Goal         = Q3GoalsRetention().Cast <object>().ToArray();
            object[] Q3Actual       = Q3ActualsRetention().Cast <object>().ToArray();
            object[] Q4Goal         = Q4GoalsRetention().Cast <object>().ToArray();
            object[] Q4Actual       = Q4ActualsRetention().Cast <object>().ToArray();
            object[] AnnualGoal     = AnnualGoalsRetention().Cast <object>().ToArray();
            object[] AnnualActual   = AnnualActualsRetention().Cast <object>().ToArray();
            object[] BestofCYGoal   = BestofCYGoalsRetention().Cast <object>().ToArray();
            object[] BestofCYActual = BestofCYActualsRetention().Cast <object>().ToArray();

            // Create objects for Y - Axis
            string[] Subcategories = subCat().ToArray();


            retentionChart.SetXAxis(new XAxis()
            {
                Type  = AxisTypes.Category,
                Title = new XAxisTitle()
                {
                    Text = "Goal vs Actual", Style = "fontWeight: 'bold', fontSize: '17px'"
                },
                Categories = Subcategories
            });

            retentionChart.SetYAxis(new YAxis()
            {
                Title = new YAxisTitle()
                {
                    Text  = "# Of AmeriCorps Members",
                    Style = "fontWeight: 'bold', fontSize: '17px'"
                },
                ShowFirstLabel = true,
                ShowLastLabel  = true,
                Min            = 0
            });

            retentionChart.SetLegend(new Legend
            {
                Enabled         = true,
                BorderRadius    = 6,
                BackgroundColor = new BackColorOrGradient(ColorTranslator.FromHtml("#FFADD8E6"))
            });


            // Set series for quarterly goals + actuals
            retentionChart.SetSeries(new Series[]
            {
                new Series {
                    Name  = "Q1 GOAL",
                    Data  = new Data(Q1Goal),
                    Color = ColorTranslator.FromHtml("#3EC2CF")
                },

                new Series
                {
                    Name  = "Q1 ACTUAL",
                    Data  = new Data(Q1Actual),
                    Color = ColorTranslator.FromHtml("#bedde0")
                },

                new Series {
                    Name  = "Q2 GOAL",
                    Data  = new Data(Q2Goal),
                    Color = ColorTranslator.FromHtml("#3EC2CF")
                },

                new Series
                {
                    Name  = "Q2 ACTUAL",
                    Data  = new Data(Q2Actual),
                    Color = ColorTranslator.FromHtml("#bedde0")
                },

                new Series {
                    Name  = "Q3 GOAL",
                    Data  = new Data(Q3Goal),
                    Color = ColorTranslator.FromHtml("#3EC2CF")
                },

                new Series
                {
                    Name  = "Q3 ACTUAL",
                    Data  = new Data(Q3Actual),
                    Color = ColorTranslator.FromHtml("#bedde0")
                },

                new Series {
                    Name  = "Q4 GOAL",
                    Data  = new Data(Q4Goal),
                    Color = ColorTranslator.FromHtml("#3EC2CF")
                },

                new Series
                {
                    Name  = "Q4 ACTUAL",
                    Data  = new Data(Q4Actual),
                    Color = ColorTranslator.FromHtml("#bedde0")
                },

                new Series {
                    Name  = "ANNUAL GOAL",
                    Data  = new Data(AnnualGoal),
                    Color = ColorTranslator.FromHtml("#3EC2CF")
                },

                new Series
                {
                    Name  = "ANNUAL ACTUAL",
                    Data  = new Data(AnnualActual),
                    Color = ColorTranslator.FromHtml("#bedde0")
                },
                new Series {
                    Name  = "BEST OF CITY YEAR GOAL",
                    Data  = new Data(BestofCYGoal),
                    Color = ColorTranslator.FromHtml("#3EC2CF")
                },

                new Series
                {
                    Name  = "BEST OF CITY YEAR ACTUAL",
                    Data  = new Data(BestofCYActual),
                    Color = ColorTranslator.FromHtml("#bedde0")
                }
            }
                                     );



            return(View(retentionChart));
        }
Exemple #13
0
 private void _8QAInfo_Load(object sender, EventArgs e)
 {
     ConsChangeInForms.ConsChangeInForm(this);
     this.BackColor = ColorTranslator.FromHtml("#CCCCCC");
 }
 public Color al(string value)
 {
     return(ColorTranslator.FromHtml(read.getini(value)));
 }
        // colcon.fromhtml is weirdly slow, so we cache its result

        private static object ConvertXmlStringToObject(string valueName, string valueText, Type type)
        {
            if (type == typeof(bool))
            {
                if (string.Compare(valueText, "off", true) == 0 ||
                    string.Compare(valueText, "no", true) == 0 ||
                    string.Compare(valueText, "disabled", true) == 0)
                {
                    return(false);
                }

                return(true);
            }

            try
            {
                if (type == typeof(double))
                {
                    double result = 0;

                    if (double.TryParse(valueText, NumberStyles.Number, null, out result))
                    {
                        return(result);
                    }

                    return(1);
                }

                if (type == typeof(int) || type == typeof(long))
                {
                    if (string.Compare(valueName, "textcolor", true) == 0 ||
                        string.Compare(valueName, "colorkey", true) == 0 ||
                        string.Compare(valueName, "colordiffuse", true) == 0)
                    {
                        if (valueText.Length > 0)
                        {
                            bool isNamedColor = false;

                            foreach (char ch in valueText)
                            {
                                if (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f')
                                {
                                    continue;
                                }

                                isNamedColor = true;
                                break;
                            }

                            if (isNamedColor)
                            {
                                int index = valueText.IndexOf(':');

                                if (index != -1)
                                {
                                    // FromHTML is strangly and unnessesarily slow, simple cache
                                    //Color color = ColorTranslator.FromHtml(valueText.Substring(0, index));
                                    Color color = colCache.TryGetOrAdd(valueText.Substring(0, index), col => ColorTranslator.FromHtml(col));
                                    int   alpha = 255;

                                    if (index < valueText.Length)
                                    {
                                        if (valueText[index + 1] == '#')
                                        {
                                            alpha = int.Parse(valueText.Substring(index + 2), NumberStyles.HexNumber);
                                        }
                                        else
                                        {
                                            alpha = int.Parse(valueText.Substring(index + 1));
                                        }
                                    }

                                    return(Color.FromArgb(alpha, color).ToArgb());
                                }
                                return(colCache.TryGetOrAdd(valueText, col => Color.FromName(valueText)).ToArgb());
                                //return Color.FromName(valueText).ToArgb();
                            }

                            try
                            {
                                Color color = colCache.TryGetOrAdd('#' + valueText, col => ColorTranslator.FromHtml(col));
                                //Color color = ColorTranslator.FromHtml('#' + valueText);

                                return(color.ToArgb());
                            }
                            catch
                            {
                                Log.Info("GUIControlFactory.ConvertXmlStringToObject: Invalid color format '#{0}' reverting to White",
                                         valueText);

                                return(Color.White.ToArgb());
                            }
                        }
                    }
                }

                if (type == typeof(int))
                {
                    if (valueText.CompareTo("-") == 0)
                    {
                        return(0);
                    }
                    if (valueText.CompareTo("") == 0)
                    {
                        return(0);
                    }
                    int res;
                    if (int.TryParse(valueText, out res))
                    {
                        return(res);
                    }
                    if (int.TryParse(valueText, NumberStyles.HexNumber, null, out res))
                    {
                        return(res);
                    }
                }
                if (type == typeof(long))
                {
                    if (valueText.CompareTo("-") == 0)
                    {
                        return(0);
                    }
                    if (valueText.CompareTo("") == 0)
                    {
                        return(0);
                    }
                    long res;
                    if (Int64.TryParse(valueText, NumberStyles.HexNumber, null, out res))
                    {
                        return(res);
                    }
                    return(0);
                }
            }
            catch (Exception)
            {
                return(0);
            }

            if (type == typeof(ILayout) || type == typeof(ILayoutDetail))
            {
                return(ParseLayout(valueText));
            }

            // much of the above could be changed to use the following, needs time for thorough testing though
            //TypeConverter converter = TypeDescriptor.GetConverter(type);
            TypeConverter converter = convCache.TryGetOrAdd(type, t => TypeDescriptor.GetConverter(t));

            if (converter.CanConvertFrom(typeof(string)))
            {
                return(converter.ConvertFromString(null, CultureInfo.InvariantCulture, valueText));
            }

            return(null);
        }
    protected void gvSupplier_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "View")
        {
            LinkButton  lnkView = (LinkButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((LinkButton)lnkView).NamingContainer;
            //int index = Convert.ToInt32(e.CommandArgument);

            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }

            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string msg2         = String.Format("OpenASLScreen('" + suppliercode + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }

        if (e.CommandName == "ImgView")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenASLScreen('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgREGD")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenRegisteredData('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
            //string OCA_URL1 = "PO_LOG/ASL_Data_Entry.aspx?P=" + PassString + "";

            //ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "javascript:window.open('" + OCA_URL1 + "');", true);
        }
        if (e.CommandName == "ImgEvaluateN")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenScreenEvalaution('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgEvaluateL")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenScreenEHistory('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgSupplierD")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenScreenDocument('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgSupplierR")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenScreenRemarks('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgEmail")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenScreenEmail('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgChangeR")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string StatusType   = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[4]);
            string msg2         = String.Format("OpenScreenRequest('" + suppliercode + "','" + ProposedType + "','" + StatusType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgChangeH")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string msg2         = String.Format("OpenScreenCHistory('" + suppliercode + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgInvoice")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string PassString   = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[3]);
            //string msg2 = String.Format("OpenASLScreen('" + suppliercode + "','" + ProposedType + "');");
            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
            string OCA_URL = null;
            if (!Request.Url.AbsoluteUri.Contains(ConfigurationManager.AppSettings["OCA_APP_URL"]))
            {
                OCA_URL = ConfigurationManager.AppSettings["OCA_APP_URL"];
            }
            //string PassString = e.CommandArgument.ToString();
            string OCA_URL1 = OCA_URL + "/PO_LOG/Supplier_Online_Invoice_Status_V2.asp?P=" + PassString + "";

            ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "javascript:window.open('" + OCA_URL1 + "');", true);
        }
        if (e.CommandName == "ImgPayment")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string Register_Name = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            Session["Register_Name"] = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            string msg2 = String.Format("OpenScreenPayment('" + suppliercode + "','" + Register_Name + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgInvoicePO")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string Register_Name = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            Session["Register_Name"] = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            string msg2 = String.Format("OpenScreenPOInvoice('" + suppliercode + "','" + Register_Name + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgInvoiceWIP")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string Register_Name = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            Session["Register_Name"] = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            string msg2 = String.Format("OpenScreenInvoiceWIP('" + suppliercode + "','" + Register_Name + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgOutstandings")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string Register_Name = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            Session["Register_Name"] = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            string msg2 = String.Format("OpenScreenOutStanding('" + suppliercode + "','" + Register_Name + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgStatistics")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string Register_Name = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            Session["Register_Name"] = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            string msg2 = String.Format("OpenScreenStatistics('" + suppliercode + "','" + Register_Name + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
        if (e.CommandName == "ImgTransaction")
        {
            ImageButton lnkView = (ImageButton)e.CommandSource;
            GridViewRow grdrow  = (GridViewRow)((ImageButton)lnkView).NamingContainer;
            foreach (GridViewRow gr in gvSupplier.Rows)
            {
                gr.BackColor = ColorTranslator.FromHtml("#FFFFFF");
            }
            GridViewRow gvRow = gvSupplier.Rows[grdrow.RowIndex];
            gvRow.BackColor = ColorTranslator.FromHtml("#abcdef");
            string suppliercode  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[0]);
            string ProposedType  = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[1]);
            string Register_Name = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            Session["Register_Name"] = Convert.ToString(gvSupplier.DataKeys[grdrow.RowIndex].Values[2]);
            string msg2 = String.Format("OpenTransactionLog('" + suppliercode + "','" + Register_Name + "','" + ProposedType + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
        }
    }
        public ActionResult Create(string c1, string c2)
        {
            c1 = Request.Form["color1"];
            c2 = Request.Form["color2"];

            //Debug
            Debug.WriteLine(c1);
            Debug.WriteLine(c2);

            // Translation from hex to Color structure using System.Drawing
            Color color1 = ColorTranslator.FromHtml(c1);
            Color color2 = ColorTranslator.FromHtml(c2);

            // placeholders for results
            int alpha = 0;
            int red   = 0;
            int green = 0;
            int blue  = 0;

            // Added checking to make sure values of alpha, red, green, and blue are valid
            if (color1.A + color2.A <= 255)
            {
                alpha = color1.A + color2.A;
            }
            else
            {
                alpha = 255;
            }
            if (color1.R + color2.R <= 255)
            {
                red = color1.R + color2.R;
            }
            else
            {
                red = 255;
            }
            if (color1.G + color2.G <= 255)
            {
                green = color1.G + color2.G;
            }
            else
            {
                green = 255;
            }
            if (color1.B + color2.B <= 255)
            {
                blue = color1.B + color2.B;
            }
            else
            {
                blue = 255;
            }

            // Translation back to hex from Color structure for showing results
            string result = ColorTranslator.ToHtml(Color.FromArgb(alpha, red, green, blue));

            // Making Results show as boxes with each color in it, 3 boxes all together
            ViewBag.Show        = true;
            ViewBag.firstColor  = "width:80px; height:80px; background: " + c1 + "; ";
            ViewBag.secondColor = "width:80px; height:80px; background: " + c2 + "; ";
            ViewBag.mixedColor  = "width:80px; height:80px; background: " + result + "; ";

            return(View());
        }
Exemple #18
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            try {
                if (this.PublicParmValues.Count > 0)
                {
                    string sTmp = "";

                    this.OverrideCSS = GetParmValue("OverrideCSS", "");
                    this.ExtraCSS    = GetParmValue("ExtraCSS", "");

                    sTmp = GetParmValue("AutoStylingDisabled", "false");
                    if (!String.IsNullOrEmpty(sTmp))
                    {
                        this.AutoStylingDisabled = Convert.ToBoolean(sTmp);
                    }

                    sTmp = GetParmValue("AttemptResponsiveCSS", "true");
                    if (!String.IsNullOrEmpty(sTmp))
                    {
                        this.AttemptResponsiveCSS = Convert.ToBoolean(sTmp);
                    }

                    sTmp = GetParmValue("WrapList", "false");
                    if (!String.IsNullOrEmpty(sTmp))
                    {
                        this.WrapList = Convert.ToBoolean(sTmp);
                    }

                    if (!this.AutoStylingDisabled)
                    {
                        sTmp = GetParmValue("FontSize", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            FontSize = new Unit(sTmp);
                        }

                        sTmp = GetParmValue("TopBackgroundStyle", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.TopBackgroundStyle = sTmp;
                        }

                        sTmp = GetParmValue("ForeColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.ForeColor = ColorTranslator.FromHtml(sTmp);
                        }
                        sTmp = GetParmValue("BackColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.BackColor = ColorTranslator.FromHtml(sTmp);
                        }
                        sTmp = GetParmValue("BGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.BGColor = ColorTranslator.FromHtml(sTmp);
                        }
                        sTmp = GetParmValue("HoverFGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.HoverFGColor = ColorTranslator.FromHtml(sTmp);
                        }
                        sTmp = GetParmValue("HoverBGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.HoverBGColor = ColorTranslator.FromHtml(sTmp);
                        }

                        sTmp = GetParmValue("UnSelFGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.UnSelFGColor = ColorTranslator.FromHtml(sTmp);
                        }
                        sTmp = GetParmValue("UnSelBGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.UnSelBGColor = ColorTranslator.FromHtml(sTmp);
                        }

                        sTmp = GetParmValue("SelFGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.SelFGColor = ColorTranslator.FromHtml(sTmp);
                        }
                        sTmp = GetParmValue("SelBGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.SelBGColor = ColorTranslator.FromHtml(sTmp);
                        }

                        sTmp = GetParmValue("SubFGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.SubFGColor = ColorTranslator.FromHtml(sTmp);
                        }
                        sTmp = GetParmValue("SubBGColor", "");
                        if (!String.IsNullOrEmpty(sTmp))
                        {
                            this.SubBGColor = ColorTranslator.FromHtml(sTmp);
                        }
                    }
                }
            } catch (Exception ex) {
            }

            if (String.IsNullOrEmpty(this.OverrideCSS) && !this.AutoStylingDisabled)
            {
                ParseCSS();
            }
            else
            {
                if (!String.IsNullOrEmpty(this.OverrideCSS))
                {
                    HtmlLink link = new HtmlLink();
                    link.Href = OverrideCSS;
                    link.Attributes.Add("rel", "stylesheet");
                    link.Attributes.Add("type", "text/css");
                    this.Page.Header.Controls.Add(link);
                }
            }

            if (!String.IsNullOrEmpty(this.ExtraCSS))
            {
                HtmlLink link = new HtmlLink();
                link.Href = ExtraCSS;
                link.Attributes.Add("rel", "stylesheet");
                link.Attributes.Add("type", "text/css");
                this.Page.Header.Controls.Add(link);
            }

            if (!this.AutoStylingDisabled)
            {
                this.WrapList = false;
            }
        }
Exemple #19
0
 private void PaintMe()
 {
     this.MaximumSize = new Size(1460, 800);
     this.StartPosition = FormStartPosition.CenterScreen;
     this.BackColor = ColorTranslator.FromHtml("#E5CD8C");
 }
Exemple #20
0
        public void DrawLine(string percentX, string percentY, int mode, string color, int width)
        {
            DateTime tm_now         = DateTime.Now;
            TimeSpan createtimespan = new TimeSpan(tm_lastdraw.Ticks);
            TimeSpan nowtimespan    = new TimeSpan(tm_now.Ticks);
            TimeSpan timespan       = nowtimespan.Subtract(createtimespan).Duration();
            int      timeDiff       = timespan.Minutes * 60 + timespan.Seconds;

            tm_lastdraw = DateTime.Now;

            m_bDraw = true;
            double perX = Convert.ToDouble(percentX);
            double perY = Convert.ToDouble(percentY);

            double x = 0;
            double y = 0;

            //double x = (screenWidth-imgWidth)/2+this.imgWidth * perX;
            //double y = (screenHeight-imgHeight)/2+this.imgHeight * perY;
            double screenX  = this.screenWidth * perX;
            double screenY  = this.screenHeight * perY;
            double screenX2 = 65536 * perX;
            double screenY2 = 65536 * perY;

            x = m_bmp.Width * perX;
            y = m_bmp.Height * perY;
            Log.Info("x :" + x + " y=" + y + ", screenX=" + screenX + ", screenY=" + screenY);


            //mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, (int)screenX2, (int)screenY2, 0, UIntPtr.Zero);
            //dx和dy指定鼠标坐标系统中的一个绝对位置。在鼠标坐标系统中,屏幕在水平和垂直方向上均匀分割成65535×65535个单元

            //[DllImport("user32.dll")]
            //static extern搜索 int LoadCursorFromFile(string lpFileName);
            //Cursor myCursor = new Cursor(Cursor.Current.Handle);
            ////加载光标文件:
            //IntPtr colorCursorHandle = LoadCursorFromFile("Cross.cur");
            //myCursor.GetType().InvokeMember("handle",   BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField,   null, myCursor, new Object() { colorCursorHandle });
            //this.Cursor = myCursor;

            if (mode == 0 || timeDiff > 1)
            {
                m_pointLast.X = (int)x;
                m_pointLast.Y = (int)y;
                Log.Info("Color: " + color + " width=" + width);
            }
            else
            {
                Point pt2 = new Point();
                pt2.X = (int)x;
                pt2.Y = (int)y;

                try
                {
                    if (IsPixelFormatIndexed(m_bmp.PixelFormat))
                    {
                        Bitmap bmp = new Bitmap(m_bmp.Width, m_bmp.Height, PixelFormat.Format32bppArgb);
                        using (Graphics g = Graphics.FromImage(bmp))
                        {
                            g.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                            g.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                            g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                            g.DrawImage(m_bmp, 0, 0);

                            //draw.....
                            Color c   = ColorTranslator.FromHtml(color);
                            Pen   pen = new Pen(c, width);
                            g.DrawLine(pen, m_pointLast, pt2);

                            pictureBox1.Image = (Image)m_bmp;
                            m_pointLast.X     = (int)x;
                            m_pointLast.Y     = (int)y;
                        }
                    }
                    else
                    {
                        Graphics g   = Graphics.FromImage(m_bmp);
                        Color    c   = ColorTranslator.FromHtml(color);
                        Pen      pen = new Pen(c, width);

                        g.DrawLine(pen, m_pointLast, pt2);
                        pictureBox1.Image = (Image)m_bmp;

                        m_pointLast.X = (int)x;
                        m_pointLast.Y = (int)y;
                    }
                }
                catch (Exception ee)
                {
                    Log.Info(ee.Message);
                }
            }
        }
Exemple #21
0
        public void XLSDo(ApplyCredit ApplyCredit, EFPagingInfo <ApplyCredit> p)
        {
            if (ApplyCredit.STime.IsNullOrEmpty())
            {
                ApplyCredit.STime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
            }
            if (ApplyCredit.ETime.IsNullOrEmpty())
            {
                //ApplyCredit.ETime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                ApplyCredit.ETime = DateTime.Now;
            }
            if (!ApplyCredit.TrueName.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.TrueName == ApplyCredit.TrueName);
            }
            if (!ApplyCredit.BankId.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.BankId == ApplyCredit.BankId);
            }
            if (!ApplyCredit.Education.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.Education.Contains(ApplyCredit.Education));
            }
            if (!ApplyCredit.HasSheBao.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.HasSheBao == (ApplyCredit.HasSheBao == 99 ? 0 : ApplyCredit.HasSheBao));
            }
            if (!ApplyCredit.Marry.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.Marry == ApplyCredit.Marry);
            }
            if (!ApplyCredit.HasCar.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.HasCar == (ApplyCredit.HasCar == 99 ? 0 : ApplyCredit.HasCar));
            }
            if (!ApplyCredit.House.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.House == ApplyCredit.House);
            }
            if (!ApplyCredit.HasCredit.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.HasCredit == ApplyCredit.HasCredit);
            }
            if (!ApplyCredit.State.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.State == ApplyCredit.State);
            }
            if (!ApplyCredit.AgentPay.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.AgentPay == (ApplyCredit.AgentPay == 99 ? 0 : ApplyCredit.AgentPay));
            }
            if (!ApplyCredit.AgentAId.IsNullOrEmpty())
            {
                p.SqlWhere.Add(f => f.AgentAId == ApplyCredit.AgentAId);
            }
            if (!ApplyCredit.STime.IsNullOrEmpty() && !ApplyCredit.ETime.IsNullOrEmpty())
            {
                DateTime ETime = ApplyCredit.ETime;
                p.SqlWhere.Add(f => f.PayTime > ApplyCredit.STime && f.PayTime < ETime);
            }
            p.SqlWhere.Add(f => f.PayState == 1);
            p.PageSize = 99999999;
            p.OrderByList.Add("Id", "DESC");
            IPageOfItems <ApplyCredit> ApplyCreditList = Entity.Selects <ApplyCredit>(p);
            IList <BasicBank>          BasicBankList   = Entity.BasicBank.Where(n => n.State == 1).ToList();
            IList <ApplyCredit>        List            = ApplyCreditList.GroupBy(n => n.AgentId).Select(n => n.First()).ToList();
            List <int> AgentId = new List <int>();

            foreach (var pp in List)
            {
                AgentId.Add(pp.AgentId);
            }
            IList <SysAgent> SysAgentList = Entity.SysAgent.Where(n => AgentId.Contains(n.Id) && n.Tier == 1).ToList();

            if (SysAgentList.Count > 0)
            {
                //加载对应银行模板
                string       tempname = "AgentCredit.xlsx";
                string       file     = Server.MapPath("/template") + "\\" + tempname;
                ExcelPackage package  = new ExcelPackage(new FileInfo(file), true);
                //设置数据开始行
                int Befor  = 2;
                int maxCol = 7;//最大列数
                //加载模板第一张表
                var     sheet      = package.Workbook.Worksheets[1];
                var     cells      = sheet.Cells;
                decimal TotalMoney = 0; //计算总金额
                decimal TotalPrice = 0; //计算总金额
                int     Rows       = ApplyCreditList.Count() + SysAgentList.Count();
                sheet.InsertRow(Befor + 1, Rows - 1, Befor);
                int i = Befor;
                foreach (var item in SysAgentList)
                {
                    IList <ApplyCredit> ListSub    = ApplyCreditList.Where(n => n.AgentId == item.Id).ToList();
                    decimal             AgentMoney = 0; //计算供应商金额
                    decimal             AgentPrice = 0; //计算供应商金额
                    foreach (var s in ListSub)
                    {
                        sheet.Row(i).Height = 20;//设置行高
                        BasicBank BasicBank = BasicBankList.FirstOrNew(n => n.Id == s.BankId);
                        //分支机构
                        cells["A" + i].Value = item.Name;
                        //编号
                        cells["B" + i].Value = s.Id;
                        //姓名
                        cells["C" + i].Value = s.TrueName;
                        //申请银行
                        cells["D" + i].Value = BasicBank.Name;
                        //售出金额
                        cells["E" + i].Value = s.Amoney;
                        //售出时间
                        cells["F" + i].Value = s.PayTime;
                        //结算金额
                        cells["G" + i].Value = s.AgentMoney;
                        AgentMoney          += s.Amoney;
                        AgentPrice          += s.AgentMoney;
                        i++;
                    }
                    sheet.Row(i).Height = 28;//设置行高
                    //交易金额汇总
                    cells["E" + i].Value = AgentMoney;
                    //结算金额汇总
                    cells["G" + i].Value = AgentPrice;
                    Color bgColor = ColorTranslator.FromHtml("#DDDDDD");
                    Color fColor  = ColorTranslator.FromHtml("#FF0000");
                    sheet.Cells[i, 1, i, maxCol].Style.Fill.PatternType = ExcelFillStyle.Solid;
                    sheet.Cells[i, 1, i, maxCol].Style.Fill.BackgroundColor.SetColor(bgColor);
                    sheet.Cells[i, 1, i, maxCol].Style.Font.Size = 16;
                    sheet.Cells[i, 1, i, maxCol].Style.Font.Bold = true;
                    sheet.Cells[i, 1, i, maxCol].Style.Font.Color.SetColor(fColor);
                    TotalMoney += AgentMoney;
                    TotalPrice += AgentPrice;
                    i++;
                }
                Color bgColor_ = ColorTranslator.FromHtml("#7030A0");
                Color fColor_  = ColorTranslator.FromHtml("#FFFFFF");
                sheet.Cells[i, 1, i, maxCol].Style.Fill.PatternType = ExcelFillStyle.Solid;
                sheet.Cells[i, 1, i, maxCol].Style.Fill.BackgroundColor.SetColor(bgColor_);
                sheet.Cells[i, 1, i, maxCol].Style.Font.Size = 20;
                sheet.Cells[i, 1, i, maxCol].Style.Font.Bold = true;
                sheet.Cells[i, 1, i, maxCol].Style.Font.Color.SetColor(fColor_);
                sheet.Row(i).Height = 40;//设置行高
                //交易金额汇总
                cells["E" + i].Value = TotalMoney;
                //结算金额汇总
                cells["G" + i].Value = TotalPrice;
                sheet.Cells[Befor, 1, i, maxCol].Style.Border.Left.Style   = ExcelBorderStyle.Thin;
                sheet.Cells[Befor, 1, i, maxCol].Style.Border.Right.Style  = ExcelBorderStyle.Thin;
                sheet.Cells[Befor, 1, i, maxCol].Style.Border.Top.Style    = ExcelBorderStyle.Thin;
                sheet.Cells[Befor, 1, i, maxCol].Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
                sheet.Cells[Befor, 5, i, 5].Style.Numberformat.Format      = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)";
                sheet.Cells[Befor, 6, i, 6].Style.Numberformat.Format      = "yyyy-mm-dd hh:mm";
                sheet.Cells[Befor, 7, i, 7].Style.Numberformat.Format      = "\"¥\"#,##0.00_);[Red](\"¥\"#,##0.00)";
                Response.BinaryWrite(package.GetAsByteArray());//输出
                Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
                Response.AddHeader("content-disposition", "attachment;  filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(10, 99) + ".xlsx");
            }
            else
            {
                Response.Write("暂无符合条件数据");
            }
        }
Exemple #22
0
 public static Color FromRgb(string code)
 {
     return(ColorTranslator.FromHtml(code));
 }
Exemple #23
0
        //таймер

        public Form1()
        {
            InitializeComponent();
            XmlTextReader       reader      = new XmlTextReader("XMLFile1.xml");
            XmlValidatingReader validreader = new XmlValidatingReader(reader);

            validreader.Schemas.Add(null, "XMLSchema1.xsd");
            validreader.ValidationType          = ValidationType.Schema;
            validreader.ValidationEventHandler += new ValidationEventHandler(ValidationHandler);
            try
            {
                while (validreader.Read())
                {
                    ;
                }
            }
            catch
            {
                valid = false;
                MessageBox.Show("Файл конфигурации не найден\nЗагружены параметры по умолчанию");
            }
            //validreader.Close();

            if (valid)
            {
                reader = new XmlTextReader("XMLFile1.xml");
                while (reader.Read())
                {
                    if (reader.Name == "range" && reader.NodeType != XmlNodeType.EndElement)
                    {
                        r = reader.ReadElementContentAsInt();
                    }
                    if (reader.Name == "color" && reader.NodeType != XmlNodeType.EndElement)
                    {
                        back = ColorTranslator.FromHtml(reader.ReadElementContentAsString());
                    }
                    if (reader.Name == "x" && reader.NodeType != XmlNodeType.EndElement)
                    {
                        xscale = reader.ReadElementContentAsInt();
                    }
                    if (reader.Name == "y" && reader.NodeType != XmlNodeType.EndElement)
                    {
                        yscale = reader.ReadElementContentAsInt();
                    }
                }
                reader.Close();
                validreader.Close();
            }
            Brush b;

            this.MouseClick += new MouseEventHandler(Form1_MouseClick);
            try
            {
                //загружаем файл с картинками
                pics = new Bitmap("1.bmp");
            }
            catch (Exception exc)
            {
                MessageBox.Show("Файл '1.bmp' не найден.\n" + exc.ToString(), "Парные картинки", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }
            //определяем высоту и ширину клетки области формы
            cw              = (int)(pics.Width / np);
            ch              = pics.Height;
            this.Width      = 2 + 5 * r + xscale * 4;
            this.Height     = 2 + 5 * r + yscale * 4 + this.menuStrip1.Height;
            this.ClientSize = new System.Drawing.Size(this.Width, this.Height);
            //рабочая графическая поверхносить
            g               = this.CreateGraphics();
            timer2          = new Timer();
            timer2.Tick    += new System.EventHandler(this.timer2_Tick);
            timer2.Interval = 1000;
            // newGame();
        }
Exemple #24
0
/* ---------------------------------------------------------------Eventos-------------------------------------------------------------------- */

        private void Consulta_Load(object sender, EventArgs e)
        {
            BackColor = ColorTranslator.FromHtml("#F5F5F5");
        }
Exemple #25
0
        private void btnCreateZip_Click(object sender, EventArgs e)
        {
            // Create and start a stopwatch to measure the function performance
            Stopwatch sw = Stopwatch.StartNew();

            // Start checks before running the the acutal create elements
            if (tbxMapDocument.Text == string.Empty)
            {
                MessageBox.Show("A document name is required. It is used as a part of the output file names.",
                                "Update document name", MessageBoxButtons.OK, MessageBoxIcon.Information);
                tabExportTool.SelectedTab = tabPageLayout;
                tbxMapDocument.Focus();
                return;
            }

            //!!!!!!!!!!Need a method to check to see if the user has write access to the set path !!!!!!!!!!!!!!//
            var path = tbxExportZipPath.Text;

            //check the path exists and ideally check for write permissions
            if (!Directory.Exists(@path))
            {
                Debug.WriteLine("Exiting createZip function as path is not valid");
                //set up a timer and flash the background of the tbxExportZipPath control red for .25 of a second
                //then take the form focus
                System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
                t.Interval = 250;
                t.Tick    += delegate(System.Object o, System.EventArgs error)
                {
                    t.Stop();
                    t.Dispose();
                    tbxExportZipPath.Focus();
                    tbxExportZipPath.BackColor = System.Drawing.Color.White;
                };
                t.Start();
                tbxExportZipPath.BackColor = ColorTranslator.FromHtml("#FFE5EB");
                return;
            }
            Debug.WriteLine("checks on export complete");

            // Get the path and file name to pass to the various functions
            string exportPathFileName = getExportPathFileName(tbxExportZipPath.Text, tbxMapDocument.Text);

            // Disable the button after the export checks are complete to prevent multiple clicks
            this.Enabled = false;

            // this method doesn't correctly in checking for permissions, requires updating.
            // MapAction.Utilities.detectWriteAccessToPath(path);

            IMxDocument pMxDoc      = ArcMap.Application.Document as IMxDocument;
            IActiveView pActiveView = pMxDoc.ActiveView;

            // Call to export the images and return a dictionary of the file sizes
            Dictionary <string, string> dictFilePaths = exportAllImages();

            // Create a dictionary to store the image file sizes to add to the output xml
            Dictionary <string, long> dictImageFileSizes = new Dictionary <string, long>();

            // Calculate the file size of each image and add it to the dictionary
            dictImageFileSizes.Add("pdf", MapAction.Utilities.getFileSize(dictFilePaths["pdf"]));
            System.Windows.Forms.Application.DoEvents();
            dictImageFileSizes.Add("jpeg", MapAction.Utilities.getFileSize(dictFilePaths["jpeg"]));
            dictImageFileSizes.Add("emf", MapAction.Utilities.getFileSize(dictFilePaths["emf"]));

            // Create a dictionary to get and store the map frame extents to pass to the output xml
            Dictionary <string, string> dictFrameExtents = MapAction.PageLayoutProperties.getDataframeProperties(pMxDoc, "Main map");

            // Export KML
            string kmzPathFileName = exportPathFileName + ".kmz";
            string kmzScale;

            if (dictFrameExtents.ContainsKey("scale"))
            {
                kmzScale = dictFrameExtents["scale"];
            }
            else
            {
                kmzScale = null;
            };
            MapAction.MapExport.exportMapFrameKmlAsRaster(pMxDoc, "Main map", @kmzPathFileName, kmzScale);

            // Get the mxd filename
            string mxdName = ArcMap.Application.Document.Title;

            System.Windows.Forms.Application.DoEvents();
            // Create the output xml file & return the xml path
            string xmlPath = string.Empty;

            try
            {
                Dictionary <string, string> dict = getExportToolValues(dictImageFileSizes, dictFilePaths, dictFrameExtents, mxdName);
                xmlPath = MapAction.Utilities.createXML(dict, "mapdata", path, tbxMapDocument.Text, 2);
            }
            catch (Exception xml_e)
            {
                Debug.WriteLine("Error writing out xml file.");
                Debug.WriteLine(xml_e.Message);
                return;
            }

            // Add the xml path to the dictFilePaths, which is the input into the creatZip method
            dictFilePaths.Add("xml", xmlPath);

            // Create zip
            MapAction.MapExport.createZip(dictFilePaths);
            // close the wait dialog
            // dlg.lblWaitMainMessage.Text = "Export complete";
            // int milliseconds = 1250;
            // Thread.Sleep(milliseconds);
            this.Close();

            // the output filepath

            MessageBox.Show("Files successfully output to: " + Environment.NewLine + path,
                            "Export complete", MessageBoxButtons.OK, MessageBoxIcon.Information);

            // If open explorer checkbox is ticked, open windows explorer to the directory
            if (chkOpenExplorer.Checked)
            {
                MapAction.MapExport.openExplorerDirectory(tbxExportZipPath.Text);
            }

            sw.Stop();
            string timeTaken = Math.Round((sw.Elapsed.TotalMilliseconds / 1000), 2).ToString();

            Debug.WriteLine("Time taken: ", timeTaken);
        }
        /// <summary>
        /// Tries to read the splashscreen.xml file of the current skin
        /// </summary>
        private void ReadSplashScreenXML()
        {
            string skinFilePath = GUIGraphicsContext.GetThemedSkinFile("\\splashscreen.xml");

            if (!File.Exists(skinFilePath))
            {
                Log.Debug("FullScreenSplash: Splashscreen.xml not found!: {0}", skinFilePath);
                return;
            }

            Log.Debug("FullScreenSplash: Splashscreen.xml found: {0}", skinFilePath);

            var doc = new XmlDocument();

            doc.Load(skinFilePath);
            if (doc.DocumentElement != null)
            {
                XmlNodeList controlsList = doc.DocumentElement.SelectNodes("/window/controls/control");
                if (controlsList != null)
                {
                    foreach (XmlNode control in controlsList)
                    {
                        XmlNode selectSingleNode = control.SelectSingleNode("type/text()");
                        XmlNode singleNode       = control.SelectSingleNode("id/text()");
                        // if the background image control is found
                        if (singleNode != null && (selectSingleNode != null && (selectSingleNode.Value.ToLowerInvariant() == "image" && singleNode.Value == "1")))
                        {
                            XmlNode xmlNode = control.SelectSingleNode("texture/text()");
                            if (xmlNode != null)
                            {
                                string backgoundImageName  = xmlNode.Value;
                                string backgroundImagePath = GUIGraphicsContext.GetThemedSkinFile("\\media\\" + backgoundImageName);
                                if (File.Exists(backgroundImagePath))
                                {
                                    Log.Debug("FullScreenSplash: Try to load background image value found: {0}", backgroundImagePath);
                                    pbBackground.Image = new Bitmap(backgroundImagePath); // load the image as background
                                    Log.Debug("FullScreenSplash: background image successfully loaded: {0}", backgroundImagePath);
                                }
                            }
                            continue;
                        }
                        XmlNode node = control.SelectSingleNode("type/text()");
                        XmlNode selectSingleNode1 = control.SelectSingleNode("id/text()");
                        // if the center label control is found
                        if (selectSingleNode1 != null && (node != null && (node.Value.ToLowerInvariant() == "label" && selectSingleNode1.Value == "2")))
                        {
                            if (control.SelectSingleNode("textsize") != null)
                            {
                                XmlNode xmlNode = control.SelectSingleNode("textsize/text()");
                                if (xmlNode != null)
                                {
                                    float textSize = float.Parse(xmlNode.Value);
                                    Log.Debug("FullScreenSplash: Textsize value found: {0}", textSize);
                                    lblMain.Font = new Font(lblMain.Font.FontFamily, textSize, lblMain.Font.Style);
                                    Log.Debug("FullScreenSplash: Textsize successfully set: {0}", textSize);
                                }
                            }
                            if (control.SelectSingleNode("textcolor") != null)
                            {
                                XmlNode xmlNode = control.SelectSingleNode("textcolor/text()");
                                if (xmlNode != null)
                                {
                                    Color textColor = ColorTranslator.FromHtml(xmlNode.Value);
                                    Log.Debug("FullScreenSplash: TextColor value found: {0}", textColor);
                                    lblMain.ForeColor    = textColor;
                                    lblVersion.ForeColor = textColor;
                                    lblCVS.ForeColor     = textColor;
                                    Log.Debug("FullScreenSplash: TextColor successfully set: {0}", textColor);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #27
0
        private static void ReadConfigFromFile(string fileName)
        {
            int         discordImageKey;
            XmlDocument doc = new XmlDocument();

            doc.Load(fileName);
            Queue <XmlNode> que = new Queue <XmlNode>();

            foreach (XmlNode node in doc.ChildNodes)
            {
                que.Enqueue(node);
            }

            while (que.Count > 0)
            {
                XmlNode node = que.Dequeue();

                foreach (XmlNode n in node.ChildNodes)
                {
                    que.Enqueue(n);
                }

                switch (node.Name)
                {
                case "texture":
                    if (node.ParentNode != null)
                    {
                        switch (node.ParentNode.Name)
                        {
                        case "floor":
                            if (File.Exists(node.InnerText) && node.InnerText.ToLower().EndsWith(".png"))
                            {
                                Runtime.FloorURL = node.InnerText;
                                Rendering.RenderTools.floorTexture = NUT.loadImage(new Bitmap(node.InnerText));
                                Runtime.floorStyle = Runtime.FloorStyle.UserTexture;
                            }
                            break;
                        }
                    }
                    break;

                case "texture_wrap":
                    if (node.ParentNode != null)
                    {
                        switch (node.ParentNode.Name)
                        {
                        case "floor": Enum.TryParse(node.InnerText, out Runtime.floorWrap); break;
                        }
                    }
                    break;

                case "default_texture":
                    if (File.Exists(node.InnerText) && node.InnerText.ToLower().EndsWith(".png"))
                    {
                        Rendering.RenderTools.defaultTex = NUT.loadImage(new Bitmap(node.InnerText));
                    }
                    break;

                case "size":
                    if (node.ParentNode != null)
                    {
                        switch (node.ParentNode.Name)
                        {
                        case "floor": float.TryParse(node.InnerText, out Runtime.floorSize); break;
                        }
                    }
                    break;

                case "guide_lines":
                    bool.TryParse(node.InnerText, out Runtime.renderFloorLines);
                    break;

                case "zoom_speed":
                    float.TryParse(node.InnerText, out Runtime.zoomspeed);
                    break;

                case "zoom_modifier_multiplier":
                    float.TryParse(node.InnerText, out Runtime.zoomModifierScale);
                    break;

                case "render_depth":
                    float.TryParse(node.InnerText, out Runtime.renderDepth);
                    break;

                case "fov":
                    float.TryParse(node.InnerText, out Runtime.fov);
                    break;

                case "back_gradient_top":
                    TryParseHexColor(node, ref Runtime.backgroundGradientTop);
                    break;

                case "back_gradient_bottom":
                    TryParseHexColor(node, ref Runtime.backgroundGradientBottom);
                    break;

                case "type":
                    if (node.ParentNode != null && node.ParentNode.Name.Equals("RENDERSETTINGS"))
                    {
                        Enum.TryParse(node.InnerText, out Runtime.renderType);
                    }
                    break;

                case "OpenGL_2.10":
                    bool.TryParse(node.InnerText, out Runtime.useLegacyShaders);
                    break;

                case "camera_light":
                    bool.TryParse(node.InnerText, out Runtime.cameraLight);
                    break;

                case "use_normal_map":
                    bool.TryParse(node.InnerText, out Runtime.renderNormalMap);
                    break;

                case "render_vertex_color":
                    bool.TryParse(node.InnerText, out Runtime.renderVertColor);
                    break;

                case "render_alpha":
                    bool.TryParse(node.InnerText, out Runtime.renderAlpha);
                    break;

                case "render_diffuse":
                    bool.TryParse(node.InnerText, out Runtime.renderDiffuse);
                    break;

                case "render_specular":
                    bool.TryParse(node.InnerText, out Runtime.renderSpecular);
                    break;

                case "render_fresnel":
                    bool.TryParse(node.InnerText, out Runtime.renderFresnel);
                    break;

                case "render_reflection":
                    bool.TryParse(node.InnerText, out Runtime.renderReflection);
                    break;

                case "render_selection":
                    bool.TryParse(node.InnerText, out Runtime.renderModelSelection);
                    break;

                case "render_wireframe":
                    bool.TryParse(node.InnerText, out Runtime.renderModelWireframe);
                    break;

                case "render_bones":
                    bool.TryParse(node.InnerText, out Runtime.renderBones);
                    break;

                case "render_collisions":
                    bool.TryParse(node.InnerText, out Runtime.renderCollisions);
                    break;

                case "render_collision_normals":
                    bool.TryParse(node.InnerText, out Runtime.renderCollisionNormals);
                    break;

                case "render_hitboxes":
                    bool.TryParse(node.InnerText, out Runtime.renderHitboxes);
                    break;

                case "render_interpolated_hitboxes":
                    bool.TryParse(node.InnerText, out Runtime.renderInterpolatedHitboxes);
                    break;

                case "render_hitboxes_no_overlap":
                    bool.TryParse(node.InnerText, out Runtime.renderHitboxesNoOverlap);
                    break;

                case "render_hitboxes_mode":
                    int.TryParse(node.InnerText, out Runtime.hitboxRenderMode);
                    break;

                case "render_hitbox_angles":
                    bool.TryParse(node.InnerText, out Runtime.renderHitboxAngles);
                    break;

                case "render_hurtboxes":
                    bool.TryParse(node.InnerText, out Runtime.renderHurtboxes);
                    break;

                case "render_hurtboxes_zone":
                    bool.TryParse(node.InnerText, out Runtime.renderHurtboxesZone);
                    break;

                case "render_ECB":
                    bool.TryParse(node.InnerText, out Runtime.renderECB);
                    break;

                case "render_special_bubbles":
                    bool.TryParse(node.InnerText, out Runtime.renderSpecialBubbles);
                    break;

                case "render_ledge_grabboxes":
                    bool.TryParse(node.InnerText, out Runtime.renderLedgeGrabboxes);
                    break;

                case "render_reverse_ledge_grabboxes":
                    bool.TryParse(node.InnerText, out Runtime.renderReverseLedgeGrabboxes);
                    break;

                case "render_tether_ledge_grabboxes":
                    bool.TryParse(node.InnerText, out Runtime.renderTetherLedgeGrabboxes);
                    break;

                case "render_bounding_boxes":
                    bool.TryParse(node.InnerText, out Runtime.renderBoundingBox);
                    break;

                case "render_path":
                    bool.TryParse(node.InnerText, out Runtime.renderPath);
                    break;

                case "render_respawns":
                    bool.TryParse(node.InnerText, out Runtime.renderRespawns);
                    break;

                case "render_spawns":
                    bool.TryParse(node.InnerText, out Runtime.renderSpawns);
                    break;

                case "render_item_spawners":
                    bool.TryParse(node.InnerText, out Runtime.renderItemSpawners);
                    break;

                case "render_general_points":
                    bool.TryParse(node.InnerText, out Runtime.renderGeneralPoints);
                    break;

                case "render_otherLVDEntries":
                    bool.TryParse(node.InnerText, out Runtime.renderOtherLVDEntries);
                    break;

                case "render_swag":
                    bool.TryParse(node.InnerText, out Runtime.renderSwagY);
                    break;

                case "render_swagZ":
                    bool.TryParse(node.InnerText, out Runtime.renderSwagZ);
                    break;

                case "fighter_dir":
                    Runtime.fighterDir = node.InnerText;
                    break;

                case "param_dir":
                    Runtime.paramDir = node.InnerText;
                    break;

                case "render_indicators":
                    bool.TryParse(node.InnerText, out Runtime.renderIndicators);
                    break;

                case "hitbox_alpha":
                    int.TryParse(node.InnerText, out Runtime.hitboxAlpha);
                    break;

                case "hurtbox_alpha":
                    int.TryParse(node.InnerText, out Runtime.hurtboxAlpha);
                    break;

                case "hitbox_angles_color":
                    TryParseHexColor(node, ref Runtime.hitboxAnglesColor);
                    break;

                case "hurtbox_color":
                    TryParseHexColor(node, ref Runtime.hurtboxColor);
                    break;

                case "hurtbox_color_hi":
                    TryParseHexColor(node, ref Runtime.hurtboxColorHi);
                    break;

                case "hurtbox_color_med":
                    TryParseHexColor(node, ref Runtime.hurtboxColorMed);
                    break;

                case "hurtbox_color_low":
                    TryParseHexColor(node, ref Runtime.hurtboxColorLow);
                    break;

                case "hurtbox_color_selected":
                    TryParseHexColor(node, ref Runtime.hurtboxColorSelected);
                    break;

                case "windbox_color":
                    TryParseHexColor(node, ref Runtime.windboxColor);
                    break;

                case "grabbox_color":
                    TryParseHexColor(node, ref Runtime.grabboxColor);
                    break;

                case "searchbox_color":
                    TryParseHexColor(node, ref Runtime.searchboxColor);
                    break;

                case "counterBubble_color":
                    TryParseHexColor(node, ref Runtime.counterBubbleColor);
                    break;

                case "reflectBubble_color":
                    TryParseHexColor(node, ref Runtime.reflectBubbleColor);
                    break;

                case "shieldBubble_color":
                    TryParseHexColor(node, ref Runtime.shieldBubbleColor);
                    break;

                case "absorbBubble_color":
                    TryParseHexColor(node, ref Runtime.absorbBubbleColor);
                    break;

                case "wtSlowdownBubble_color":
                    TryParseHexColor(node, ref Runtime.wtSlowdownBubbleColor);
                    break;

                //Discord Stuff
                case "image_key_mode":
                    int.TryParse(node.InnerText, out discordImageKey);
                    DiscordSettings.imageKeyMode = (DiscordSettings.ImageKeyMode)discordImageKey;
                    break;

                case "user_image_key":
                    DiscordSettings.userPickedImageKey = node.InnerText;
                    break;

                case "user_mod_name":
                    DiscordSettings.userNamedMod = node.InnerText;
                    break;

                case "use_user_mod_name":
                    bool.TryParse(node.InnerText, out DiscordSettings.useUserModName);
                    break;

                case "show_current_window":
                    bool.TryParse(node.InnerText, out DiscordSettings.showCurrentWindow);
                    break;

                case "show_time_elapsed":
                    bool.TryParse(node.InnerText, out DiscordSettings.showTimeElapsed);
                    break;

                case "enabled":
                    if (node.ParentNode != null)
                    {
                        switch (node.ParentNode.Name)
                        {
                        case "diffuse": bool.TryParse(node.InnerText, out Runtime.renderDiffuse); break;

                        case "specular": bool.TryParse(node.InnerText, out Runtime.renderSpecular); break;

                        case "fresnel": bool.TryParse(node.InnerText, out Runtime.renderFresnel); break;

                        case "reflection": bool.TryParse(node.InnerText, out Runtime.renderReflection); break;

                        case "floor": bool.TryParse(node.InnerText, out Runtime.renderFloor); break;

                        case "lighting": bool.TryParse(node.InnerText, out Runtime.renderMaterialLighting); break;

                        case "render_model": bool.TryParse(node.InnerText, out Runtime.renderModel); break;

                        case "render_LVD": bool.TryParse(node.InnerText, out Runtime.renderLVD); break;
                        }
                    }
                    break;

                case "color":
                    if (node.ParentNode != null)
                    {
                        switch (node.ParentNode.Name)
                        {
                        case "floor": try { Runtime.floorColor = ColorTranslator.FromHtml(node.InnerText); } catch (Exception) { } break;

                        case "hitbox_kb_colors": try { Runtime.hitboxKnockbackColors.Add(ColorTranslator.FromHtml(node.InnerText)); } catch (Exception) { } break;

                        case "hitbox_id_colors": try { Runtime.hitboxIdColors.Add(ColorTranslator.FromHtml(node.InnerText)); } catch (Exception) { } break;
                        }
                    }
                    break;

                case "style":
                    if (node.ParentNode != null)
                    {
                        switch (node.ParentNode.Name)
                        {
                        case "floor": Enum.TryParse(node.InnerText, out Runtime.floorStyle); break;
                        }
                    }
                    break;
                }
            }
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Size     titleSize;
            Point    titlePosition;
            Color    bg;
            Brush    fb;
            int      borderSize = 4;

            g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            if (Enabled)
            {
                fb = new SolidBrush(ForeColor);
            }
            else
            {
                fb = new SolidBrush(ColorTranslator.FromHtml("#A0A0A0"));
            }

            if (BackColor != Color.Transparent)
            {
                bg = BackColor;
            }
            else
            if (Parent.GetType() == typeof(CustomGroupBox))
            {
                bg = Color.Transparent;
            }
            else
            {
                bg = Color.FromArgb(31, Color.Black);
            }

            g.FillRectangle(new SolidBrush(bg), new Rectangle(borderSize, borderSize, Width - borderSize * 2, Height - borderSize * 2));
            DrawingPlus.DrawBorder(g, ClientRectangle, BorderColor, borderSize);

            titleSize        = new Size();
            titleSize.Width  = (int)g.MeasureString(Text, Font).Width + 2 + borderSize;
            titleSize.Height = (int)g.MeasureString(Text, Font).Height + 2;

            switch (TextPosition)
            {
            case CustomGroupBoxTextPosition.Left:
                titlePosition = new Point(0, 0);
                break;

            case CustomGroupBoxTextPosition.Center:
                titlePosition = new Point((Width - titleSize.Width) / 2, 0);
                break;

            case CustomGroupBoxTextPosition.Right:
                titlePosition = new Point(Width - titleSize.Width, 0);
                break;

            default:
                goto case CustomGroupBoxTextPosition.Left;
            }

            DrawingPlus.DrawPanel(g,
                                  new Rectangle(titlePosition.X, titlePosition.Y, titleSize.Width, titleSize.Height),
                                  BorderColor, borderSize - 2);

            if (ShadowColor != Color.Transparent)
            {
                g.DrawString(Text, Font, new SolidBrush(ShadowColor),
                             new Point(titlePosition.X + borderSize + 1, 0));
            }
            g.DrawString(Text, Font, fb,
                         new Point(titlePosition.X + borderSize, 0));
        }
        private async Task startImageWordExposition()
        {
            cts = new CancellationTokenSource();
            try
            {
                configureImagePictureBox();
                outputContent = new List <string>();

                // restart elapsed miliseconds
                elapsedTime = 0;
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                await Task.Delay(currentTest.ProgramInUse.IntervalTime, cts.Token);

                // beginAudio
                if (currentTest.ProgramInUse.AudioCapture)
                {
                    startRecordingAudio();
                }                                                                     // inicia gravação áudio
                                                                                      // endAudio
                for (int counter = 0; counter < currentTest.ProgramInUse.NumExpositions && runExposition; counter++)
                {
                    imgPictureBox.Visible = false;
                    wordLabel.Visible     = false;
                    subtitleLabel.Visible = false;
                    await intervalOrFixPoint(currentTest.ProgramInUse, cts.Token);

                    drawImage();

                    elapsedTime = stopwatch.ElapsedMilliseconds;

                    //sending event to program that is running on background, normally neuronspectrum
                    SendKeys.SendWait(currentTest.Mark.ToString());
                    imgPictureBox.Visible = true;

                    showSubtitle();

                    wordLabel.Visible = false;


                    currentTest.writeLineOutputResult(currentStimulus, "false", counter + 1,
                                                      outputContent, elapsedTime, "false");

                    await Task.Delay(currentTest.ProgramInUse.ExpositionTime, cts.Token);

                    imgPictureBox.Visible = false;
                    wordLabel.Visible     = false;

                    await Task.Delay(currentTest.ProgramInUse.DelayTime, cts.Token);


                    if (wordCounter == wordList.Count() - 1)
                    {
                        wordCounter = 0;
                    }
                    wordLabel.Text  = wordList[wordCounter];
                    currentStimulus = wordLabel.Text;
                    wordCounter++;
                    elapsedTime = stopwatch.ElapsedMilliseconds;

                    //sending event to program that is running on background, normally neuronspectrum
                    SendKeys.SendWait(currentTest.Mark.ToString());
                    imgPictureBox.Visible = false;
                    subtitleLabel.Visible = false;
                    wordLabel.ForeColor   = ColorTranslator.FromHtml(currentTest.ProgramInUse.WordColor);
                    wordLabel.Visible     = true;
                    showSubtitle();

                    currentTest.writeLineOutputResult(currentStimulus, "false", counter + 1,
                                                      outputContent, elapsedTime, "false");
                    await Task.Delay(currentTest.ProgramInUse.ExpositionTime, cts.Token);


                    await Task.Delay(currentTest.ProgramInUse.IntervalTime, cts.Token);
                }
                imgPictureBox.Visible = false;
                wordLabel.Visible     = false;
                subtitleLabel.Visible = false;


                await Task.Delay(currentTest.ProgramInUse.IntervalTime, cts.Token);

                // beginAudio
                if (currentTest.ProgramInUse.AudioCapture)
                {
                    stopRecordingAudio();
                }
            }
            catch (TaskCanceledException)
            {
                if (currentTest.ProgramInUse.AudioCapture)
                {
                    stopRecordingAudio();
                }
                finishExposition();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            cts = null;
        }
        // GET: Admin
        //public UnidadGenericaDeTrabajo _UnidadDeTrabajo = new UnidadGenericaDeTrabajo();


        public ActionResult Dashboard()
        {
            //var venta = db.Venta.ToList();
            var stock  = db.DetalleProducto.ToList();
            var ventas = db.Venta.OrderBy(v => v.totalVenta).ToList();

            object[] totalventas = new object[ventas.Count];
            string[] Clientes    = new string[ventas.Count];

            object[] stocks = new object[stock.Count];
            string[] prod   = new string[stock.Count];

            for (int i = 0; i < totalventas.Length; i++)
            {
                totalventas[i] = ventas[i].totalVenta;
                Clientes[i]    = ventas[i].Cliente.nombre + " " + ventas[i].Cliente.apellido;
            }

            for (int i = 0; i < stocks.Length; i++)
            {
                prod[i]   = stock[i].Producto.nombreProducto + " " + stock[i].Talla;
                stocks[i] = stock[i].CantidadStock;
            }
            //GRÁFICO VENTAS
            Highcharts graficoV = new Highcharts("graficoV");

            graficoV.InitChart(new Chart()
            {
                Type            = DotNet.Highcharts.Enums.ChartTypes.Bar,
                BackgroundColor = new BackColorOrGradient(System.Drawing.Color.Aquamarine),
                Style           = "fontWeight: 'bold', fontSize: '17px'",
                BorderColor     = System.Drawing.Color.Transparent,
                BorderRadius    = 0,
                BorderWidth     = 2
            });

            graficoV.SetTitle(new Title()
            {
                Text = "Mis Ventas"
            });

            graficoV.SetSubtitle(new Subtitle()
            {
                Text = "Clientes compradores"
            });

            graficoV.SetXAxis(new XAxis()
            {
                Type  = AxisTypes.Category,
                Title = new XAxisTitle()
                {
                    Text = "Clientes", Style = "fontWeight: 'bold', fontSize: '17px'"
                },
                Categories = Clientes
                             //   TickmarkPlacement=on,
            });

            graficoV.SetYAxis(new YAxis()
            {
                // Type = AxisTypes.Category,
                Title = new YAxisTitle()
                {
                    Text  = "Ventas",
                    Style = "fontWeight: 'bold', fontSize: '17px'",
                },
                //Categories = new[] { "5000", "10000", "15000", "20000" },
                ShowFirstLabel = true,
                ShowLastLabel  = true,
                Min            = 0,
                Max            = 20000,
            });

            graficoV.SetLegend(new Legend
            {
                Enabled         = false,
                BorderColor     = System.Drawing.Color.CornflowerBlue,
                BorderRadius    = 6,
                BackgroundColor = new BackColorOrGradient(ColorTranslator.FromHtml("#FFADD8E6"))
            });

            graficoV.SetSeries(new Series[]
            {
                new Series {
                    Name = "$ Compra",
                    Data = new Data(totalventas)
                },
            }
                               );
            //GRAFICO CLIENTES
            Highcharts columnChart = new Highcharts("columnchart");

            columnChart.InitChart(new Chart()
            {
                Type            = DotNet.Highcharts.Enums.ChartTypes.Spline,
                BackgroundColor = new BackColorOrGradient(System.Drawing.Color.Coral),
                Style           = "fontWeight: 'bold', fontSize: '17px',color:'#000000'",
                BorderColor     = System.Drawing.Color.Coral,
                //  PlotBackgroundColor= new BackColorOrGradient(System.Drawing.Color.Red),
                BorderRadius = 0,
                BorderWidth  = 2
            });

            columnChart.SetTitle(new Title()
            {
                Text = "Stock Disponible"
            });

            columnChart.SetSubtitle(new Subtitle()
            {
                Text = "Prenda - Tallas"
            });

            columnChart.SetXAxis(new XAxis()
            {
                Type  = AxisTypes.Category,
                Title = new XAxisTitle()
                {
                    Text = "Clientes", Style = "fontWeight: 'bold', fontSize: '17px',color:'#000000'"
                },
                Categories = prod,

                //   TickmarkPlacement=on,
            });;

            columnChart.SetYAxis(new YAxis()
            {
                // Type = AxisTypes.Category,
                Title = new YAxisTitle()
                {
                    Text  = "Cantidad Stock",
                    Style = "fontWeight: 'bold', fontSize: '17px', color:'#000000'",
                },
                //Categories = new[] { "5000", "10000", "15000", "20000" },

                ShowFirstLabel = true,
                ShowLastLabel  = true,
                Min            = 0,
                Max            = 500,
            });

            /* columnChart.SetPlotOptions(new PlotOptions{
             *   Area =
             *   {
             *       LineColor= System.Drawing.Color.Red,
             *   }
             * });*/
            columnChart.SetLegend(new Legend
            {
                Enabled         = false,
                BorderColor     = System.Drawing.Color.CornflowerBlue,
                BorderRadius    = 6,
                BackgroundColor = new BackColorOrGradient(ColorTranslator.FromHtml("#FFADD8E6"))
            });

            columnChart.SetSeries(new Series[]
            {
                new Series {
                    Name = "Stock",
                    Data = new Data(stocks

                                    ),
                },
            }
                                  );


            ViewBag.GraficoVentasCliente = columnChart;
            ViewBag.GraficoVentas        = graficoV;
            return(View());
        }