public void UpdatePresentacion(E_Presentacion ObjPresentacion, 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_UpdatePresentacion]"); SqlClient.AddInParameter(SqlCommand, "@PresentacionID", SqlDbType.Char, ObjPresentacion.PresentacionID); SqlClient.AddInParameter(SqlCommand, "@NomPresentacion", SqlDbType.VarChar, ObjPresentacion.NomPresentacion); SqlClient.AddInParameter(SqlCommand, "@Unidades", SqlDbType.Decimal, ObjPresentacion.Unidades); SqlClient.AddInParameter(SqlCommand, "@UnidadMedidaID", SqlDbType.Char, ObjPresentacion.UnidadMedidaID); SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjPresentacion.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 InsertPresentacion(E_Presentacion ObjPresentacion) { string PresentacionID = ""; SqlDatabase SqlClient = new SqlDatabase(connectionString); DbConnection tCnn; tCnn = SqlClient.CreateConnection(); tCnn.Open(); DbTransaction tran = tCnn.BeginTransaction(); try { DbCommand SqlCommand = SqlClient.GetStoredProcCommand("[Producto].[Usp_InsertPresentacion]"); SqlClient.AddInParameter(SqlCommand, "@NomPresentacion", SqlDbType.VarChar, ObjPresentacion.NomPresentacion); SqlClient.AddInParameter(SqlCommand, "@Unidades", SqlDbType.Decimal, ObjPresentacion.Unidades); SqlClient.AddInParameter(SqlCommand, "@UnidadMedidaID", SqlDbType.Char, ObjPresentacion.UnidadMedidaID); SqlClient.AddInParameter(SqlCommand, "@UsuarioID", SqlDbType.Int, ObjPresentacion.UsuarioID); PresentacionID = 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(PresentacionID); }
public string InsertPresentacion(E_Presentacion ObjPresentacion) { string PresentacionID = ""; CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString); PresentacionID = ObjCD_Producto.InsertPresentacion(ObjPresentacion); return(PresentacionID); }
private void ObtenerDatosControles() { ObjPresentacion = new E_Presentacion(); ObjPresentacion.PresentacionID = TxtPresentacionID.Text; ObjPresentacion.NomPresentacion = TxtNomPresentacion.Text; ObjPresentacion.Unidades = Convert.ToDecimal(TxtUnidades.Text); ObjPresentacion.UnidadMedidaID = CboUM.SelectedValue.ToString(); ObjPresentacion.UsuarioID = AppSettings.UserID; }
//Metodo eliminar presentacion public void EliminarRegistro(E_Presentacion Presentacion) { SqlCommand SqlCmd = new SqlCommand("sp_eliminar_presentacion", Conectar) { CommandType = CommandType.StoredProcedure }; Conectar.Open(); SqlCmd.Parameters.AddWithValue("@id", Presentacion.Id_presentacion); SqlCmd.ExecuteNonQuery(); Conectar.Close(); }
//Metodo Agregar Presentacion public void InsertarRegistro(E_Presentacion Presentacion) { SqlCommand SqlCmd = new SqlCommand("sp_insertar_presentacion", Conectar) { CommandType = CommandType.StoredProcedure }; Conectar.Open(); SqlCmd.Parameters.AddWithValue("@nombre", Presentacion.Nombre); SqlCmd.Parameters.AddWithValue("@descripcion", Presentacion.Descripcion); SqlCmd.ExecuteNonQuery(); Conectar.Close(); }
public void EliminarRegistro(E_Presentacion Presentacion) { Obj.EliminarRegistro(Presentacion); }
public void EditarRegistro(E_Presentacion Presentacion) { Obj.EditarRegistro(Presentacion); }
public void InsertarRegistro(E_Presentacion Presentacion) { Obj.InsertarRegistro(Presentacion); }
public void UpdatePresentacion(E_Presentacion ObjPresentacion, string Tipo) { CD_Producto ObjCD_Producto = new CD_Producto(AppSettings.GetConnectionString); ObjCD_Producto.UpdatePresentacion(ObjPresentacion, Tipo); }