private void Dgv_Users_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (this.dgv_Users.Columns[e.ColumnIndex].Name.Equals("Btn_Det")) { frmDataUsers frmdata = new frmDataUsers(this, "blanquear"); DataGridViewRow dgv = dgv_Users.Rows[e.RowIndex]; frmdata.Txt_Nick.Text = dgv.Cells["Nick"].Value.ToString(); frmdata.Txt_Name.Text = dgv.Cells["Nombre"].Value.ToString(); frmdata.Txt_Surname.Text = dgv.Cells["Apellido"].Value.ToString(); frmdata.cbprofile.ValueMember = dgv.Cells["TipoUsuario"].Value.ToString(); frmdata.Btn_New.Visible = false; frmdata.Btn_Refresh.Visible = true; frmdata.Txt_Nick.Enabled = false; frmdata.Btn_NewP.Visible = true; frmdata.Txt_Pass.Enabled = false; frmdata.Txt_RPass.Enabled = false; frmdata.Btn_CancelFirst.Visible = false; frmdata.Btn_CancelUser.Visible = false; frmdata.Btn_CancelAdm.Enabled = true; if (frmdata.cbprofile.ValueMember == "Administrador") { frmdata.cbprofile.Enabled = false; } frmdata.ShowDialog(); } }
private void BtnModify_Click(object sender, EventArgs e) { frmDataUsers frmdata = new frmDataUsers(this, "blanquear"); if (dgv_Users.SelectedRows.Count > 0) { frmdata.Txt_Nick.Text = dgv_Users.CurrentRow.Cells["Nick"].Value.ToString(); frmdata.Txt_Name.Text = dgv_Users.CurrentRow.Cells["Nombre"].Value.ToString(); frmdata.Txt_Surname.Text = dgv_Users.CurrentRow.Cells["Apellido"].Value.ToString(); frmdata.cbprofile.ValueMember = dgv_Users.CurrentRow.Cells["TipoUsuario"].Value.ToString(); frmdata.Btn_New.Visible = false; frmdata.Btn_Refresh.Visible = true; frmdata.Txt_Nick.Enabled = false; frmdata.Btn_NewP.Visible = true; frmdata.Txt_Pass.Enabled = false; frmdata.Txt_RPass.Enabled = false; frmdata.Btn_CancelFirst.Visible = false; frmdata.Btn_CancelUser.Visible = false; frmdata.Btn_CancelAdm.Enabled = true; if (frmdata.cbprofile.ValueMember == "Administrador") { frmdata.cbprofile.Enabled = false; } frmdata.ShowDialog(); } }
private void BtnNew_Click(object sender, EventArgs e) { frmDataUsers frmdata = new frmDataUsers(this, ""); frmdata.Btn_NewP.Visible = false; frmdata.Btn_CancelFirst.Visible = false; frmdata.Btn_CancelUser.Visible = false; frmdata.Btn_Refresh.Visible = false; frmdata.Btn_UserPass.Visible = false; frmdata.Btn_New.Visible = true; frmdata.Txt_Pass.Enabled = false; frmdata.Txt_RPass.Enabled = false; frmdata.ShowDialog(); }
private void Btn_Datos_Click(object sender, EventArgs e) { hideSubMenu(); Btn_Datos.BackColor = Color.FromArgb(0, 187, 194); frmUsers fu = new frmUsers(); frmDataUsers frmdata = new frmDataUsers(fu, "misdatos"); flag = 1; frmdata.Btn_NewP.Visible = false; frmdata.Txt_Nick.Enabled = false; frmdata.Txt_Nick.Text = Users.CacheUser.Nick; frmdata.Txt_Name.Text = Users.CacheUser.Name; frmdata.Txt_Name.Enabled = false; frmdata.Txt_Surname.Text = Users.CacheUser.Surname; frmdata.Txt_Surname.Enabled = false; frmdata.Btn_CancelAdm.Visible = false; frmdata.Btn_CancelFirst.Visible = false; frmdata.Btn_New.Visible = false; frmdata.Btn_Refresh.Visible = false; frmdata.Btn_UserPass.Visible = true; frmdata.Txt_Nick.Visible = true; /*frmdata.Lbl_Usuario.Visible = true; * frmdata.Txt_Nick.Text = Users.CacheUser.Nick; * frmdata.Txt_Nick.Visible = true; * frmdata.Txt_Nick.Enabled = false; * frmdata.Lbl_Contraseña.Visible = true; * frmdata.Txt_Pass.Visible = true; * frmdata.Lbl_Repetir.Visible = true; * frmdata.Txt_RPass.Visible = true; * frmdata.Lbl_Nombre.Visible = false; * frmdata.Txt_Name.Visible = false;*/ if (Users.UserTypeId.TypeId == 1) { frmdata.cbprofile.Text = "Administrador"; frmdata.cbprofile.Enabled = false; } else { frmdata.cbprofile.Text = "Usuario"; frmdata.cbprofile.Enabled = false; } frmdata.ShowDialog(); }
private void Btn_ingresar_Click(object sender, EventArgs e) { if (txtUser.Text != "Usuario") { if (txt_password.Text != "Usuario") { var loginvalido = UL.login(txtUser.Text, txt_password.Text); //Se guarda en variable el resultado del Metodo de Buscar Usuario (Log.login) if (loginvalido == true) //Si la variable es verdadera, se ingresa al sistema. { L.Action = "El usuario " + txtUser.Text + " inició sesión en la aplicación"; L.ActionDate = DateTime.Now; L._users.Id = UL.GetUserId(txtUser.Text); L.WriteLog(L); if (txt_password.Text == "nuevousuario") { frmUsers fu = new frmUsers(); frmDataUsers frmdata = new frmDataUsers(fu, "nuevousuario"); //Instancia Formulario de Bienvenida. MessageBox.Show("Primer ingreso, cambio de contraseña obligatorio", "Solicitud de cambio de contraseña", MessageBoxButtons.OK, MessageBoxIcon.Information); frmdata.Btn_NewP.Visible = false; frmdata.Txt_Nick.Enabled = false; frmdata.Txt_Nick.Text = Users.CacheUser.Nick; frmdata.Txt_Name.Text = Users.CacheUser.Name; frmdata.Txt_Name.Enabled = false; frmdata.Txt_Surname.Text = Users.CacheUser.Surname; frmdata.Txt_Surname.Enabled = false; frmdata.Btn_CancelAdm.Visible = false; frmdata.Btn_CancelFirst.Visible = true; frmdata.Btn_CancelUser.Visible = false; frmdata.Btn_New.Visible = false; frmdata.Btn_Refresh.Visible = false; frmdata.Btn_UserPass.Visible = true; frmdata.Txt_Nick.Visible = true; frmdata.cbprofile.Enabled = false; frmdata.ShowDialog(); this.Dispose(); this.Close(); /*frmdata.Lbl_Nombre.Visible = false; * frmdata.Txt_Name.Visible = false; * frmdata.Lbl_Apellido.Visible = false; * frmdata.Txt_Surname.Visible = false; * frmdata.Txt_Nick.Text = Users.CacheUser.Nick; * frmdata.Txt_Nick.Enabled = false; * frmdata.Lbl_Contraseña.Visible = true; * frmdata.Lbl_Repetir.Visible = true; * frmdata.Txt_Pass.Visible = true; * frmdata.Txt_RPass.Visible = true; * frmdata.Lbl_Perfil.Visible = false; * frmdata.cbprofile.Visible = false; * frmdata.Btn_CancelUser.Visible = false; * frmdata.Btn_CancelAdm.Visible = false; * frmdata.Btn_CancelFirst.Visible = true; * frmdata.Btn_New.Visible = false; * frmdata.Btn_Refresh.Visible = false; * frmdata.Btn_UserPass.Visible = true; * frmdata.Lbl_NUser.Visible = false; * frmdata.Txt_Nick.Visible = false; * frmdata.ShowDialog(); * this.Dispose(); * this.Close();*/ } else { frmMenu frmMenu = new frmMenu(); //Instancia Formulario de Bienvenida. frmMenu.WindowState = FormWindowState.Maximized; frmMenu.Show(); this.Dispose(); this.Close(); } }//IF LOGIN else { MessageBox.Show("Usuario y/o contraseña invalidos.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error); txtUser.Focus(); txt_password.Clear(); } //ELSE USER/PW } //IF PASSWORD else { MessageBox.Show("Por favor ingrese una contraseña", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error); } txt_password.Focus(); }//IF USUARIO else { MessageBox.Show("Por favor ingrese un usuario", "Login", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUser.Focus(); }//ELSE USUARIO }