Пример #1
0
        /// <summary>
        /// Sybase internal use only.
        /// <summary>
        public void RbsReplayInternal(YPF.Comercial.RRCC.SUP.Formulario entity)
        {
            YPF.Comercial.RRCC.SUP.intrnl.OperationReplay _replay = new YPF.Comercial.RRCC.SUP.intrnl.OperationReplay();
            _replay.RemoteId  = (".");
            _replay.Component = ("CRMMobileDesa.Formulario_rs");
            _replay.EntityKey = (entity.KeyToString());
            _replay.Operation = (entity.LastOperation);
            bool _includeBig = !("delete").Equals(_replay.Operation);

            com.sybase.afx.json.JsonObject _parameters = new com.sybase.afx.json.JsonObject();
            _parameters.Put("entity", YPF.Comercial.RRCC.SUP.Formulario.__toJSON(entity, _includeBig));
            //_replay.Parameters =(_parameters.ToString());
            //lock(typeof(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB))
            //{
            Sybase.Persistence.ConnectionWrapper _conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
            Sybase.Persistence.LocalTransaction  _tran = null;
            try
            {
                _tran = _conn.BeginTransaction();

                com.sybase.afx.json.JsonObject _json = new com.sybase.afx.json.JsonObject();
                _replay.Attributes = (_json.ToString());
                _replay.Save();
                _replay.SaveParameter(_parameters);
                _tran.Commit();
            }
            catch (Sybase.Persistence.PersistenceException pe)
            {
                _tran.Rollback();
                throw pe;
            }
            catch (System.ApplicationException e)
            {
                _tran.Rollback();
                throw e;
            }
            //}
        }
Пример #2
0
 /// <summary>
 /// copy the MBO attributes to current MBO
 /// </summary>
 public void CopyAll(YPF.Comercial.RRCC.SUP.PreguntaFormulario entity)
 {
     this._isNew = entity._isNew;
     this.__idFormulario = entity.__idFormulario;
     this.__idPregunta = entity.__idPregunta;
     this.__valor = entity.__valor;
     this.__operacionNoCumplimiento = entity.__operacionNoCumplimiento;
     this.__pregunta = entity.__pregunta;
     this.__preguntaValid = entity.__preguntaValid;
     this.__formulario1 = entity.__formulario1;
     this.__formulario1Valid = entity.__formulario1Valid;
     this.__pending = entity.__pending;
     this.__pendingChange = entity.__pendingChange;
     this.__replayPending = entity.__replayPending;
     this.__replayFailure = entity.__replayFailure;
     this.__preguntaFK = entity.__preguntaFK;
     this.__formulario1FK = entity.__formulario1FK;
     this.__surrogateKey = entity.SurrogateKey;
     this.__replayCounter = entity.__replayCounter;
     this.__disableSubmit = entity.__disableSubmit;
 }
Пример #3
0
 /// <summary>
 /// Clear the reference of relationships in memory.
 /// </summary>
 public void ClearRelationshipObjects()
 {
     __preguntaValid = false;
     __pregunta = null;
     __formulario1Valid = false;
     __formulario1 = null;
 }
Пример #4
0
 /// <summary>
 /// Sybase internal use only.
 /// <summary>
 public void SetOriginalState(YPF.Comercial.RRCC.SUP.Formulario orig)
 {
     __originalStateValid = true;
     __originalState = orig;
 }
Пример #5
0
 /// <summary>
 /// Set current MBO attributes by specified MBO.
 /// </summary>
 public static YPF.Comercial.RRCC.SUP.Formulario Merge(YPF.Comercial.RRCC.SUP.Formulario entity)
 {
     YPF.Comercial.RRCC.SUP.Formulario ent = Find(entity._pk());
     if (ent == null)
     {
         ent = new YPF.Comercial.RRCC.SUP.Formulario();
     }
     ent.CopyAll(entity);
     ent.Save();
     return ent;
 }
