Ejemplo n.º 1
0
        public void SP_FrmRecargas_Buscar()
        {
            CLConexion objconect = new CLConexion();
            SqlCommand con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_FrmRecargas_Buscar", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@Codigo", RFID);
            objconect.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                Saldo = Convert.ToDouble(Lectura[0]);
                msn   = "";
                objconect.connection.Close();
                return;
            }
            if (Lectura.Read() == false)
            {
                msn = "No hay Registro";
                objconect.connection.Close();
                return;
            }
        }
Ejemplo n.º 2
0
        public void Ejecutar()
        {
            string mensaje;

            mensaje = clienteCom.Leer();
            string[] tArr    = mensaje.Trim().Split('|');
            int      NroMed  = Convert.ToInt32(tArr[0]);
            DateTime fecha   = Convert.ToDateTime(tArr[1]);
            double   consumo = Convert.ToDouble(tArr[2]);

            Lectura l = new Lectura()
            {
                NroMedidor = NroMed,
                Fecha      = fecha,
                Consumo    = consumo
            };
            List <Medidor> medidor = medidorDAL.ObtenerMedidor().FindAll(m => m.IdMedidor == NroMed);

            if (medidor.Count > 0)
            {
                lock (lecturaDAL)
                {
                    lecturaDAL.AgregarLectura(l);
                }
                clienteCom.Escribir("LISTO");
            }
            else
            {
                clienteCom.Escribir("ERROR");
            }

            clienteCom.Desconectar();
        }
Ejemplo n.º 3
0
    protected void Leer_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["USUARIO"] == null)
            {
                Response.Redirect("~/Usuario/LoginUsuario.aspx");
            }

            string strId    = Request.Params["Id"];
            int    codLibro = Int32.Parse(strId);

            DateTime fec        = Convert.ToDateTime(DateTime.Now.ToString("dd/MM/yyyy"));
            Usuario  user       = UsuarioBRL.getUsuariosActivos();
            Lectura  objLectura = new Lectura();
            objLectura.libroId   = codLibro;
            objLectura.usuarioId = user.UsuarioId;
            objLectura.fecha     = fec;

            LecturaBRL.insertarLectura(objLectura);

            Libros lib = libroBRL.getLibroById(codLibro);

            string nombreLibro = "" + lib.Titulo;

            Response.Clear();
            string filePath = "~/Libros/Pdf/" + nombreLibro + ".pdf";
            Response.ContentType = "application/pdf";
            Response.WriteFile(filePath);
            Response.End();
        }
        catch (Exception ex)
        {
        }
    }
Ejemplo n.º 4
0
        public ActionResult About()
        {
            Lectura        let = new Lectura();
            List <Lectura> lis = new List <Lectura>();
            List <Lectura> las = new List <Lectura>();

            lis = let.lect();
            int ultima = lis.Count();

            if (ultima > 5)
            {
                int ultimamenos10 = ultima - 5;

                for (int i = ultimamenos10; i < ultima; i++)
                {
                    las.Add(lis.ElementAt(i));
                }
            }
            else
            {
                for (int i = 0; i < ultima; i++)
                {
                    las.Add(lis.ElementAt(i));
                }
            }
            ViewBag.Ultima = las;

            return(View());
        }
Ejemplo n.º 5
0
        public void SP_FrmRegistrarVinculo_GuardarPersona()
        {
            CLConexion    Obj = new CLConexion();
            SqlDataReader Lectura;
            SqlCommand    con = new SqlCommand("SP_FrmRegistrarVinculo_BuscarPersona", Obj.connection);

            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@Documento", Documento);
            Obj.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == false)
            {
                Obj.connection.Close();
                con             = new SqlCommand("SP_FrmRegistrarVinculo_GuardarPersona", Obj.connection);
                con.CommandType = CommandType.StoredProcedure;
                con.Parameters.AddWithValue("@Documento", Documento);
                con.Parameters.AddWithValue("@Nombre", Nombre);
                con.Parameters.AddWithValue("@Institucion", Institucion);
                con.Parameters.AddWithValue("@Correo", Correo);
                con.Connection.Open();
                con.ExecuteNonQuery();
                con.Connection.Close();
                msn = "";
                return;
            }
            if (Lectura.Read() == true)
            {
                Obj.connection.Close();
            }
        }
