예제 #1
0
        void SubmitUpdate(  )
        {
            CheckForIllegalCrossThreadCalls = false;
            this._inAction = true;
            this._tPersonal_Old = this._tPersonal;

            if ( this._cPersonal.Modify( this._tPersonal.Codigo ) )
            {
                DataRow[] row = this._data.Tables["TipoPersonal"].Select( "Codigo=" + this._tPersonal.CodigoTipoPersonal );

                this.dgvListado.CurrentRow.Cells[2].Value = this._tPersonal.Names + " " + this._tPersonal.LastNames;
                this.dgvListado.CurrentRow.Cells[3].Value = row[0]["Name"];
                this.dgvListado.CurrentRow.Cells[4].Value = row[0]["IsUser"];

                this.pgsLoading.Visible = false;
                this.panelMain.Enabled = true;
                MetroMessageBox.Show( this, "Se ha Modificado al Personal", "Muy Bien!", MessageBoxButtons.OK, MessageBoxIcon.Question );
                this.ResetControls();
            }
            else
            {
                this._tPersonal = this._tPersonal_Old;
                this.panelMain.Enabled = true;
                this.pgsLoading.Visible = false;
                MetroMessageBox.Show(this, this._cPersonal.ExceptionPersonal, "Error al Modificar", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this._inAction = false;
            this._hilo.Abort();
        }
예제 #2
0
        void ResetControls()
        {
            //limpiar
            this.txtNombres.Clear();
            this.txtApellidos.Clear();
            this.txtN_Documento.Clear();
            this.txtEmail.Clear();
            this.txtTelefono.Clear();
            this.txtDireccion.Clear();
            this.lblSrcImage.Text = "";
            this.ptbImage.Image = null;
            this.dtpBirthday.Value = dtpBirthday.MaxDate;
            this.CboGenero.SelectedIndex = -1;
            this.CboGenero.Text = "Seleccione...";
            this.cboProfesion.SelectedIndex = -1;
            this.cboProfesion.Text = "";
            this.cboDocumento.SelectedIndex = -1;
            this.cboDocumento.Text = "Seleccione...";
            this.cboTipoPersonal.SelectedIndex = -1;
            this.cboTipoPersonal.Text = "Seleccione...";

            //regresar estados por defecto
            this.panelRegistros.Enabled = false;
            this.panelListado.Enabled = true;
            this.tabControl.SelectedTab = this.tabPageListado;
            this.btnNuevo.Enabled = true;
            this.lblLastModified.Text = string.Empty;

            if ( this.dgvListado.Rows.Count == 0 )
            {
                this.btnModificar.Enabled = false;
                this.btnEliminar.Enabled = false;
                this.txtSearch.Enabled = false;
                this.btnSearch.Enabled = false;
            }
            else
            {
                this.btnModificar.Enabled = true;
                this.btnEliminar.Enabled = true;
                this.txtSearch.Enabled = true;
                this.btnSearch.Enabled = true;
            }

            this.lblNombres_Validator.Visible = true;
            this.lblApellidos_Validator.Visible = true;
            this.lblGenero_Validator.Visible = true;
            this.lblTipoDocumento_Validator.Visible = true;
            this.lblDocumento_Validator.Visible = true;
            this.lblTipoPersonal_Validator.Visible = true;
            this.lblDireccion_Validator.Visible = true;

            this._tPersonal = new tPersonal();
        }
예제 #3
0
        void SubmitInsert(  )
        {
            CheckForIllegalCrossThreadCalls = false;

            this._tPersonal_Old = this._tPersonal;
            this._tPersonal = this._cPersonal.Insert();

            if ( this._tPersonal != null )
            {
                DataRow[] row = this._data.Tables["TipoPersonal"].Select("Codigo=" + this._tPersonal.CodigoTipoPersonal );

                object[] temp = new object[6]
                {
                    this._tPersonal.Codigo,
                    this._tPersonal.Key,
                    this._tPersonal.Names + " " + this._tPersonal.LastNames,
                    row[0]["Name"].ToString(),
                    row[0]["IsUser"],
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                };

                this.dgvListado.Rows.Add( temp );

                this.panelMain.Enabled = true;
                this.pgsLoading.Visible = false;

                MetroMessageBox.Show( this, "Se ha registrado al Personal", "Muy Bien!", MessageBoxButtons.OK, MessageBoxIcon.Question );
                this.ResetControls();
            }
            else
            {
                this.panelMain.Enabled = true;
                this.pgsLoading.Visible = false;
                this._tPersonal = this._tPersonal_Old;
                MetroMessageBox.Show( this, this._cPersonal.ExceptionPersonal, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error );

            }

            this._hilo.Abort();
        }
예제 #4
0
        void FindPersonal( )
        {
            CheckForIllegalCrossThreadCalls = false;

            this._inAction = true;

            this._tPersonal = this._cPersonal.Find( this._idPersonal );

            if ( this._tPersonal == null )
            {
                pgsLoading.Visible = false;
                this.panelMain.Enabled = true;
                this._tPersonal = new tPersonal();
                MetroMessageBox.Show( this, this._cPersonal.ExceptionPersonal, "Error en la Solicitud", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }
            else
            {
                this._tPersonal_Old = this._tPersonal;
                this._tProfesion = this._tPersonal.Profesion;
                this.RestoreData();
            }

            this._inAction = false;

            this._hilo.Abort();
        }