Пример #6
0
 protected  override void Bind(Sybase.Persistence.ConnectionProfile profile, System.Data.IDataReader rs) 
 {
     this.__idFormulario = com.sybase.afx.db.ReaderUtil.GetInt(profile,rs,"idFormulario",0);
     this.__descripcion = com.sybase.afx.db.ReaderUtil.GetString(profile,rs,"descripcion",1);
     this.__calculaPuntuacion = com.sybase.afx.db.ReaderUtil.GetBoolean(profile,rs,"calculaPuntuacion",2);
     this.__codigoSAP = com.sybase.afx.db.ReaderUtil.GetString(profile,rs,"codigoSAP",3);
     PreguntasFormulario =(null);
     SeleccionTablasRelevamiento =(null);
     SeleccionFormularios =(null);
     this.__pending = com.sybase.afx.db.ReaderUtil.GetBoolean(profile,rs,"pending",4);
     this.__pendingChange = com.sybase.afx.db.ReaderUtil.GetChar(profile,rs,"pendingChange",5);
     this.__replayPending = com.sybase.afx.db.ReaderUtil.GetLong(profile,rs,"replayPending",6);
     this.__replayFailure = com.sybase.afx.db.ReaderUtil.GetLong(profile,rs,"replayFailure",7);
     this.__surrogateKey = com.sybase.afx.db.ReaderUtil.GetLong(profile,rs,"surrogateKey",8);
     this.__replayCounter = com.sybase.afx.db.ReaderUtil.GetLong(profile,rs,"replayCounter",9);
     this.__disableSubmit = com.sybase.afx.db.ReaderUtil.GetBoolean(profile,rs,"disableSubmit",10);
     _isNew = false;
     _isDirty = false;
     if (this.IsPending)
     {
         this.SetOriginalState(null);
         this.__originalStateValid = false;
     }
     else
     {
         YPF.Comercial.RRCC.SUP.Formulario os_1 = new YPF.Comercial.RRCC.SUP.Formulario();
         os_1.CopyAll(this);
         this.SetOriginalState(os_1);
     }
 }
Пример #7
0
 private static YPF.Comercial.RRCC.SUP.Formulario _find(long 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.Formulario _rt = null;
         System.Data.IDbCommand ps = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, sql);
         com.sybase.afx.db.CommandUtil.SetLong(_conn.GetConnectionProfile(), ps, "surrogateKey", id);
         _rs = ps.ExecuteReader();
         Sybase.Persistence.ConnectionProfile profile = _conn.GetConnectionProfile();
         while (com.sybase.afx.db.ReaderUtil.Read(profile, _rs))
         {
             _rt = new YPF.Comercial.RRCC.SUP.Formulario();
             _rt.Bind(profile, _rs);
             count++;
             if(findOs)
             {
                 _rt.__isOsEntity = true;
                 _rt.__pending = false;  
             }
             if( !findNonPending )
             {
                 if(_rt.IsPending)
                 {
                     break;
                 }
             }
             else
             {
                 if( !_rt.IsPending )
                 {
                     break;
                 }
                 else
                 {
                     _rt = null;
                 }
             }
         }
         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();
     }
 }
Пример #8
0
 /// <summary>
 /// Refresh the mobile business object from database.
 /// </summary>
 public void Refresh()
 {
     if (!_isNew && !__isOsEntity)
     {
         YPF.Comercial.RRCC.SUP.Formulario ent = Load(_pk());
         CopyAll(ent);
         if (this.IsPending)
         {
             this.SetOriginalState(null);
             this.__originalStateValid = false;
         }
         else
         {
             YPF.Comercial.RRCC.SUP.Formulario os_1 = new YPF.Comercial.RRCC.SUP.Formulario();
             os_1.CopyAll(this);
             this.SetOriginalState(os_1);
         }
         _isNew = false;
         _isDirty = false;
     }
 }
Пример #9
0
 internal static YPF.Comercial.RRCC.SUP.Formulario FromJSON(object _json)
 {
     if (_json == null)
     {
         return null;
     }
     else
     {
         YPF.Comercial.RRCC.SUP.Formulario _obj = new YPF.Comercial.RRCC.SUP.Formulario();
         _obj._fromJSON((com.sybase.afx.json.JsonObject)_json);
         return _obj;
     }
 }