Ejemplo n.º 6
0
        public void SP_FrmRegistrarVinculo_BuscarPersona()
        {
            CLConexion objconect = new CLConexion();
            SqlCommand con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_FrmRegistrarVinculo_BuscarPersona", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@Documento", Documento);
            objconect.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                Nombre      = Convert.ToString(Lectura[0]);
                Institucion = Convert.ToString(Lectura[1]);
                RFID        = Convert.ToString(Lectura[2]);
                Saldo       = Convert.ToDouble(Lectura[3]);
                Correo      = Convert.ToString(Lectura[4]);
                Contraseña  = Convert.ToString(Lectura[5]);
                msn         = "";
                objconect.connection.Close();
                return;
            }
            if (Lectura.Read() == false)
            {
                msn = "No hay Registro";
                objconect.connection.Close();
                return;
            }
        }
Ejemplo n.º 7
0
        protected void Func_ConsultarUsuario()
        {
            ClsConexion objconect = new ClsConexion();
            SqlCommand  con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_BuscarCliente", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@id", id);
            objconect.connection.Open();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                nombre    = Convert.ToString(Lectura[0]);
                apellidos = Convert.ToString(Lectura[1]);
                sexo      = Convert.ToString(Lectura[5]);
                direccion = Convert.ToString(Lectura[3]);
                correo    = Convert.ToString(Lectura[2]);
                telefono  = Convert.ToString(Lectura[7]);
                movil     = Convert.ToString(Lectura[6]);
                estado    = Convert.ToString(Lectura[4]);
                foto      = Convert.ToString(Lectura[8]);
                usuario   = Convert.ToString(Lectura[9]);
                sw        = 1;
            }
            objconect.connection.Close();
        }
Ejemplo n.º 8
0
        public void Ejecutar()
        {
            string mensaje;

            mensaje = clienteCom.Leer();
            string[] textoArr     = mensaje.Trim().Split('|');
            int      idMedidor    = Convert.ToInt32(textoArr[0]);
            DateTime fecha        = DateTime.ParseExact(textoArr[1], "yyyy-MM-dd-HH-mm-ss", null);
            decimal  valorConsumo = Convert.ToDecimal(textoArr[2]);

            Lectura l = new Lectura()
            {
                IdMedidor    = idMedidor,
                Fecha        = fecha,
                ValorConsumo = valorConsumo
            };
            List <Medidor> medidores = medidoresDAL.ObtenerMedidor().FindAll(m => m.Id == idMedidor);

            if (medidores.Count > 0)
            {
                lock (lecturasDAL)
                {
                    lecturasDAL.IngresarLectura(l);
                }
                clienteCom.Escribir("OK");
            }
            else
            {
                clienteCom.Escribir("ERROR");
            }

            clienteCom.Desconectar();
        }
Ejemplo n.º 9
0
    private void SPO2_lectura()
    {
        Debug.Log("Empezando a leer bloque SPO2...");

        int command_opcode = Lectura.leer(puerto, "Command Opcode: ");

        if (command_opcode == Lectura.POX_MEASUREMENT_COMPLETE_OK)
        {
            int length = Lectura.leer(puerto, "LENGTH: ");

            // leer desde el dato 0 hasta el dato n
            int[] bloque = Lectura.leerBloque(puerto, length);

            Debug.Log("Datos: " + Lectura.ArrayToString(bloque));

            if (length == 2)
            {
                Debug.Log("SPO2: " + bloque[0]);
                Debug.Log("Heart Rate: " + bloque[1]);
                SPO2v          = bloque[0];
                RITMOCARDIACOv = bloque[1];

                estado_puerto = estado.CALCULADO;

                Lectura.cerrarPuerto(puerto);
//                StartCoroutine(SPO2_DB(10, 1, bloque[0]));
//                StartCoroutine(SPO2_DB(10, 2, bloque[1]));
            }
        }
    }
        public List <Lectura> GetAll()
        {
            List <Lectura> lecturas = new List <Lectura>();

            try
            {
                using (StreamReader reader = new StreamReader(registroLecturas))
                {
                    string texto = null;
                    do
                    {
                        texto = reader.ReadLine();
                        if (texto != null)
                        {
                            string[] textoArray = texto.Split('|');
                            Lectura  l          = new Lectura()
                            {
                                Fecha        = textoArray[0],
                                Valor        = textoArray[1],
                                Tipo         = textoArray[2],
                                UnidadMedida = textoArray[3]
                            };
                            lecturas.Add(l);
                        }
                    } while (texto != null);
                }
            }catch (IOException ex)
            {
            }

            return(lecturas);
        }
