예제 #1
0
        private void BtnNew_Click(object sender, EventArgs e)
        {
            var empDetails = new FrmEmployeeDetails();

            ///<summary>Nuevo Empleado</summary>
            ///necesito habilitar todos los textbox menos currentPass
            ///desahiblitar radiobtn estado, activo=checked
            ///radiobtn contraseña dehabilitado, si=checked
            ///btnEditProfile enable=false / btnEdit visible=false
            empDetails.btnEditProfile.Enabled = false;
            empDetails.btnEditDetails.Visible = false;

            empDetails.stateYes.Checked = true;
            empDetails.stateNo.Checked  = false;

            empDetails.passNo.Checked  = false;
            empDetails.passYes.Checked = true;

            empDetails.txtPass.Enabled        = true;
            empDetails.txtConfirmPass.Enabled = true;
            empDetails.txtCurrentPass.Enabled = false;

            if (UserCache.PositionId == (int)PositionEnum.Administrator)
            {
                empDetails.cmbPosition.Enabled = true;
            }
            else
            {
                empDetails.cmbPosition.Enabled = false;
            }


            EnableTextBox();//habilito textbox

            empDetails.ShowDialog();
        }
예제 #2
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            var empDetails = new FrmEmployeeDetails();

            ///<summary>Nuevo Empleado</summary>
            ///necesito habilitar todos los textbox
            ///cargar los datos de usu en los textbox
            ///habilitar radiobtn estado checked=>radioAct/Inac segun usuario a editar
            ///habilitar radiobtn contraseña, No=checked por defecto
            ///si radiobtn contraseña Si=checked=>habilitar los 3 textbox de contraseña
            ///btnEditProfile enable=false / btnAdd visible=false
            ///
            EnableTextBox();//habilito textbox
            empDetails.btnAddDetails.Visible = false;

            empDetails.stateYes.Enabled = true;
            empDetails.stateNo.Enabled  = true;

            empDetails.passYes.Enabled = true;
            empDetails.passNo.Enabled  = true;

            if (dgvEmployeeList.SelectedRows.Count > 0)//envio los valores a editar
            {
                //envio a los textbox
                //empDetails.lblEmployeeId.Text = dgvEmployeeList.CurrentRow.Cells[0].Value.ToString();//envio el id directamente ya que este no es modificable
                empDetails.cmbPosition.Text       = dgvEmployeeList.CurrentRow.Cells[2].Value.ToString();
                empDetails.txtFirstName.Text      = dgvEmployeeList.CurrentRow.Cells[3].Value.ToString();
                empDetails.txtLastName.Text       = dgvEmployeeList.CurrentRow.Cells[4].Value.ToString();
                empDetails.mskTxtBirthday.Text    = dgvEmployeeList.CurrentRow.Cells[5].Value.ToString();
                empDetails.cmbTypeDocument.Text   = dgvEmployeeList.CurrentRow.Cells[7].Value.ToString();
                empDetails.txtDocumentNumber.Text = dgvEmployeeList.CurrentRow.Cells[8].Value.ToString();
                empDetails.txtAddress.Text        = dgvEmployeeList.CurrentRow.Cells[9].Value.ToString();
                empDetails.txtPhone.Text          = dgvEmployeeList.CurrentRow.Cells[10].Value.ToString();
                empDetails.txtEmail.Text          = dgvEmployeeList.CurrentRow.Cells[11].Value.ToString();
                empDetails.txtUser.Text           = dgvEmployeeList.CurrentRow.Cells[12].Value.ToString();
                //envio a los label
                empDetails.lblEmployeeId.Text     = dgvEmployeeList.CurrentRow.Cells[0].Value.ToString();//envio el id directamente ya que este no es modificable
                empDetails.lblPosition.Text       = dgvEmployeeList.CurrentRow.Cells[2].Value.ToString();
                empDetails.lblFirstName.Text      = dgvEmployeeList.CurrentRow.Cells[3].Value.ToString();
                empDetails.lblLastName.Text       = dgvEmployeeList.CurrentRow.Cells[4].Value.ToString();
                empDetails.lblDate.Text           = dgvEmployeeList.CurrentRow.Cells[5].Value.ToString();
                empDetails.lblTypeDocument.Text   = dgvEmployeeList.CurrentRow.Cells[7].Value.ToString();
                empDetails.lblDocumentNumber.Text = dgvEmployeeList.CurrentRow.Cells[8].Value.ToString();
                empDetails.lblAddress.Text        = dgvEmployeeList.CurrentRow.Cells[9].Value.ToString();
                empDetails.lblPhoneNumber.Text    = dgvEmployeeList.CurrentRow.Cells[10].Value.ToString();
                empDetails.lblEmail.Text          = dgvEmployeeList.CurrentRow.Cells[11].Value.ToString();
                empDetails.lblUser.Text           = dgvEmployeeList.CurrentRow.Cells[12].Value.ToString();

                if (dgvEmployeeList.CurrentRow.Cells[14].Value.ToString() == "Activo")
                {
                    empDetails.stateYes.Checked = true;
                }
                else
                {
                    empDetails.stateNo.Checked = false;
                }



                empDetails.ShowDialog();
            }
            else
            {
                MessageBox.Show("Seleccione una fila");
            }
        }