Ejemplo n.º 1
0
 private SobreEstadia SelectOne(Int32 CONT_Codigo, Int16 SOES_Item)
 {
     try
     {
         SobreEstadia item = new SobreEstadia();
         DataAccessEnterpriseSQL.DAAsignarProcedure("COM_SOESSS_UnReg");
         DataAccessEnterpriseSQL.DAAgregarParametro("@pintCONT_Codigo", CONT_Codigo, SqlDbType.Int, 4, ParameterDirection.Input);
         DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_Item", SOES_Item, SqlDbType.SmallInt, 2, ParameterDirection.Input);
         using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader())
         {
             if (reader.Read())
             {
                 Loader.LoadEntity(reader, item);
                 item.Instance = InstanceEntity.Unchanged;
             }
             else
             {
                 throw new Exception("No se encontro el registro.");
             }
         }
         return(item);
     }
     catch (Exception)
     { throw; }
 }
Ejemplo n.º 2
0
        private bool Delete(ref SobreEstadia Item)
        {
            try
            {
                if (Item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("COM_SOESSD_UnReg");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintCONT_Codigo", Item.CONT_Codigo, SqlDbType.Int, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_Item", Item.SOES_Item, SqlDbType.SmallInt, 2, ParameterDirection.Input);

                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception)
            { throw; }
        }
Ejemplo n.º 3
0
        public BLSobreEstadia(IUnityContainer container)
        {
            this.ContainerService = container;
            Loader = new BusinessEntityLoader <SobreEstadia>();
            SobreEstadia Item = new SobreEstadia();

            Loader.EntityType = Item.GetType();
        }
Ejemplo n.º 4
0
 public Boolean SaveSobreEstadia(ref SobreEstadia Item)
 {
     try
     {
         if (Item.Instance != Infrastructure.Aspect.BusinessEntity.InstanceEntity.Unchanged)
         {
             return(BL_SobreEstadia.Save(ref Item));
         }
         return(true);
     }
     catch (Exception)
     { throw; }
 }
Ejemplo n.º 5
0
        private bool Insert(ref SobreEstadia Item)
        {
            try
            {
                if (Item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("COM_SOESSI_UnReg");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintCONT_Codigo", Item.CONT_Codigo, SqlDbType.Int, 4, ParameterDirection.InputOutput);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_Item", Item.SOES_Item, SqlDbType.SmallInt, 2, ParameterDirection.InputOutput);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_DiasSobrestadiaLinea", Item.SOES_DiasSobrestadiaLinea, SqlDbType.SmallInt, 2, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_DiasSobrestadiaCliente", Item.SOES_DiasSobrestadiaCliente, SqlDbType.SmallInt, 2, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmSOES_FecInicio", Item.SOES_FecInicio, SqlDbType.DateTime, 8, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_TabTRF", Item.TIPO_TabTRF, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_CodTRF", Item.TIPO_CodTRF, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmSOES_FecFin", Item.SOES_FecFin, SqlDbType.DateTime, 8, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_TabCNT", Item.TIPO_TabCNT, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_CodCNT", Item.TIPO_CodCNT, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchSOES_ObsFecInicio", Item.SOES_ObsFecInicio, SqlDbType.VarChar, 50, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchSOES_Observaciones", Item.SOES_Observaciones, SqlDbType.VarChar, 100, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintPUER_CodDestino", Item.PUER_CodDestino, SqlDbType.Int, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pbitSOES_Oferta", Item.SOES_Oferta, SqlDbType.Bit, 1, ParameterDirection.Input);


                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        Int32 _CONT_Codigo;
                        if (Int32.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pintCONT_Codigo"].Value.ToString(), out _CONT_Codigo))
                        {
                            Item.CONT_Codigo = _CONT_Codigo;
                        }
                        Int16 _SOES_Item;
                        if (Int16.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@psinSOES_Item"].Value.ToString(), out _SOES_Item))
                        {
                            Item.SOES_Item = _SOES_Item;
                        }
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception)
            { throw; }
        }
Ejemplo n.º 6
0
        public Boolean Save(ref SobreEstadia Item)
        {
            try
            {
                Boolean m_isCorrect = true;
                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;
                }
                return(m_isCorrect);
            }
            catch (Exception)
            { throw; }
        }