Ejemplo n.º 11
0
        private void btn_buscar_Click(object sender, EventArgs e)
        {
            string       BUSCAR    = "SELECT * FROM persona WHERE Id=@Id";
            OleDbCommand CmdBuscar = new OleDbCommand(BUSCAR, Cnx);

            CmdBuscar.CommandType = CommandType.Text;
            CmdBuscar.Parameters.AddWithValue("@Id", txt_id.Text);
            Cnx.Open();
            OleDbDataReader Lectura;

            Lectura = CmdBuscar.ExecuteReader();
            if (Lectura.Read() == true)
            {
                txt_nombre.Text            = Lectura[1].ToString();
                txt_apellido.Text          = Lectura[2].ToString();
                txt_domicilio.Text         = Lectura[3].ToString();
                txt_colonia.Text           = Lectura[4].ToString();
                txt_ciudad.Text            = Lectura[5].ToString();
                txt_telcasa.Text           = Lectura[6].ToString();
                txt_telmovil.Text          = Lectura[7].ToString();
                txt_email.Text             = Lectura[8].ToString();
                txt_email_empresarial.Text = Lectura[9].ToString();
                pic_foto.ImageLocation     = Lectura[10].ToString();
            }


            else
            {
                MessageBox.Show("Los Datos a Buscar No Estan Registrados");
                txt_id.Clear();
                txt_id.Focus();
            }
            Cnx.Close();
        }
Ejemplo n.º 12
0
 public LecturaForm(Lectura l)
 {
     InitializeComponent();
     if (l == null)
     {
         MessageBox.Show("Falta realizar una lectura", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
         LeerCodigo leerCodigo = new LeerCodigo();
         leerCodigo.Show();
         this.Close();
     }
     this.lec = l;
     //
     if (l.Status == 0)
     {
         mnuCancelar.Enabled = false;
     }
     //
     if (l.InAuto == "CORRECTO" || l.InAuto == "COMENTARIO")
     {
         lblInAuto.BackColor = System.Drawing.Color.Green;
         this.BackColor      = System.Drawing.Color.LightGreen;
     }
     else
     {
         lblInAuto.BackColor = System.Drawing.Color.Red;
         this.BackColor      = System.Drawing.Color.LightSalmon;
     }
     lblInAuto.Text  = l.InAuto;
     txtObsAuto.Text = l.ObsAuto;
     lblLeido.Text   = l.Leido;
     CargarIncidencias();
     txtObsAuto.Focus();
 }
Ejemplo n.º 13
0
        /// //////////////////////////////////////////// BUSCAR Persona /////////////////////////////////////////////////////////////
        protected void Func_BuscarPersona()
        {
            ClsConexion objconect = new ClsConexion();
            SqlCommand  con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_ConsultarPersona", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@id", Id);
            objconect.connection.Open();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                Primer_Nombre    = Convert.ToString(Lectura[0]);
                Segundo_nombre   = Convert.ToString(Lectura[1]);
                Primer_Apellido  = Convert.ToString(Lectura[2]);
                Segundo_Apellido = Convert.ToString(Lectura[3]);
                Telefono         = Convert.ToString(Lectura[4]);
                Correo           = Convert.ToString(Lectura[5]);
                direccion        = Convert.ToString(Lectura[6]);
                Rol     = Convert.ToString(Lectura[8]);
                Usuario = Convert.ToString(Lectura[7]);
                sw      = 1;
            }

            objconect.connection.Close();
        }
