コード例 #1
0
 /// <summary>
 /// Generate surrogate key.
 /// </summary>
 public static long GenerateId()
 {
     //lock(typeof(YPF.Comercial.RRCC.SUP.LocalKeyGenerator))
     YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
     try
     {
         YPF.Comercial.RRCC.SUP.LocalKeyGenerator _batch_2 = YPF.Comercial.RRCC.SUP.LocalKeyGenerator.ID_BATCH;
         long __id = 0;
         lock (_batch_2)
         {
             if (((_batch_2.BatchId == 0)) || (_batch_2.NextId > _batch_2.LastId))
             {
                 _batch_2.NextBatch();
                 _batch_2.BatchId = (1);
             }
             long _id_3 = _batch_2.NextId;
             _batch_2.NextId = (_id_3 + 1);
             __id            = _id_3;
         }
         return(__id);
     }
     finally
     {
         YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection();
     }
 }
コード例 #2
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static void SaveBatch()
 {
     Sybase.Persistence.ConnectionWrapper     _conn    = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
     YPF.Comercial.RRCC.SUP.LocalKeyGenerator _batch_2 = YPF.Comercial.RRCC.SUP.LocalKeyGenerator.ID_BATCH;
     lock (_batch_2)
     {
         bool ok_3 = false;
         Sybase.Persistence.LocalTransaction tran = null;
         try
         {
             tran = _conn.BeginTransaction();
             _batch_2.Update();
             ok_3 = true;
         }
         finally
         {
             if (ok_3)
             {
                 tran.Commit();
             }
             else if (tran != null)
             {
                 tran.Rollback();
             }
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Get the mobile business object by surrogate key.
 /// </summary>
 /// <param name="id">surrogate key</param>
 /// <returns>the mobile business object for the surroget key</returns>
 /// <exception cref="ObjectNotFoundException">Thrown if unable to retrieve mobile business object.</exception>
 /// <remarks> </remarks>
 public static YPF.Comercial.RRCC.SUP.LocalKeyGenerator Load(YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK id)
 {
     YPF.Comercial.RRCC.SUP.LocalKeyGenerator _ent = Find(id);
     if (_ent == null)
     {
         throw new Sybase.Persistence.ObjectNotFoundException();
     }
     return(_ent);
 }
コード例 #4
0
 /// <summary>
 /// copy the MBO attributes to current MBO
 /// </summary>
 public void CopyAll(YPF.Comercial.RRCC.SUP.LocalKeyGenerator entity)
 {
     this._isNew     = entity._isNew;
     this.__firstId  = entity.__firstId;
     this.__lastId   = entity.__lastId;
     this.__nextId   = entity.__nextId;
     this.__remoteId = entity.__remoteId;
     this.__batchId  = entity.__batchId;
 }
コード例 #5
0
 /// <summary>
 /// Set current MBO attributes by specified MBO.
 /// </summary>
 public static YPF.Comercial.RRCC.SUP.LocalKeyGenerator Merge(YPF.Comercial.RRCC.SUP.LocalKeyGenerator entity)
 {
     YPF.Comercial.RRCC.SUP.LocalKeyGenerator ent = Find(entity._pk());
     if (ent == null)
     {
         ent = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
     }
     ent.CopyAll(entity);
     ent.Save();
     return(ent);
 }
コード例 #6
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.LocalKeyGenerator _object, bool __buildGraph, bool _includeBigAttribute, bool _includeUserAttributes)
 {
     if ((_object == null))
     {
         return(null);
     }
     else
     {
         return(_object._toJSON(__buildGraph, _includeBigAttribute, _includeUserAttributes));
     }
 }
コード例 #7
0
        /// <summary>
        /// Refresh the mobile business object from database.
        /// </summary>
        public void Refresh()
        {
            if (!_isNew)
            {
                YPF.Comercial.RRCC.SUP.LocalKeyGenerator ent = Load(_pk());
                CopyAll(ent);

                _isNew   = false;
                _isDirty = false;
            }
        }
コード例 #8
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.LocalKeyGenerator _object, bool _includeBigAttribute)
 {
     if (_includeBigAttribute)
     {
         return(YPF.Comercial.RRCC.SUP.LocalKeyGenerator.ToJSON(_object));
     }
     else
     {
         return(YPF.Comercial.RRCC.SUP.LocalKeyGenerator.ToJSONWithoutBigAttribute(_object));
     }
 }
コード例 #9
0
 internal static YPF.Comercial.RRCC.SUP.LocalKeyGenerator FromJSON(object _json)
 {
     if (_json == null)
     {
         return(null);
     }
     else
     {
         YPF.Comercial.RRCC.SUP.LocalKeyGenerator _obj = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
         _obj._fromJSON((com.sybase.afx.json.JsonObject)_json);
         return(_obj);
     }
 }
コード例 #10
0
 /// <summary>
 /// override method
 /// </summary>
 public override bool Equals(object that)
 {
     YPF.Comercial.RRCC.SUP.LocalKeyGenerator that_1 = that as YPF.Comercial.RRCC.SUP.LocalKeyGenerator;
     if (that_1 == null)
     {
         return(false);
     }
     YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK id_2 = this._pk();
     YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK id_3 = that_1._pk();
     if ((id_2 == null) || (id_3 == null))
     {
         return(false);
     }
     return(id_2.Equals(id_3));
 }
コード例 #11
0
        /// <summary>
        /// Find a List of YPF.Comercial.RRCC.SUP.LocalKeyGenerator
        /// </summary>
        /// <exception cref="PersistentException">Thrown if unable to retrieve mobile business object.</exception>
        /// <remarks> </remarks>
        public static Sybase.Collections.GenericList <YPF.Comercial.RRCC.SUP.LocalKeyGenerator> FindAll(int skip, int take)
        {
            skip = skip + 1;
            Sybase.Collections.GenericList <YPF.Comercial.RRCC.SUP.LocalKeyGenerator> result_2 = new Sybase.Collections.GenericList <YPF.Comercial.RRCC.SUP.LocalKeyGenerator>();
            System.Data.IDataReader rs_4 = null;
            int count_5 = 0;

            Sybase.Persistence.ConnectionWrapper _conn = null;
            try
            {
                _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBReadConnection();
                string _selectSQL = " x.\"first_id\",x.\"last_id\",x.\"next_id\",x.\"remote_id\",x.\"batch_id\" from \"co_crmmobiledesa_1_0_localkeygenerator\" x order by x.\"first_id\"";
                _selectSQL = "select top " + take + " start at " + skip + " " + _selectSQL;
                System.Data.IDbCommand ps_3 = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, _selectSQL);
                rs_4 = ps_3.ExecuteReader();
                Sybase.Persistence.ConnectionProfile profile = _conn.GetConnectionProfile();
                while (com.sybase.afx.db.ReaderUtil.Read(profile, rs_4))
                {
                    YPF.Comercial.RRCC.SUP.LocalKeyGenerator entity_6 = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
                    entity_6.Bind(profile, rs_4);
                    count_5++;
                    result_2.Add(entity_6);
                }
                if (rs_4 != null)
                {
                    com.sybase.afx.db.ReaderUtil.Close(profile, rs_4, count_5);
                }
                if (ps_3 != null)
                {
                    ps_3.Dispose();
                }
                _selectSQL = null;
            }
            catch (System.Data.DataException ex)
            {
                throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex);
            }
            finally
            {
                YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection();
            }
            return(result_2);
        }
