示例#1
0
        public static DateTime ProximaFechaCalibracion(int CodInstrumento, string Estado, DateTime Fecha)
        {
            DateTime FechaP = new DateTime(1900, 01, 01);

            DataTable DT = NInstrumento.Buscar(CodInstrumento);

            string InstruFrecu = Estado == "Nuevo" ? Convert.ToString(DT.Rows[0][3]) : Convert.ToString(DT.Rows[0][4]);

            DT = NFrecuencia.Buscar(InstruFrecu);

            string sFrecu = Convert.ToString(DT.Rows[0][2]);
            int    nFrecu = Convert.ToInt32(DT.Rows[0][3]);

            if (sFrecu == "D")
            {
                FechaP = Fecha.AddDays(nFrecu);
            }
            else if (sFrecu == "M")
            {
                FechaP = Fecha.AddMonths(nFrecu);
            }

            FechaP = (int)FechaP.DayOfWeek == 0 ? FechaP.AddDays(1) :
                     (int)FechaP.DayOfWeek == 7 ? FechaP.AddDays(2) :
                     FechaP;

            return(FechaP);
        }
示例#2
0
        private void eliminarInstrumentoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string rpta    = "";
            int    nId     = Convert.ToInt32(dataInstrumentos.Rows[dataInstrumentos.CurrentRow.Index].Cells[0].Value);
            string nCodigo = Convert.ToString(dataInstrumentos[1, dataInstrumentos.CurrentRow.Index].Value);

            if (MessageBox.Show("Eliminar el Instrumento '" + Convert.ToString(dataInstrumentos[2, dataInstrumentos.CurrentRow.Index].Value) + "'", "Sistema Mantenimiento", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                rpta = NInstrumento.Eliminar(nId, nCodigo);
                ListarInstrumentos();
            }
        }
示例#3
0
        private void CargaEncabezado()
        {
            DataTable DTInstru = new DataTable();

            DTInstru           = NInstrumento.Buscar(IDInstrumento);
            txtCodInstru.Text  = Convert.ToString(DTInstru.Rows[0][1]);
            txtDescInstru.Text = Convert.ToString(DTInstru.Rows[0][2]);

            txtCodInstru.Enabled  = false;
            txtDescInstru.Enabled = false;

            txtCodInstru.BackColor  = System.Drawing.SystemColors.ControlLightLight;
            txtDescInstru.BackColor = System.Drawing.SystemColors.ControlLightLight;
        }