Пример #10
0
 /// <summary>
 /// Find a List of YPF.Comercial.RRCC.SUP.Formulario
 /// </summary>
 /// <exception cref="PersistentException">Thrown if unable to retrieve mobile business object.</exception>
 /// <remarks> </remarks>
 public static Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.Formulario> GetPendingObjects(char pendingChange, int skip, int take)
 {
         skip = skip + 1;
     Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.Formulario> result_2 = new Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.Formulario>();
     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.\"a\",x.\"b\",x.\"c\",x.\"d\",x.\"pending\",x.\"_pc\",x.\"_rp\",x.\"_rf\",x.\"e\",x.\"_rc\",x.\"_ds\" from \"crmmobiledesa_1_0_formulario\" x where x.\"_pc\" = ?";
         _selectSQL = "select top " + take + " start at " + skip + " " + _selectSQL;
         System.Data.IDbCommand ps_3 = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, _selectSQL);
         com.sybase.afx.db.CommandUtil.SetChar(_conn.GetConnectionProfile(), ps_3, "pendingChange", pendingChange);
         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.Formulario entity_6 = new YPF.Comercial.RRCC.SUP.Formulario();
             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
 /// <summary>
 /// Find a mobile business object YPF.Comercial.RRCC.SUP.Formulario
 /// </summary>
 /// <exception cref="PersistentException">Thrown if unable to retrieve mobile business object.</exception>
 /// <remarks> </remarks>
 public static YPF.Comercial.RRCC.SUP.Formulario FindByCodigoSAP(string codigoSAP)
 {
     YPF.Comercial.RRCC.SUP.Formulario result_2 = null;
     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 = "SELECT x.\"a\",x.\"b\",x.\"c\",x.\"d\",x.\"pending\",x.\"_pc\",x.\"_rp\",x.\"_rf\",x.\"e\",x.\"_rc\",x.\"_ds\" FROM \"crmmobiledesa_1_0_formulario\" x WHERE (((x.\"pending\" = 1 or not exists (select x_os.\"e\" from \"crmmobiledesa_1_0_formulario_os\" x_os where x_os.\"e\" = x.\"e\")))) and ( x.\"d\" = ?)"
                                 + "";
         System.Data.IDbCommand ps_3 = com.sybase.afx.db.CommandUtil.CreateCommand(_conn, _selectSQL);
         com.sybase.afx.db.CommandUtil.SetString(_conn.GetConnectionProfile(), ps_3, "codigoSAP", codigoSAP);
         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.Formulario entity_6 = new YPF.Comercial.RRCC.SUP.Formulario();
             entity_6.Bind(profile, rs_4);
             count_5++;
             result_2 = 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; 
   
 }
 /// <summary>
 /// copy the MBO attributes to current MBO
 /// </summary>
 public void CopyAll(YPF.Comercial.RRCC.SUP.SeleccionTablaRelevamiento entity)
 {
     this._isNew = entity._isNew;
     this.__idFormulario = entity.__idFormulario;
     this.__idTablaRelevamiento = entity.__idTablaRelevamiento;
     this.__tablaRelevamiento = entity.__tablaRelevamiento;
     this.__tablaRelevamientoValid = entity.__tablaRelevamientoValid;
     this.__formulario = entity.__formulario;
     this.__formularioValid = entity.__formularioValid;
     this.__pending = entity.__pending;
     this.__pendingChange = entity.__pendingChange;
     this.__replayPending = entity.__replayPending;
     this.__replayFailure = entity.__replayFailure;
     this.__tablaRelevamientoFK = entity.__tablaRelevamientoFK;
     this.__formularioFK = entity.__formularioFK;
     this.__surrogateKey = entity.SurrogateKey;
     this.__replayCounter = entity.__replayCounter;
     this.__disableSubmit = entity.__disableSubmit;
 }
 /// <summary>
 /// Clear the reference of relationships in memory.
 /// </summary>
 public void ClearRelationshipObjects()
 {
     __tablaRelevamientoValid = false;
     __tablaRelevamiento = null;
     __formularioValid = false;
     __formulario = null;
 }
