Пример #1
0
        private void BtnAgregarNuevo_Click(object sender, EventArgs e)
        {
            FrmTecnico objMod = new FrmTecnico(this);

            objMod.IsNuevo             = true;
            objMod.btnGuardar.Text     = "Guardar Datos";
            objMod.UpdateEventHandler += F2_UpdateEventHandler;
            objMod.ShowDialog();
            //this.ListarTecnico();
        }
Пример #2
0
        private void DgvDataList_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                if (e.ColumnIndex == dgvDataList.Columns[8].Index)
                {
                    var objModal = new FrmTecnico(this);

                    objModal.IsNuevo         = false;
                    objModal.btnGuardar.Text = "Actualizar";

                    objModal.txtId.Text         = Convert.ToString(dgvDataList.CurrentRow.Cells[0].Value);
                    objModal.txtNombre.Text     = Convert.ToString(dgvDataList.CurrentRow.Cells[2].Value);
                    objModal.txtApePaterno.Text = Convert.ToString(dgvDataList.CurrentRow.Cells[3].Value);
                    objModal.txtApeMaterno.Text = Convert.ToString(dgvDataList.CurrentRow.Cells[4].Value);
                    objModal.txtUsuario.Text    = Convert.ToString(dgvDataList.CurrentRow.Cells[5].Value);
                    objModal.txtClave.Text      = DesEncrypt(Convert.ToString(dgvDataList.CurrentRow.Cells[6].Value));


                    if (int.Parse(dgvDataList.CurrentRow.Cells[7].Value.ToString()) == 1)
                    {
                        objModal.chkEstado.Checked = true;
                    }
                    else
                    {
                        objModal.chkEstado.Checked = false;
                    }


                    objModal.UpdateEventHandler += F2_UpdateEventHandler;
                    objModal.ShowDialog();
                    //objCon.View(dgvDataList);
                }
                else if (e.ColumnIndex == dgvDataList.Columns[9].Index)
                {
                    DialogResult r = MessageBox.Show("Esta seguro que desea eliminar el registro?", "Eliminar", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (r == DialogResult.OK)
                    {
                        objEnt.IdTecnico = int.Parse(dgvDataList.CurrentRow.Cells[0].Value.ToString());
                        objCon.Delete(objEnt);
                        MessageConfirmation("El registro ha sido eliminado correctamente.");
                        objCon.View(dgvDataList);
                    }
                }
            }
        }