Beispiel #1
0
        public void Guardar(Notificacion obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString());
                obj.SecLog = (long)p.PK_SecLog;
                sql        = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6})" +
                             "VALUES(:{1},:{2},:{3},:{4},:{5},:{6})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{3}=:{3} ," +
                      "{4}=:{4} ," +
                      "{5}=:{5} ," +
                      "{6}=:{6}  WHERE " +
                      "{1}=:{1} AND " +
                      "{2}=:{2}";
            }

            sql = string.Format(sql, Notificacion.NOMBRE_TABLA, Notificacion.C_PK_COD_FALLA,
                                Notificacion.C_PK_COD_PERSONA,
                                Notificacion.C_D_COD_ESTADO_NOTIFICACION,
                                Notificacion.C_D_COD_ESTADO,
                                Notificacion.C_SEC_LOG,
                                Notificacion.C_SINC_VER);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(Notificacion.C_PK_COD_FALLA, OracleDbType.Int32, obj.PkCodFalla, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_PK_COD_PERSONA, OracleDbType.Int64, obj.PkCodPersona, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_D_COD_ESTADO_NOTIFICACION, OracleDbType.Int64, obj.DCodEstadoNotificacion, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_D_COD_ESTADO, OracleDbType.Varchar2, obj.DCodEstado, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(Notificacion.C_SINC_VER, OracleDbType.Int64, obj.SincVer, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }