private void EnableTextBox() { var empDetails = new FrmEmployeeDetails(); empDetails.cmbPosition.DataSource = position.GetPositionList(); empDetails.cmbPosition.ValueMember = "PositionId"; empDetails.cmbPosition.DisplayMember = "PositionName"; empDetails.cmbPosition.SelectedIndex = -1; empDetails.txtFirstName.Enabled = true; empDetails.txtLastName.Enabled = true; empDetails.mskTxtBirthday.Enabled = true; empDetails.cmbTypeDocument.Enabled = true; empDetails.txtDocumentNumber.Enabled = true; empDetails.cmbTypeDocument.DataSource = document.GetDocumentList(); empDetails.cmbTypeDocument.ValueMember = "TypeDocumentId"; empDetails.cmbTypeDocument.DisplayMember = "DocumentName"; empDetails.cmbTypeDocument.SelectedIndex = -1; empDetails.txtAddress.Enabled = true; empDetails.txtPhone.Enabled = true; empDetails.txtEmail.Enabled = true; empDetails.txtUser.Enabled = true; }
private void BtnEditProfile_Click(object sender, EventArgs e) { var document = new DocumentModel(); var position = new PositionModel(); Form currentForm = Application.OpenForms.OfType <Form>().Where(f => f.Name == "FrmEmployeeDetails").SingleOrDefault <Form>(); if (currentForm != null) { cmbPosition.Enabled = UserCache.PositionId == (int)PositionEnum.Administrator; txtFirstName.Enabled = true; txtLastName.Enabled = true; mskTxtBirthday.Enabled = true; cmbTypeDocument.Enabled = true; txtDocumentNumber.Enabled = true; txtAddress.Enabled = true; txtPhone.Enabled = true; txtEmail.Enabled = true; txtUser.Enabled = true; //stateYes.Enabled = true; //stateNo.Enabled = true; passYes.Enabled = true; passNo.Enabled = true; cmbPosition.DataSource = position.GetPositionList(); cmbPosition.ValueMember = "PositionId"; cmbPosition.DisplayMember = "PositionName"; cmbPosition.DisplayMember = UserCache.PositionName; txtFirstName.Text = UserCache.FirstName; txtLastName.Text = UserCache.LastName; mskTxtBirthday.Text = UserCache.BirthDate.ToString(); cmbTypeDocument.DataSource = document.GetDocumentList(); cmbTypeDocument.ValueMember = "TypeDocumentId"; cmbTypeDocument.DisplayMember = "DocumentName"; txtDocumentNumber.Text = UserCache.DocumentNumber; txtAddress.Text = UserCache.Address; txtPhone.Text = UserCache.PhoneNumber; txtEmail.Text = UserCache.Email; txtUser.Text = UserCache.UserName; if (UserCache.StateB == true) { stateYes.Checked = true; stateNo.Checked = false; } else { stateYes.Checked = false; stateNo.Checked = true; } } }