private void BtnCancel_Click(object sender, EventArgs e) { TxtID.Text = string.Empty; TxtPwd.Text = string.Empty; TxtID.Focus(); }
private void CboTipoId_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { TxtID.Focus(); } }
/// <summary>Resets all TextBoxes to the default data.</summary> private void Reset() { TxtID.Text = School.CurrentStudent.Id; TxtFirstName.Text = School.CurrentStudent.FirstName; TxtLastName.Text = School.CurrentStudent.LastName; TxtID.Focus(); }
public LoadFromID(DataSet data) { InitializeComponent(); _data = data; TxtID.Focus(); }
public FrmPrincipal() { InitializeComponent(); TxtID.Focus(); label6.Text = "0.0"; GrillaConsultar.DataSource = PersonaService.Consutar(); }
public NewClassView() { InitializeComponent(); TxtID.Focus(); CmbCourse.ItemsSource = School.AllCourses; CmbTeacher.ItemsSource = School.AllTeachers; }
private void BtnSearchProduct_Click(object sender, EventArgs e) { if (invoice.Client != null) { if (TxtID.Text != "") { SearchProductAnswer answer = productService.Search(TxtID.Text); Product product = answer.Product; if (answer.Product != null) { TxtID.Text = product.ID; TxtName.Text = product.Name; TxtUnitMeasure.Text = product.UnitMeasure; TxtWarehouseQuantity.Text = product.Quantity.ToString(); TxtUnitValue.Text = product.UnitValue.ToString(); TxtIVA.Text = product.IVA.ToString(); TxtQuantity.Text = "0"; TxtDiscount.Text = "0"; } MessageBox.Show(answer.Message); } else { MessageBox.Show("Debe ingrasar un codigo de producto para realizar la busqueda!"); TxtID.Focus(); } } else { MessageBox.Show("Primero debe agragarun cliente a la factura!"); } }
/// <summary>Clears all TextBoxes.</summary> private void Clear() { TxtID.Clear(); TxtFirstName.Clear(); TxtLastName.Clear(); TxtID.Focus(); }
private void InitControls() { TxtID.Text = TxtAuthor.Text = string.Empty; TxtISBN.Text = TxtNames.Text = TxtPrice.Text = string.Empty; CboDivision.SelectedIndex = 0; //선택 TxtID.Focus(); TxtID.ReadOnly = true; DtpReleaseDate.CustomFormat = "yyyy-MM-dd"; DtpReleaseDate.Format = DateTimePickerFormat.Custom; DtpReleaseDate.Value = DateTime.Now; myMode = BaseMode.NONE; ////콤보 박스 데이터 바인딩 //Dictionary<string, string> dic = new Dictionary<string, string>(); //dic.Add("선택", "00"); //dic.Add("서울특별시", "11");//key value //dic.Add("부산광역시", "21"); //dic.Add("대구광역시", "22"); //dic.Add("인천광역시", "23"); //dic.Add("광주광역시", "24"); //dic.Add("대전광역시", "25"); //CboDivision.DataSource = new BindingSource(dic,null); //폼의 데이터 소스 캡슐화 //CboDivision.DisplayMember = "key"; //CboDivision.ValueMember = "Value"; }
private void LimpiarCajas() { TxtID.Text = ""; TxtNombre.Text = ""; TxtUsuarioID.Text = ""; TxtDNI.Text = ""; TxtTelefono.Text = ""; TxtID.Focus(); }
private void BtnSave_Click(object sender, EventArgs e) { Product product = MapOutProduct(); MessageBox.Show(productService.Save(product)); FillTable(); EmptyTextBoxes(); TxtID.Focus(); }
public FindForm() { InitializeComponent(); CboQ.IsAccessible = false; TxtID.Focus(); label4.Visible = CboQ.Visible = CheckButton.Visible = true; Txt.Text = "ID"; PWA.Text = "비번 답"; Find.Text = "찾기"; }
private void ChangePW() { TxtID.Focus(); TxtID.PasswordChar = txtA.PasswordChar = '♥'; CK = 1; TxtID.Text = txtA.Text = ""; Txt.Text = "새 비번"; PWA.Text = "새 비번 확인"; label4.Visible = CboQ.Visible = CheckButton.Visible = false; Find.Text = "비번 바꾸기"; }
void temizle() { TxtID.Text = ""; TxtSinav1.Text = ""; TxtSinav2.Text = ""; TxtSinav3.Text = ""; TxtProje.Text = ""; comboBox1.Text = ""; TxtOrtalama.Text = ""; TxtDurum.Text = ""; TxtID.Focus(); }
private void TxtContact_KeyUp(object sender, KeyEventArgs e) { switch (e.KeyCode) { case Keys.Enter: { TxtID.SelectAll(); TxtID.Focus(); break; } } }
private void BtnCancel_Click(object sender, EventArgs e) { TxtID.Text = string.Empty; TxtNickName.Text = string.Empty; TxtPwd.Text = string.Empty; TxtPwdConfirm.Text = string.Empty; TxtMailAddress.Text = string.Empty; TxtVerticationCode.Text = string.Empty; CmbPwdQuestion.Text = string.Empty; TxtPwdAnswer.Text = string.Empty; TxtID.Focus(); }
public void ClearTextBoxes() { TxtID.Clear(); TxtName.Clear(); TxtUnitMeasure.Clear(); TxtQuantity.Clear(); TxtUnitValue.Clear(); TxtIVA.Clear(); TxtWarehouseQuantity.Clear(); TxtDiscount.Clear(); TxtID.Focus(); }
private void FrmSinavNotlar_Load(object sender, EventArgs e) { TxtID.Focus(); baglanti.Open(); SqlCommand komut = new SqlCommand("Select*From TBLDERSLER", baglanti); SqlDataAdapter da = new SqlDataAdapter(komut); DataTable dt = new DataTable(); da.Fill(dt); comboBox1.DisplayMember = "DERSAD"; comboBox1.ValueMember = "DERSID"; comboBox1.DataSource = dt; baglanti.Close(); }
/// <summary>Clears all TextBoxes.</summary> private void Clear() { TxtID.Clear(); CmbCourse.SelectedIndex = -1; CmbTeacher.SelectedIndex = -1; TxtDaily.Clear(); TxtHomework.Clear(); TxtProject.Clear(); TxtQuiz.Clear(); TxtReport.Clear(); TxtTest.Clear(); TxtStartTime.Text = "9:00 AM"; TxtEndTime.Text = "9:50 AM"; TxtID.Focus(); TxtError.Visibility = Visibility.Collapsed; }
private void BtnEditar_Click(object sender, EventArgs e) { if (DGV.SelectedRows.Count > 0) { Editar = true; TxtID.Text = DGV.CurrentRow.Cells[0].Value.ToString(); TxtNombre.Text = DGV.CurrentRow.Cells[1].Value.ToString(); TxtUsuarioID.Text = DGV.CurrentRow.Cells[2].Value.ToString(); TxtDNI.Text = DGV.CurrentRow.Cells[3].Value.ToString(); TxtTelefono.Text = DGV.CurrentRow.Cells[4].Value.ToString(); TxtID.Focus(); } else { MensajeError("Seleccione una fila primero."); } }
//验证是否为空 private bool ValidateInput() { bool isOk = true; if (TxtID.Text == "") { TxtID.BackColor = Color.Red; TxtID.Focus(); isOk = false; } if (Txtname.Text == "") { Txtname.BackColor = Color.Red; Txtname.Focus(); isOk = false; } if (Txtpwd.Text == "") { Txtpwd.BackColor = Color.Red; Txtpwd.Focus(); isOk = false; } if (txtAddress.Text == "") { txtAddress.BackColor = Color.Red; txtAddress.Focus(); isOk = false; } if (TxtpaperID.Text == "") { TxtpaperID.BackColor = Color.Red; TxtpaperID.Focus(); isOk = false; } if (TxtcontactTel.Text == "") { TxtcontactTel.BackColor = Color.Red; TxtcontactTel.Focus(); isOk = false; } return(isOk); //返回结果 }
private void CHECK_ID() { string strQuery = "SELECT id FROM member " + //반드시 뒤에 SpaceBar를 넣어줘야됨(안넣으면 userTBLWHERE로 붙어져서 Syntax Error나옴) " WHERE id = @id "; //@userID로 사용안하고 직접적 ID(TxtUserID)를 바로 넣으면 SQL Injection으로 해킹위험이 나옴 try { using (MySqlConnection conn = new MySqlConnection(strConnString)) { conn.Open(); //MetroMessageBox.Show(this, $"DB접속성공!!"); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = strQuery; MySqlParameter paramUserId = new MySqlParameter("@id", MySqlDbType.VarChar, 45); cmd.Parameters.Add(paramUserId); paramUserId.Value = TxtID.Text.Trim(); MySqlDataReader reader = cmd.ExecuteReader(); reader.Read(); if (reader.HasRows) { MessageBox.Show("등록아이디가 있습니다."); CboQ.Focus(); CboQ.IsAccessible = true; } else { MessageBox.Show("없는 아이디 입니다."); TxtID.Text = null; TxtID.Focus(); } } } catch (Exception e) { MessageBox.Show(e.Message); } }
//当移出会员框,判断是否有重名 private void TxtID_Leave(object sender, EventArgs e) { DBHelper db = null; try { db = new DBHelper(); string sql = string.Format("select count(*) from users where U_UsersId='{0}'", TxtID.Text); if ((int)db.SelectOne(sql) > 0) { MessageBox.Show("已有相同的用户名!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtID.Focus(); TxtID.SelectAll(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { db.GetClose(); } }
public NewStudentView() { InitializeComponent(); TxtID.Focus(); }
private void FormLogin_Load(object sender, EventArgs e) { TxtID.Text = string.Empty; TxtID.Focus(); }
private void ViewMode() { switch (_pMode) { case "ADD": grButton1.Enabled = false; dataGridView1.Enabled = false; this.Height = 440; DesFor.ColorChange(ref btnAdd); #region "Load Text Box Clear" TxtID.Text = ""; TxtName.Text = ""; TxtID.Enabled = false; #endregion TxtID.Focus(); DesFor.AlignCenterToScreen(); break; case "FIND": grButton1.Enabled = false; dataGridView1.Enabled = false; this.Height = 440; DesFor.ColorChange(ref btnFind); #region "Load Text Box Clear" TxtID.Text = ""; TxtName.Text = ""; TxtID.Enabled = true; #endregion TxtID.Focus(); DesFor.AlignCenterToScreen(); break; case "EDIT": grButton1.Enabled = false; dataGridView1.Enabled = false; this.Height = 440; DesFor.ColorChange(ref btnEdit); #region "Load Text Box" TxtID.Text = dataGridView1.CurrentRow.Cells["MA_NHOM_HANG"].Value.ToString(); TxtName.Text = dataGridView1.CurrentRow.Cells["TEN_NHOM_HANG"].Value.ToString(); TxtID.Enabled = false; #endregion TxtName.Focus(); DesFor.AlignCenterToScreen(); break; case "": grButton1.Enabled = true; dataGridView1.Enabled = true; #region "Load Text Box Clear" TxtID.Text = ""; TxtName.Text = ""; #endregion this.Height = 336; DesFor.AlignCenterToScreen(); break; default: break; } }
private void BtnRegister_Click(object sender, EventArgs e) { if (PicAvatar.Image == null) { DialogResult DRret; DRret = MessageBox.Show("要上传头像吗", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (DRret == DialogResult.Yes) { return; } else { } } else { } int ret = 0; DialogResult retDR; User user = new User() { ID = TxtID.Text.Trim(), Nickname = TxtNickName.Text.Trim(), Mailaddress = TxtMailAddress.Text.Trim(), PwdQuestion = CmbPwdQuestion.Text.Trim(), PwdAnswer = TxtPwdAnswer.Text.Trim(), FileNameOfAvatar = strAvatarFileName, }; if (TxtPwd.Text.Trim().Equals(TxtPwdConfirm.Text.Trim()) != true) { MessageBox.Show("您输入的密码前后不一样!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtPwd.Text = string.Empty; TxtPwdConfirm.Text = string.Empty; TxtPwd.Focus(); return; } if (user.ID.Equals(string.Empty) || TxtPwd.Text.Trim().Equals(string.Empty) || user.Mailaddress.Equals(string.Empty) || TxtPwdConfirm.Text.Trim().Equals(string.Empty) || user.PwdQuestion.Equals(string.Empty) || user.PwdAnswer.Equals(string.Empty)) { MessageBox.Show("您有选项没有输入!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (TxtVerticationCode.Text.Trim().Equals(strVttCode) == false || TxtVerticationCode.Text.Trim().Equals(string.Empty)) { MessageBox.Show("验证码不正确!\n或不能为空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //将image转为byte[]保存到数据库MEDIUMBLOB里面 byte[] bytesAvatar = null; ImageConverter imgconv = new ImageConverter(); bytesAvatar = (byte[])imgconv.ConvertTo(PicAvatar.Image, typeof(byte[])); user.Avatar = bytesAvatar; //将密码转为hash保存到数据库 user.Password = PasswordStorage.CreateHash(TxtPwd.Text.Trim()); retDR = MessageBox.Show("您确定注册?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (retDR == DialogResult.Yes) { try { SQLExecute Excute = new SQLExecute(); ret = Excute.InsertUserInfo(user); if (ret > 0) { MessageBox.Show("注册成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("请登录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtID.Text = string.Empty; TxtID.Focus(); } } else { //用户选择了不注册, 就什么都不干 } }
private void Find_Click(object sender, EventArgs e) { if (CK == 0) { string strQuery = " SELECT password " + " FROM member " + " WHERE id = @id " + " AND question = @question " + " AND answer = @answer; "; try { using (MySqlConnection conn = new MySqlConnection(strConnString)) { conn.Open(); //MetroMessageBox.Show(this, $"DB접속성공!!"); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = strQuery; MySqlParameter paramUserId = new MySqlParameter("@id", MySqlDbType.VarChar, 45); paramUserId.Value = TxtID.Text.Trim(); // 공백 넣는 경우가 아주 많기때문에 cmd.Parameters.Add(paramUserId); MySqlParameter paramQuestion = new MySqlParameter("@question", MySqlDbType.VarChar, 45); paramQuestion.Value = CboQ.SelectedItem.ToString(); cmd.Parameters.Add(paramQuestion); MySqlParameter paramAnswer = new MySqlParameter("@answer", MySqlDbType.VarChar, 45); paramAnswer.Value = txtA.Text.Trim(); cmd.Parameters.Add(paramAnswer); //MySqlDataReader reader = cmd.ExecuteReader(); //reader.Read(); cmd.ExecuteNonQuery(); string PW = cmd.ExecuteScalar().ToString(); if (string.IsNullOrEmpty(PW)) { MessageBox.Show(this, "질문과 답을 정확히 입력하세요", "로그인실패", MessageBoxButtons.OK, MessageBoxIcon.Error); txtA.Text = string.Empty; txtA.Focus(); return; } else { //var md5Hash = MD5.Create(); //var decryptoPassword = Commons.VerifyMd5Hash(md5Hash, PW); //PW = decryptoPassword; var res = MessageBox.Show("비번을 새로 입력", "새 비번", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { id = TxtID.Text.Trim(); ChangePW(); } //joinForm.FormClosed += new FormClosedEventHandler(childForm_Closed); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { if (string.IsNullOrEmpty(TxtID.Text) || string.IsNullOrEmpty(txtA.Text) || TxtID.Text != txtA.Text) { MessageBox.Show("새 비번을 정확히 적어주세요"); TxtID.Text = txtA.Text = null; TxtID.Focus(); } else { string strQuery = " UPDATE omok.member " + " SET " + " password = @password " + " WHERE NO = " + " (SELECT temp.NO FROM " + " (SELECT NO " + " FROM omok.member " + " WHERE id= @id) as temp); "; using (MySqlConnection conn = new MySqlConnection(strConnString)) { conn.Open(); //MetroMessageBox.Show(this, $"DB접속성공!!"); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = conn; cmd.CommandText = strQuery; MySqlParameter paramPW = new MySqlParameter("@password", MySqlDbType.VarChar, 45); string PW = TxtID.Text.Trim(); var md5Hash = MD5.Create(); var cryptoPassword = Commons.GetMd5Hash(md5Hash, TxtID.Text.Trim()); paramPW.Value = cryptoPassword; MySqlParameter paramid = new MySqlParameter("@id", MySqlDbType.VarChar, 45); paramid.Value = id; cmd.Parameters.Add(paramid); cmd.Parameters.Add(paramPW); cmd.ExecuteNonQuery(); } var res = MessageBox.Show("새 비번이 바뀌었습니다.", "비번", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (res == DialogResult.Yes) { Hide(); LoginForm loginForm = new LoginForm(); loginForm.Show(); } } } }
private void ViewMode() { switch (_pMode) { case "ADD": grButton1.Enabled = false; dataGridView1.Enabled = false; this.Height = 440; DesFor.ColorChange(ref btnAdd); #region "Load Text Box Clear" TxtID.Text = ""; TxtName.Text = ""; txtDiaChi.Text = ""; TxtSDT.Text = ""; txtEmail.Text = ""; cbbLoai.Text = ""; txtTThai.Text = "1"; txtTThai.Enabled = false; TxtID.Enabled = false; #endregion TxtID.Focus(); DesFor.AlignCenterToScreen(); break; case "FIND": grButton1.Enabled = false; dataGridView1.Enabled = false; this.Height = 440; DesFor.ColorChange(ref btnFind); #region "Load Text Box Clear" TxtID.Text = ""; TxtName.Text = ""; txtDiaChi.Text = ""; TxtSDT.Text = ""; txtEmail.Text = ""; cbbLoai.Text = ""; txtTThai.Text = ""; txtTThai.Enabled = true; TxtID.Enabled = true; #endregion TxtID.Focus(); DesFor.AlignCenterToScreen(); break; case "EDIT": grButton1.Enabled = false; dataGridView1.Enabled = false; this.Height = 440; DesFor.ColorChange(ref btnEdit); #region "Load Text Box" TxtID.Text = dataGridView1.CurrentRow.Cells["MA_KH"].Value.ToString(); TxtName.Text = dataGridView1.CurrentRow.Cells["TEN_KH"].Value.ToString(); txtDiaChi.Text = dataGridView1.CurrentRow.Cells["DIA_CHI"].Value.ToString(); TxtSDT.Text = dataGridView1.CurrentRow.Cells["SDT"].Value.ToString(); txtEmail.Text = dataGridView1.CurrentRow.Cells["EMAIL"].Value.ToString(); cbbLoai.Text = dataGridView1.CurrentRow.Cells["LOAI"].Value.ToString(); txtTThai.Text = dataGridView1.CurrentRow.Cells["TTHAI"].Value.ToString(); TxtID.Enabled = false; txtTThai.Enabled = false; #endregion TxtName.Focus(); DesFor.AlignCenterToScreen(); break; case "": grButton1.Enabled = true; dataGridView1.Enabled = true; #region "Load Text Box Clear" TxtID.Text = ""; TxtName.Text = ""; txtDiaChi.Text = ""; TxtSDT.Text = ""; txtEmail.Text = ""; cbbLoai.Text = ""; txtTThai.Text = ""; TxtID.Enabled = true; txtTThai.Enabled = true; #endregion this.Height = 336; DesFor.AlignCenterToScreen(); break; default: break; } }
private void InsertDataToDB() { string strQuery = "INSERT INTO member " + " (id, password, question, answer) " + " VALUES " + " (@id, @password, @question, @answer); "; if (txtPassword.Text.Trim() != txtPWCHECK.Text.Trim()) { MessageBox.Show("비번이 같지 않습니다."); txtPassword.Text = txtPWCHECK.Text = null; txtPassword.Focus(); } else if (string.IsNullOrEmpty(txtPassword.Text) || string.IsNullOrEmpty(txtPWCHECK.Text) || string.IsNullOrEmpty(Txt.Text)) { MessageBox.Show("아이디 비번을 채워주세요."); TxtID.Text = txtPassword.Text = txtPWCHECK.Text = null; TxtID.Focus(); } else if (CboQ.SelectedIndex == 0 || string.IsNullOrEmpty(txtA.Text)) { MessageBox.Show("질문과 답을 해주세요."); CboQ.Focus(); } else { using (MySqlConnection conn = new MySqlConnection(strConnString)) { conn.Open(); string PW; MySqlCommand cmd = new MySqlCommand(strQuery, conn); MySqlParameter paramId = new MySqlParameter("@id", MySqlDbType.VarChar, 45); paramId.Value = TxtID.Text.Trim().ToString(); cmd.Parameters.Add(paramId); MySqlParameter paramPassword = new MySqlParameter("@password", MySqlDbType.VarChar, 45); PW = txtPassword.Text.Trim(); var md5Hash = MD5.Create(); var cryptoPassword = Commons.GetMd5Hash(md5Hash, txtPassword.Text.Trim()); paramPassword.Value = cryptoPassword; cmd.Parameters.Add(paramPassword); MySqlParameter paramQuestion = new MySqlParameter("@question", MySqlDbType.VarChar, 45); paramQuestion.Value = CboQ.SelectedItem.ToString(); cmd.Parameters.Add(paramQuestion); MySqlParameter paramAnswer = new MySqlParameter("@answer", MySqlDbType.VarChar, 45); paramAnswer.Value = txtA.Text.Trim(); cmd.Parameters.Add(paramAnswer); cmd.ExecuteNonQuery(); } InsertDataToDB1(); MessageBox.Show("가입되었습니다."); Hide(); LoginForm loginForm = new LoginForm(); loginForm.Show(); } }