Ejemplo n.º 1
0
        private Image GetImageFromExcel(string path, string range)
        {
            Image     i     = null;
            ExcelLink teste = null;

            try
            {
                teste = new ExcelLink(tempPath, true);
            }
            catch (Exception)
            {
                MessageBox.Show("Ficheiro:" + path + "\n Não encontrado");
                ListaAlertas.Add(new Alertas()
                {
                    Alerta = TipoAlerta.Erro, Ficheiro = path, TimeError = DateTime.Now
                });

                //throw ex ;
            }
            //  teste.copyChart();
            if (teste != null)
            {
                i = teste.CopyImage(range); rngAl.Visible = false;
                teste.closeFile(false);
            }
            else
            {
                // GetAutomatismo();
            }

            return(i);
        }
Ejemplo n.º 2
0
        private void RefreshAutos()
        {
            List <string> Folders = SearchFolder.GetDirectories(setts.MainFolder);

            foreach (var folder in Folders)
            {
                AutomatismosClass.Automatismo t = autos.Automatismos.Find(x => x.Path.Equals(folder));
                if (t == null)
                {
                    //Adicionar Nova pasta á strutura
                }
                else
                {
                    foreach (var file in new DirectoryInfo(@"" + t.Path + "\\01. Script").GetFiles().Where(f => !f.Attributes.HasFlag(FileAttributes.Hidden)))
                    {
                        AutomatismosClass.Automatismo.Ficheiro f = t.Ficheiros.Find(x => x.Nome.Equals(file.Name));
                        if (f == null)
                        { //Adicionar Ficheiro
                        }
                        else
                        {
                            ExcelLink teste = new ExcelLink(t.Path + "\\01. Script\\" + f.Nome);
                            Range     r     = teste.GetRange("C6:E36", "");
                            foreach (Range item in r.Rows)
                            {
                                if (item.Cells[1, 3].Value == null)
                                {
                                    break;
                                }
                                AutomatismosClass.Automatismo.Ficheiro.Consulta lig = f.Ligacoes.Find(l => l.Nome.Equals(item.Cells[1, 3].Value));
                                if (lig == null)
                                { //Adicionar Consulta
                                }
                                else
                                {
                                    lig.Nome            = item.Cells[1, 3].Value;
                                    lig.Ok              = item.Cells[1, 1].Value;
                                    lig.VOlBD_Export    = item.Cells[1, 4].Value;
                                    lig.Seq_Data_Report = item.Cells[1, 5].Value;
                                    lig.DA_Mod          = item.Cells[1, 9].Value.ToString("dd/MM/yyyy");
                                    lig.FO_Mod          = item.Cells[1, 15].Value;
                                    lig.FO_Trans        = (item.Cells[1, 13].value == null ? "" : item.Cells[1, 13].Value.ToString("dd/MM/yyyy"));
                                    if (lig.Range != "")
                                    {
                                        lig.Image = teste.CopyImage(r, lig.Range);
                                    }
                                    teste.closeFile(false);
                                }
                            }
                        }
                    }
                }
            }
        }