Exemplo n.º 1
0
        private void guardar()
        {
            //Update Inventario
            try
            {
                if (this.mouseTableAdapter.ObtenerIdMouse(txtMouse.Text.Trim()).ToString().Length != 0 && this.InventarioAnterior != txtMouse.Text.Trim())
                {
                    if (txtMouse.Enabled)
                    {
                        MessageBox.Show("Inventario Repetido ");
                    }
                }
            }
            catch (NullReferenceException)
            {
                this.mouseTableAdapter.UpdateInventario(txtMouse.Text.Trim(), this.InventarioAnterior);
            }
            //Update Serie
            try
            {
                if (txtSerie.Text.Trim() != "N/A")
                {
                    if (this.mouseTableAdapter.ObtenerSerie(txtSerie.Text.Trim()).ToString().Length != 0 && this.SerieAnterior != "N/A")
                    {
                        this.mouseTableAdapter.UpdateSerie(txtSerie.Text.Trim(), txtMouse.Text.Trim());
                    }
                    else
                    {
                        try
                        {
                            this.mouseTableAdapter.UpdateTablaMouseSerie((int)this.mouseTableAdapter.ObtenerSerie(txtSerie.Text), txtMouse.Text.Trim());
                        }
                        catch (InvalidOperationException)
                        {
                            this.mouseTableAdapter.InsertSerie(txtSerie.Text.Trim());
                            this.mouseTableAdapter.UpdateTablaMouseSerie((int)this.mouseTableAdapter.ObtenerSerie(txtSerie.Text), txtMouse.Text.Trim());
                        }
                    }
                }
                else
                {
                    this.mouseTableAdapter.UpdateTablaMouseSerie((int)this.mouseTableAdapter.ObtenerSerie(txtSerie.Text), txtMouse.Text.Trim());
                }
            }
            catch (NullReferenceException)
            {
                this.mouseTableAdapter.InsertSerie(txtSerie.Text.Trim());
                this.mouseTableAdapter.UpdateTablaMouseSerie((int)this.mouseTableAdapter.ObtenerSerie(txtSerie.Text), txtMouse.Text.Trim());
            }

            //Update Combos
            try
            {
                this.mouseTableAdapter.UpdateTablaMouse(this.mouseTableAdapter.ObtenerMarca(comboMarca.SelectedItem.ToString()),
                                                        this.mouseTableAdapter.ObtenerModelo(comboModelo.SelectedItem.ToString()),
                                                        this.mouseTableAdapter.ObtenerEstado(comboEstado.SelectedItem.ToString()), txtMouse.Text.Trim());
            }
            catch (NullReferenceException)
            {
                this.mouseTableAdapter.UpdateTablaMouse(this.mouseTableAdapter.ObtenerMarca(comboMarca.Text),
                                                        this.mouseTableAdapter.ObtenerModelo(comboModelo.Text),
                                                        this.mouseTableAdapter.ObtenerEstado(comboEstado.Text), txtSerie.Text.Trim());
            }
            if (FuncionesUtiles.INVENTARIO_EQUIPO == "" || FuncionesUtiles.INVENTARIO_EQUIPO == null)
            {
                return;
            }
            FuncionesUtiles.OBSERVACION += "Mouse: " + Microsoft.VisualBasic.Interaction.InputBox("OBSERVACION", "Ingrese Su Observacion", "", 600) + " ; ";
            FuncionesEquipo.ActualizarInventario(FuncionesUtiles.OBSERVACION);
        }
