コード例 #1
0
 private void creaNuevoId()
 {
     string sCad = "SELECT MAX(idtipocomponente) AS id FROM imagenes.cattipocomponentes ";
     Clases.cDatos oDat = new Clases.cDatos();
     oComp.idtipocomponente = oDat.nuevoId(sCad) + 1;
     oDat = null;
 }
コード例 #2
0
ファイル: fCreaItem.cs プロジェクト: mchevez/pruebagithub
        private void cmdAceptar_Click(object sender, EventArgs e)
        {
            if (txtItem.Text == "")
            {
                MessageBox.Show("FALTA el nombre del Item", "Inconsistencia en los Datos a Grabar  ");
                this.txtItem.Focus();
                return;
            }

            if (modo == "A")
            {
                //  determina el nuevo id
                string sCad = " SELECT MAX( " + oCat.lista[2] + ") AS id FROM " + oCat.lista[0] + " ";
                Clases.cDatos oDat = new Clases.cDatos();
                idItem = oDat.nuevoId(sCad) + 1;
                oDat = null;
                this.label2.Text = oCat.lista[2] ;

                Item = txtItem.Text.ToUpper();
                oCat.id = idItem;
                oCat.nombreItem = Item;
                oCat.bcampo = chk1.Checked ? true : false;
                //  Crea el nuevo Item en el Catalogo respectivo
                creaNuevoItem(  );

            }
            else if (modo == "M")
            {
                Item = txtItem.Text.ToUpper();
                if (ItemAnterior != Item)
                    modificaItem();
            }
        }
コード例 #3
0
ファイル: fSolicitudes.cs プロジェクト: mchevez/pruebagithub
        private void CargaTablas()
        {
            string sCad;
            int[] aCols = {30,30,150,150,200,150,75, 150, 150 };
            Clases.cDatos oDat = new Clases.cDatos();

            //  Tabla de Solicitudes
            sCad = "SELECT solicitudnum AS solicitud, fecha, categoria as equipo, tipoequipo,  ubica,  tecnico, telefono, " +
                "  nombres || '  ' || apellidos AS entrega,   nombresrecibe || '  ' ||  apellidosrecibe AS recibe, " +
                "  fechaprobable, cedulaentrega, cedularecibe, fechaprobable, " +
                " serie, seriecse, idtipoequipo, idubica, telefono, motivo, idsolicitud, cargo,  cargorecibe, referencia " +
                " FROM imagenes.Solicitud3vw ORDER BY solicitudnum";

               dtSol = oDat.LlenaTabla(sCad);
               grSolicitudes.DataSource = dtSol;
               oDat = null;

            //Configura el Grid
               for (int i = 0; i < dtSol.Rows.Count; i++)
               {
               if (i < aCols.Length)
                    gridView1.Columns[i].Width = aCols[i];
               else
                    gridView1.Columns[i].Visible = false;
               }
        }
コード例 #4
0
        private void fTipoComponente_Load(object sender, EventArgs e)
        {
            String sCad = "SELECT * FROM imagenes.catcomponentes ORDER BY componente ";
            // Llena el dtatable
            Clases.cDatos oDat = new Clases.cDatos();
            dtComponentes = oDat.LlenaTabla(sCad);

            oDat = null;
        }
コード例 #5
0
ファイル: cPersona.cs プロジェクト: mchevez/pruebagithub
        public int creaItem()
        {
            int x;
            string scad = "INSERT INTO imagenes.personas ( nombres, apellidos, cedula, cargo, ubica, idubica ) " +
                " VALUES ( '" + nombres + "', '" + apellidos + "', '" + cedula + "', '" + cargo + "', '" + ubica + "', '" + idubica + "' )";

            Clases.cDatos oDat = new Clases.cDatos();

            x = oDat.ejecutarComando(scad);
            return x;
        }