Ejemplo n.º 14
0
        protected void FuncBuscarInventario()
        {
            ClsConexion objconect = new ClsConexion();
            SqlCommand  con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_BuscarInventario", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@codigo", Codigo);
            objconect.connection.Open();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                // Codigo = Convert.ToString(Lectura[0]);
                Nombre          = Convert.ToString(Lectura[1]);
                Caracteristicas = Convert.ToString(Lectura[2]);
                Serie           = Convert.ToString(Lectura[3]);
                Tipo            = Convert.ToString(Lectura[4]);
                Nivel           = Convert.ToString(Lectura[5]);
                Dependencias    = Convert.ToString(Lectura[7]);
                Valor           = Convert.ToString(Lectura[8]);
                Modelo          = Convert.ToString(Lectura[9]);
                Ambientes       = Convert.ToString(Lectura[10]);
                sw = 1;
            }

            objconect.connection.Close();
        }
Ejemplo n.º 15
0
        public ActionResult Edit(Guid id, Lectura lectura)
        {
            if (id != lectura.Id_Lectura)
            {
                return(HttpNotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    db.Entry(lectura).State = EntityState.Modified;
                    db.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LecturaExists(lectura.Id_Lectura))
                    {
                        return(HttpNotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(lectura));
        }
Ejemplo n.º 16
0
    public static int insertarLectura(Lectura obj)
    {
        if (obj == null)
        {
            throw new ArgumentException("El objeto a insertar no puede tener un valor nulo");
        }

        if (obj.LecturaID < 0)
        {
            throw new ArgumentException("El codigo Descarga debe de ser Mayor a 0");
        }

        if (obj.usuarioId < 0)
        {
            throw new ArgumentException("El codigo Descarga debe de ser Mayor a 0");
        }

        if (obj.libroId < 0)
        {
            throw new ArgumentException("El codigo Descarga debe de ser Mayor a 0");
        }

        int?lecturaId = 0;

        LecturaDSTableAdapters.LecturasTableAdapter adapter = new LecturaDSTableAdapters.LecturasTableAdapter();
        adapter.Insert(obj.usuarioId, obj.libroId, obj.fecha, ref lecturaId);

        if (lecturaId == null || lecturaId.Value <= 0)
        {
            throw new Exception("La llave primaria no se genero correctamente");
        }

        return(lecturaId.Value);
    }
        public List <Lectura> VerLectura()
        {
            List <Lectura> lecturas = new List <Lectura>();

            using (StreamReader r = new StreamReader(url))
            {
                string texto;
                do
                {
                    texto = r.ReadLine();
                    if (texto != null)
                    {
                        string[] tArr    = texto.Trim().Split(';');
                        int      NroMed  = Convert.ToInt32(tArr[0]);
                        DateTime fecha   = Convert.ToDateTime(tArr[1]);
                        double   consumo = Convert.ToDouble(tArr[2]);

                        Lectura l = new Lectura()
                        {
                            NroMedidor = NroMed,
                            Fecha      = fecha,
                            Consumo    = consumo
                        };
                        lecturas.Add(l);
                    }
                } while (texto != null);
            }
            return(lecturas);
        }
Ejemplo n.º 18
0
        public void SP_FrmRegistrarVinculo_BuscarTarjeta()
        {
            CLConexion objconect = new CLConexion();
            SqlCommand con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_FrmRegistrarVinculo_BuscarTarjeta", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@RFDI", RFID);
            objconect.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                Contraseña = Convert.ToString(Lectura[0]);
                msn        = "";
                objconect.connection.Close();
                return;
            }
            if (Lectura.Read() == false)
            {
                msn = "No hay Registro";
                objconect.connection.Close();
                return;
            }
        }
Ejemplo n.º 19
0
        public static bool Eliminar(int id)
        {
            bool eliminado = false;

            Contexto contexto = new Contexto();

            try
            {
                Lectura lectura = contexto.lecturas.Find(id);
                contexto.lecturas.Remove(lectura);
                if (contexto.SaveChanges() > 0)
                {
                    eliminado = true;
                }

                contexto.Dispose();
            }

            catch (Exception)
            {
                throw;
            }

            return(eliminado);
        }
Ejemplo n.º 20
0
        public void SP_FrmRegistrarVinculo_RegistrarTarjeta()
        {
            CLConexion    Obj = new CLConexion();
            SqlDataReader Lectura;
            SqlCommand    con = new SqlCommand("SP_FrmRegistrarVinculo_BuscarTarjeta", Obj.connection);

            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@RFDI", RFID);
            Obj.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == false)
            {
                Obj.connection.Close();
                con             = new SqlCommand("SP_FrmRegistrarVinculo_RegistrarTarjeta", Obj.connection);
                con.CommandType = CommandType.StoredProcedure;
                con.Parameters.AddWithValue("@RFID", RFID);
                con.Parameters.AddWithValue("@Contraseña", Contraseña);
                con.Parameters.AddWithValue("@Saldo", Saldo);
                con.Connection.Open();
                con.ExecuteNonQuery();
                con.Connection.Close();
                msn = "";
                return;
            }
            if (Lectura.Read() == true)
            {
                Obj.connection.Close();
            }
        }
Ejemplo n.º 21
0
        private void btn_Buscar_Click(object sender, EventArgs e)
        {
            string       BUSCAR    = "SELECT * FROM DBP WHERE Id=@Id";
            OleDbCommand CmdBuscar = new OleDbCommand(BUSCAR, Cnx);

            CmdBuscar.CommandType = CommandType.Text;
            CmdBuscar.Parameters.AddWithValue("@Id", idTextBox.Text);
            Cnx.Open();
            OleDbDataReader Lectura;

            Lectura = CmdBuscar.ExecuteReader();
            if (Lectura.Read() == true)
            {
                nombreTextBox.Text         = Lectura[1].ToString();
                apellidoTextBox.Text       = Lectura[2].ToString();
                departamentoTextBox.Text   = Lectura[3].ToString();
                turnoTextBox.Text          = Lectura[4].ToString();
                contactoTextBox.Text       = Lectura[5].ToString();
                pic_Empleado.ImageLocation = Lectura[6].ToString();
            }
            else
            {
                MessageBox.Show("Los Datos a Buscar No Estan Registrados");
                idTextBox.Clear();
                idTextBox.Focus();
            }
            Cnx.Close();
        }
Ejemplo n.º 22
0
        public void SP_FrmProductos_Buscar()
        {
            CLConexion objconect = new CLConexion();
            SqlCommand con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_FrmProductos_Buscar", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@Codigo", Codigo);
            objconect.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                Nombre = Convert.ToString(Lectura[0]);
                Precio = Convert.ToDouble(Lectura[1]);
                Stock  = Convert.ToInt32(Lectura[2]);
                msn    = "";
                objconect.connection.Close();
                return;
            }
            if (Lectura.Read() == false)
            {
                msn = "No hay Registro";
                objconect.connection.Close();
                return;
            }
        }
Ejemplo n.º 23
0
        private void mnuAceptar_Click(object sender, EventArgs e)
        {
            if (!DatosOk())
            {
                return;
            }
            // comprobamos el login
            CntCN50.TOpen(this.conn);
            TVigilante v = CntCN50.GetVigilanteFromTag(txtLogin.Text, this.conn);

            CntCN50.TClose(this.conn);
            if (v == null)
            {
                MessageBox.Show("No se reconoce el vigilante asociado a la etiqueta", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                return;
            }
            // ponemos el vigilante logado
            Estado.Vigilante = v;
            Lectura l = CntLecturas.LeidoVigilante(v, txtLogin.Text);

            LecturaForm lfrm = new LecturaForm(l);

            lfrm.Show();
            //this.Close();

            //LeerCodigo leerCodigo = new LeerCodigo();
            //leerCodigo.Show();
        }
Ejemplo n.º 24
0
        public void SP_FrmEmpleados_BuscarEmpleado()
        {
            CLConexion objconect = new CLConexion();
            SqlCommand con; SqlDataReader Lectura;

            con             = new SqlCommand("SP_FrmEmpleados_BuscarEmpleados", objconect.connection);
            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@Documento", Documento);
            objconect.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                Nombre   = Convert.ToString(Lectura[0]);
                Telefono = Convert.ToString(Lectura[1]);
                Correo   = Convert.ToString(Lectura[2]);
                msn      = "";
                objconect.connection.Close();
                return;
            }
            if (Lectura.Read() == false)
            {
                msn = "No hay Registro";
                objconect.connection.Close();
                return;
            }
        }