コード例 #12
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public void NextBatch()
 {
     //lock(typeof(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB))
     //{
     Sybase.Persistence.ConnectionWrapper       _conn   = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
     Sybase.Persistence.LocalTransaction        _tran_1 = _conn.BeginTransaction();
     YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK _pk_2   = new YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK();
     _pk_2.RemoteId = ("*");
     _pk_2.BatchId  = (1);
     YPF.Comercial.RRCC.SUP.LocalKeyGenerator _batch_3 = YPF.Comercial.RRCC.SUP.LocalKeyGenerator.Find(_pk_2);
     if (_batch_3 == null)
     {
         _batch_3          = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
         _batch_3.RemoteId = (_pk_2.RemoteId);
         _batch_3.BatchId  = (_pk_2.BatchId);
         _batch_3.FirstId  = (1);
         _batch_3.NextId   = (1 + 100000);
         // _batch_3.LastId =(9223372036854775807);
         _batch_3.LastId = (2147483647);
         _batch_3.Save();
         this.RemoteId = ("*");
         this.BatchId  = (1);
         this.FirstId  = (1);
         this.NextId   = (1);
         this.LastId   = (100000);
     }
     else
     {
         long _next_4 = _batch_3.NextId;
         long _next_5 = _next_4 + 100000;
         _batch_3.NextId = (_next_5);
         _batch_3.Save();
         this.FirstId = (_next_4);
         this.NextId  = (_next_4);
         this.LastId  = (_next_5 - 1);
     }
     _tran_1.Commit();
     //}
 }