コード例 #6
0
ファイル: fEqPartes.cs プロジェクト: mchevez/pruebagithub
        //   Falta refrescar el ListView con los cambios en los datos, para tipocomponente
        private void cmdAceptar_Click(object sender, EventArgs e)
        {
            int retorno;
            string scad = "" ;
            Clases.cDatos oDat = new Clases.cDatos();

            // valida datos

                if (oComp.componente == "")
                {
                    MessageBox.Show("FALTA ESPECIFICAR COMPONENTE ..");
                    txtComponente.Focus();
                    return;
                }
                if (oComp.tipocomponente == "")
                {
                    MessageBox.Show("FALTA ESPECIFICAR  EL TIPO DEL COMPONENTE ..");
                    txtTipoComponente.Focus();
                    return;
                }

                if (oComp.marca == "")
                {
                    MessageBox.Show("FALTA ESPECIFICAR MARCA DEL COMPONENTE ..");
                    txtMarca.Focus();
                    return;
                }

                 if (txtSerie.Text != "")
                    oComp.serie = txtSerie.Text.ToUpper();
                else
                    oComp.serie = "";

               oComp.seriecse = txtSerieCSE.Text.ToUpper();

               oComp.valormedida = int.Parse(txtValor.Text);

            if (modo == "A")
               {
                //  crea el idparte secuencial consecutivo
                scad = "SELECT MAX(idparte) AS id FROM imagenes.componentes  ";

                oComp.idparte = oDat.nuevoId(scad) + 1;

                // Llena el listView
                lvItem = new ListViewItem(oComp.componente);  //   ToString().TrimEnd());
                lvItem.SubItems.Add(oComp.tipocomponente);
                lvItem.SubItems.Add(oComp.marca);
                lvItem.SubItems.Add(oComp.serie);
                lvItem.SubItems.Add(oComp.seriecse);
                lvItem.SubItems.Add(oComp.magnitud  );
                lvItem.SubItems.Add(oComp.valormedida.ToString()  );
                lvItem.SubItems.Add(oComp.medida);
                lvItem.Tag = oComp.idparte.ToString();
                //            lvItem.ImageKey = "si";
                lsComponentes.Items.Add(lvItem);

                //  Graba el componente
                scad = "INSERT INTO imagenes.componentes ( idcomponente, componente, marca, serie, idequipo, idparte,  " +
                        "  tipocomponente, idmarca, seriecse, idtipocomponente,  magnitud,valormedida, medida, idmagnitud, idmedida  ) " +
                    " VALUES (  '" + oComp.idcomponente + "', '" + oComp.componente + "', '" + oComp.marca + "', '" + oComp.serie + "', '" +
                        oComp.idequipo + "', '" + oComp.idparte + "', '" + oComp.tipocomponente + "', '" + oComp.idmarca +
                        "', '" + oComp.seriecse + "', '" + oComp.idtipocomponente +
                        "', '" + oComp.magnitud +  "', '" + oComp.valormedida + "', '" + oComp.medida + "', '" + oComp.idmagnitud +
                        "', '" + oComp.idmedida + "' );";

                retorno = oDat.ejecutarComando(scad);

                oDat = null;
                actualizadtComponentes();

            //                if (MessageBox.Show("Desea Grabar otro Componente del equipo ? ", "COMPONENTES DEL EQUIPO ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) ;
                initComponente();
            }

            else if (modo == "M")           //  Modificar
            {
                //oComp.serie = txtSerie.Text;
                //oComp.seriecse = txtSerieCSE.Text;

                int valor = int.Parse(  txtValor.Text );

                scad = "UPDATE imagenes.componentes SET marca = '" + oComp.marca + "', idmarca = '" + oComp.idmarca + "',  serie = '" +
                           oComp.serie + "',  seriecse =  '" + oComp.seriecse +
                           "',  tipocomponente = '" + oComp.tipocomponente + "',  idtipocomponente = '" +
                           oComp.idtipocomponente + "', magnitud = '" + oComp.magnitud + "', valormedida = '" + oComp.valormedida  + "', " +
                           " medida = '" +   oComp.medida + "', idmagnitud = '" + oComp.idmagnitud + "', idmedida = '" + oComp.idmedida + "' "+
                           " WHERE idparte = '" + nTag + "' ;";

                int x = oDat.ejecutarComando(scad);

                if (x == 1)  // grabar componente ok
                {
                    //  Actualiza el ListView
                    for (int i = 0; i < lsComponentes.Items.Count; i++)
                    {
                        lvItem = lsComponentes.Items[i];
                        if (int.Parse(lvItem.Tag.ToString()) == nTag)
                        {
                            //  Sustituir los items
                            lvItem.SubItems[0].Text = oComp.componente;
                            lvItem.SubItems[1].Text = oComp.tipocomponente;
                            lvItem.SubItems[2].Text = oComp.marca;
                            lvItem.SubItems[3].Text = oComp.serie;
                            lvItem.SubItems[4].Text = oComp.seriecse;
                            lvItem.SubItems[5].Text = oComp.magnitud;
                            lvItem.SubItems[6].Text = oComp.valormedida.ToString();
                            lvItem.SubItems[7].Text = oComp.medida;

                        }
                    }

                    actualizadtComponentes();
                }
                initComponente();
            }
            oDat = null;
        }
