private bool Delete(Det_Direccionamiento item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted) { DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_DDIRSD_UnReg"); DataAccessEnterpriseSQL.DAAgregarParametro("@pintDDIR_Item", item.DDIR_Item, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintCDIR_Codigo", item.CDIR_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
public void CargarDetalleForward(Int32 x_Operacion, Int32 CDIR_Codigo) { DataTable _dt = new DataTable(); Det_Direccionamiento _Item; _dt = Client.GetDetalleForward(x_Operacion); ObservableCollection <Det_Direccionamiento> ItemsDetalle = new ObservableCollection <Det_Direccionamiento>(); for (Int16 i = 0; i < _dt.Rows.Count; i++) { _Item = new Det_Direccionamiento { AUDI_UsrCrea = Session.UserName, CDIR_Codigo = CDIR_Codigo, DDIR_Cantidad = 1, DDIR_Tarja = true, DDIR_Rebate = false, DDIR_Contenedor = _dt.Rows[0]["con_numero"].ToString(), DDIR_Estado = "A", DDIR_MontoTarja = 0, DDIR_MontoRebate = 0, PACK_Codigo = Convert.ToInt32(_dt.Rows[0]["con_tipo"].ToString()), Instance = Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added, }; Client.SaveDet_Direccionamiento(_Item); } }
public Boolean Save(Det_Direccionamiento Item) { try { Boolean m_isCorrect = true; Infrastructure.Aspect.DataAccess.DataAccessEnterpriseSQL.DABeginTransaction(); switch (Item.Instance) { case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added: m_isCorrect = Insert(Item); break; case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified: m_isCorrect = Update(Item); break; case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted: m_isCorrect = Delete(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 BLDet_Direccionamiento(IUnityContainer container) { this.ContainerService = container; Loader = new BusinessEntityLoader <Det_Direccionamiento>(); Det_Direccionamiento item = new Det_Direccionamiento(); Loader.EntityType = item.GetType(); }
public Boolean SaveDet_Direccionamiento(ref Det_Direccionamiento Item) { try { if (Item.Instance != Infrastructure.Aspect.BusinessEntity.InstanceEntity.Unchanged) { return(BL_Det_Direccionamiento.Save(ref Item)); } return(true); } catch (Exception) { throw; } }
private bool Insert(Det_Direccionamiento item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added) { DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_DDIRSI_UnReg"); DataAccessEnterpriseSQL.DAAgregarParametro("@pintDDIR_Item", item.DDIR_Item, SqlDbType.Int, 4, ParameterDirection.InputOutput); DataAccessEnterpriseSQL.DAAgregarParametro("@pintCDIR_Codigo", item.CDIR_Codigo, SqlDbType.Int, 4, ParameterDirection.InputOutput); DataAccessEnterpriseSQL.DAAgregarParametro("@psinDDIR_Cantidad", item.DDIR_Cantidad, SqlDbType.SmallInt, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pbitDDIR_Tarja", item.DDIR_Tarja, SqlDbType.Bit, 1, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pbitDDIR_Rebate", item.DDIR_Rebate, SqlDbType.Bit, 1, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchDDIR_Contenedor", item.DDIR_Contenedor, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pchrDDIR_Estado", item.DDIR_Estado, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintPACK_Codigo", item.PACK_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDIR_MontoTarja", item.DDIR_MontoTarja, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDIR_MontoRebate", item.DDIR_MontoRebate, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchAUDI_UsrCrea", item.AUDI_UsrCrea, SqlDbType.VarChar, 20, ParameterDirection.Input); if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0) { Int32 _DDIR_Item; if (Int32.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pintDDIR_Item"].Value.ToString(), out _DDIR_Item)) { item.DDIR_Item = _DDIR_Item; } Int32 _CDIR_Codigo; if (Int32.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pintCDIR_Codigo"].Value.ToString(), out _CDIR_Codigo)) { item.CDIR_Codigo = _CDIR_Codigo; } return(true); } else { return(false); } } else { return(true); } } catch (Exception ex) { throw ex; } }
private ObservableCollection <Det_Direccionamiento> SelectAll() { try { ObservableCollection <Det_Direccionamiento> items = new ObservableCollection <Det_Direccionamiento>(); Det_Direccionamiento item = new Det_Direccionamiento(); DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_DDIRSS_Todos"); using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader()) { while (reader.Read()) { item = new Det_Direccionamiento(); Loader.LoadEntity(reader, item); item.Instance = InstanceEntity.Unchanged; items.Add(item); } } return(items); } catch (Exception ex) { throw ex; } }
public void CargarDetalleForward(Int16 CCOT_Tipo, Int32 CCOT_Numero, Int32 CDIR_Codigo) { Det_Direccionamiento _Item; ObservableCollection <Infrastructure.Aspect.DataAccess.DataAccessFilterSQL> _listFilters = new ObservableCollection <Infrastructure.Aspect.DataAccess.DataAccessFilterSQL>(); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@psinCCOT_Tipo", FilterValue = CCOT_Tipo, FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Int16, FilterSize = 2 }); _listFilters.Add(new Infrastructure.Aspect.DataAccess.DataAccessFilterSQL() { FilterName = "@pintCCOT_Numero", FilterValue = CCOT_Numero, FilterType = Infrastructure.Aspect.DataAccess.DataAccessFilterTypes.Int32, FilterSize = 4 }); ObservableCollection <Det_CNTR> ListaCNTR = Client.GetAllDet_CNTRFilter("OPE_DHBLSS_TodosPorOV", _listFilters); if (ListaCNTR != null && ListaCNTR.Count > 0) { ObservableCollection <Det_Direccionamiento> ItemsDetalle = new ObservableCollection <Det_Direccionamiento>(); foreach (Det_CNTR item in ListaCNTR) { _Item = new Det_Direccionamiento { AUDI_UsrCrea = Session.UserName, CDIR_Codigo = CDIR_Codigo, DDIR_Cantidad = 1, DDIR_Tarja = true, DDIR_Rebate = false, DDIR_Contenedor = item.CNTR_Numero, //_dt.Rows[0]["con_numero"].ToString(), DDIR_Estado = "A", DDIR_MontoTarja = 0, DDIR_MontoRebate = 0, PACK_Codigo = item.PACK_Codigo, //Convert.ToInt32(_dt.Rows[0]["con_tipo"].ToString()), Instance = Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added, }; Client.SaveDet_Direccionamiento(_Item); } } }
private bool Update(Det_Direccionamiento item) { try { if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified) { DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_DDIRSU_UnReg"); DataAccessEnterpriseSQL.DAAgregarParametro("@pintDDIR_Item", item.DDIR_Item, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintCDIR_Codigo", item.CDIR_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@psinDDIR_Cantidad", item.DDIR_Cantidad, SqlDbType.SmallInt, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pbitDDIR_Tarja", item.DDIR_Tarja, SqlDbType.Bit, 1, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pbitDDIR_Rebate", item.DDIR_Rebate, SqlDbType.Bit, 1, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pvchDDIR_Contenedor", item.DDIR_Contenedor, SqlDbType.VarChar, 20, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pchrDDIR_Estado", item.DDIR_Estado, SqlDbType.Char, 1, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pintPACK_Codigo", item.PACK_Codigo, SqlDbType.Int, 4, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDIR_MontoTarja", item.DDIR_MontoTarja, SqlDbType.Decimal, 15, 2, ParameterDirection.Input); DataAccessEnterpriseSQL.DAAgregarParametro("@pdecDDIR_MontoRebate", item.DDIR_MontoRebate, SqlDbType.Decimal, 15, 2, 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; } }