/// <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(); } } //} }
/// <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); }
/// <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; }
/// <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); }
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)); } }
/// <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)); } }
/// <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; } }
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); } }
/// <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)); }
/// <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); }
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(); } }
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(); } }
internal static com.sybase.afx.json.JsonObject ToJSON(YPF.Comercial.RRCC.SUP.KeyGenerator _object, bool __buildGraph, bool _includeBigAttribute) { return(ToJSON(_object, __buildGraph, _includeBigAttribute, true)); }
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)); }
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)); }
/// <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)); }
/// <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; }
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();; }
/// <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; }
/// <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(); } } //} }
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; } }