コード例 #1
0
ファイル: DACab_Tarifa.cs プロジェクト: ferarell/DelfinGroup
        private bool Delete(ref Cab_Tarifa item)
        {
            try
            {
                if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_CTARSD_UnReg");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCTAR_Tipo", item.CTAR_Tipo, SqlDbType.Char, 1, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintCTAR_Codigo", item.CTAR_Codigo, SqlDbType.Int, 4, ParameterDirection.Input);

                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
コード例 #2
0
ファイル: DACab_Tarifa.cs プロジェクト: ferarell/DelfinGroup
 private Cab_Tarifa SelectOne(String CTAR_Tipo, Int32 CTAR_Codigo)
 {
     try
     {
         Cab_Tarifa item = new Cab_Tarifa();
         DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_CTARSS_UnReg");
         DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCTAR_Tipo", CTAR_Tipo, SqlDbType.Char, 1, ParameterDirection.Input);
         DataAccessEnterpriseSQL.DAAgregarParametro("@pintCTAR_Codigo", CTAR_Codigo, SqlDbType.Int, 4, 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 ex)
     { throw ex; }
 }
コード例 #3
0
ファイル: DACab_Tarifa.cs プロジェクト: ferarell/DelfinGroup
        public BLCab_Tarifa(IUnityContainer container)
        {
            this.ContainerService = container;
            Loader = new BusinessEntityLoader <Cab_Tarifa>();
            Cab_Tarifa item = new Cab_Tarifa();

            Loader.EntityType = item.GetType();
        }
コード例 #4
0
ファイル: DACab_Tarifa.cs プロジェクト: ferarell/DelfinGroup
        private bool Insert(ref Cab_Tarifa item)
        {
            try
            {
                if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_CTARSI_UnReg");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCTAR_Tipo", item.CTAR_Tipo, SqlDbType.Char, 1, ParameterDirection.InputOutput);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintCTAR_Codigo", item.CTAR_Codigo, SqlDbType.Int, 4, ParameterDirection.InputOutput);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCTAR_Numero", item.CTAR_Numero, SqlDbType.VarChar, 11, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCTAR_Descrip", item.CTAR_Descrip, SqlDbType.VarChar, 50, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmCTAR_FecEmi", item.CTAR_FecEmi, SqlDbType.DateTime, 8, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmCTAR_FecIni", item.CTAR_FecIni, SqlDbType.DateTime, 8, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmCTAR_FecFin", item.CTAR_FecFin, SqlDbType.DateTime, 8, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_TabMnd", item.TIPO_TabMnd, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTIPO_CodMnd", item.TIPO_CodMnd, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_Codigo", item.ENTC_Codigo, SqlDbType.Int, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pbitCTAR_AgMaritimo", item.CTAR_AgMaritimo, SqlDbType.Bit, 1, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pbitCTAR_DepTemporal", item.CTAR_DepTemporal, SqlDbType.Bit, 1, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pbitCTAR_DepVacio", item.CTAR_DepVacio, SqlDbType.Bit, 1, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCONS_CodReg", item.CONS_CodReg, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCONS_TabReg", item.CONS_TabReg, SqlDbType.Char, 3, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pnumCTAR_Profit", item.CTAR_Profit, SqlDbType.Decimal, 12, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdecCTAR_MontoLNaviera", item.CTAR_MontoLNaviera, SqlDbType.Decimal, 15, 2, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pdecCTAR_MontoDTemporal", item.CTAR_MontoDTemporal, SqlDbType.Decimal, 15, 2, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@psinTIPE_Codigo", item.TIPE_Codigo, SqlDbType.SmallInt, 2, ParameterDirection.Input);

                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchAUDI_UsrCrea", item.AUDI_UsrCrea, SqlDbType.VarChar, 20, ParameterDirection.Input);

                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        item.CTAR_Tipo = DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pchrCTAR_Tipo"].Value.ToString();
                        Int32 _CTAR_Codigo;
                        if (Int32.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pintCTAR_Codigo"].Value.ToString(), out _CTAR_Codigo))
                        {
                            item.CTAR_Codigo = _CTAR_Codigo;
                        }
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
コード例 #5
0
 public Boolean SaveCab_Tarifa(ref Cab_Tarifa Item)
 {
     try
     {
         if (Item.Instance != Infrastructure.Aspect.BusinessEntity.InstanceEntity.Unchanged)
         {
             return(BL_Cab_Tarifa.Save(ref Item));
         }
         return(true);
     }
     catch (Exception)
     { throw; }
 }
コード例 #6
0
ファイル: DACab_Tarifa.cs プロジェクト: ferarell/DelfinGroup
 private ObservableCollection <Cab_Tarifa> SelectAll()
 {
     try
     {
         ObservableCollection <Cab_Tarifa> items = new ObservableCollection <Cab_Tarifa>();
         Cab_Tarifa item = new Cab_Tarifa();
         DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_CTARSS_Todos");
         using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader())
         {
             while (reader.Read())
             {
                 item = new Cab_Tarifa();
                 Loader.LoadEntity(reader, item);
                 item.Instance = InstanceEntity.Unchanged;
                 items.Add(item);
             }
         }
         return(items);
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #7
0
        public void Nuevo()
        {
            try
            {
                if (!isMViewShow)
                {
                    MView           = new PRO001MView();
                    MView.Presenter = this;
                    MView.LoadView();
                }

                MView.ClearItem();
                ItemCAB_Tarifa = new Cab_Tarifa
                {
                    AUDI_UsrCrea = Session.UserName,
                    AUDI_FecCrea = Session.Fecha,
                    Instance     = InstanceEntity.Added,
                    TIPO_TabMnd  = "MND",
                    CONS_TabReg  = "RGM",
                    CTAR_Tipo    = TipoTarifa
                };
                MView.ClearItemsDetalles();
                ItemDET_Tarifa          = new Det_Tarifa();
                ItemsGrillaDet_Tarifa   = new ObservableCollection <Det_Tarifa>();
                ItemsDet_Tarifa         = new ObservableCollection <Det_Tarifa>();
                ItemsDet_TarifaServicio = new ObservableCollection <Det_Tarifa_Servicio>();
                MView.ClearItemsDetalleServicios();
                MView.SetInstance(InstanceView.New);

                isMViewShow = true;
                ((PRO001MView)MView).Show();
                ((PRO001MView)MView).BringToFront();
            }
            catch (Exception ex)
            { Dialogos.MostrarMensajeError(Title, Mensajes.NewPresenter, ex); }
        }
コード例 #8
0
        public Boolean Save(ref Cab_Tarifa 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);
                    if (m_isCorrect)
                    {
                        /* Items Detalle Tarifa */
                        if (Item.ItemsDet_Tarifa != null && Item.ItemsDet_Tarifa.Count > 0)
                        {
                            foreach (var _item in Item.ItemsDet_Tarifa)
                            {
                                Det_Tarifa _Deta = new Det_Tarifa();
                                _Deta             = _item;
                                _Deta.CTAR_Codigo = Item.CTAR_Codigo;
                                _Deta.CTAR_Tipo   = Item.CTAR_Tipo;
                                _Deta.Trasanct    = false;
                                m_isCorrect       = BLDet_Tarifa.Save(ref _Deta);
                                if (!m_isCorrect)
                                {
                                    break;
                                }
                            }
                        }
                        /* Items Servicios */
                        if (Item.ItemsDet_Tarifa_Servicio != null && Item.ItemsDet_Tarifa_Servicio.Count > 0)
                        {
                            foreach (var _itemServ in Item.ItemsDet_Tarifa_Servicio)
                            {
                                Det_Tarifa_Servicio _Servicio = new Det_Tarifa_Servicio();
                                _Servicio             = _itemServ;
                                _Servicio.CTAR_Codigo = Item.CTAR_Codigo;
                                _Servicio.CTAR_Tipo   = Item.CTAR_Tipo;
                                _Servicio.Trasanct    = false;
                                m_isCorrect           = BLDet_Tarifa_Servicio.Save(ref _Servicio);
                                if (!m_isCorrect)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    break;

                case Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified:
                    m_isCorrect = Update(ref Item);
                    if (m_isCorrect)
                    {
                        /* Items Detalle Tarifa */
                        if (Item.ItemsDet_Tarifa != null && Item.ItemsDet_Tarifa.Count > 0)
                        {
                            foreach (var _item in Item.ItemsDet_Tarifa)
                            {
                                Det_Tarifa _Deta = new Det_Tarifa();
                                _Deta             = _item;
                                _Deta.CTAR_Codigo = Item.CTAR_Codigo;
                                _Deta.CTAR_Tipo   = Item.CTAR_Tipo;
                                _Deta.Trasanct    = false;
                                m_isCorrect       = BLDet_Tarifa.Save(ref _Deta);
                                if (!m_isCorrect)
                                {
                                    break;
                                }
                            }
                        }
                        /* Items Servicios */
                        if (Item.ItemsDet_Tarifa_Servicio != null && Item.ItemsDet_Tarifa_Servicio.Count > 0)
                        {
                            foreach (var _itemServ in Item.ItemsDet_Tarifa_Servicio)
                            {
                                Det_Tarifa_Servicio _Servicio = new Det_Tarifa_Servicio();
                                _Servicio             = _itemServ;
                                _Servicio.CTAR_Codigo = Item.CTAR_Codigo;
                                _Servicio.CTAR_Tipo   = Item.CTAR_Tipo;
                                _Servicio.Trasanct    = false;
                                m_isCorrect           = BLDet_Tarifa_Servicio.Save(ref _Servicio);
                                if (!m_isCorrect)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    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; }
        }
コード例 #9
0
 private ObservableCollection <Cab_Tarifa> SelectAllByFiltros(Int32?LineaNaviera, Int32?AgMaritimo, Int32?DepTemporal,
                                                              Int32?DepVacio, Int32?AgAduana, Int32?Transporte, DateTime FecEmiDesde, DateTime FecEmiHasta, String TipoTarifa)
 {
     try
     {
         ObservableCollection <Cab_Tarifa> items = new ObservableCollection <Cab_Tarifa>();
         Cab_Tarifa item = new Cab_Tarifa();
         DataAccessEnterpriseSQL.DAAsignarProcedure("SLI_CTARSS_TodosByFiltros");
         if (LineaNaviera != null)
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoLN", LineaNaviera, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         else
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoLN", DBNull.Value, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         if (AgMaritimo != null)
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoAM", AgMaritimo, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         else
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoAM", DBNull.Value, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         if (DepTemporal != null)
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoDT", DepTemporal, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         else
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoDT", DBNull.Value, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         if (DepVacio != null)
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoDV", DepVacio, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         else
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoDV", DBNull.Value, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         if (AgAduana != null)
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoAA", AgAduana, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         else
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoAA", DBNull.Value, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         if (Transporte != null)
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoLT", Transporte, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         else
         {
             DataAccessEnterpriseSQL.DAAgregarParametro("@pintENTC_CodigoLT", DBNull.Value, SqlDbType.Int, 4, ParameterDirection.Input);
         }
         DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmCTAR_FecIni", FecEmiDesde, SqlDbType.DateTime, 8, ParameterDirection.Input);
         DataAccessEnterpriseSQL.DAAgregarParametro("@pdtmCTAR_FecFin", FecEmiHasta, SqlDbType.DateTime, 8, ParameterDirection.Input);
         DataAccessEnterpriseSQL.DAAgregarParametro("@pchrTipoTarifa", TipoTarifa, SqlDbType.Char, 1, ParameterDirection.Input);
         using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader())
         {
             while (reader.Read())
             {
                 item = new Cab_Tarifa();
                 Loader.LoadEntity(reader, item);
                 item.Instance = InstanceEntity.Unchanged;
                 items.Add(item);
             }
         }
         return(items);
     }
     catch (Exception ex)
     { throw ex; }
 }