Пример #14
0
 /// <summary>
 /// copy the MBO attributes to current MBO
 /// </summary>
 public void CopyAll(YPF.Comercial.RRCC.SUP.SeleccionFormulario entity)
 {
     this._isNew = entity._isNew;
     this.__idMotivo = entity.__idMotivo;
     this.__idNegocio = entity.__idNegocio;
     this.__idFormulario = entity.__idFormulario;
     this.__negocio = entity.__negocio;
     this.__negocioValid = entity.__negocioValid;
     this.__motivo = entity.__motivo;
     this.__motivoValid = entity.__motivoValid;
     this.__formulario = entity.__formulario;
     this.__formularioValid = entity.__formularioValid;
     this.__pending = entity.__pending;
     this.__pendingChange = entity.__pendingChange;
     this.__replayPending = entity.__replayPending;
     this.__replayFailure = entity.__replayFailure;
     this.__negocioFK = entity.__negocioFK;
     this.__motivoFK = entity.__motivoFK;
     this.__formularioFK = entity.__formularioFK;
     this.__surrogateKey = entity.SurrogateKey;
     this.__replayCounter = entity.__replayCounter;
     this.__disableSubmit = entity.__disableSubmit;
 }
Пример #15
0
 /// <summary>
 /// Clear the reference of relationships in memory.
 /// </summary>
 public void ClearRelationshipObjects()
 {
     __negocioValid = false;
     __negocio = null;
     __motivoValid = false;
     __motivo = null;
     __formularioValid = false;
     __formulario = null;
 }
Пример #16
0
        public void Finish_rbsReplayInternal(Sybase.Persistence.IOperationReplay _call_tmp)
        {
            YPF.Comercial.RRCC.SUP.intrnl.OperationReplay _call = (YPF.Comercial.RRCC.SUP.intrnl.OperationReplay)_call_tmp;
            com.sybase.afx.json.JsonObject parameters           = (com.sybase.afx.json.JsonObject)(com.sybase.afx.json.JsonReader
                                                                                                   .Parse(_call.Parameters));
            string exception = _call.Exception;

            YPF.Comercial.RRCC.SUP.Formulario entity = (YPF.Comercial.RRCC.SUP.Formulario)(YPF.Comercial.RRCC.SUP.Formulario.__fromJSON(parameters.Get("entity")));

            //lock(typeof(YPF.Comercial.RRCC.SUP.CRMMobileDesaDB))
            //{
            Sybase.Persistence.ConnectionWrapper conn = YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.AcquireDBWriteConnection();
            Sybase.Persistence.LocalTransaction  tran = null;
            try
            {
                tran = conn.BeginTransaction();

                long ____id = entity.ReplayCounter;
                YPF.Comercial.RRCC.SUP.Formulario _client        = YPF.Comercial.RRCC.SUP.Formulario.Find(entity._pk());
                YPF.Comercial.RRCC.SUP.Formulario _downloadState = null;
                if (_client != null)
                {
                    _downloadState = _client.DownloadState;
                }
                if (exception == null)
                {
                    YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.GetCallbackHandler().OnReplaySuccess(_client == null ? entity : _client);
                    YPF.Comercial.RRCC.SUP.Formulario.GetCallbackHandler().OnReplaySuccess(_client == null ? entity : _client);
                    if ((_client != null) && _client.IsPending)
                    {
                        long _rc = _client.ReplayPending;
                        if (_rc == ____id)
                        {
                            if (_rc == _client.ReplayCounter)
                            {
                                _client._cancelPending2(false);
                            }
                            else
                            {
                                _client.ReplayPending = 0;
                                _client.ReplayFailure = 0;
                                _client.__update(true);
                            }
                        }
                    }
                }
                else
                {
                    _client.ReplayFailure = (_client.ReplayPending);
                    _client._cascadeUpdateReplayCounterPending(false);
                    if (_client != null && _client.ReplayPending == ____id)
                    {
                        _client.ReplayPending = (0);
                        _client.ReplayCounter = (YPF.Comercial.RRCC.SUP.KeyGenerator.GenerateId());
                        _client.ReplayFailure = (____id);
                        _client.__update(true);
                        if (_downloadState != null)
                        {
                            _downloadState._update_os();
                        }
                    }
                    YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.GetCallbackHandler().OnReplayFailure(_client);
                    YPF.Comercial.RRCC.SUP.Formulario.GetCallbackHandler().OnReplayFailure(_client);
                }
                _call.Delete();
                tran.Commit();
            }
            catch (Sybase.Persistence.PersistenceException pe)
            {
                tran.Rollback();
                throw pe;
            }
            catch (System.ApplicationException e)
            {
                tran.Rollback();
                throw e;
            }
            //}
        }