private void btnAgregarTipoLicencia_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txtNúmeroLicencia.Text) || string.IsNullOrEmpty(txtDescripcion.Text)) { MessageBox.Show("Campos son requeridos"); } else { if (Validaciones.EsNumerico(txtNúmeroLicencia.Text)) { TipoLicencia tl = new TipoLicencia() { NROLICENCIA = Convert.ToInt32(txtNúmeroLicencia.Text), FECHA_VENCIMIENTO = Convert.ToDateTime(mdt_fechavencimiento.Value), FECHA_EXPEDICION = Convert.ToDateTime(mdt_fechaExpedicion.Value), DESCRIPCION = txtDescripcion.Text }; Singleton.optipolicencia.insertarTipoLicencia(tl); txtNúmeroLicencia.Text = string.Empty; mdt_fechaExpedicion.Text = string.Empty; mdt_fechavencimiento.Text = string.Empty; txtDescripcion.Text = string.Empty; MessageBox.Show("Tipo licencia insertado", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch { } }
//GUARDAR TIPO LICENCIA public JsonResult GuardarTipoLicencia(List <TipoLicencia> dataToProcess) { TipoLicencia Movil = new TipoLicencia(); foreach (var item in dataToProcess) { Movil.Cod_Licencia = item.Cod_Licencia; Movil.Nom_Licencia = item.Nom_Licencia; Movil.Descripcion = item.Descripcion; Movil.User_Log = item.User_Log; //LLENADO DE BD string constr = conexion; using (MySqlConnection con = new MySqlConnection(constr)) { con.Open(); MySqlCommand cmd = new MySqlCommand(bd + "web_pgraba_tip_licencias", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("p_Cod_Licencia", Movil.Cod_Licencia); cmd.Parameters.AddWithValue("p_Nom_Licencia", Movil.Nom_Licencia); cmd.Parameters.AddWithValue("p_Descripcion", Movil.Descripcion); cmd.Parameters.AddWithValue("p_User_Log", Movil.User_Log); cmd.ExecuteNonQuery(); con.Close(); } } return(Json(dataToProcess, JsonRequestBehavior.AllowGet)); }
public DataSet ConsultarTipoLicencia(TipoLicencia obj) { try { return(ClsEmpleadoLicencia.ConsultarTipoLicencia(obj)); } catch (Exception) { return(null); } }
public void insertarTipoLicencia(TipoLicencia tl) { OracleConnection ora = new OracleConnection("DATA SOURCE=TOSHIBA-PC:1521/XE;PASSWORD=ORACLE01;USER ID=DESARROLLO"); ora.Open(); OracleCommand comando = new OracleCommand("INSERTARTIPOLICENCIA", ora); comando.CommandType = CommandType.StoredProcedure; comando.Parameters.Add("NROLICENCIA", OracleDbType.Int32).Value = tl.NROLICENCIA; comando.Parameters.Add("FECHA_VENCIMIENTO", OracleDbType.Date).Value = tl.FECHA_VENCIMIENTO; comando.Parameters.Add("FECHA_EXPEDICION", OracleDbType.Date).Value = tl.FECHA_EXPEDICION; comando.Parameters.Add("DESCRIPCION", OracleDbType.Varchar2).Value = tl.DESCRIPCION; comando.ExecuteNonQuery(); }
public static DataSet ConsultarTipoLicencia(TipoLicencia obj) { try { var comando = new SqlCommand(); _conexion = AccesoDatos.Validar_Conexion("SisAsepba", ref _mensaje); if (_conexion == null) { _mensaje = "Error al encontrar la conexion proporcionada"; return(null); } else { AccesoDatos.Conectar(_conexion, ref _mensaje); comando.Connection = _conexion; comando.CommandText = SpConexion2; comando.Parameters.AddWithValue("@@Accion", obj.Accion); comando.Parameters.AddWithValue("@@IdTipoLicencia", obj.IdTipoLicencia); comando.Parameters.AddWithValue("@@Alias", obj.Alias); comando.Parameters.AddWithValue("@@Descripcion", obj.Descripcion); comando.Parameters.AddWithValue("@@Estado", obj.Estado); comando.Parameters.AddWithValue("@@UsuarioCreacion", obj.UsuarioCreacion); comando.Parameters.AddWithValue("@@FechaCreacion", obj.FechaCreacion); comando.Parameters.AddWithValue("@@UsuarioModificacion", obj.UsuarioModificacion); comando.Parameters.AddWithValue("@@FechaModificacion", obj.FechaModificacion); var resultado = AccesoDatos.LlenarDataTable(comando, ref _mensaje); var ds = new DataSet(); ds.Tables.Add(resultado.Copy()); return(ds); } } catch (Exception ex) { _mensaje = ex.Message; return(null); } finally { AccesoDatos.Desconectar(_conexion, ref _mensaje); } }
private void btnAgregarPilotoLicencia_Click(object sender, EventArgs e) { try { Piloto pilo = new Piloto(); TipoLicencia tl = new TipoLicencia(); pilo = Singleton.opPiloto.buscarPilotoPorNombre(cbonombrePiloto.Text); var idpilo = pilo.idPiloto.ToString(); tl = Singleton.optipolicencia.buscarPorDescripcion(cboTipoLicencia.Text); var idtl = tl.IDTIPOLICENCIA.ToString(); PilotoLicencia pl = new PilotoLicencia() { IDPILOTO = Convert.ToInt32(idpilo), IDTIPOLICENCIA = Convert.ToInt32(idtl) }; Singleton.opPilotoLicencia.insertarPilotoLicencia(pl); MessageBox.Show("Piloto licencia insertado correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { } }
public void ActualizarTipoLicencia(TipoLicencia tl) { _db.Update(tl); }