Пример #1
0
        /// <summary>
        /// Sybase internal use only.
        /// <summary>
        public static bool InitSync()
        {
            //lock(typeof(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB))
            //{
            Sybase.Persistence.LocalTransaction _tran = null;
            bool ok_3 = false;

            try
            {
                Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
                _tran = _conn.BeginTransaction();
                ok_3  = false;

                Sybase.Collections.GenericList <YPF.Comercial.RRCC.SUP.KeyGenerator> list_4 = YPF.Comercial.RRCC.SUP.KeyGenerator.FindAll();
                int size_5 = list_4.Count;
                if ((size_5 == 0))
                {
                    YPF.Comercial.RRCC.SUP.KeyGenerator batch_6 = new YPF.Comercial.RRCC.SUP.KeyGenerator();
                    batch_6.RemoteId = (".");
                    batch_6.BatchId  = (1);
                    batch_6.LastId   = (-1);
                    batch_6.Create();
                    YPF.Comercial.RRCC.SUP.KeyGenerator batch_7 = new YPF.Comercial.RRCC.SUP.KeyGenerator();
                    batch_7.RemoteId = (".");
                    batch_7.BatchId  = (2);
                    batch_7.LastId   = (-1);
                    batch_7.Create();
                    ok_3 = true;
                    return(true);
                }
                if ((size_5 == 4))
                {
                    foreach (YPF.Comercial.RRCC.SUP.KeyGenerator item_8 in list_4)
                    {
                        if ((item_8.LastId == -1))
                        {
                            item_8.Delete();
                        }
                    }
                    list_4 = YPF.Comercial.RRCC.SUP.KeyGenerator.FindAll();
                }
                YPF.Comercial.RRCC.SUP.KeyGenerator batch_10 = list_4[0];
                ok_3 = true;
                long last_11 = batch_10.LastId;
                long next_12 = batch_10.NextId;
                return(((last_11 == -1)) || (next_12 > last_11));
            }
            finally
            {
                if (ok_3)
                {
                    _tran.Commit();
                }
                else
                {
                    _tran.Rollback();
                }
            }
            //}
        }
Пример #2
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.KeyGenerator Load(YPF.Comercial.RRCC.SUP.KeyGeneratorPK id)
 {
     YPF.Comercial.RRCC.SUP.KeyGenerator _ent = Find(id);
     if (_ent == null)
     {
         throw new Sybase.Persistence.ObjectNotFoundException();
     }
     return(_ent);
 }
Пример #3
0
 /// <summary>
 /// copy the MBO attributes to current MBO
 /// </summary>
 public void CopyAll(YPF.Comercial.RRCC.SUP.KeyGenerator 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;
 }
Пример #4
0
 /// <summary>
 /// Set current MBO attributes by specified MBO.
 /// </summary>
 public static YPF.Comercial.RRCC.SUP.KeyGenerator Merge(YPF.Comercial.RRCC.SUP.KeyGenerator entity)
 {
     YPF.Comercial.RRCC.SUP.KeyGenerator ent = Find(entity._pk());
     if (ent == null)
     {
         ent = new YPF.Comercial.RRCC.SUP.KeyGenerator();
     }
     ent.CopyAll(entity);
     ent.Save();
     return(ent);
 }
Пример #5
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.KeyGenerator _object, bool __buildGraph, bool _includeBigAttribute, bool _includeUserAttributes)
 {
     if ((_object == null))
     {
         return(null);
     }
     else
     {
         return(_object._toJSON(__buildGraph, _includeBigAttribute, _includeUserAttributes));
     }
 }
Пример #6
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static com.sybase.afx.json.JsonObject __toJSON(YPF.Comercial.RRCC.SUP.KeyGenerator _object, bool _includeBigAttribute)
 {
     if (_includeBigAttribute)
     {
         return(YPF.Comercial.RRCC.SUP.KeyGenerator.ToJSON(_object));
     }
     else
     {
         return(YPF.Comercial.RRCC.SUP.KeyGenerator.ToJSONWithoutBigAttribute(_object));
     }
 }
Пример #7
0
        /// <summary>
        /// Refresh the mobile business object from database.
        /// </summary>
        public void Refresh()
        {
            if (!_isNew)
            {
                YPF.Comercial.RRCC.SUP.KeyGenerator ent = Load(_pk());
                CopyAll(ent);

                _isNew   = false;
                _isDirty = false;
            }
        }
Пример #8
0
 internal static YPF.Comercial.RRCC.SUP.KeyGenerator FromJSON(object _json)
 {
     if (_json == null)
     {
         return(null);
     }
     else
     {
         YPF.Comercial.RRCC.SUP.KeyGenerator _obj = new YPF.Comercial.RRCC.SUP.KeyGenerator();
         _obj._fromJSON((com.sybase.afx.json.JsonObject)_json);
         return(_obj);
     }
 }
Пример #9
0
 /// <summary>
 /// override method
 /// </summary>
 public override bool Equals(object that)
 {
     YPF.Comercial.RRCC.SUP.KeyGenerator that_1 = that as YPF.Comercial.RRCC.SUP.KeyGenerator;
     if (that_1 == null)
     {
         return(false);
     }
     YPF.Comercial.RRCC.SUP.KeyGeneratorPK id_2 = this._pk();
     YPF.Comercial.RRCC.SUP.KeyGeneratorPK id_3 = that_1._pk();
     if ((id_2 == null) || (id_3 == null))
     {
         return(false);
     }
     return(id_2.Equals(id_3));
 }
