private bool Delete(ref DetDocsVta item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted) { DataAccessEnterpriseSQL.DAAsignarProcedure("VEN_DDOVSD_UnReg"); DataAccessEnterpriseSQL.DAAgregarParametro("@psinDDOV_Item", item.DDOV_Item, SqlDbType.SmallInt, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintDOCV_Codigo", item.DOCV_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
public Boolean Save(DetDocsVta Item) { try { Boolean m_isCorrect = true; Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DABeginTransaction(); switch (Item.Instance) { case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added: m_isCorrect = Insert(ref Item); break; case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified: m_isCorrect = Update(ref Item); break; case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted: m_isCorrect = Delete(ref Item); break; } if (m_isCorrect) { Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DACommitTransaction(); } else { Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DARollbackTransaction(); } return(m_isCorrect); } catch (Exception) { Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DARollbackTransaction(); throw; } }
public BLDetDocsVta(IUnityContainer container) { this.ContainerService = container; Loader = new BusinessEntityLoader <DetDocsVta>(); DetDocsVta item = new DetDocsVta(); Loader.EntityType = item.GetType(); }
private bool Insert(ref DetDocsVta item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added) { DataAccessEnterpriseSQL.DAAsignarProcedure("VEN_DDOVSI_UnReg"); DataAccessEnterpriseSQL.DAAgregarParametro("@psinDDOV_Item", item.DDOV_Item, SqlDbType.SmallInt, 2, ParameterDirection.InputOutput); DataAccessEnterpriseSQL.DAAgregarParametro("@pintDOCV_Codigo", item.DOCV_Codigo, SqlDbType.Int, 4, ParameterDirection.InputOutput); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Cantidad", item.DDOV_Cantidad, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_PrecioUnitario", item.DDOV_PrecioUnitario, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_PrecioUnitarioD", item.DDOV_PrecioUnitarioD, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_ValorVenta", item.DDOV_ValorVenta, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_ValorVentaD", item.DDOV_ValorVentaD, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto1", item.DDOV_Impuesto1, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto1D", item.DDOV_Impuesto1D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto2", item.DDOV_Impuesto2, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto2D", item.DDOV_Impuesto2D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto3", item.DDOV_Impuesto3, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto3D", item.DDOV_Impuesto3D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto4", item.DDOV_Impuesto4, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto4D", item.DDOV_Impuesto4D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchDDOV_Notas", item.DDOV_Notas, SqlDbType.VarChar, 1000, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintSERV_Codigo", item.SERV_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchDDOV_Descripcion", item.DDOV_Descripcion, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchAUDI_UsrCrea", item.AUDI_UsrCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { Int16 _DDOV_Item; if (Int16.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@psinDDOV_Item"].Value.ToString(), out _DDOV_Item)) { item.DDOV_Item = _DDOV_Item; } Int32 _DOCV_Codigo; if (Int32.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pintDOCV_Codigo"].Value.ToString(), out _DOCV_Codigo)) { item.DOCV_Codigo = _DOCV_Codigo; } return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
public Boolean SaveDetDocsVta(ref DetDocsVta Item) { try { if (Item.Instance != Infrastructure.Aspect.BusinessEntity.InstanceEntity.Unchanged) { return(BL_DetDocsVta.Save(ref Item)); } return(true); } catch (Exception) { throw; } }
private bool Update(ref DetDocsVta item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified) { DataAccessEnterpriseSQL.DAAsignarProcedure("VEN_DDOVSU_UnReg"); DataAccessEnterpriseSQL.DAAgregarParametro("@psinDDOV_Item", item.DDOV_Item, SqlDbType.SmallInt, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintDOCV_Codigo", item.DOCV_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Cantidad", item.DDOV_Cantidad, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_PrecioUnitario", item.DDOV_PrecioUnitario, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_PrecioUnitarioD", item.DDOV_PrecioUnitarioD, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_ValorVenta", item.DDOV_ValorVenta, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_ValorVentaD", item.DDOV_ValorVentaD, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto1", item.DDOV_Impuesto1, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto1D", item.DDOV_Impuesto1D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto2", item.DDOV_Impuesto2, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto2D", item.DDOV_Impuesto2D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto3", item.DDOV_Impuesto3, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto3D", item.DDOV_Impuesto3D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto4", item.DDOV_Impuesto4, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDOV_Impuesto4D", item.DDOV_Impuesto4D, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchDDOV_Notas", item.DDOV_Notas, SqlDbType.VarChar, 1000, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintSERV_Codigo", item.SERV_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchDDOV_Descripcion", item.DDOV_Descripcion, SqlDbType.VarChar, 100, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchAUDI_UsrMod", item.AUDI_UsrMod, SqlDbType.VarChar, 20, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
private DetDocsVta SelectOne(Int16 DDOV_Item, Int32 DOCV_Codigo) { try { DetDocsVta item = new DetDocsVta(); DataAccessEnterpriseSQL.DAAsignarProcedure("VEN_DDOVSS_UnReg"); DataAccessEnterpriseSQL.DAAgregarParametro("@psinDDOV_Item", DDOV_Item, SqlDbType.SmallInt, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintDOCV_Codigo", DOCV_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader()) { if (reader.Read()) { Loader.LoadEntity(reader, item); item.Instance = InstanceEntity.Unchanged; } } return(item); } catch (Exception ex) { throw ex; } }
private ObservableCollection <DetDocsVta> SelectAll() { try { ObservableCollection <DetDocsVta> items = new ObservableCollection <DetDocsVta>(); DetDocsVta item = new DetDocsVta(); DataAccessEnterpriseSQL.DAAsignarProcedure("VEN_DDOVSS_Todos"); using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader()) { while (reader.Read()) { item = new DetDocsVta(); Loader.LoadEntity(reader, item); item.Instance = InstanceEntity.Unchanged; items.Add(item); } } return(items); } catch (Exception ex) { throw ex; } }