Beispiel #1
0
        /// <summary>
        /// Actualiza Administrador
        /// </summary>
        /// <param name="theEmpresaDTO"></param>
        /// <returns></returns>
        public static int UpdateAdministrador(UsuarioDTO theUsuarioDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("UDP_administrador", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            //myCommand.Parameters.Add("@paterno", SqlDbType.VarChar).Value = theUsuarioDTO.Paterno;
            //myCommand.Parameters.Add("@materno", SqlDbType.VarChar).Value = theUsuarioDTO.Materno;
            //myCommand.Parameters.Add("@nombres", SqlDbType.VarChar).Value = theUsuarioDTO.Nombres;
            //myCommand.Parameters.Add("@rut", SqlDbType.Int).Value = theUsuarioDTO.Rut;
            //myCommand.Parameters.Add("@mail", SqlDbType.VarChar).Value = theUsuarioDTO.Mail;
            //myCommand.Parameters.Add("@empresa", SqlDbType.Int).Value = theUsuarioDTO.Empresa;
            //myCommand.Parameters.Add("@usuarioIngreso", SqlDbType.Int).Value = theUsuarioDTO.UsuarioIngreso;


            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(0);
        }
        /// <summary>
        /// Actualiza Intentos Fallidos
        /// </summary>
        /// <param name="mvarUsuarioCod"></param>
        /// <param name="pvarIntentoFallidoCant"></param>
        private static void ActIntentoFallidos(string mvarUsuarioCod, short pvarIntentoFallidoCant)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("UPD_Operador1", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;
            SqlDataReader datos;
            string        idEmpleado = string.Empty;

            myCommand.Parameters.Add("@pUsu_Rut", SqlDbType.VarChar).Value             = mvarUsuarioCod;
            myCommand.Parameters.Add("@pIntentoFallidoFecha", SqlDbType.VarChar).Value = "";
            myCommand.Parameters.Add("@pIntentoFallidoCant", SqlDbType.VarChar).Value  = pvarIntentoFallidoCant;

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    idEmpleado = datos.GetString(0);
                }
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                myConnection.Close();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Agregar un usuario
        /// </summary>
        /// <param name="UsuarioDTO"></param>
        /// <returns></returns>
        public static int InsertarUsuario(UsuarioDTO UsuarioDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("ins_usuario", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@rut", SqlDbType.VarChar).Value               = UsuarioDTO.Usuario;
            myCommand.Parameters.Add("@password", SqlDbType.VarChar).Value          = UsuarioDTO.Password;
            myCommand.Parameters.Add("@pNombreUsuario", SqlDbType.VarChar).Value    = UsuarioDTO.Nombres;
            myCommand.Parameters.Add("@pPaternoUsuario", SqlDbType.VarChar).Value   = UsuarioDTO.Paterno;
            myCommand.Parameters.Add("@pMaternoUsuario", SqlDbType.VarChar).Value   = UsuarioDTO.Materno;
            myCommand.Parameters.Add("@pFechaNacimiento", SqlDbType.DateTime).Value = UsuarioDTO.FechaNacimiento;
            myCommand.Parameters.Add("@pMailUsuario", SqlDbType.VarChar).Value      = UsuarioDTO.Mail;
            myCommand.Parameters.Add("@pIdCondominio", SqlDbType.Decimal).Value     = UsuarioDTO.IdCondominio;
            myCommand.Parameters.Add("@usuarioIngreso", SqlDbType.VarChar).Value    = UsuarioDTO.UsuarioIngreso;

            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(0);
        }
Beispiel #4
0
        /// <summary>
        /// Actualiza datos de empresa existente
        /// </summary>
        /// <param name="theEmpresaDTO"></param>
        /// <returns></returns>
        public static int UpdateCondominio(CondominioDTO theCondominioDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("UPD_CONDOMINIO", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@idCondominio", SqlDbType.Decimal).Value        = theCondominioDTO.IdCondominio;
            myCommand.Parameters.Add("@idPorteria", SqlDbType.Decimal).Value          = theCondominioDTO.IdPorteria;
            myCommand.Parameters.Add("@idAdministracion", SqlDbType.Decimal).Value    = theCondominioDTO.IdAdministracion;
            myCommand.Parameters.Add("@nombreCondominio", SqlDbType.VarChar).Value    = theCondominioDTO.NombreCondominio;
            myCommand.Parameters.Add("@telefonoCondominio", SqlDbType.VarChar).Value  = theCondominioDTO.TelefonoCondominio;
            myCommand.Parameters.Add("@correoCondominio", SqlDbType.VarChar).Value    = theCondominioDTO.EmailCondominio;
            myCommand.Parameters.Add("@direccionCondominio", SqlDbType.VarChar).Value = theCondominioDTO.DireccionCondominio;
            myCommand.Parameters.Add("@usuarioIngreso", SqlDbType.VarChar).Value      = theCondominioDTO.UsuarioIngreso;
            myCommand.Parameters.Add("@fechaIngreso", SqlDbType.DateTime).Value       = theCondominioDTO.FechaIngreso;
            myCommand.Parameters.Add("@usuarioModificacion", SqlDbType.VarChar).Value = theCondominioDTO.UsuarioModificacion;
            myCommand.Parameters.Add("@fechaModificacion", SqlDbType.DateTime).Value  = theCondominioDTO.FechaModificacion;
            myCommand.Parameters.Add("@estado", SqlDbType.Int).Value = theCondominioDTO.Estado;

            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(0);
        }
 public void AddMovie(IMDB movie)
 {
     try
     {
         //progressLabel.Content = string.Format("Adding movie [ {0} ]...", Movie.Title);
         bool inserted = movie.AddMovieToCollection();
         if (inserted)
         {
             _moviesInsertedSuccessfully++;
         }
         movie.Inserted = inserted;
         //processedMovies.Add( movie );
         //Film moviePulledFromDB = movieToRetrieve.ReadMovieFromCollection();
         Dispatcher.Invoke(_updatePbDelegate,
                           System.Windows.Threading.DispatcherPriority.Background, new object[]
         {
             RangeBase.ValueProperty, (double)_movieCount
         });
     }
     catch (Exception ex)
     {
         Log.Trace("Could not complete movie insert", movie.Title);
         Log.Error(ex);
         ex.ThrowFormattedException();
     }
 }
Beispiel #6
0
        /// <summary>
        /// Inserta una nueva Empresa
        /// </summary>
        /// <param name="theEmpresaDTO"></param>
        /// <returns></returns>
        public static int InsertarCondominio(CondominioDTO theCondominioDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("INS_Condominio", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@pRutCondominio", SqlDbType.VarChar).Value       = theCondominioDTO.RutCondominio;
            myCommand.Parameters.Add("@pNombreCondominio", SqlDbType.VarChar).Value    = theCondominioDTO.NombreCondominio;
            myCommand.Parameters.Add("@pTelefonoCondominio", SqlDbType.VarChar).Value  = theCondominioDTO.TelefonoCondominio;
            myCommand.Parameters.Add("@pCorreoCondominio", SqlDbType.VarChar).Value    = theCondominioDTO.EmailCondominio;
            myCommand.Parameters.Add("@pDireccionCondominio", SqlDbType.VarChar).Value = theCondominioDTO.DireccionCondominio;
            myCommand.Parameters.Add("@pUsuarioIngreso", SqlDbType.VarChar).Value      = theCondominioDTO.UsuarioIngreso;

            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(0);
        }
Beispiel #7
0
        /// <summary>
        /// Lista usuarios
        /// </summary>
        /// <returns></returns>
        public static List <UsuarioDTO> ListaUsuarios()
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("QRY_listaUsuarios", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;
            SqlDataReader     datos;
            UsuarioDTO        theUsuarioDTO;
            List <UsuarioDTO> usuario = new List <UsuarioDTO>();

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    theUsuarioDTO = new UsuarioDTO();

                    if (!datos.IsDBNull(0))
                    {
                        theUsuarioDTO.Rut = datos.GetString(0);
                    }
                    if (!datos.IsDBNull(1))
                    {
                        theUsuarioDTO.Nombres = datos.GetString(1);
                    }
                    if (!datos.IsDBNull(2))
                    {
                        theUsuarioDTO.Paterno = datos.GetString(2);
                    }
                    if (!datos.IsDBNull(3))
                    {
                        theUsuarioDTO.Materno = datos.GetString(3);
                    }
                    if (!datos.IsDBNull(4))
                    {
                        theUsuarioDTO.Mail = datos.GetString(4);
                    }
                    if (!datos.IsDBNull(13))
                    {
                        theUsuarioDTO.Estado = datos.GetInt32(13).ToString();
                    }
                    usuario.Add(theUsuarioDTO);
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }

            finally
            {
                myConnection.Close();
            }

            return(usuario);
        }
 public ActionResult AddMovie(IMDB movie)
 {
     if (ModelState.IsValid)
     {
         DbRepository.AddMovie(movie);
         DbRepository.Save();
     }
     return(RedirectToAction("MovieIndex"));
 }
Beispiel #9
0
        public static List <FuncionDTO> ListaFuncionGrupoSistema()
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("GetFuncionalidadesSistema", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;
            SqlDataReader     datos;
            FuncionDTO        theFuncionDTO;
            List <FuncionDTO> funciones  = new List <FuncionDTO>();
            string            idEmpleado = string.Empty;

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    theFuncionDTO = new FuncionDTO();
                    try
                    {
                        if (!datos.IsDBNull(0))
                        {
                            theFuncionDTO.FuncionCod = datos.GetInt32(0).ToString();
                        }
                    }

                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    try
                    {
                        if (!datos.IsDBNull(1))
                        {
                            theFuncionDTO.FuncionNombre = datos.GetString(1);
                        }
                    }

                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    funciones.Add(theFuncionDTO);
                }
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                myConnection.Close();
            }

            return(funciones);
        }
Beispiel #10
0
        public static YouCom.DTO.Seguridad.UsuarioDTO GetGrupos(string pvarUsuarioCod)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("QRY_Permiso3", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;
            SqlDataReader          datos;
            List <FuncionGrupoDTO> ListfuncionGrupo = new List <FuncionGrupoDTO>();
            FuncionGrupoDTO        theFuncionGrupo;
            FuncionDTO             theFuncionDTO;

            YouCom.DTO.Seguridad.UsuarioDTO theOperador = new YouCom.DTO.Seguridad.UsuarioDTO();
            theOperador.Grupo = new List <FuncionGrupoDTO>();

            myCommand.Parameters.Add("@pUSU_RUT", SqlDbType.VarChar).Value = pvarUsuarioCod;

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    theFuncionDTO             = new FuncionDTO();
                    theFuncionGrupo           = new FuncionGrupoDTO();
                    theFuncionGrupo.Funciones = new List <FuncionDTO>();
                    ListfuncionGrupo          = new List <FuncionGrupoDTO>();
                    ///Carga Grupo
                    theFuncionGrupo.FuncionGrupoCod    = datos.GetInt32(0).ToString();
                    theFuncionGrupo.FuncionGrupoNombre = datos.GetString(1);
                    theFuncionGrupo.FuncionGrupoTipo   = datos.GetString(5);

                    ///Carga Funcionalidades de Grupo y Funcionalidades Internas del Negocio
                    theFuncionDTO.FuncionCod           = datos.GetInt32(2).ToString();
                    theFuncionDTO.FuncionNombre        = datos.GetString(3);
                    theFuncionDTO.Url                  = datos.GetString(4);
                    theFuncionDTO.FuncionalidadNegocio = datos.GetString(5);
                    theFuncionGrupo.Funciones.Add(theFuncionDTO);

                    //  ListfuncionGrupo.Add(theFuncionGrupo);
                    theOperador.Grupo.Add(theFuncionGrupo);
                }
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                myConnection.Close();
            }
            return(theOperador);
        }
 private void SaveTransaction()
 {
     foreach (var transaction in this.CurrentTransaction.FullChain)
     {
         if (!IMDB.Add(transaction))
         {
             throw new ApplicationException(String.Format("Commit ({0}) - SaveTransaction", this.CurrentTransaction.Id));
         }
     }
 }
        //Invokes DisplayTrailers View.
        public ActionResult DisplayTrailers()
        {
            IMDB   imdb  = null;
            string movie = Convert.ToString(Request.Form["movieName"]);

            if (!string.IsNullOrEmpty(movie))
            {
                imdb = new IMDB(movie);
            }
            return(View(imdb));
        }
