コード例 #1
0
        private bool Delete(ref correlativos item)
        {
            try
            {
                if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Deleted)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("TGEN_SP_ELIMINAR_correlativos");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_ServerName", item.CORR_ServerName, SqlDbType.VarChar, 50, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_CodCorr", item.CORR_CodCorr, SqlDbType.VarChar, 10, ParameterDirection.Input);

                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
コード例 #2
0
        public Boolean Save(ref correlativos 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; }
        }
コード例 #3
0
 private correlativos SelectOne(String CORR_ServerName, String CORR_CodCorr)
 {
     try
     {
         correlativos item = new correlativos();
         DataAccessEnterpriseSQL.DAAsignarProcedure("TGEN_SP_CONSULTAR_correlativos");
         DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_ServerName", CORR_ServerName, SqlDbType.VarChar, 50, ParameterDirection.Input);
         DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_CodCorr", CORR_CodCorr, SqlDbType.VarChar, 10, 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; }
 }
コード例 #4
0
        private bool Update(ref correlativos item)
        {
            try
            {
                if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Modified)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("TGEN_SP_ACTUALIZAR_correlativos");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_ServerName", item.CORR_ServerName, SqlDbType.VarChar, 50, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_CodCorr", item.CORR_CodCorr, SqlDbType.VarChar, 10, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintCORR_UltNum", item.CORR_UltNum, SqlDbType.Int, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_Desc", item.CORR_Desc, SqlDbType.VarChar, 50, ParameterDirection.Input);

                    DataAccessEnterpriseSQL.DAAgregarParametro("@pchrCORR_UsrMod", item.CORR_UsrMod, SqlDbType.Char, 18, ParameterDirection.Input);

                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }
コード例 #5
0
 public Boolean Savecorrelativos(correlativos Item)
 {
     try
     { return(base.Channel.Savecorrelativos(Item)); }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #6
0
        public BLcorrelativos(IUnityContainer container)
        {
            this.ContainerService = container;
            Loader = new BusinessEntityLoader <correlativos>();
            correlativos item = new correlativos();

            Loader.EntityType = item.GetType();
        }
コード例 #7
0
 public Boolean Savecorrelativos(correlativos Item)
 {
     try
     {
         if (Item.Instance != Infrastructure.Aspect.BusinessEntity.InstanceEntity.Unchanged)
         {
             return(BL_correlativos.Save(ref Item));
         }
         return(true);
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #8
0
 private ObservableCollection <correlativos> SelectAll()
 {
     try
     {
         ObservableCollection <correlativos> items = new ObservableCollection <correlativos>();
         correlativos item = new correlativos();
         DataAccessEnterpriseSQL.DAAsignarProcedure("TGEN_SP_CONSULTAR_correlativos");
         using (IDataReader reader = DataAccessEnterpriseSQL.DAExecuteReader())
         {
             while (reader.Read())
             {
                 item = new correlativos();
                 Loader.LoadEntity(reader, item);
                 item.Instance = InstanceEntity.Unchanged;
                 items.Add(item);
             }
         }
         return(items);
     }
     catch (Exception ex)
     { throw ex; }
 }
コード例 #9
0
        private bool Insert(ref correlativos item)
        {
            try
            {
                if (item.Instance == Infrastructure.Aspect.BusinessEntity.InstanceEntity.Added)
                {
                    DataAccessEnterpriseSQL.DAAsignarProcedure("TGEN_SP_INSERTAR_correlativos");
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_ServerName", item.CORR_ServerName, SqlDbType.VarChar, 50, ParameterDirection.InputOutput);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_CodCorr", item.CORR_CodCorr, SqlDbType.VarChar, 10, ParameterDirection.InputOutput);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pintCORR_UltNum", item.CORR_UltNum, SqlDbType.Int, 4, ParameterDirection.Input);
                    DataAccessEnterpriseSQL.DAAgregarParametro("@pvchCORR_Desc", item.CORR_Desc, SqlDbType.VarChar, 50, ParameterDirection.Input);


                    if (DataAccessEnterpriseSQL.DAExecuteNonQuery() > 0)
                    {
                        //String _CORR_ServerName;
                        //if (String.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pvchCORR_ServerName"].Value.ToString(), out _CORR_ServerName))
                        //{ item.CORR_ServerName = _CORR_ServerName; }
                        //String _CORR_CodCorr;
                        //if (String.TryParse(DataAccessEnterpriseSQL.DASqlCommand.Parameters["@pvchCORR_CodCorr"].Value.ToString(), out _CORR_CodCorr))
                        //{ item.CORR_CodCorr = _CORR_CodCorr; }
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            { throw ex; }
        }