private void ObtenerDatosControles() { ObjChofer = new E_Chofer(); if (TxtChoferID.Text != "") { ObjChofer.ChoferID = Convert.ToInt32(TxtChoferID.Text); } ObjChofer.NomChofer = TxtNomChofer.Text; ObjChofer.ApeChofer = TxtApeChofer.Text; ObjChofer.DNI = TxtDNI.Text; ObjChofer.Licencia = TxtLicencia.Text; if (CboEmpresa.SelectedIndex != -1) { ObjChofer.EmpresaID = CboEmpresa.SelectedValue.ToString(); } ObjChofer.UsuarioID = AppSettings.UserID; }
public void UpdateChofer(E_Chofer ObjChofer, string Tipo) { SqlDatabase SqlClient = new SqlDatabase(connectionString); DbConnection tCnn; tCnn = SqlClient.CreateConnection(); tCnn.Open(); DbTransaction tran = tCnn.BeginTransaction(); try { DbCommand SqlCommand = SqlClient.GetStoredProcCommand("[Empresa].[Usp_UpdateChofer]"); SqlClient.AddInParameter(SqlCommand, "@ChoferID", SqlDbType.Int, ObjChofer.ChoferID); SqlClient.AddInParameter(SqlCommand, "@NomChofer", SqlDbType.VarChar, ObjChofer.NomChofer); SqlClient.AddInParameter(SqlCommand, "@ApeChofer", SqlDbType.VarChar, ObjChofer.ApeChofer); SqlClient.AddInParameter(SqlCommand, "@DNI", SqlDbType.Char, ObjChofer.DNI); SqlClient.AddInParameter(SqlCommand, "@Licencia", SqlDbType.VarChar, ObjChofer.Licencia); SqlClient.AddInParameter(SqlCommand, "@EmpresaID", SqlDbType.Char, ObjChofer.EmpresaID); SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjChofer.UsuarioID); SqlClient.AddInParameter(SqlCommand, "@Tipo", SqlDbType.Char, Tipo); SqlClient.ExecuteNonQuery(SqlCommand, tran); tran.Commit(); tCnn.Close(); tCnn.Dispose(); SqlCommand.Dispose(); } catch (Exception ex) { tran.Rollback(); throw new Exception(ex.Message); } }
public void InsertChofer(E_Chofer ObjChofer) { CD_Chofer objCD_Chofer = new CD_Chofer(AppSettings.GetConnectionString); objCD_Chofer.InsertChofer(ObjChofer); }
public void UpdateChofer(E_Chofer ObjChofer, string Tipo) { CD_Chofer objCD_Chofer = new CD_Chofer(AppSettings.GetConnectionString); objCD_Chofer.UpdateChofer(ObjChofer, Tipo); }