コード例 #7
0
ファイル: fEqPartes.cs プロジェクト: mchevez/pruebagithub
        private void llenaDataTables()
        {
            Clases.cDatos oDat = new Clases.cDatos();
            //  tabla equipos
            string sCad = "SELECT categoria, tipoequipo, serie, seriecse, ubica, marca, modelo, color, idequipo, idtipoequipo, idubica, " +
                    " idmarca, idmodelo, idcategoria, bpartes "  +
                    " FROM imagenes.equiposvw WHERE bpartes = true;  ";

            dtEquipos = oDat.LlenaTabla(sCad);

            //  tabla Componentes
            sCad = "SELECT * FROM imagenes.componentes ORDER BY idequipo ";
            dtComponentes = oDat.LlenaTabla(sCad);

            //  tabla Catalogo de Componentes:
            sCad = "SELECT componente, magnitud,  idcomponente, brepite, idmagnitud FROM  imagenes.catcomponentes ORDER BY componente ";
            dtCatComponentes = oDat.LlenaTabla(sCad);

            //  Tabla catalogo tipo de componnetes
            sCad = "SELECT * FROM  imagenes.cattipocomponentes ORDER BY idcomponente  ";
            dtTipoComponentes = oDat.LlenaTabla(sCad);

            //  Tabla de Marcas
            sCad = "SELECT * FROM imagenes.catmarcas ORDER BY marca";
            dtMarcas = oDat.LlenaTabla(sCad);

            //  Tabla de Magnitudes
            sCad = "SELECT * FROM imagenes.catmagnitudes ORDER BY magnitud";
            dtMagnitudes = oDat.LlenaTabla(sCad);

            //  Tabla de Medidas
            sCad = "SELECT * FROM imagenes.catmedidas ORDER BY medida";
            dtMedidas = oDat.LlenaTabla(sCad);

            oDat = null;
        }
コード例 #8
0
ファイル: fEqPartes.cs プロジェクト: mchevez/pruebagithub
        private void cmdEliminar_Click(object sender, EventArgs e)
        {
            int x;
            if (indice > -1)
            {
                //   Borra el componente registrado en la BD y lo quita del listview
                String scad = "DELETE FROM imagenes.componentes WHERE idparte = '" + nTag + "' ";
                Clases.cDatos oDat = new Clases.cDatos();
                x = oDat.ejecutarComando(scad);
                lsComponentes.Items.RemoveAt(indice);

                //  Eliminar del dtComponentes
                for (int i = 0; i < dtComponentes.Rows.Count; i++)
                {
                    if (int.Parse(dtComponentes.Rows[i]["idparte"].ToString()) == nTag)
                    {
                        dtComponentes.Rows.RemoveAt(i);
                        break;
                    }

                }
                dtComponentes.AcceptChanges();
            }
        }
コード例 #9
0
ファイル: cSolicitud.cs プロジェクト: mchevez/pruebagithub
        //   Selecciona e imprime una solicitud permitirendo modificar, imprimir una solicitud previamente grabada.
        public void selImprimirSolicitud()
        {
            DataTable dtSol = new DataTable();
            DataRow fila;
            int[] aColumns = { 100, 100, 150, 150, 150, 100, 100, 150 };
            string titulo = "Seleccion de Solicitudes de ST";

            String sCad = "SELECT solicitudnum , fecha, categoria, marca, modelo, tipoequipo,  ubica,  serie, seriecse, tecnico, " +
                " cedulaentrega, cedularecibe, telefono, idequipo, idtipoequipo, idubica,  motivo, idsolicitud,  " +
                " nombres, apellidos, cargo,  nombresrecibe, apellidosrecibe, cargorecibe,  referencia, color " +
                " FROM imagenes.Solicitud3vw ORDER BY solicitudnum";

            Clases.cDatos oDat = new Clases.cDatos();
            dtSol = oDat.LlenaTabla(sCad);
            DataTable dt = dtSol.Clone();

            Clases.cCatalogo oCat = new SOPORTEC.Clases.cCatalogo(dtSol, titulo, "solicitudesST", aColumns, false);
            fila = oCat.retornaFila();

            if (fila == null)
            {
                MessageBox.Show("SELECCIONE UNA SOLICITUD DE ST CON UN DOBLE CLICK DEL MOUSE ");
                return;
            }
            else
            {
              //  fila["nombres"] = fila["nombres"].ToString() + "  " + fila["apellidos"].ToString();
              //  fila["nombresrecibe"] = fila["nombresrecibe"].ToString() + "  " + fila["apellidosrecibe"].ToString();
                fila["tipoequipo"] = fila["categoria"].ToString()  + "  " + fila["tipoequipo"].ToString() ;
                fila["nombres"] = fila["nombres"].ToString() + "  " + fila["apellidos"].ToString();
                fila["nombresrecibe"] = fila["nombresrecibe"].ToString() + "  " + fila["apellidosrecibe"].ToString();
                dt.ImportRow(fila);
                dtSol = null;

                cReportes oRep = new cReportes();
                oRep.CreafReportes("Solicitud", "", "Titulo 1", dt);

                oRep = null;
                dt = null;
            }
        }
