private void BtnPesquisarL_Click(object sender, EventArgs e) { if (TxtId.Text != " ") { try { livro = Funcoes.PesquisarLivro(TxtId.Text); if (livro != null) { TxtNome.Text = livro.Nome; TxtAutor.Text = livro.Autor; TxtEditora.Text = livro.Editora; } else { MessageBox.Show("Livro não encontrado!", "Cadastro de livros", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); ResetaForm(); TxtId.Focus(); } } catch (Exception ex) { MessageBox.Show("Ocorreu um erro na pesquisa do livro!" + "\n\nErro: " + ex.Message, "Cadastro de Livro", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void BtnAdicionar_Click(object sender, EventArgs e) { //OK ADICIONANDO NA LISTA ProdutoController produto = new ProdutoController(); ProdutoModel produtoM = new ProdutoModel(); produtoM = produto.ExibirProduto(TxtId.Text); if (produtoM.Nome == null) { MessageBox.Show("Produto não encontrado"); } else { LBITEM.Items.Add(produtoM.Nome); //CALCUAR POR QUANTIDADE VendaController v = new VendaController(); VT += v.CalcularPorQuantidade(produtoM.Nome, TxtNumQuant.Value); TxtTotal.Text = Convert.ToString(VT); TxtId.Text = ""; TxtId.Focus(); //MANDA PRO BANCO TEMP produto.PreparaBanco(produtoM.Nome, TxtNumQuant.Value); } }
private void BtnBuscar_Click_1(object sender, EventArgs e) { const string buscar = "SELECT * FROM Vendedores WHERE IdVendedor=@Id"; var cmdBuscar = new OleDbCommand(buscar, Cnx) { CommandType = CommandType.Text }; cmdBuscar.Parameters.AddWithValue("@Id", TxtId.Text); Cnx.Open(); var lectura = cmdBuscar.ExecuteReader(); if (lectura != null && lectura.Read() == true) { TxtNombre.Text = lectura[1].ToString(); TxtFechaAlta.Text = lectura[2].ToString(); TxtNIF.Text = lectura[3].ToString(); TxtFechaNac.Text = lectura[4].ToString(); TxtDireccion.Text = lectura[5].ToString(); TxtPoblacion.Text = lectura[6].ToString(); TxtTelefono.Text = lectura[7].ToString(); TxtEstadoCivil.Text = lectura[8].ToString(); pictureBox1.ImageLocation = lectura[9].ToString(); } else { MessageBox.Show(@"Los Datos a Buscar No Estan Registrados"); TxtId.Clear(); TxtId.Focus(); } Cnx.Close(); }
private void BtnEliminar_Click(object sender, EventArgs e) { try { const string eliminar = "DELETE FROM Vendedores WHERE IdVendedor=@Id"; var cmd = new OleDbCommand(eliminar, Cnx) { CommandType = CommandType.Text }; cmd.Parameters.AddWithValue("@Id", TxtId.Text); Cnx.Open(); cmd.ExecuteNonQuery(); Cnx.Close(); MessageBox.Show(@"El Contacto Fue Eliminado...."); } catch (Exception ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); } TxtId.Clear(); TxtNombre.Clear(); TxtFechaAlta.Clear(); TxtNIF.Clear(); TxtFechaNac.Clear(); TxtDireccion.Clear(); TxtPoblacion.Clear(); TxtTelefono.Clear(); TxtEstadoCivil.Clear(); pictureBox1.ImageLocation = ""; TxtId.Focus(); }
private void Login_Load(object sender, EventArgs e) { (new ShowHelper()).ShowDialog(); var chkDoNotLogin = GetConfigData("ChkDoNotLogin"); ChkDoNotLogin.Checked = chkDoNotLogin == true.ToString(); var idSave = GetConfigData("CbIdSave"); if (idSave == true.ToString()) { CbIdSave.Checked = true; var id = GetConfigData("TxtId"); if (!string.IsNullOrEmpty(id)) { TxtId.Text = id; } else { TxtId.Text = IdText; } } else { TxtId.Text = IdText; } TxtPw.Text = PwText; TxtId.Focus(); TxtPw.Focus(); TxtId.Focus(); }
private void BtnAdicionar_Click(object sender, EventArgs e) { //OK ADICIONANDO NA LISTA LBITEM.Items.Clear(); VendaController venda = new VendaController(); VendaModel vendaM = new VendaModel(); vendaM = venda.ListarVendasPendentesPorId(TxtId.Text); if (String.IsNullOrEmpty(vendaM.ValorPendente)) { MessageBox.Show("Venda não encontrada"); } else { LBITEM.Items.Add(vendaM.ValorPendente); IdParaDecrementar = Convert.ToString(vendaM.Id); TxtId.Text = ""; TxtId.Focus(); //CALCULAR TOTAL Decimal VT = 0; VT = Convert.ToDecimal(vendaM.ValorPendente); TxtTotal.Text = Convert.ToString(VT); } }
private bool ValidateInput() { if (TxtLoginId.Text == "") { MessageBox.Show("请输入用户名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginId.Focus(); return(false); } if (TxtLoginPwdAgain.Text == "") { MessageBox.Show("请输入密码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginPwdAgain.Focus(); return(false); } if (TxtLoginPwdAgain.Text == "") { MessageBox.Show("请输入密码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginPwdAgain.Focus(); return(false); } if (!(TxtLoginPwd.Text == TxtLoginPwdAgain.Text)) { MessageBox.Show("两次输入密码不一致", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtLoginPwdAgain.Focus(); return(false); } if (!RadioActive.Checked && !RadioInActive.Checked) { MessageBox.Show("请设置用户状态", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); RadioActive.Focus(); return(false); } if (TxtStudentName.Text == "") { MessageBox.Show("请输入学员姓名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtStudentName.Focus(); return(false); } if (TxtId.Text == "") { MessageBox.Show("请输入学员学号", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtId.Focus(); return(false); } if (!RadioMale.Checked && !RadioFemale.Checked) { MessageBox.Show("请选择学员性别", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); RadioMale.Focus(); return(false); } if (CboClass.Text == "") { MessageBox.Show("请选择学员班级", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CboClass.Focus(); return(false); } return(true); }
private void MostraTodos() { BtnNovoL.Enabled = true; btnGravarl.Enabled = true; BtnCancelarL.Enabled = true; btnExcluirL.Enabled = true; BtnVoltarL.Enabled = true; BtnPesquisarL.Enabled = true; TxtId.Enabled = true; TxtId.Focus(); }
private void BtNuevo_Click(object sender, EventArgs e) { //Limpiar de manera rapida foreach (Control c in this.Controls) { if (c is TextBox) { c.Text = ""; c.Enabled = true; //Enfoco en el primer TextBox TxtId.Focus(); } } }
private void BtnLimpiar_Click_1(object sender, EventArgs e) { TxtId.Clear(); TxtNombre.Clear(); TxtFechaAlta.Clear(); TxtNIF.Clear(); TxtFechaNac.Clear(); TxtDireccion.Clear(); TxtPoblacion.Clear(); TxtTelefono.Clear(); TxtEstadoCivil.Clear(); pictureBox1.ImageLocation = ""; TxtId.Focus(); }
private void checkValues() { bool emailCheck = checkValiditEmail(TxtEmail.Text); if (emailCheck == false) { TxtEmail.Focus(); showErrorMwssage(3010); return; } if (TxtPhone.Text.Length < 9 || TxtPhone.Text.Length > 11) { TxtPhone.Focus(); showErrorMwssage(3011); return; } string m_PERID = TxtId.Text; char[] digits = m_PERID.PadLeft(9, '0').ToCharArray(); int[] oneTwo = { 1, 2, 1, 2, 1, 2, 1, 2, 1 }; int[] multiply = new int[9]; int[] oneDigit = new int[9]; for (int i = 0; i < 9; i++) { multiply[i] = Convert.ToInt32(digits[i].ToString()) * oneTwo[i]; } for (int i = 0; i < 9; i++) { oneDigit[i] = (int)(multiply[i] / 10) + multiply[i] % 10; } int sum = 0; for (int i = 0; i < 9; i++) { sum += oneDigit[i]; } if (sum % 10 != 0) { showErrorMwssage(3012); TxtId.Focus(); return; } }
private void BtnAgregar_Click(object sender, EventArgs e) { try { const string insertar = @"Insert Into Vendedores Values (@IdVendedor, @NombreVendedor, @FechaAlta, @NIF, @FechaNac,@Direccion,@Poblacion,@Telefono,@EstadoCivil,@Fotografia)"; var cmd = new OleDbCommand(insertar, Cnx) { CommandType = CommandType.Text }; cmd.Parameters.AddWithValue("@IdVendedor", TxtId.Text); cmd.Parameters.AddWithValue("@NombreVendedor", TxtNombre.Text); cmd.Parameters.AddWithValue("@FechaAlta", TxtFechaAlta.Text); cmd.Parameters.AddWithValue("@NIF", TxtNIF.Text); cmd.Parameters.AddWithValue("@FechaNac", TxtFechaNac.Text); cmd.Parameters.AddWithValue("@Direccion", TxtDireccion.Text); cmd.Parameters.AddWithValue("@Poblacion", TxtPoblacion.Text); cmd.Parameters.AddWithValue("@Telefono", TxtTelefono.Text); cmd.Parameters.AddWithValue("@EstadoCivil", TxtEstadoCivil.Text); pictureBox1.ImageLocation = StrFileName; cmd.Parameters.AddWithValue("@Fotografia", pictureBox1.ImageLocation); Cnx.Open(); cmd.ExecuteNonQuery(); Cnx.Close(); MessageBox.Show(@"El Contacto Fue Registrado"); } catch (Exception ex) { MessageBox.Show(@"La Clave a Registrar Ya Existe", ex.Message); } TxtId.Clear(); TxtNombre.Clear(); TxtFechaAlta.Clear(); TxtNIF.Clear(); TxtFechaNac.Clear(); TxtDireccion.Clear(); TxtPoblacion.Clear(); TxtTelefono.Clear(); TxtEstadoCivil.Clear(); pictureBox1.ImageLocation = ""; TxtId.Focus(); }
private void BtnModificar_Click(object sender, EventArgs e) { try { const string actualizar = @"UPDATE Vendedores SET IdVendedor=@Id, NombreVendedor=@Nombre ,FechaAlta = @FechaAlta, NIF = @NIF, FechaNac = @FechaNac, Direccion = @Direccion, Poblacion = @Poblacion, Telefon = @Telefon, EstalCivil = @EstalCivil,Fotografia = @Fotografia WHERE IdVendedor = @Id"; var cmd = new OleDbCommand(actualizar, Cnx) { CommandType = CommandType.Text }; cmd.Parameters.AddWithValue("@Id", TxtId.Text); cmd.Parameters.AddWithValue("@Nombre", TxtNombre.Text); cmd.Parameters.AddWithValue("@FechaAlta", TxtFechaAlta.Text); cmd.Parameters.AddWithValue("@NIF", TxtNIF.Text); cmd.Parameters.AddWithValue("@FechaNac", TxtFechaNac.Text); cmd.Parameters.AddWithValue("@Direccion", TxtDireccion.Text); cmd.Parameters.AddWithValue("@Poblacion", TxtPoblacion.Text); cmd.Parameters.AddWithValue("@Telefon", TxtTelefono.Text); cmd.Parameters.AddWithValue("@EstalCivil", TxtEstadoCivil.Text); cmd.Parameters.AddWithValue("@Fotografia", pictureBox1.ImageLocation); Cnx.Open(); cmd.ExecuteNonQuery(); Cnx.Close(); MessageBox.Show(@"Los Datos Del Contacto Fueron Actualizados"); } catch (Exception ex) { MessageBox.Show(ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); } TxtId.Clear(); TxtNombre.Clear(); TxtFechaAlta.Clear(); TxtNIF.Clear(); TxtFechaNac.Clear(); TxtDireccion.Clear(); TxtPoblacion.Clear(); TxtTelefono.Clear(); TxtEstadoCivil.Clear(); pictureBox1.ImageLocation = ""; TxtId.Focus(); }
private void btnGravarl_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(TxtNome.Text)) { MessageBox.Show("Informe o nome do Livro!", "Cadastro de livro", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtNome.Focus(); return; } else if (String.IsNullOrEmpty(TxtAutor.Text)) { MessageBox.Show("Informe o nome do Autor!", "Cadastro de livro", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtNome.Focus(); return; } else if (String.IsNullOrEmpty(TxtEditora.Text)) { MessageBox.Show("Informe o nome da editora!", "Cadastro de livro", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtNome.Focus(); return; } else { livro.Nome = TxtNome.Text; livro.Autor = TxtAutor.Text; livro.Editora = TxtEditora.Text; Funcoes.SalvarLivro(livro); MessageBox.Show("Livro salvo com sucesso!", "Cadastro de livros", MessageBoxButtons.OK, MessageBoxIcon.Information); ResetaForm(); novoRegistro = false; MostraTodos(); TxtId.Focus(); } } catch (Exception ex) { MessageBox.Show("Ocorreu um erro ao salvar os dados do livro" + "\n\nErro: " + ex.Message, "Cadastro de livros", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private async void Button_Click(object sender, RoutedEventArgs e) { if (TxtId.IsEnabled) { var apiIdParsed = int.TryParse(TxtId.Text, out var apiId); if (!apiIdParsed) { TxtId.Focus(); TxtId.SelectAll(); return; } LastClient = new TelegramClient(apiId, TxtHash.Text); try { await LastClient.ConnectAsync(); // err here LastAuthHash = await LastClient.SendCodeRequestAsync(TxtPhone.Text); CodePage(); } catch { Button_Click(sender, e); } } else { if (TxtPassword.Visibility != Visibility.Visible) { try { await LastClient.MakeAuthAsync(TxtPhone.Text, LastAuthHash, TxtAuthCode.Text); var win = new WinMain(LastClient); win.Show(); Close(); } catch (CloudPasswordNeededException) { PasswordPage(); } } else { try { var password = await LastClient.GetPasswordSetting(); // err here var password_str = TxtPassword.Text; await LastClient.MakeAuthWithPasswordAsync(password, password_str); var win = new WinMain(LastClient); win.Show(); Close(); } catch { Button_Click(sender, e); } } } }
protected void BtnReg_Click(object sender, EventArgs e) { if (TxtCity.SelectedValue == "-1") { TxtCity.Focus(); showErrorMwssage(4); } else if (DdlLicensCode.SelectedValue == "-1") { DdlLicensCode.Focus(); showErrorMwssage(5); } else { if (GlobFuncs.IsExist(TxtEmail.Text.ToString()) == true) { TxtEmail.Focus(); showErrorMwssage(6); } else if (checkbox1.Checked != true) { showErrorMwssage(7); } else if (TxtName.Text.Length == 0) { TxtName.Focus(); showErrorMwssage(8); } else if (TxtAddress.Text.Length == 0) { TxtAddress.Focus(); showErrorMwssage(9); } else if (TxtId.Text.Length == 0) { TxtId.Focus(); showErrorMwssage(10); } else if (TxtDateOfBirth.Text.Length == 0) { TxtDateOfBirth.Focus(); showErrorMwssage(11); } else if (TxtLicenseNumber.Text.Length == 0) { TxtLicenseNumber.Focus(); showErrorMwssage(12); } else if (TxtDateOfIssuanceLicense.Text.Length == 0) { TxtDateOfIssuanceLicense.Focus(); showErrorMwssage(13); } else if (TxtEmail.Text.Length == 0) { TxtEmail.Focus(); showErrorMwssage(14); } else if (TxtPass.Text.Length == 0) { TxtPass.Focus(); showErrorMwssage(15); } else if (TxtPhone.Text.Length == 0) { TxtPhone.Focus(); showErrorMwssage(16); } else { string pass = GlobFuncs.Hash(TxtPass.Text.ToString()); Users Us = new Users(-1, TxtName.Text.ToString(), TxtAddress.Text.ToString(), int.Parse(TxtCity.Text.ToString()), TxtId.Text.ToString(), DateTime.Parse(TxtDateOfBirth.Text), TxtLicenseNumber.Text.ToString(), int.Parse(DdlLicensCode.Text.ToString()), DateTime.Parse(TxtDateOfIssuanceLicense.Text), TxtEmail.Text.ToString(), pass, TxtPhone.Text.ToString()); person per = new person(); per = Us.RegUser(); sendRegMessage(per.CustomId, 0.ToString(), per.FullName); Session["Person"] = per; Response.Redirect("PrivateArea.aspx"); } } }
private void BtnSearch_Click(object sender, EventArgs e) { if (CboCx.Text == "") { MessageBox.Show("请选择查询类型!", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CboCx.Focus(); } else if (CboCx.Text == "学号") { if (TxtId.Text == "") { MessageBox.Show("请输入学号!", "查询提示", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtId.Focus(); } string sql = string.Format("select distinct studentNo 学号,courseID 课程号,score 成绩,term 学期,Year 学年 from tbscore where studentNo='{0}'", TxtId.Text); DBHelper.conn.Open(); SqlCommand command = new SqlCommand(sql, DBHelper.conn); DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = command; sda.Fill(ds); DataView dv = new DataView(ds.Tables[0]); DGVGrade.DataSource = dv; DBHelper.conn.Close(); } else if (CboCx.Text == "课程") { if (CboCourse.Text == "") { MessageBox.Show("请选择课程!", "查询提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CboCourse.Focus(); } else { string sql1 = string.Format("select courseID from tbcourse where courseName='{0}'", CboCourse.Text); if (DBHelper.conn.State == ConnectionState.Closed) { DBHelper.conn.Open(); } else { DBHelper.conn.Close(); DBHelper.conn.Open(); } SqlCommand command = new SqlCommand(sql1, DBHelper.conn); SqlDataReader datareader = command.ExecuteReader(); while (datareader.Read()) { Status.sql1 = (string)datareader["courseID"]; } DBHelper.conn.Close(); string str = string.Format("select distinct studentNo 学号,courseID 课程号,score 成绩,term 学期,Year 学年 from tbscore where courseID='{0}'", Status.sql1); DBHelper.conn.Open(); SqlCommand cmd = new SqlCommand(str, DBHelper.conn); DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = cmd; sda.Fill(ds); DataView dv = new DataView(ds.Tables[0]); DGVGrade.DataSource = dv; DBHelper.conn.Close(); } } else if (CboCx.Text == "学期") { if (CboTeam.Text == "") { MessageBox.Show("请选择学期", "查询提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CboTeam.Focus(); } else { Status.sql2 = "select distinct studentNo 学号,courseID 课程号,score 成绩,term 学期,Year 学年 from tbscore where term='" + CboTeam.Text.Trim() + "'"; DBHelper.conn.Open(); SqlCommand command = new SqlCommand(Status.sql2, DBHelper.conn); DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = command; sda.Fill(ds); DataView dv = new DataView(ds.Tables[0]); DGVGrade.DataSource = dv; DBHelper.conn.Close(); } } else if (CboCx.Text == "学年") { if (CboYear.Text == "") { MessageBox.Show("请选择学年!", "查询提示", MessageBoxButtons.OK, MessageBoxIcon.Information); CboYear.Focus(); } else { Status.sql3 = "select distinct studentNo 学号,courseID 课程号,score 成绩,term 学期,Year 学年 from tbscore where Year='" + CboYear.Text.Trim() + "'"; DBHelper.conn.Open(); SqlCommand command = new SqlCommand(Status.sql3, DBHelper.conn); DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter(); sda.SelectCommand = command; sda.Fill(ds); DataView dv = new DataView(ds.Tables[0]); DGVGrade.DataSource = dv; DBHelper.conn.Close(); } } }