示例#4
0
        private void CargarEncabezado()
        {
            DataTable DTInstru = new DataTable();

            DTInstru           = NInstrumento.Buscar(Convert.ToInt32(DataIdentidad.Cells[0].Value));
            txtCodInstru.Text  = Convert.ToString(DTInstru.Rows[0][1]);
            txtDescInstru.Text = Convert.ToString(DTInstru.Rows[0][2]);

            txtId.Text = Convert.ToString(DataIdentidad.Cells[1].Value);
            //txtEstado.Text = Convert.ToString(DataIdentidad.Cells[3].Value);
            txtCodEmp.Text      = Convert.ToString(DataIdentidad.Cells[4].Value);
            txtNomEmp.Text      = Convert.ToString(DataIdentidad.Cells[5].Value);
            txtCertificado.Text = Convert.ToString(DataIdentidad.Cells[9].Value);
            txtMarca.Text       = Convert.ToString(DataIdentidad.Cells[10].Value);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///  FUNCIONES Y PROCEDIMIENTOS
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        private void CargaEncabezado()
        {
            DataTable DTInstru = new DataTable();

            DTInstru           = NInstrumento.Buscar(Convert.ToInt32(IDInstrumento.Cells[0].Value));
            txtCodInstru.Text  = Convert.ToString(DTInstru.Rows[0][1]);
            txtDescInstru.Text = Convert.ToString(DTInstru.Rows[0][2]);
            FrecNuevo          = Convert.ToString(DTInstru.Rows[0][3]);
            FrecUsado          = Convert.ToString(DTInstru.Rows[0][4]);

            txtCodInstru.Enabled  = false;
            txtDescInstru.Enabled = false;

            txtCodInstru.BackColor  = System.Drawing.SystemColors.ControlLightLight;
            txtDescInstru.BackColor = System.Drawing.SystemColors.ControlLightLight;
        }
示例#6
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ///  FUNIONES Y PROCEDIMIENTOS
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


        /// <summary>
        /// Carga el DataGrid dataInstrumentos
        /// </summary>
        public void ListarInstrumentos()
        {
            // Asignar los datos a combos de frecuencia
            DataGridViewComboBoxColumn cmbfrecuencia = dataInstrumentos.Columns[3] as DataGridViewComboBoxColumn;

            cmbfrecuencia.DataSource    = NFrecuencia.Listar();
            cmbfrecuencia.DisplayMember = "Descripcion";
            cmbfrecuencia.ValueMember   = "Descripcion";

            cmbfrecuencia               = dataInstrumentos.Columns[4] as DataGridViewComboBoxColumn;
            cmbfrecuencia.DataSource    = NFrecuencia.Listar();
            cmbfrecuencia.DisplayMember = "Descripcion";
            cmbfrecuencia.ValueMember   = "Descripcion";

            dataInstrumentos.AutoGenerateColumns = false;
            dataInstrumentos.DataSource          = NInstrumento.Listar();
            dataInstrumentos.Columns[1].ReadOnly = true;
            dataInstrumentos.Columns[2].ReadOnly = true;
        }
示例#7
0
        private void CargarEncabezado()
        {
            DataTable DTInstru = new DataTable();

            DTInstru           = NInstrumento.Buscar(Convert.ToInt32(DataIdentidad.Cells[0].Value));
            txtCodInstru.Text  = Convert.ToString(DTInstru.Rows[0][1]);
            txtDescInstru.Text = Convert.ToString(DTInstru.Rows[0][2]);

            txtId.Text          = Convert.ToString(DataIdentidad.Cells[1].Value);
            txtEstado.Text      = Convert.ToString(DataIdentidad.Cells[3].Value);
            txtCodEmp.Text      = Convert.ToString(DataIdentidad.Cells[4].Value);
            txtNomEmp.Text      = Convert.ToString(DataIdentidad.Cells[5].Value);
            txtCertificado.Text = Convert.ToString(DataIdentidad.Cells[9].Value);
            txtMarca.Text       = Convert.ToString(DataIdentidad.Cells[10].Value);

            if (AccionEnviada == "Nuevo")
            {
                txtCalibra.Text   = Convert.ToString(NCalibracion.ProximoCodigoIndividual(Convert.ToInt32(DataIdentidad.Cells[0].Value), Convert.ToInt32(DataIdentidad.Cells[1].Value)));
                dtpFecCalib.Text  = Convert.ToString(DataIdentidad.Cells[8].Value);
                dtpProxCalib.Text = Convert.ToString(Funciones.ProximaFechaCalibracion(Convert.ToInt32(DataIdentidad.Cells[0].Value), txtEstado.Text.Trim(), dtpFecCalib.Value));
            }
            else if (AccionEnviada == "Actualizar")
            {
                txtCalibra.Text   = Convert.ToString(DataCalibracion.Cells[3].Value);
                dtpFecCalib.Text  = Convert.ToString(DataCalibracion.Cells[4].Value);
                dtpProxCalib.Text = Convert.ToString(Funciones.ProximaFechaCalibracion(Convert.ToInt32(DataIdentidad.Cells[0].Value), txtEstado.Text.Trim(), dtpFecCalib.Value));
            }


            txtCodInstru.BackColor   = System.Drawing.SystemColors.ControlLightLight;
            txtDescInstru.BackColor  = System.Drawing.SystemColors.ControlLightLight;
            txtId.BackColor          = System.Drawing.SystemColors.ControlLightLight;
            txtEstado.BackColor      = System.Drawing.SystemColors.ControlLightLight;
            txtCodEmp.BackColor      = System.Drawing.SystemColors.ControlLightLight;
            txtNomEmp.BackColor      = System.Drawing.SystemColors.ControlLightLight;
            txtCertificado.BackColor = System.Drawing.SystemColors.ControlLightLight;
            txtMarca.BackColor       = System.Drawing.SystemColors.ControlLightLight;
            txtCalibra.BackColor     = System.Drawing.SystemColors.ControlLightLight;
        }
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (ValidarCampos())
            {
                string rpta = "";

                rpta = NInstrumento.Insertar(Convert.ToString(dataGridView1[0, dataGridView1.CurrentRow.Index].Value),
                                             Convert.ToString(dataGridView1[1, dataGridView1.CurrentRow.Index].Value),
                                             cmbFrecuenciaN.Text,
                                             cmbFrecuenciaU.Text,
                                             "A");
                if (rpta == "OK")
                {
                    btnCancelar.PerformClick();
                    FrmInstrumentoHandler.ListarInstrumentos();
                }
                else
                {
                    this.MensajeError(rpta);
                }
            }
        }
示例#9
0
        private void dataInstrumentos_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                DataGridViewComboBoxCell comboboxColumn1 = (DataGridViewComboBoxCell)dataInstrumentos.Rows[e.RowIndex].Cells[3];
                DataGridViewComboBoxCell comboboxColumn2 = (DataGridViewComboBoxCell)dataInstrumentos.Rows[e.RowIndex].Cells[4];

                if (e.ColumnIndex == comboboxColumn1.ColumnIndex || e.ColumnIndex == comboboxColumn2.ColumnIndex) //check if combobox column
                {
                    string rpta = NInstrumento.Actualizar(Convert.ToInt32(dataInstrumentos[0, dataInstrumentos.CurrentRow.Index].Value),
                                                          Convert.ToString(dataInstrumentos[1, dataInstrumentos.CurrentRow.Index].Value),
                                                          Convert.ToString(dataInstrumentos[2, dataInstrumentos.CurrentRow.Index].Value),
                                                          Convert.ToString(dataInstrumentos[3, dataInstrumentos.CurrentRow.Index].Value),
                                                          Convert.ToString(dataInstrumentos[4, dataInstrumentos.CurrentRow.Index].Value),
                                                          "A");
                    if (rpta != "OK")
                    {
                        this.MensajeError(rpta);
                    }
                    // object selectedValue = dataInstrumentos.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
                }
            }
        }