Exemplo n.º 2
0
        private void guardar()
        {
            //Update Inventario
            try
            {
                if (this.cpuTableAdapter.ObtenerIDCPU(txtCpu.Text.Trim()).ToString().Length != 0 && this.InventarioAnterior != txtCpu.Text.Trim())
                {
                    if (txtCpu.Enabled)
                    {
                        MessageBox.Show("Inventario Repetido ");
                    }
                }
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.UpdateInventario(txtCpu.Text.Trim(), this.InventarioAnterior);
            }
            //Update Adicional Lote
            try
            {
                if (txtLote.Text.Trim() != "N/A")
                {
                    if (this.cpuTableAdapter.ObtenerAdicionalLote(txtLote.Text.Trim()).ToString().Length != 0 && this.LoteAnterior != "N/A")
                    {
                        this.cpuTableAdapter.UpdateAdicionalLote(txtLote.Text.Trim(), txtCpu.Text.Trim());
                    }
                    else
                    {
                        this.cpuTableAdapter.UpdateTablaCpuLote((int)this.cpuTableAdapter.ObtenerAdicionalLote(txtLote.Text.Trim()), txtCpu.Text.Trim());
                    }
                }
                else
                {
                    this.cpuTableAdapter.UpdateTablaCpuLote((int)this.cpuTableAdapter.ObtenerAdicionalLote(txtLote.Text.Trim()), txtCpu.Text.Trim());
                }
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.InsertAdicionalote(txtLote.Text.Trim());
                this.cpuTableAdapter.UpdateTablaCpuLote((int)this.cpuTableAdapter.ObtenerAdicionalLote(txtLote.Text.Trim()), txtCpu.Text.Trim());
            }
            //Update CODE
            try
            {
                if (txtCode.Text.Trim() != "N/A")
                {
                    if (this.cpuTableAdapter.ObtenerCode(txtCode.Text.Trim()).ToString().Length != 0 && this.CodeAnterior != "N/A")
                    {
                        this.cpuTableAdapter.UpdateCode(txtCode.Text.Trim(), txtCpu.Text.Trim());
                    }
                    else
                    {
                        this.cpuTableAdapter.UpdateTablaCpuCode((int)this.cpuTableAdapter.ObtenerCode(txtCode.Text.Trim()), txtCpu.Text.Trim());
                    }
                }
                else
                {
                    this.cpuTableAdapter.UpdateTablaCpuCode((int)this.cpuTableAdapter.ObtenerCode(txtCode.Text.Trim()), txtCpu.Text.Trim());
                }
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.InsertCode(txtCode.Text.Trim());
                this.cpuTableAdapter.UpdateTablaCpuCode((int)this.cpuTableAdapter.ObtenerCode(txtCode.Text.Trim()), txtCpu.Text.Trim());
            }
            //Update Nombre
            try
            {
                if (txtNombre.Text.Trim() != "N/A")
                {
                    if (this.cpuTableAdapter.ObtenerNombrePc(txtNombre.Text.Trim()).ToString().Length != 0 && this.NombreAnterior != "N/A")
                    {
                        this.cpuTableAdapter.UpdateNombrePc(txtNombre.Text.Trim(), txtCpu.Text.Trim());
                    }
                    else
                    {
                        this.cpuTableAdapter.UpdateTablaCpuNombre((int)this.cpuTableAdapter.ObtenerNombrePc(txtNombre.Text.Trim()), txtCpu.Text.Trim());
                    }
                }
                else
                {
                    this.cpuTableAdapter.UpdateTablaCpuNombre((int)this.cpuTableAdapter.ObtenerNombrePc(txtNombre.Text.Trim()), txtCpu.Text.Trim());
                }
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.InsertNombre(txtNombre.Text.Trim());
                this.cpuTableAdapter.UpdateTablaCpuNombre((int)this.cpuTableAdapter.ObtenerNombrePc(txtNombre.Text.Trim()), txtCpu.Text.Trim());
            }

            //Update Serie
            try
            {
                if (txtSerie.Text.Trim() != "N/A")
                {
                    if (this.cpuTableAdapter.ObtenerSerie(txtSerie.Text.Trim()).ToString().Length != 0 && this.SerieAnterior != "N/A")
                    {
                        this.cpuTableAdapter.UpdateSerie(txtSerie.Text.Trim(), txtCpu.Text.Trim());
                    }
                    else
                    {
                        this.cpuTableAdapter.UpdateTablaCpuSerie((int)this.cpuTableAdapter.ObtenerSerie(txtSerie.Text.Trim()), txtCpu.Text.Trim());
                    }
                }
                else
                {
                    this.cpuTableAdapter.UpdateTablaCpuSerie((int)this.cpuTableAdapter.ObtenerSerie(txtSerie.Text.Trim()), txtCpu.Text.Trim());
                }
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.InsertSerie(txtSerie.Text.Trim());
                this.cpuTableAdapter.UpdateTablaCpuSerie((int)this.cpuTableAdapter.ObtenerSerie(txtSerie.Text.Trim()), txtCpu.Text.Trim());
            }

            //Update Tag
            try
            {
                if (txtTag.Text.Trim() != "N/A")
                {
                    if (this.cpuTableAdapter.ObtenerTag(txtTag.Text.Trim()).ToString().Length != 0 && this.TagAnterior != "N/A")
                    {
                        this.cpuTableAdapter.UpdateTag(txtTag.Text.Trim(), txtCpu.Text.Trim());
                    }
                    else
                    {
                        this.cpuTableAdapter.UpdateTablaCpuTag((int)this.cpuTableAdapter.ObtenerTag(txtTag.Text.Trim()), txtCpu.Text.Trim());
                    }
                }
                else
                {
                    this.cpuTableAdapter.UpdateTablaCpuTag((int)this.cpuTableAdapter.ObtenerTag(txtTag.Text.Trim()), txtCpu.Text.Trim());
                }
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.InsertTag(txtTag.Text.Trim());
                this.cpuTableAdapter.UpdateTablaCpuTag((int)this.cpuTableAdapter.ObtenerTag(txtTag.Text.Trim()), txtCpu.Text.Trim());
            }
            //Guardado TipoPC
            try
            {
                this.cpuTableAdapter.UpdateTablaCpuTipo(this.cpuTableAdapter.ObtenerTipo(comboTipo.SelectedItem.ToString()), txtCpu.Text.Trim());
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.UpdateTablaCpuTipo(this.cpuTableAdapter.ObtenerTipo(comboTipo.Text), txtCpu.Text.Trim());
            }

            //Guardado Perfil
            try
            {
                this.cpuTableAdapter.UpdateTablaCpuPerfil(this.cpuTableAdapter.ObtenerPerfil(comboPerfil.SelectedItem.ToString()), txtCpu.Text.Trim());
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.UpdateTablaCpuPerfil(this.cpuTableAdapter.ObtenerPerfil(comboPerfil.Text), txtCpu.Text.Trim());
            }
            //Guardado Estado
            try
            {
                this.cpuTableAdapter.UpdateTablaCpuEstado(FuncionesEquipo.estado.ObtenerEstado(comboEstado.SelectedItem.ToString()), txtCpu.Text.Trim());
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.UpdateTablaCpuEstado(FuncionesEquipo.estado.ObtenerEstado(comboEstado.Text), txtCpu.Text.Trim());
            }
            //Guardado Procesador
            try
            {
                this.cpuTableAdapter.UpdateTablaCpuProcesador(this.cpuTableAdapter.ObtenerProcesador(comboProcesador.SelectedItem.ToString()), txtCpu.Text.Trim());
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.UpdateTablaCpuProcesador(this.cpuTableAdapter.ObtenerProcesador(comboProcesador.Text), txtCpu.Text.Trim());
            }
            //Guardado Memoria
            try
            {
                this.cpuTableAdapter.UpdateTablaCpuMemoria(this.cpuTableAdapter.ObtenerMemoria(comboMemoria.SelectedItem.ToString()), txtCpu.Text.Trim());
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.UpdateTablaCpuMemoria(this.cpuTableAdapter.ObtenerMemoria(comboMemoria.Text), txtCpu.Text.Trim());
            }
            //Guardado Disco
            try
            {
                this.cpuTableAdapter.UpdateTablaCpuDisco(this.cpuTableAdapter.ObtenerDisco(comboDisco.SelectedItem.ToString()), txtCpu.Text.Trim());
            }
            catch (NullReferenceException)
            {
                this.cpuTableAdapter.UpdateTablaCpuDisco(this.cpuTableAdapter.ObtenerDisco(comboDisco.Text), txtCpu.Text.Trim());
            }
            if (FuncionesUtiles.INVENTARIO_EQUIPO == "" || FuncionesUtiles.INVENTARIO_EQUIPO == null)
            {
                return;
            }
            FuncionesUtiles.OBSERVACION += "Cpu: " + Microsoft.VisualBasic.Interaction.InputBox("OBSERVACION", "Ingrese Su Observacion", "", 600) + " ; ";
            FuncionesEquipo.ActualizarInventario(FuncionesUtiles.OBSERVACION);
        }