コード例 #13
0
        private static YPF.Comercial.RRCC.SUP.LocalKeyGenerator _find(YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK id, String sql, bool findOs, bool findNonPending)
        {
            Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBReadConnection();
            System.Data.IDataReader _rs = null;
            int count = 0;

            try
            {
                YPF.Comercial.RRCC.SUP.LocalKeyGenerator _rt = null;
                System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql);
                com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "remoteId", id.RemoteId);
                com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "batchId", id.BatchId);
                _rs = ps.ExecuteReader();
                Sybase.Persistence.ConnectionProfile profile = _conn.GetConnectionProfile();
                while (com.sybase.afx.db.ReaderUtil.Read(profile, _rs))
                {
                    _rt = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
                    _rt.Bind(profile, _rs);
                    count++;
                }
                if (_rs != null)
                {
                    com.sybase.afx.db.ReaderUtil.Close(profile, _rs, count);
                }
                if (ps != null)
                {
                    ps.Dispose();
                }
                return(_rt);
            }
            catch (System.Data.DataException ex)
            {
                throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex);
            }
            finally
            {
                YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection();
            }
        }
コード例 #14
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.LocalKeyGenerator _object)
 {
     return(YPF.Comercial.RRCC.SUP.LocalKeyGenerator.ToJSON(_object, false, true, true));
 }
コード例 #15
0
 internal static com.sybase.afx.json.JsonObject ToJSONWithoutUserAttributes(YPF.Comercial.RRCC.SUP.LocalKeyGenerator _object)
 {
     return(YPF.Comercial.RRCC.SUP.LocalKeyGenerator.ToJSON(_object, false, false, false));
 }
コード例 #16
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.LocalKeyGenerator _object)
 {
     return(YPF.Comercial.RRCC.SUP.LocalKeyGenerator.ToJSON(_object));
 }
コード例 #17
0
 /// <summary>
 /// Find a List of YPF.Comercial.RRCC.SUP.LocalKeyGenerator
 /// </summary>
 /// <exception cref="PersistentException">Thrown if unable to retrieve mobile business object.</exception>
 /// <remarks> </remarks>
 public static Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.LocalKeyGenerator> FindAll(int skip, int take)
 {
         skip = skip + 1;
     Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.LocalKeyGenerator> result_2 = new Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.LocalKeyGenerator>();
     System.Data.IDataReader rs_4 = null;
     int count_5 = 0;
     Sybase.Persistence.ConnectionWrapper _conn = null;
     try
     {
         _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBReadConnection();
         string _selectSQL = " x.\"first_id\",x.\"last_id\",x.\"next_id\",x.\"remote_id\",x.\"batch_id\" from \"co_crmmobiledesa_1_0_localkeygenerator\" x order by x.\"first_id\"";
         _selectSQL = "select top " + take + " start at " + skip + " " + _selectSQL;
         System.Data.IDbCommand ps_3 = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, _selectSQL);
         rs_4 = ps_3.ExecuteReader();
         Sybase.Persistence.ConnectionProfile profile = _conn.GetConnectionProfile();
         while (com.sybase.afx.db.ReaderUtil.Read(profile, rs_4))
         {       
             YPF.Comercial.RRCC.SUP.LocalKeyGenerator entity_6 = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
             entity_6.Bind(profile, rs_4);
             count_5++;
             result_2.Add(entity_6);
         }
         if (rs_4 != null) com.sybase.afx.db.ReaderUtil.Close(profile, rs_4, count_5);
         if (ps_3 != null) ps_3.Dispose();
         _selectSQL = null;
     }
     catch (System.Data.DataException ex)
     {
         throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex);
     }
     finally
     {
         YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection();
     } 
     return result_2; 
   
 }