Ejemplo n.º 7
0
        private bool Update(ref SobreEstadia Item)
        {
            try
            {
                if (Item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("COM_SOESSU_UnReg");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintCONT_Codigo", Item.CONT_Codigo, SqlDbType.Int, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_Item", Item.SOES_Item, SqlDbType.SmallInt, 2, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_DiasSobrestadiaLinea", Item.SOES_DiasSobrestadiaLinea, SqlDbType.SmallInt, 2, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinSOES_DiasSobrestadiaCliente", Item.SOES_DiasSobrestadiaCliente, SqlDbType.SmallInt, 2, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmSOES_FecInicio", Item.SOES_FecInicio, SqlDbType.DateTime, 8, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_TabTRF", Item.TIPO_TabTRF, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_CodTRF", Item.TIPO_CodTRF, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmSOES_FecFin", Item.SOES_FecFin, SqlDbType.DateTime, 8, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_TabCNT", Item.TIPO_TabCNT, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_CodCNT", Item.TIPO_CodCNT, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchSOES_ObsFecInicio", Item.SOES_ObsFecInicio, SqlDbType.VarChar, 50, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchSOES_Observaciones", Item.SOES_Observaciones, SqlDbType.VarChar, 100, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintPUER_CodDestino", Item.PUER_CodDestino, SqlDbType.Int, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pbitSOES_Oferta", Item.SOES_Oferta, SqlDbType.Bit, 1, ParameterDirection.Input);


                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception)
            { throw; }
        }
Ejemplo n.º 8
0
 private ObservableCollection <SobreEstadia> SelectAll()
 {
     try
     {
         ObservableCollection <SobreEstadia> items = new ObservableCollection <SobreEstadia>();
         SobreEstadia item = new SobreEstadia();
         DataAccessEnterpriseSQL.DAAsignarProcedure("COM_SOESSS_Todos");
         using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader())
         {
             while (reader.Read())
             {
                 item = new SobreEstadia();
                 Loader.LoadEntity(reader, item);
                 item.Instance = InstanceEntity.Unchanged;
                 items.Add(item);
             }
         }
         return(items);
     }
     catch (Exception)
     { throw; }
 }
Ejemplo n.º 9
0
 private ObservableCollection <SobreEstadia> SelectAllByFilter(String x_procedure, ObservableCollection <Infrastructure.Aspect.DataAccess.DataAccessFilterSQL> x_filters)
 {
     try
     {
         ObservableCollection <SobreEstadia> items = new ObservableCollection <SobreEstadia>();
         SobreEstadia item = new SobreEstadia();
         if (!String.IsNullOrEmpty(x_procedure))
         {
             DataAccessEnterpriseSQL.DAAsignarProcedure(x_procedure);
         }
         else
         {
             DataAccessEnterpriseSQL.DAAsignarProcedure("COM_SOESSS_TodosByFilters");
         }
         if (x_filters != null && x_filters.Count > 0)
         {
             foreach (Infrastructure.Aspect.DataAccess.DataAccessFilterSQL _itemFilter in x_filters)
             {
                 DataAccessEnterpriseSQL.DAAgregarParametro(_itemFilter.FilterName, _itemFilter.FilterValue, _itemFilter.FilterSQLType, _itemFilter.FilterSize);
             }
         }
         using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader())
         {
             while (reader.Read())
             {
                 item = new SobreEstadia();
                 Loader.LoadEntity(reader, item);
                 item.Instance = InstanceEntity.Unchanged;
                 items.Add(item);
             }
         }
         return(items);
     }
     catch (Exception)
     { throw; }
 }