private void buttonLogin_Click(object sender, EventArgs e) { //TODO:validacion here..... //Validaciones de las textbox if (textBoxContraseña.Text.Length == 0 && textBoxNombre.Text.Length == 0) { MessageBox.Show("Omplir els camps.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (textBoxNombre.Text.Length == 0) { MessageBox.Show("Omplir el camp Nom d'usuari.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); textBoxNombre.Focus(); } else if (textBoxContraseña.Text.Length == 0) { MessageBox.Show("Omplir el camp Clau d'accés.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); textBoxContraseña.Focus(); } else { // En este else irian las comprobaciones con el servidor List <ADMINS> _admins = ORMAdmins.SelectAllAdmins(); foreach (ADMINS admin in _admins) { if (admin.nombre == textBoxNombre.Text) { if (admin.password == textBoxContraseña.Text) { correcto = true; } } } if (!correcto) { MessageBox.Show("Nom o contrasenya incorrectes.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); textBoxNombre.Focus(); } } if (correcto) { this.Close(); } }
private void buttonAcceptar_Click(object sender, EventArgs e) { if (textBoxNom.Text.Length == 0 || textBoxPAss.Text.Length < 4 || textBoxCorreu.Text.Length == 0) { MessageBox.Show("Les dades son incorrectes.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ORMAdmins.InsertAdmin(textBoxNom.Text, textBoxPAss.Text, textBoxCorreu.Text); //Refrescamos la grid bindingSourceAdmins.DataSource = ORMAdmins.SelectAllAdmins(); //Dejamos las textbox limpias textBoxNom.Text = ""; textBoxPAss.Text = ""; textBoxCorreu.Text = ""; } }
private void FormInicio_Load(object sender, EventArgs e) { tabPeticio(); //cargamos grids bindingSourceEntitats.DataSource = ORMEntitats.SelectAllEntitats(); bindingSourcePeticions.DataSource = ORMActivitatsDemandades.SelectAllActvitats(); bindingSourceInstalacions.DataSource = ORMInstalacions.SelectAllInstalacions(); bindingSourceActivitats.DataSource = ORMActivitats.SelectAllActvitats(); bindingSourceAdmins.DataSource = ORMAdmins.SelectAllAdmins(); //Grid de peticiones foreach (DataGridViewRow item in dataGridViewPeticio.Rows) { //if (item.Cells[1].Value.ToString().Equals("Acceptada")) if (item.Cells[1].Value == null) { item.DefaultCellStyle.SelectionBackColor = Color.Green; } } }