private void Abrir_Limpiar(object sender, RoutedEventArgs e) { TextBoxCodigo.Clear(); TextBoxNombre.Clear(); TextBoxID.Text = ""; TextContrato.Clear(); TextTelefono.Clear(); TextEmail.Clear(); TextEmpre.Clear(); TextAgente.Clear(); }
public void Clear() { TextUsuario.Clear(); TextSenha.Clear(); TextConfirma.Clear(); TextNome.Clear(); TextTelefone.Clear(); TextCEP.Clear(); labVerifica.Content = "Status:"; TextEmail.Clear(); Data.SelectedDate = DateTime.Now; TextCnpj.Clear(); }
public void Clear() { TextUsuario.Clear(); TextPassSenha.Clear(); TextPassConfirma.Clear(); TextNome.Clear(); TextTelefone.Clear(); TextCEP.Clear(); labVerifica.Content = "Status:"; TextEmail.Clear(); Data.SelectedDate = DateTime.Now; RadioM.IsChecked = true; RadioF.IsChecked = false; }
// 确定按钮 private void Ok_Click(object sender, EventArgs e) { string username = TextAccount.Text.Trim(); string password = TextPasswd.Text.Trim(); string sex = TextSex.Text.Trim(); string birthday = TextBirthday.Text.Trim(); string telephone = TextPhone.Text.Trim(); string email = TextEmail.Text.Trim(); String2NULL(ref username); String2NULL(ref password); String2NULL(ref sex); String2NULL(ref birthday); String2NULL(ref telephone); String2NULL(ref email); #region 查询数据库当前账号是否被注册过 sqlCon.Open(); string sql_cmd = String.Format("select * from [user] where username={0}", username); SqlDataAdapter sda = new SqlDataAdapter(sql_cmd, sqlCon); DataSet ds = new DataSet(); sda.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { MessageBox.Show("当前账户名已被使用,请重新输入!"); } else { sql_cmd = String.Format("insert into [user] values({0},{1},{2},{3},{4},{5},0,0,NULL,NULL)", username, password, sex, birthday, telephone, email); SqlCommand SqlCmd = new SqlCommand(sql_cmd, sqlCon); SqlCmd.ExecuteNonQuery(); MessageBox.Show("账号创建成功!"); } TextAccount.Clear(); TextPasswd.Clear(); TextSex.Clear(); TextBirthday.Clear(); TextPhone.Clear(); TextEmail.Clear(); TextAccount.Focus(); sqlCon.Close(); #endregion }