private void btn_add_Click(object sender, EventArgs e) { MessageForm m = new MessageForm(); DataTable dt = new DataTable(); dt = user.Search(txt_username.Text); if (txt_name.Text == "") { MessageBox.Show("please enter name!"); return; } if (txt_family.Text == "") { MessageBox.Show("please enter family!"); return; } if (cmb_position.SelectedIndex == -1 && cmb_position.Text == "") { MessageBox.Show("please select position!"); return; } if (txt_username.Text == "") { MessageBox.Show("please enter username!"); return; } if (txt_password.Text == "") { MessageBox.Show("please enter password!"); return; } if (txt_repeatpassword.Text == "") { MessageBox.Show("please enter repeatpassword!"); return; } if (txt_password.Text != txt_repeatpassword.Text) { MessageBox.Show("please enter same password!"); return; } if (dt != null) { MessageBox.Show("there is a user with this username, so please change username"); return; } else { user.Add(txt_name.Text, txt_family.Text, cmb_position.SelectedItem.ToString(), txt_username.Text, txt_password.Text); txt_name.Text = ""; txt_family.Text = ""; cmb_position.SelectedIndex = -1; txt_username.Text = ""; txt_password.Text = ""; txt_repeatpassword.Text = ""; btn_refresh_Click(btn_refresh, EventArgs.Empty); return; } }
private void LogIn_Load(object sender, EventArgs e) { MessageForm ms = new MessageForm(); ms.timer1.Stop(); }