Beispiel #13
0
        public IEnumerable <string> Handle(string input, Match match, IListener listener)
        {
            var query = match.Groups[1].Value.Trim();
            var imdb  = IMDB.FromQuery(query);

            yield return("{0} received a rating of {1}.".Template(imdb.Title, imdb.ImdbRating));

            if (double.Parse(imdb.ImdbRating) > 6)
            {
                yield return("You should probably watch it.");
            }
        }
Beispiel #14
0
        public static List <FuncionDTO> ListaPermisos(string Usuario)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("PermisosUsuario", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@usuario", SqlDbType.VarChar).Value = Usuario;
            SqlDataReader datos;
            FuncionDTO    theFuncionDTO;

            List <FuncionDTO> funciones = new List <FuncionDTO>();

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    theFuncionDTO = new FuncionDTO();

                    if (!datos.IsDBNull(0))
                    {
                        theFuncionDTO.FuncionNombre = datos.GetString(0);
                    }
                    if (!datos.IsDBNull(1))
                    {
                        theFuncionDTO.FuncionCod = datos.GetInt32(1).ToString();
                    }
                    if (!datos.IsDBNull(2))
                    {
                        theFuncionDTO.EnviaCorreo = datos.GetString(2);
                    }
                    //if (!datos.IsDBNull(2))
                    //{
                    //    theFuncionDTO.Estado = datos.GetString(3);
                    //}
                    funciones.Add(theFuncionDTO);
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }

            finally
            {
                myConnection.Close();
            }

            return(funciones);
        }
        public static void Run()
        {
            //Load IMDb dataset
            var((x_train, y_train), (x_test, y_test)) = IMDB.LoadData();

            var X = np.concatenate(new NDarray[] { x_train, x_test }, axis: 0);
            var Y = np.concatenate(new NDarray[] { y_train, y_test }, axis: 0);

            Console.WriteLine("Shape of X: " + X.shape);
            Console.WriteLine("Shape of Y: " + Y.shape);

            //We can get an idea of the total number of unique words in the dataset.
            Console.WriteLine("Number of words: ");
            var hstack = np.hstack(new NDarray[] { X });
            //var unique = hstack.unique();
            //Console.WriteLine(np.unique(np.hstack(new NDarray[] { X })).Item1);

            // Load the dataset but only keep the top n words, zero the rest
            int top_words = 1000;// 5000;

            ((x_train, y_train), (x_test, y_test)) = IMDB.LoadData(num_words: top_words);

            int max_words = 500;

            x_train = SequenceUtil.PadSequences(x_train, maxlen: max_words);
            x_test  = SequenceUtil.PadSequences(x_test, maxlen: max_words);

            //Create model
            Sequential model = new Sequential();

            model.Add(new Embedding(top_words, 32, input_length: max_words));
            model.Add(new Conv1D(filters: 32, kernel_size: 3, padding: "same", activation: "relu"));
            model.Add(new MaxPooling1D(pool_size: 2));
            model.Add(new Flatten());
            model.Add(new Dense(250, activation: "relu"));
            model.Add(new Dense(1, activation: "sigmoid"));

            model.Compile(loss: "binary_crossentropy", optimizer: "adam", metrics: new string[] { "accuracy" });
            model.Summary();

            // Fit the model
            model.Fit(x_train, y_train, validation_data: new NDarray[] { x_test, y_test },
                      epochs: 1 /*10*/, batch_size: 128, verbose: 2);
            // Final evaluation of the model
            var scores = model.Evaluate(x_test, y_test, verbose: 0);

            Console.WriteLine("Accuracy: " + (scores[1] * 100));

            model.Save("model.h5");
            File.WriteAllText("model.json", model.ToJson());    //save model
            //model.SaveTensorflowJSFormat("./");   //error - Cannot perform runtime binding on a null reference
        }
