private void CmdPro_Click(object sender, EventArgs e) { if (TxtFchIni.Text == " ") { MessageBox.Show("¡ No ha especificado la fecha de inicio !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); TxtFchIni.Focus(); return; } if (TxtFchFin.Text == " ") { MessageBox.Show("¡ No ha especificado la fecha de termino !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); TxtFchFin.Focus(); return; } objRegistro.mysConec = mysConec; if (objRegistro.PuedeImportarTareasParaPlanillaDestajo(STU_SISTEMA.EMPRESAID, TxtFchIni.Text, TxtFchFin.Text, Convert.ToInt32(CboLocal.SelectedValue)) == false) { MessageBox.Show("¡ No hay tareas enviadas a produccion en el periodo especificado, vaya al modulos de tareas y chequee tareas a produccion !", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); TxtObs.Focus(); return; } bool booResultado = false; if (CamposOK() == false) { return; } AsignarEntidad(); if (n_QueHace == 1) { booResultado = objRegistro.Insertar(entCargos); } if (n_QueHace == 2) { booResultado = objRegistro.Actualizar(entCargos); } if (booResultado == true) { if (objRegistro.Listar(STU_SISTEMA.EMPRESAID, STU_SISTEMA.ANOTRABAJO, STU_SISTEMA.MESTRABAJO) == true) { dtListar = objRegistro.dtLista; } // MOSTRAMOS LOS DATOS EN LA GRILLA ListarItems(); if (n_QueHace == 1) { MessageBox.Show("¡ La planilla se genero con exito ! ", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } else { MessageBox.Show("¡ La planilla se actualizo con exito ! ", "", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } Cancelar(); } }
private void btnCadVeiculo_Click(object sender, EventArgs e) { ModeloVeiculo modeloVeiculo = new ModeloVeiculo(); Cadastro cadastro = new Cadastro(); try { int qtdPortas = int.Parse(txtQtdPortas.Text); if (string.IsNullOrEmpty(txtPlaca.Text)) { MessageBox.Show("A placa do veículo é obrigatória!", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPlaca.Focus(); } else if (string.IsNullOrEmpty(cbModelo.Text)) { MessageBox.Show("O modelo do veículo é Obrigatório!", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Error); cbModelo.Focus(); } else if (string.IsNullOrEmpty(cbCor.Text)) { MessageBox.Show("A cor do veículo é Obrigatória!", "ATENÇÃO", MessageBoxButtons.OK, MessageBoxIcon.Error); cbCor.Focus(); } else { modeloVeiculo.Placa = txtPlaca.Text; modeloVeiculo.Modelo = Convert.ToInt32(cbModelo.SelectedValue); modeloVeiculo.Cor = Convert.ToInt32(cbCor.SelectedValue); modeloVeiculo.Ano = int.Parse(txtAno.Text); modeloVeiculo.AnoModelo = int.Parse(txtAnoModelo.Text); modeloVeiculo.Cambio = Convert.ToInt32(cbCambio.SelectedValue); modeloVeiculo.Combustivel = Convert.ToInt32(cbCombustivel.SelectedValue); modeloVeiculo.KmRodado = int.Parse(txtKmRodado.Text); modeloVeiculo.Categoria = Convert.ToInt32(cbCategoria.SelectedValue); modeloVeiculo.Segmento = Convert.ToInt32(cbSegmento.SelectedValue); modeloVeiculo.Porta = int.Parse(txtQtdPortas.Text); modeloVeiculo.Obs = TxtObs.Text; cadastro.CadastraVeiculo(modeloVeiculo); var resposta = MessageBox.Show("Dados cadastrados com Sucesso. " + "Deseja adicionar outro ?", "Novo Registro", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (resposta == DialogResult.Yes) { txtAno.Clear(); txtAnoModelo.Clear(); txtKmRodado.Clear(); TxtObs.Clear(); txtPlaca.Clear(); txtQtdPortas.Clear(); cbCambio.ResetText(); cbCategoria.ResetText(); cbCombustivel.ResetText(); cbCor.ResetText(); cbModelo.ResetText(); cbSegmento.ResetText(); } else { this.Close(); } } } catch (FormatException) { MessageBox.Show("Valor informado inválido!", "ATENÇÃO!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }