public void UpdateGenerico(E_Generico ObjGenerico, string Tipo) { SqlDatabase SqlClient = new SqlDatabase(connectionString); DbConnection tCnn; tCnn = SqlClient.CreateConnection(); tCnn.Open(); DbTransaction tran = tCnn.BeginTransaction(); try { DbCommand SqlCommand = SqlClient.GetStoredProcCommand("[Producto].[Usp_UpdateGenerico]"); SqlClient.AddInParameter(SqlCommand, "@GenericoID", SqlDbType.Char, ObjGenerico.GenericoID); SqlClient.AddInParameter(SqlCommand, "@NomGenerico", SqlDbType.VarChar, ObjGenerico.NomGenerico); SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjGenerico.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 string InsertGenerico(E_Generico ObjGenerico) { string GenericoID = ""; SqlDatabase SqlClient = new SqlDatabase(connectionString); DbConnection tCnn; tCnn = SqlClient.CreateConnection(); tCnn.Open(); DbTransaction tran = tCnn.BeginTransaction(); try { DbCommand SqlCommand = SqlClient.GetStoredProcCommand("[Producto].[Usp_InsertGenerico]"); SqlClient.AddInParameter(SqlCommand, "@NomGenerico", SqlDbType.VarChar, ObjGenerico.NomGenerico); SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjGenerico.UsuarioID); GenericoID = Convert.ToString(SqlClient.ExecuteScalar(SqlCommand, tran)); tran.Commit(); tCnn.Close(); tCnn.Dispose(); SqlCommand.Dispose(); } catch (Exception ex) { tran.Rollback(); throw new Exception(ex.Message); } return(GenericoID); }
private void ObtenerDatosControles() { ObjGenerico = new E_Generico(); ObjGenerico.GenericoID = TxtGenericoID.Text; ObjGenerico.NomGenerico = TxtNomGenerico.Text; ObjGenerico.UsuarioID = AppSettings.UserID; }
public string InsertGenerico(E_Generico ObjGenerico) { string GenericoID = ""; CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString); GenericoID = ObjCD_Producto.InsertGenerico(ObjGenerico); return(GenericoID); }
public void UpdateEnvase(E_Generico ObjGenerico, string Tipo) { CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString); ObjCD_Producto.UpdateGenerico(ObjGenerico, Tipo); }