Ejemplo n.º 25
0
        public void SP_FrmProductos_Guardar()
        {
            CLConexion    Obj = new CLConexion();
            SqlDataReader Lectura;
            SqlCommand    con = new SqlCommand("SP_FrmProductos_Buscar", Obj.connection);

            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@Codigo", Codigo);
            Obj.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == false)
            {
                Obj.connection.Close();
                con             = new SqlCommand("SP_FrmProductos_Guardar", Obj.connection);
                con.CommandType = CommandType.StoredProcedure;
                con.Parameters.AddWithValue("@Codigo", Codigo);
                con.Parameters.AddWithValue("@Nombre", Nombre);
                con.Parameters.AddWithValue("@Precio", Precio);
                con.Parameters.AddWithValue("@Stock", Stock);
                con.Connection.Open();
                con.ExecuteNonQuery();
                con.Connection.Close();
                msn = "";
                return;
            }
            if (Lectura.Read() == true)
            {
                Obj.connection.Close();
            }
        }
Ejemplo n.º 26
0
        public void SP_FrmEmpleado_GuardarEmpleado()
        {
            CLConexion    Obj = new CLConexion();
            SqlDataReader Lectura;
            SqlCommand    con = new SqlCommand("SP_FrmEmpleados_BuscarEmpleados", Obj.connection);

            con.CommandType = CommandType.StoredProcedure;
            con.Parameters.AddWithValue("@Documento", Documento);
            Obj.connection.Open();
            con.ExecuteNonQuery();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == false)
            {
                Obj.connection.Close();
                con             = new SqlCommand("SP_FrmEmpleado_GuardarEmpleado", Obj.connection);
                con.CommandType = CommandType.StoredProcedure;
                con.Parameters.AddWithValue("@Documento", Documento);
                con.Parameters.AddWithValue("@Nombre", Nombre);
                con.Parameters.AddWithValue("@Telefono", Telefono);
                con.Parameters.AddWithValue("@Correo", Correo);
                con.Connection.Open();
                con.ExecuteNonQuery();
                con.Connection.Close();
                msn = "";
                return;
            }
            if (Lectura.Read() == true)
            {
                Obj.connection.Close();
            }
        }
Ejemplo n.º 27
0
    private void GLU_lectura()
    {
        Debug.Log("Empezando a leer bloque GLU...");

        int ind     = Lectura.leer(puerto, "IND: ");
        int m_ready = Lectura.leer(puerto, "M READY: ");

        if (ind == Lectura.IND && m_ready == Lectura.GLU_BLOOD_DETECTED)
        {
            int length = Lectura.leer(puerto, "LENGTH: ");

            ind     = Lectura.leer(puerto, "IND: ");
            m_ready = Lectura.leer(puerto, "M READY: ");
            length  = Lectura.leer(puerto, "LENGTH: ");

            // leer desde el dato 0 hasta el dato n
            int[] bloque = Lectura.leerBloque(puerto, length);

            Debug.Log("Datos: " + Lectura.ArrayToString(bloque));

            if (length == 2)
            {
                Debug.Log("GLU: " + bloque[1]);
                GLUv = bloque[1];

                estado_puerto = estado.CALCULADO;

                Lectura.cerrarPuerto(puerto);
            }
        }
    }