Пример #10
0
        /// <summary>
        /// Find a List of YPF.Comercial.RRCC.SUP.KeyGenerator
        /// </summary>
        /// <exception cref="PersistentException">Thrown if unable to retrieve mobile business object.</exception>
        /// <remarks> </remarks>
        public static Sybase.Collections.GenericList <YPF.Comercial.RRCC.SUP.KeyGenerator> FindAll(int skip, int take)
        {
            skip = skip + 1;
            Sybase.Collections.GenericList <YPF.Comercial.RRCC.SUP.KeyGenerator> result_2 = new Sybase.Collections.GenericList <YPF.Comercial.RRCC.SUP.KeyGenerator>();
            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 \"crmmobiledesa_1_0_keygenerator\" 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.KeyGenerator entity_6 = new YPF.Comercial.RRCC.SUP.KeyGenerator();
                    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);
        }
Пример #11
0
        private static YPF.Comercial.RRCC.SUP.KeyGenerator _find(YPF.Comercial.RRCC.SUP.KeyGeneratorPK 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.KeyGenerator _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.KeyGenerator();
                    _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();
            }
        }
Пример #12
0
 private static YPF.Comercial.RRCC.SUP.KeyGenerator _find(YPF.Comercial.RRCC.SUP.KeyGeneratorPK 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.KeyGenerator _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.KeyGenerator();
             _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();
     }
 }
Пример #13
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.KeyGenerator _object, bool __buildGraph, bool _includeBigAttribute)
 {
     return(ToJSON(_object, __buildGraph, _includeBigAttribute, true));
 }
Пример #14
0
 internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.KeyGenerator _object)
 {
     return(YPF.Comercial.RRCC.SUP.KeyGenerator.ToJSON(_object, false, true, true));
 }
Пример #15
0
 internal static com.sybase.afx.json.JsonObject ToJSONWithoutUserAttributes(YPF.Comercial.RRCC.SUP.KeyGenerator _object)
 {
     return(YPF.Comercial.RRCC.SUP.KeyGenerator.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.KeyGenerator _object)
 {
     return(YPF.Comercial.RRCC.SUP.KeyGenerator.ToJSON(_object));
 }
Пример #17
0
 /// <summary>
 /// Find a List of YPF.Comercial.RRCC.SUP.KeyGenerator
 /// </summary>
 /// <exception cref="PersistentException">Thrown if unable to retrieve mobile business object.</exception>
 /// <remarks> </remarks>
 public static Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.KeyGenerator> FindAll(int skip, int take)
 {
         skip = skip + 1;
     Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.KeyGenerator> result_2 = new Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.KeyGenerator>();
     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 \"crmmobiledesa_1_0_keygenerator\" 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.KeyGenerator entity_6 = new YPF.Comercial.RRCC.SUP.KeyGenerator();
             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
 private void CreateBySQL(Sybase.Persistence.ConnectionWrapper _conn, string sql, YPF.Comercial.RRCC.SUP.KeyGenerator __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();;
 }
Пример #19
0
 /// <summary>
 /// Set current MBO attributes by specified MBO.
 /// </summary>
 public static YPF.Comercial.RRCC.SUP.KeyGenerator Merge(YPF.Comercial.RRCC.SUP.KeyGenerator entity)
 {
     YPF.Comercial.RRCC.SUP.KeyGenerator ent = Find(entity._pk());
     if (ent == null)
     {
         ent = new YPF.Comercial.RRCC.SUP.KeyGenerator();
     }
     ent.CopyAll(entity);
     ent.Save();
     return ent;
 }
Пример #20
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public static bool InitSync()
 {
     //lock(typeof(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB))
     //{
         Sybase.Persistence.LocalTransaction _tran = null;
         bool ok_3 = false;
         try
         {
             Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
             _tran = _conn.BeginTransaction();
             ok_3 = false;        
 
             Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.KeyGenerator> list_4 = YPF.Comercial.RRCC.SUP.KeyGenerator.FindAll();
             int size_5 = list_4.Count;
             if ((size_5 == 0))
             {
                 YPF.Comercial.RRCC.SUP.KeyGenerator batch_6 = new YPF.Comercial.RRCC.SUP.KeyGenerator();
                 batch_6.RemoteId =(".");
                 batch_6.BatchId =(1);
                 batch_6.LastId =(-1);
                 batch_6.Create();
                 YPF.Comercial.RRCC.SUP.KeyGenerator batch_7 = new YPF.Comercial.RRCC.SUP.KeyGenerator();
                 batch_7.RemoteId =(".");
                 batch_7.BatchId =(2);
                 batch_7.LastId =(-1);
                 batch_7.Create();
                 ok_3 = true;
                 return true;
             }
             if ((size_5 == 4))
             {
                 foreach(YPF.Comercial.RRCC.SUP.KeyGenerator item_8 in list_4)
                 {
                     if ((item_8.LastId == -1))
                     {
                         item_8.Delete();
                     }
                 }
                 list_4 = YPF.Comercial.RRCC.SUP.KeyGenerator.FindAll();
             }
             YPF.Comercial.RRCC.SUP.KeyGenerator batch_10 = list_4[0];
             ok_3 = true;
             long last_11 = batch_10.LastId;
             long next_12 = batch_10.NextId;
             return ((last_11 == -1)) || (next_12 > last_11);
         }
         finally
         {
             if (ok_3)
             {
                 _tran.Commit();
             }
             else
             {
                 _tran.Rollback();
             }
         }
     //}
 }
Пример #21
0
 internal static YPF.Comercial.RRCC.SUP.KeyGenerator FromJSON(object _json)
 {
     if (_json == null)
     {
         return null;
     }
     else
     {
         YPF.Comercial.RRCC.SUP.KeyGenerator _obj = new YPF.Comercial.RRCC.SUP.KeyGenerator();
         _obj._fromJSON((com.sybase.afx.json.JsonObject)_json);
         return _obj;
     }
 }