コード例 #18
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public void NextBatch()
 {
     //lock(typeof(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB))
     //{
         Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
         Sybase.Persistence.LocalTransaction _tran_1 = _conn.BeginTransaction();
         YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK _pk_2 = new YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK();
         _pk_2.RemoteId =("*");
         _pk_2.BatchId =(1);
         YPF.Comercial.RRCC.SUP.LocalKeyGenerator _batch_3 = YPF.Comercial.RRCC.SUP.LocalKeyGenerator.Find(_pk_2);
         if (_batch_3 == null)
         {
             _batch_3 = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
             _batch_3.RemoteId =(_pk_2.RemoteId);
             _batch_3.BatchId =(_pk_2.BatchId);
             _batch_3.FirstId =(1);
             _batch_3.NextId =(1 + 100000);
             // _batch_3.LastId =(9223372036854775807);
             _batch_3.LastId =(2147483647);
             _batch_3.Save();
             this.RemoteId =("*");
             this.BatchId =(1);
             this.FirstId =(1);
             this.NextId =(1);
             this.LastId =(100000);
         }
         else
         {
             long _next_4 = _batch_3.NextId;
             long _next_5 = _next_4 + 100000;
             _batch_3.NextId =(_next_5);
             _batch_3.Save();
             this.FirstId =(_next_4);
             this.NextId =(_next_4);
             this.LastId =(_next_5 - 1);
         }
         _tran_1.Commit();
     //}
 }
コード例 #19
0
 /// <summary>
 /// Set current MBO attributes by specified MBO.
 /// </summary>
 public static YPF.Comercial.RRCC.SUP.LocalKeyGenerator Merge(YPF.Comercial.RRCC.SUP.LocalKeyGenerator entity)
 {
     YPF.Comercial.RRCC.SUP.LocalKeyGenerator ent = Find(entity._pk());
     if (ent == null)
     {
         ent = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
     }
     ent.CopyAll(entity);
     ent.Save();
     return ent;
 }
コード例 #20
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.LocalKeyGenerator _object, bool __buildGraph, bool _includeBigAttribute)
 {
     return(ToJSON(_object, __buildGraph, _includeBigAttribute, true));
 }
コード例 #21
0
 internal static YPF.Comercial.RRCC.SUP.LocalKeyGenerator FromJSON(object _json)
 {
     if (_json == null)
     {
         return null;
     }
     else
     {
         YPF.Comercial.RRCC.SUP.LocalKeyGenerator _obj = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
         _obj._fromJSON((com.sybase.afx.json.JsonObject)_json);
         return _obj;
     }
 }
コード例 #22
0
 private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.LocalKeyGenerator __theObject)
 {
     System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "firstId", __theObject.FirstId);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "lastId", __theObject.LastId);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "nextId", __theObject.NextId);
     com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "remoteId", __theObject.RemoteId);
     com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "batchId", __theObject.BatchId);
     ps.ExecuteNonQuery();
     ps.Dispose();;
 }
コード例 #23
0
 private static YPF.Comercial.RRCC.SUP.LocalKeyGenerator _find(YPF.Comercial.RRCC.SUP.LocalKeyGeneratorPK id, String sql, bool findOs, bool findNonPending)
 {
     Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBReadConnection();
     System.Data.IDataReader _rs = null;
     int count = 0;
     try
     {
         YPF.Comercial.RRCC.SUP.LocalKeyGenerator _rt = null;
         System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql);
         com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps, "remoteId", id.RemoteId);
         com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "batchId", id.BatchId);
         _rs = ps.ExecuteReader();
         Sybase.Persistence.ConnectionProfile profile = _conn.GetConnectionProfile();
         while (com.sybase.afx.db.ReaderUtil.Read(profile, _rs))
         {
             _rt = new YPF.Comercial.RRCC.SUP.LocalKeyGenerator();
             _rt.Bind(profile, _rs);
             count++;
         }
         if (_rs != null) com.sybase.afx.db.ReaderUtil.Close(profile, _rs, count);
         if (ps != null) ps.Dispose();
         return _rt;
     }
     catch(System.Data.DataException ex)
     {
         throw new Sybase.Persistence.PersistenceException(ex.ToString(), ex);
     }
     finally
     {
         YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.ReleaseDBConnection();
     }
 }