public async Task <List <Formula> > All(string user)
        {
            string query = $@"SELECT 
                                    F.IDFORMULA,
                                    F.ARTICULO,
                                    F.CODTEMPORAL,
                                    F.NOMBRE,
                                    F.IDCLIENTE,
                                    F.IDTIPOPRODUCTO,
                                    F.CODDIV,
                                    F.CODFAM,
                                    F.CODSUBFAM,
                                    F.ESOFICIAL,
                                    F.OBSERVACIONES,
                                    TIPOPRODUCTOSTR = TP.NOMBRE,
                                    CLIENTESTR = C.NOMBRE,
                                    F.FECHAREGISTRO,
                                    F.USUARIOREGISTRO,	
                                    ESGRANEL = MONTANAINTERNOS.FORMULACION.UF_VERIFYISGRANEL(F.ARTICULO), 
                                    F.ESEMPAQUE 
                                FROM 
                                    MONTANAINTERNOS.FORMULACION.FORMULA F WITH(NOLOCK) 
                                    INNER JOIN MONTANAINTERNOS.FORMULACION.TIPOPRODUCTO TP WITH(NOLOCK) 
                                        ON TP.IDTIPOPRODUCTO = F.IDTIPOPRODUCTO
                                    LEFT JOIN MONTANAINTERNOS.EXACTUSDB.SYN_CLIENTE C WITH(NOLOCK) 
                                        ON C.CLIENTE = F.IDCLIENTE
                                where F.UsuarioRegistro like '%{user}%'
            ";

            List <Formula> Misformulas = await LocalDAO.QueryToList <Formula>(query);

            return(Misformulas);
        }
Esempio n. 2
0
        public async Task GuardarLocalmente <T>(List <T> insumo, string TableName)
        {
            try
            {
                var n = await LocalDAO.Query($@"delete from {TableName}");

                List <string> props = typeof(T).GetProperties().ToList().Select(x => x.Name).ToList();

                Parallel.ForEach(insumo, async x => {
                    string query = $@"
                        insert into 
                        {TableName}({String.Join(",", props)})
                        values({String.Join(",", props.Select(x => $"@{x}").ToList())}); 
                    ";

                    var parametros = new Dictionary <string, dynamic>();

                    props.ForEach(prop => parametros.Add($"@{prop}", x.GetType().GetProperty(prop).GetValue(x, null)));

                    var res = await LocalDAO.QueryWithParam(query, parametros);
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public async Task <List <TiposProducto> > All()
        {
            string query = $@"SELECT * FROM MONTANAINTERNOS.FORMULACION.TIPOPRODUCTO WHERE ESACTIVO = 1";

            List <TiposProducto> tiposProducto = await LocalDAO.QueryToList <TiposProducto>(query);

            return(tiposProducto);
        }
Esempio n. 4
0
 public FrmLlamador(Centralita centralita) : this()
 {
     this.centralita           = centralita;
     comboBoxFranja.DataSource = Enum.GetValues(typeof(Provincial.Franja));
     textBoxEntrada            = textBoxNroDestino;
     comboBoxFranja.Enabled    = false;
     provincialDAO             = new ProvincialDAO();
     localDAO = new LocalDAO();
 }
Esempio n. 5
0
        public async Task <List <Detalle> > GetByFormula(int formula_id)
        {
            string query = $@"
                    Select * 
                    from FORMULACION.formuladetalle 
                    where IdFormula = {formula_id}
            ";

            List <Detalle> MisDetalles = await LocalDAO.QueryToList <Detalle>(query);

            return(MisDetalles);
        }
Esempio n. 6
0
 public void Editar(LocalDTO local)
 {
     try
     {
         LocalDAO localDAO = new LocalDAO();
         localDAO.EditarLocal(local);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro ao editar local: " + ex.Message);
     }
 }
Esempio n. 7
0
 public void Inserir(LocalDTO local)
 {
     try
     {
         LocalDAO localDAO = new LocalDAO();
         localDAO.InserirLocal(local);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro ao inserir local: " + ex.Message);
     }
 }
 public IHttpActionResult ListarLocais()
 {
     try
     {
         LocalDAO localDAO = new LocalDAO();
         return(Ok(localDAO.ListarLocais()));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
 public IHttpActionResult Delete(int id)
 {
     try
     {
         LocalDAO localDAO = new LocalDAO();
         localDAO.ExcluirLocal(id);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
Esempio n. 10
0
        public async Task <List <Articulo> > PullChanges_Articulos()
        {
            try
            {
                List <Articulo> articulos = await LocalDAO.QueryToList <Articulo>("select Articulo, FCH_HORA_ULT_MODIF from Articulo");

                List <Insumo> insumo = articulos.Select(x => new Insumo
                {
                    id = x.ARTICULO,
                    UltimaModificacion = x.FCH_HORA_ULT_MODIF.ToString("o").Substring(0, 23)
                }).ToList();

                List <Articulo> actualizados = new List <Articulo>();

                var insumosPaginados = insumo.PaginateList(500);

                insumosPaginados.ForEach(async lista => {
                    string query = "FORMULACION.usp_Articulos_Diferencias";

                    //PREGUNTO A LA BBDD SI ESTOS REGISTROS CAMBIARON Y OBTENGO SOLO LOS QUE CAMBIARON

                    var concatenados = ConcatInsumo(lista);
                    var parametros   = new Dictionary <string, dynamic>();
                    parametros.Add($"@insumo", concatenados + ";");

                    List <Articulo> res = RemoteDAO.QueryToList <Articulo>(query, parametros, true);

                    //SI HUBO RESULTADOS ELIMINO LOS LOCALES CON ESOS IDS
                    if (res.Count != 0)
                    {
                        res.ForEach(x => actualizados.Add(x));
                        //ELIMINO EN LOCAL
                        var parametrosDelete = new Dictionary <string, dynamic>();
                        parametrosDelete.Add("@articulos", String.Join(",", res.Select(z => z.ARTICULO).ToList()));
                        await LocalDAO.QueryWithParam("delete from Articulo where articulo in(@articulos)", parametrosDelete);

                        //GUARDO LA VERSIÓN MÁS RECIENTE QUE ESTABA EN LA BASE DE DATOS.
                        await Guardar(res);
                    }
                });

                return(actualizados);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 11
0
        static void Main(string[] args)
        {
            //Console.WriteLine(nombreArchivo);
            //Console.ReadKey();
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1     = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2     = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3     = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4     = new Provincial(Provincial.Franja.Franja_3, l2);
            Local      sergio = new Local();

            // Las llamadas se irán registrando en la Centralita.
            c.RutaDeArchivo = "Log de llamadas";
            try
            {
                c = c + l1;
                c = c + l2;
                c = c + l3;
                c = c + l4;
            }
            catch (CentralitaException e)
            {
                Console.WriteLine(e.Message);
            }
            c.OrdenarLlamadas();
            l1.Guardar();
            l2.Guardar();
            c.Guardar();
            Console.ReadKey();
            Console.WriteLine(l1.Leer());
            Console.ReadKey();
            Console.WriteLine(l2.Leer());
            Console.ReadKey();
            Console.WriteLine(c.Leer());

            LocalDAO a = new LocalDAO();

            a.Guardar(l3);

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernala", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            LocalDAO.Guardar(l1);
            LocalDAO.Guardar(l3);
            List <Local> locales = LocalDAO.Leer("Bernal");

            foreach (Local local in locales)
            {
                Console.WriteLine(local.Mostrar());
            }
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Centralita     c             = new Centralita("Nacho Center");
            Local          l1            = new Local("Bernal", 64, "Lanus", 0.21f);
            Provincial     l2            = new Provincial("Morón", Provincial.Franja.Franja_2, 34, "Bariloche");
            Local          l3            = new Local("Lanús", 45, "Avellaneda", 0.25f);
            Provincial     l4            = new Provincial(Provincial.Franja.Franja_3, l2);
            ProvincialDAO  provincialDAO = new ProvincialDAO();
            LocalDAO       localDAO      = new LocalDAO();
            List <Llamada> listaLlamadas = new List <Llamada>();

            c.Llamadas.Add(l1);
            c.Llamadas.Add(l2);
            c.Llamadas.Add(l3);
            c.Llamadas.Add(l4);
            Console.WriteLine(c.ToString());
            c.OrdenarLlamadas();
            Console.WriteLine("-----Llamadas ordenadas por duracion-----\n");
            Console.WriteLine(c.ToString());

            try
            {
                if (l1.Guardar())
                {
                    Console.WriteLine(l1.Leer().ToString());
                }

                if (l2.Guardar())
                {
                    Console.WriteLine(l2.Leer().ToString());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }



            Console.ReadKey();
        }
Esempio n. 14
0
        static string RunReport(Dictionary <string, string> queries, Settings settings, DateTime startDate)
        {
            string result = string.Empty;

            List <SearchResult> searchResults = new List <SearchResult>();

            foreach (string k in queries.Keys)
            {
                searchResults.Add(LocalDAO.Search(k, queries[k], startDate));
            }


            try{
                result = ReportBuilder.SaveReport(settings, searchResults);
            }catch (Exception ex) {
                Console.WriteLine("There was an error saving the report. Error details: " + ex.Message);
                Console.ReadLine();
            }

            settings.LastSuccessfulReportDate = DateTime.Now.Date;
            LocalDAO.SaveSettings(settings);
            return(result);
        }
Esempio n. 15
0
 public string ActualizarLocal(Local value)
 {
     return(LocalDAO.Actualizar(value));
 }
Esempio n. 16
0
        static void Main(string[] args)
        {
            DateTime?searchDate = null;

            bool downloadOnly = false;

            if (args.Length > 0)
            {
                if (args[0] == "-downloadonly")
                {
                    downloadOnly = true;
                }
                if ((args[0]) == "-version")
                {
                    System.Reflection.Assembly assembly    = System.Reflection.Assembly.GetExecutingAssembly();
                    FileVersionInfo            fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location);
                    Console.WriteLine(fileVersion.FileVersion);

                    return;
                }
            }

            Console.Write(licenseStatement);
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();

            List <int> statusCodeIdsNew  = LocalDAO.GetNewApplicationStatusCodes();
            List <int> statusCodeIdsDead = LocalDAO.GetDeadApplicationStatusCodes();

            if (UserInputDAO.TryGetQueries(queriesFilename, out Dictionary <string, string> queries, out string errorMessage))
            {
                Console.WriteLine("There are " + queries.Count.ToString() + " queries in " + queriesFilename);

                Settings settings = LocalDAO.GetSettings();

                if (LocalDAO.CreateDatabaseIfNeeded())
                {
                    if (!LocalDAO.ValidateDatabase())
                    {
                        Console.WriteLine("Local trademark application database is corrupted");
                        Console.WriteLine("Deleting and re-creating database");
                        LocalDAO.DeleteDatabase();
                        LocalDAO.CreateDatabaseIfNeeded();
                        settings.EarliestFilingDate = DateTime.MinValue;
                    }

                    DateTime latestDate = settings.LastDownloadDate;

                    if (settings.EarliestFilingDate == DateTime.MinValue || settings.LastSuccessfulReportDate == DateTime.MinValue)
                    {
                        //first run
                        searchDate = PromptPastDate("Search Start Date (ex: Jan 1 2019):");
                        settings.EarliestFilingDate       = (DateTime)searchDate;
                        settings.LastSuccessfulReportDate = settings.EarliestFilingDate;
                        LocalDAO.SaveSettings(settings);
                        latestDate = settings.EarliestFilingDate;
                    }

                    DateTime yesterday = DateTime.Now.AddDays(-1).Date;

                    if ((latestDate).Date >= yesterday)
                    {
                        Console.WriteLine("Local trademark application database is up-to-date");
                    }
                    else
                    {
                        foreach (DateTime day in EachDay(latestDate, yesterday))
                        {
                            WriteTimeStampedLine("Getting USPTO applications from " + day.ToString("MMM dd, yyyy"));
                            var trademarkApplications = UsptoDAO.GetDailyTrademarkApplications(day, LocalDAO.StatusCodes, settings.EarliestFilingDate, settings.DownloadAttempts);
                            LocalDAO.SaveApplications(trademarkApplications.newApps, trademarkApplications.deadApps);
                            settings.LastDownloadDate = day;
                            LocalDAO.SaveSettings(settings);
                        }
                    }

                    if (!downloadOnly)
                    {
                        Console.WriteLine();
                        //run report

                        Console.WriteLine("Earliest Filings Downloaded: " + settings.EarliestFilingDate.ToString(dateFormat));
                        Console.WriteLine("Latest Filings Downloaded: " + settings.LastDownloadDate.ToString(dateFormat));
                        Console.WriteLine("Last Report Date: " + settings.LastSuccessfulReportDate.ToString(dateFormat));
                        Console.WriteLine();

                        if (searchDate == null)
                        {
                            searchDate = PromptPastDate("Search Start Date:", settings.EarliestFilingDate);
                        }
                        string reportName = RunReport(queries, settings, (DateTime)searchDate);
                        OpenBrowser(settings.ReportsDirectory + Path.DirectorySeparatorChar + reportName);
                    }
                }
                else
                {
                    Console.WriteLine("One or more necessary files are missing or corrupted. Please re-install.");
                    PressAnyKey();
                }
            }
            else
            {
                Console.WriteLine("ERROR: " + queriesFilename + " " + errorMessage);
                PressAnyKey();
            }
        }
        public LocalDTO RecuperarLocal(int id)
        {
            LocalDAO localDAO = new LocalDAO();

            return(localDAO.ListarLocal(id));
        }
Esempio n. 18
0
 public List <Local> ListarLocal()
 {
     return(LocalDAO.Listar());
 }
Esempio n. 19
0
        static void Main(string[] args)
        {
            Console.Title = "Ejercicio Nro 59";

            string encabezado;

            // Mi central
            Centralita c = new Centralita("Fede Center");

            LocalDAO      localDAO      = new LocalDAO();
            ProvincialDAO provincialDAO = new ProvincialDAO();

            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);
            Provincial l5;
            Local      l6;

            encabezado = String.Format("{0, 3} {1, 15} {2, 15} {3, 15}\n", "Duracion", "Destino", "Origen", "Costo");



            if (localDAO.Guardar(l1))
            {
                Console.WriteLine("Llamada guardada");
            }

            if (localDAO.Guardar(l3))
            {
                Console.WriteLine("Llamada guardada");
            }
            if (provincialDAO.Guardar(l2))
            {
                Console.WriteLine("Llamada guardada");
            }

            l6 = localDAO.Leer(11);

            Console.WriteLine(l6.ToString());


            //Llamadas a Serializar

            /*
             * Console.WriteLine("Llamada a guardar: ");
             * Console.WriteLine(encabezado);
             * Console.WriteLine(l2.ToString());
             * Console.WriteLine(l1.ToString());
             *
             * l2.Guardar();
             * l1.Guardar();
             * l5 = l2.Leer();
             * l6 = l1.Leer();
             *
             * Console.WriteLine("Copia de la llamada");
             *
             * Console.WriteLine(encabezado);
             * Console.WriteLine(l5.ToString());
             * Console.WriteLine(l6.ToString());
             */
            /*
             * // Las llamadas se irán registrando en la Centralita.
             * // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
             * try
             * {
             * c = c + l1;
             *
             * c = c + l1;//lanza excepción
             *
             * System.Threading.Thread.Sleep(2000);
             *
             *
             *
             * }
             * catch (Exception e1)
             * {
             * Console.WriteLine(e1.Message);
             * }
             * finally
             * {
             * try
             * {
             *  c = c + l2;
             *
             *  System.Threading.Thread.Sleep(2000);
             *
             *  c = c + l3;
             *
             *  System.Threading.Thread.Sleep(2000);
             *
             *  c = c + l4;//lanza excepción
             * }
             * catch (Exception e2)
             * {
             *  Console.WriteLine(e2.Message);
             * }
             *
             * }
             *
             * c.OrdenarLlamadas();
             *
             * Console.WriteLine("");
             * Console.WriteLine(c.ToString());
             */



            //Muestro el contenido del Log
            //Console.WriteLine(c.Leer());

            Console.ReadKey();
        }
Esempio n. 20
0
 public Local ListarLocal(int IdLocal)
 {
     return(LocalDAO.Listar(IdLocal));
 }
Esempio n. 21
0
 public Local ListarLocal(string NombreLocal)
 {
     return(LocalDAO.Listar(NombreLocal));
 }
Esempio n. 22
0
 public string IngresarLocal(Local value)
 {
     return(LocalDAO.Ingresar(value));
 }
Esempio n. 23
0
 public FrmLlamadasBDD()
 {
     InitializeComponent();
     provincialDAO = new ProvincialDAO();
     localDAO      = new LocalDAO();
 }
Esempio n. 24
0
 public string EliminarLocal(int id)
 {
     return(LocalDAO.Eliminar(id));
 }