/// <summary> /// クラスのインスタンス作成時に実行されるコンストラクタ /// </summary> public ProgramService() { var sql = new SQLStrings(); sql.AppendLine("SELECT"); sql.AppendLine(" PROGRAM_ID,"); sql.AppendLine(" PROGRAM_NM,"); sql.AppendLine(" ASSEMBLY_NM"); sql.AppendLine("FROM"); sql.AppendLine(" M_PROGRAM"); sql.AppendLine("WHERE"); sql.AppendLine(" ASSEMBLY_NM = :ASSEMBLY_NM"); var exeName = Process.GetCurrentProcess().MainModule?.ModuleName; var param = new { ASSEMBLY_NM = exeName }; // TODO //var ret = Database.Select(sql, param); //if (ret.Count == 0) //{ // return; //} //var first = ret.FirstOrDefault(); //this.ProgramID = first.PROGRAM_ID; //this.ProgramName = first.PROGRAM_NM; //this.AssemblyName = first.ASSEMBLY_NM; }
/// <inheritdoc/> public int Insert(IDbTransaction trans, SQLStrings sql, object param = null) { try { return(this._conn.Execute(sql.ToString(), param, trans)); } catch (Exception) { trans.Rollback(); throw; } }
/// <inheritdoc/> public List <dynamic> Select(SQLStrings sql, object param = null) { this._ConnectionTask.Wait(); var retValue = this._conn.Query(sql.ToString(), param); if (retValue.IsEmpty()) { return(new List <dynamic>()); } else { return(retValue.AsList()); } }
/// <inheritdoc/> public List <T> Select <T>(SQLStrings sql, object param = null) where T : class { this._ConnectionTask.Wait(); var retValue = this._conn.Query <T>(sql.ToString(), param); if (retValue.IsEmpty()) { return(new List <T>()); } else { return(retValue.AsList()); } }
/// <summary> /// クラスへの初回アクセス時に1度だけ実行される静的コンストラクタ /// </summary> static LoggerService() { _SQL = new SQLStrings(); _SQL.AppendLine("INSERT INTO"); _SQL.AppendLine(" T_LOG"); _SQL.AppendLine("("); _SQL.AppendLine(" SEQ,"); _SQL.AppendLine(" LOG_KBN,"); _SQL.AppendLine(" CLASS_NM,"); _SQL.AppendLine(" METHOD_NM,"); _SQL.AppendLine(" MESSAGE,"); _SQL.AppendLine(" INS_DATE,"); _SQL.AppendLine(" INS_TIME,"); _SQL.AppendLine(" INS_PROGRAM_ID,"); _SQL.AppendLine(" INS_USER_NM,"); _SQL.AppendLine(" INS_TERM_NM,"); _SQL.AppendLine(" UPD_DATE,"); _SQL.AppendLine(" UPD_TIME,"); _SQL.AppendLine(" UPD_PROGRAM_ID,"); _SQL.AppendLine(" UPD_USER_NM,"); _SQL.AppendLine(" UPD_TERM_NM"); _SQL.AppendLine(")"); _SQL.AppendLine("VALUES"); _SQL.AppendLine("("); _SQL.AppendLine(" T_LOG_SEQ.NEXTVAL,"); _SQL.AppendLine(" :LOG_KBN,"); _SQL.AppendLine(" :CLASS_NM,"); _SQL.AppendLine(" :METHOD_NM,"); _SQL.AppendLine(" :MESSAGE,"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDD'),"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'HH24MISS'),"); _SQL.AppendLine(" :PROGRAM_ID,"); _SQL.AppendLine(" :USER_NM,"); _SQL.AppendLine(" :TERM_NM,"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'YYYYMMDD'),"); _SQL.AppendLine(" TO_CHAR(LOCALTIMESTAMP, 'HH24MISS'),"); _SQL.AppendLine(" :PROGRAM_ID,"); _SQL.AppendLine(" :USER_NM,"); _SQL.AppendLine(" :TERM_NM"); _SQL.AppendLine(")"); }