Beispiel #16
0
        public MetaCollector(IMDB imdb)
        {
            SeriesName = imdb.SeriesName;

            int SeasonNumber = Int32.Parse(imdb.Season);

            SeasonNumberString = iToString(SeasonNumber);

            int EpisodeNumber = Int32.Parse(imdb.EpisodeNumber);

            EpisodeNumberString = iToString(EpisodeNumber);

            EpisodeName = imdb.EpisodeName;
        }
Beispiel #17
0
        private void CreateFilmList()
        {
            Thread th = new Thread(new ThreadStart(() => {
                IMDB imdb     = new IMDB();
                string[] dirs = new Settings().GetSetting("movieDirs").Split('|');
                for (int i = 0; i < dirs.Length; i++)
                {
                    imdb.GetInfo(new Files().SearchDir(dirs[i]));
                }

                new Speech().Speak("Finished updating the film list!");
            }));

            th.Start();
        }
Beispiel #18
0
        public static void Register(Pipe pipe)
        {
            //Actors
            pipe.Listen((input, match, listener) =>
            {
                var query = match.Groups[1].Value;
                var imdb  = IMDB.FromQuery(query);
                listener.Output("{0} were in {1}".Template(imdb.Actors, imdb.Title));
            }, "who.+in (.+)");

            //Alarm
            pipe.Listen((input, match, listener) =>
            {
                ClockTicker.Instance.StopAlarm();
                Brain.Awake = true;
            }, "alarm");

            //Close
            pipe.Listen((input, match, listener) =>
            {
                var process = match.Groups[1].Value.ToLower();
                var list    = Process.GetProcesses().Where(o => o.ProcessName.ToLower().Contains(process)).ToList();
                if (list.Count < 0)
                {
                    return;
                }
                foreach (var p in list)
                {
                    try
                    {
                        p.Kill();
                    }
                    catch (Exception)
                    {
                    }
                }
                listener.Output("I've closed " + list.FirstOrDefault());
            }, "close (.+)");

            //Restart
            pipe.Listen((input, match, listener) =>
            {
                listener.Output("Restarting...");
                var path = Assembly.GetAssembly(typeof(Brain)).Location;
                Process.Start(path);
                Environment.Exit(0);
            }, "restart");
        }
        private void ButtonClick1(object sender, RoutedEventArgs e)
        {
            //Find Movie Clicked
            string movieToRetrieve = TitleToSearch.Text;

            if (!string.IsNullOrWhiteSpace(movieToRetrieve))
            {
                Movie = GetIMDBMovie(movieToRetrieve);
                retrievedTitle.Content      = Movie.Title;
                retreievedLeadActor.Content = Movie.Cast.ToArray().ToList().First();
                retrievedYear.Content       = Movie.Year;
            }
            else
            {
                "You have to enter a title to search for".ShowMessage();
            }
        }