コード例 #10
0
ファイル: fCatalogo.cs プロジェクト: mchevez/pruebagithub
        private void elimina(String campo)
        {
            //  elimina elementos de catalogos simples
            string scad = "";
            string sCampo;
            int i;
            int resultado;

            if (MessageBox.Show("SEGURO DE ELIMINAR ESTE ITEM ? ", "ELIMINAR ITEM DE CATALOGO", MessageBoxButtons.YesNo, MessageBoxIcon.Question ) == DialogResult.No)
                return;

            if (dtCatalogo.Rows.Count > 0)
            {
                i = gridView1.FocusedRowHandle;
                fila = gridView1.GetDataRow(i);
                if (campo == "cedula")
                {
                    sCampo = fila[campo].ToString();
                    scad = "DELETE FROM " + catal + " WHERE " + campo + " = '" + sCampo + "' ";

                }
                else
                {
                    idItem = int.Parse(fila[campo].ToString());
                    scad = "DELETE FROM " + catal + " WHERE " + campo + " = '" + idItem + "' ";
                }

                Clases.cDatos oDat = new Clases.cDatos();
                resultado = oDat.ejecutarComando(scad);
                if (resultado == 1)   //  ok
                {
                    dtCatalogo.Rows.RemoveAt(i);
                    dtCatalogo.AcceptChanges();
                    gridView1.RefreshData();
                }
                oDat = null;
            }
        }
コード例 #11
0
ファイル: fPersona.cs プロジェクト: mchevez/pruebagithub
 private void fPersona_Load(object sender, EventArgs e)
 {
     String sCad = "SELECT * FROM imagenes.catubica ORDER BY ubica";
     Clases.cDatos oDat = new Clases.cDatos();
     dtUbica = oDat.LlenaTabla(sCad);
     oDat = null;
 }
コード例 #12
0
ファイル: fInventarios.cs プロジェクト: mchevez/pruebagithub
        private void llenaDataTables()
        {
            int idEstado = 0;
            String scad = "";
            Clases.cDatos oDat = new Clases.cDatos();

            if (sfiltro == "I")
            {
                scad = "SELECT categoria, tipoequipo, serie, seriecse, ubica, marca, modelo, color, bpartes, idequipo, idtipoequipo, " +
                " idubica, idmarca, idmodelo, idcategoria " +
                    " FROM imagenes.equiposvw ;  ";

            }
            else if (sfiltro == "M")
            {
                scad = "SELECT categoria, tipoequipo, serie, seriecse, ubica, marca, modelo, color, bpartes, estado, idequipo, idtipoequipo, " +
                " idubica, idmarca, idmodelo, idcategoria, idestado " +
                    " FROM imagenes.eqMntto1vw ;  ";

                lblFiltro.Text = "EQUIPOS EN MANTENIMIENTO TECNICO";

            }

            dtInventarios = oDat.LlenaTabla(scad);
            oDat = null;

            if (sfiltro == "M")
            {
                idEstado = int.Parse(dtInventarios.Rows[0]["idestado"].ToString());
                if (idEstado < 3)
                {
                    cmdEstado.Text = "Asignar Tecnico";
                }
                else if (idEstado >= 3 && idEstado < 6  )
                {
                    cmdEstado.Text = "Registrar Diagnostico";
                }
                else if (idEstado >= 6 && idEstado < 8)
                {
                    cmdEstado.Text = "Acta de Entrega";
                }
                else if (idEstado == 9)
                {
                    cmdEstado.Text = "Soporte de Baja";
                }

            }
        }
コード例 #13
0
ファイル: fCreaItem.cs プロジェクト: mchevez/pruebagithub
        private void creaNuevoItem()
        {
            Clases.cDatos oDat = new Clases.cDatos();
            int x;
            string sCad= "";
            // Graba id y descripcion en el parametro con el nombre de la tabla.
            if(numCat == 1)
                sCad = "INSERT INTO " + oCat.lista[0] + " ( " + oCat.lista[2] + ", " + oCat.lista[3] +  ") " +
                    " values( '" + idItem + "', '" + Item +  "' )";

            else if(numCat == 2)  // graba id, item e idforaneo
                sCad = "INSERT INTO " + oCat.lista[0] + " ( " + oCat.lista[2] + ", " + oCat.lista[3] + ", " + oCat.lista[4]   + ") " +
                    " values( '" + idItem + "', '" + Item +  "', '" + oCat.idForaneo +  "' )";

            else if (numCat == 3)  //  graba id, item y campo Boolean (bpartes/brepite)
                sCad = "INSERT INTO " + oCat.lista[0] + " ( " + oCat.lista[2] + ", " + oCat.lista[3] + ", " + oCat.lista[4] + ") " +
                    " values( '" + idItem + "', '" + Item + "', '" + oCat.bcampo  + "' )";

            x = oDat.ejecutarComando(sCad);
            if(x != 0)
                this.DialogResult = DialogResult.Yes;
            else
                this.DialogResult = DialogResult.No;
        }