Ejemplo n.º 28
0
        protected void Func_Imprimir1()
        {
            ClsConexion objconnet = new ClsConexion();
            SqlCommand  con; SqlDataReader Lectura;

            con = new SqlCommand("SP_ImprimirOrdenTrabajo", objconnet.connection);
            con.Parameters.AddWithValue("@Codigo_Maquina", NumeroOr);
            con.CommandType = CommandType.StoredProcedure;
            objconnet.connection.Open();
            Lectura = con.ExecuteReader();
            if (Lectura.Read() == true)
            {
                regional           = Convert.ToString(Lectura[0]);
                dependencia        = Convert.ToString(Lectura[1]);
                ambiente           = Convert.ToString(Lectura[2]);
                solicitud          = Convert.ToString(Lectura[3]);
                Codigo_Maquina     = Convert.ToString(Lectura[4]);
                tipo_equipo        = Convert.ToString(Lectura[5]);
                tipo_actividad     = Convert.ToString(Lectura[6]);
                prioridad          = Convert.ToString(Lectura[7]);
                actividad_ejecutar = Convert.ToString(Lectura[8]);
                nombre_tecnico     = Convert.ToString(Lectura[9]);
                sw = 1;
            }
            objconnet.connection.Close();
        }
Ejemplo n.º 29
0
        public ActionResult DeleteConfirmed(int id)
        {
            Lectura lectura = db.Lecturas.Find(id);

            db.Lecturas.Remove(lectura);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Importar(HttpPostedFileBase file, int idlocal)
        {
            DateTime _fecha_actual = DateTime.Now;

            try
            {
                string extension    = System.IO.Path.GetExtension(file.FileName);
                string nomExcel     = ((Sesion)Session["Session_Usuario_Acceso"]).usuario.usu_id + extension;
                string fileLocation = Server.MapPath("~/Upload") + "\\" + nomExcel;

                file.SaveAs(fileLocation);



                DataTable      dt            = new DataTable();
                List <Lectura> listaLecturas = new List <Lectura>();
                Lectura        objLectura;

                dt = new NLectura().ListaExcel(fileLocation);

                foreach (DataRow row in dt.Rows)
                {
                    objLectura = new Lectura();
                    objLectura.lec_importacion_archivo = nomExcel;
                    objLectura.lec_suministro          = row["CLIENTE"].ToString();
                    objLectura.lec_direccion           = row["DIRECCION"].ToString();
                    objLectura.lec_seccion             = Convert.ToInt32(row["Sc"].ToString());
                    objLectura.lec_zona          = row["Zn"].ToString();
                    objLectura.lec_correlativo   = Convert.ToInt32(row["CRR"].ToString());
                    objLectura.lec_medidor       = row["MEDIDOR"].ToString();
                    objLectura.lec_medidor_marca = row["MARCA"].ToString();
                    objLectura.MesUno            = row["Mes Uno"].ToString();
                    objLectura.MesDos            = row["Mes Dos"].ToString();
                    objLectura.MesTres           = row["Mes Tres"].ToString();
                    objLectura.MesCuatro         = row["Mes Cuatro"].ToString();
                    objLectura.MesCinco          = row["Mes Cinco"].ToString();
                    objLectura.dniOpe            = row["DNI"].ToString();
                    objLectura.bloque            = row["Bloque"].ToString();
                    objLectura.lec_orden         = Convert.ToInt32(row["Orden"].ToString());
                    objLectura.loc_id            = idlocal;
                    objLectura.id_UsuarioExpor   = ((Sesion)Session["Session_Usuario_Acceso"]).usuario.usu_id;
                    listaLecturas.Add(objLectura);
                }
                return(new ContentResult
                {
                    Content = MvcApplication._Serialize(new NLectura().NImportarArchivoExcel(listaLecturas)),
                    ContentType = "application/json"
                });
            }
            catch (Exception e)
            {
                return(new ContentResult
                {
                    Content = MvcApplication._Serialize(e.Message),
                    ContentType = "application/json"
                });
            }
        }