Beispiel #20
0
        /// <summary>
        /// lista Funciones Asociadas a Grupo para el perfilamiento de usuario
        /// </summary>
        /// <returns></returns>
        public static List <FuncionDTO> ListaFunciones(int FuncionGrupo)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("QRY_listaFuncionesGrupo", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@FuncionGrupoCod", SqlDbType.Int).Value = FuncionGrupo;
            SqlDataReader     datos;
            FuncionDTO        theFuncionDTO;
            List <FuncionDTO> funciones = new List <FuncionDTO>();

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    theFuncionDTO = new FuncionDTO();

                    if (!datos.IsDBNull(0))
                    {
                        theFuncionDTO.FuncionCod = datos.GetInt32(0).ToString();
                    }
                    if (!datos.IsDBNull(1))
                    {
                        theFuncionDTO.FuncionNombre = datos.GetString(1);
                    }
                    funciones.Add(theFuncionDTO);
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }

            finally
            {
                myConnection.Close();
            }

            return(funciones);
        }
Beispiel #21
0
        public static void DeletePermisos(PermisoDTO thePermisoDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("DEL_Permisos", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@usuario", SqlDbType.Int).Value = thePermisoDTO.Usuario;

            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #22
0
        public static void Predict(string text)
        {
            var    model  = Sequential.LoadModel("model.h5");
            string result = "";

            var indexes = IMDB.GetWordIndex();

            string[] words  = TextUtil.TextToWordSequence(text);
            float[]  tokens = words.Select(i => ((float)indexes[i])).ToArray();

            NDarray x = np.array(tokens);

            x = x.reshape(1, x.shape[0]);
            x = SequenceUtil.PadSequences(x, maxlen: 500);
            var y      = model.Predict(x);
            var binary = Math.Round(y[0].asscalar <float>());

            result = binary == 0 ? "Negative" : "Positive";
            Console.WriteLine("Sentiment for \"{0}\": {1}", text, result);
        }
Beispiel #23
0
        /// <summary>
        /// Desactiva una empresa y todos los usuario asociados
        /// </summary>
        /// <param name="theEmpresaDTO"></param>
        /// <returns></returns>
        public static int DeleteCondominio(CondominioDTO theCondominioDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("ACT_CONDOMINIO", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@idCondominio", SqlDbType.Int).Value = theCondominioDTO.IdCondominio;

            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(0);
        }
Beispiel #24
0
        /// <summary>
        /// Inserta los permisos para las funcionalidades al Usuario asignado
        /// </summary>
        public static void InsertaPermisos(PermisoDTO thePermisoDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("INS_Permiso", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add("@pGrupoCod", SqlDbType.VarChar).Value   = thePermisoDTO.Empresa;
            myCommand.Parameters.Add("@pRolCod", SqlDbType.VarChar).Value     = thePermisoDTO.Usuario;
            myCommand.Parameters.Add("@pFuncionCod", SqlDbType.VarChar).Value = thePermisoDTO.Funcion;

            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #25
0
        /// <summary>
        /// Activa o Desactiva Usuarios
        /// </summary>
        /// <param name="UsuarioDTO"></param>
        /// <returns></returns>
        public static int ActivaDesactivaUsuario(UsuarioDTO UsuarioDTO)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("activaDesactivaUsuario", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            //myCommand.Parameters.Add("@rut", SqlDbType.Int).Value = UsuarioDTO.Rut;
            //myCommand.Parameters.Add("@usuarioModificacion", SqlDbType.VarChar).Value = UsuarioDTO.UsuarioModificacion;
            //myCommand.Parameters.Add("@estado", SqlDbType.Int).Value = UsuarioDTO.Estado;

            try
            {
                myConnection.Open();
                myCommand.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            return(0);
        }
        public HTMLExtractor(string passedURL)
        {
            URL = passedURL;

            SiteName = SiteDetector(URL);

            using (WebClient client = new WebClient()) // WebClient class inherits IDisposable
            {
                HTML = client.DownloadString(URL);
            }

            if (SiteName.ToLower() == "imdb")
            {
                IMDB imdb = new IMDB(HTML);
                MetaCollector = new MetaCollector(imdb);
            }
            else
            {
                TV tv = new TV(HTML);
                MetaCollector = new MetaCollector(tv);
            }
        }
Beispiel #27
0
        /// <summary>
        /// Override the function from the BackgroundWorker Class
        /// </summary>
        /// <param name="e">The object that we want to be processed.</param>
        protected override void OnDoWork(DoWorkEventArgs e)
        {
            WorkerReportsProgress = true;
            String url = ((Params)e.Argument).url;

            bool[]      fields = ((Params)e.Argument).fields;
            int         media  = ((Params)e.Argument).media;
            int         actorN = ((Params)e.Argument).actorN;
            int         sSeas  = ((Params)e.Argument).sSeas;
            int         eSeas  = ((Params)e.Argument).eSeas;
            XmlDocument xmlDoc = ((Params)e.Argument).xmlDoc;
            IMDB        imdb   = new IMDB();

            imdb.parentProgressCaller = progressCaller;
            imdb.parentErrorCaller    = errorCaller;

            bool success = imdb.getPage(url);

            if (success)
            {
                this.ReportProgress(40);
                imdb.parseTitlePage(xmlDoc, fields, media, actorN, sSeas, eSeas);
            }
        }
        private void ButtonClick1(object sender, RoutedEventArgs e)
        {
            _moviesInsertedSuccessfully = 0;
            MoviesToAdd            = listOfMovies.Text.Split(new[] { "\r\n", "\n", Environment.NewLine }, StringSplitOptions.None).ToList();
            progressBar.Minimum    = 0;
            progressBar.Maximum    = MoviesToAdd.Count;
            progressBar.Value      = 0;
            progressBar.Visibility = Visibility.Visible;
            Stopwatch timer = new Stopwatch();

            timer.Start();
            foreach (string movieToRetrieve in MoviesToAdd)
            {
                _movieCount++;

                if (!string.IsNullOrWhiteSpace(movieToRetrieve))
                {
                    if (movieToRetrieve.Contains(@"http://www.imdb.com/title"))
                    {
                        try
                        {
                            IMDB Movie = new IMDB(movieToRetrieve, true);
                            AddMovie(Movie);
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Could not add movie to collection: [ {0} ]", new object[] { movieToRetrieve });
                        }
                    }
                }
            }

            //Switcher.Switch(new AddResults( processedMovies));
            timer.Stop();
            "Inserted {0} of {1} movies successfully, Total run time: {2}, (see log for any failures)".ShowMessage(new object[] { _moviesInsertedSuccessfully, MoviesToAdd.Count, timer.Elapsed.ToReadableString() });
        }
Beispiel #29
0
        public static YouCom.DTO.Seguridad.UsuarioDTO AuntetificaUsuario(string usuario, string password)
        {
            SqlConnection myConnection = IMDB.GetConnection();
            SqlCommand    myCommand    = new SqlCommand("QRY_Operador", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;
            SqlDataReader datos;

            YouCom.DTO.Seguridad.UsuarioDTO theOperadorDTO = new YouCom.DTO.Seguridad.UsuarioDTO();
            string idEmpleado = string.Empty;

            myCommand.Parameters.Add("@pUsuario", SqlDbType.VarChar).Value = usuario;

            try
            {
                myConnection.Open();
                datos = myCommand.ExecuteReader();
                while (datos.Read())
                {
                    if (!datos.IsDBNull(0))
                    {
                        theOperadorDTO.OperadorNro = int.Parse(datos.GetString(0).ToString().Substring(0, datos.GetString(0).ToString().Length - 1));
                        theOperadorDTO.Usuario     = datos.GetString(0).ToString();
                    }

                    if (!datos.IsDBNull(1))
                    {
                        theOperadorDTO.Password = datos.GetString(1);
                    }
                    if (!datos.IsDBNull(2))
                    {
                        theOperadorDTO.Fechapass = datos.GetDateTime(2);
                    }

                    if (!datos.IsDBNull(3))
                    {
                        theOperadorDTO.IntentoFallidoFecha = datos.GetDateTime(3);
                    }
                    if (!datos.IsDBNull(4))
                    {
                        theOperadorDTO.IntentoFallidoCant = datos.GetInt32(4);
                    }

                    if (!datos.IsDBNull(5))
                    {
                        theOperadorDTO.Nombres = datos.GetString(5).ToString();
                    }

                    if (!datos.IsDBNull(6))
                    {
                        theOperadorDTO.Paterno = datos.GetString(6).ToString();
                    }

                    if (!datos.IsDBNull(7))
                    {
                        theOperadorDTO.Materno = datos.GetString(7).ToString();
                    }
                }
                if (theOperadorDTO.Password == password)
                {
                    if (theOperadorDTO.IntentoFallidoCant >= 3)
                    {
                        throw new Exception("4|Estimado Cliente, Supero reintentos permitidos Usuario Bloqueado");
                    }
                    else
                    {
                        ActIntentoFallidos(usuario, 0);
                    }
                }
                else
                {
                    theOperadorDTO.IntentoFallidoCant = theOperadorDTO.IntentoFallidoCant + 1;
                    ActIntentoFallidos(usuario, Convert.ToInt16(theOperadorDTO.IntentoFallidoCant));
                    throw new Exception("2|El usuario o la contraseña son incorrectos.");
                    ///usuario pass erroneas
                    //return false
                }
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.Message);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                myConnection.Close();
            }

            return(theOperadorDTO);
        }
Beispiel #30
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public Utilities()
 {
     _context = new IMDB();
 }
Beispiel #31
0
        /// <summary>
        /// Override the function from the BackgroundWorker Class
        /// </summary>
        /// <param name="e">The object that we want to be processed.</param>
        protected override void OnDoWork(DoWorkEventArgs e)
        {
            WorkerReportsProgress = true;
            String url = ((Params)e.Argument).url;
            bool[] fields = ((Params)e.Argument).fields;
            int media = ((Params)e.Argument).media;
            int actorN = ((Params)e.Argument).actorN;
            int sSeas = ((Params)e.Argument).sSeas;
            int eSeas = ((Params)e.Argument).eSeas;
            XmlDocument xmlDoc = ((Params)e.Argument).xmlDoc;
            IMDB imdb = new IMDB();
            imdb.parentProgressCaller = progressCaller;
            imdb.parentErrorCaller = errorCaller;

            bool success = imdb.getPage(url);

            if (success)
            {
                this.ReportProgress(40);
                imdb.parseTitlePage(xmlDoc, fields, media, actorN, sSeas, eSeas);
            }
        }