/// <summary>
 /// 連携ファイルの出力
 /// </summary>
 /// <param name="value"></param>
 /// <returns>実行成否</returns>
 private bool OutputSynchronizeFile(BaseParameterContainer value)
 {
     try
     {
         using (var sw = new StreamWriter($"{Startup.GetSettings("SynchronizeDirectory")}\\{value.SynchronizeFileName()}", false, System.Text.Encoding.Unicode))
         {
             sw.Write(value.OutputJson());
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #2
0
        /// <summary>
        /// OracleへのINSERT実行
        /// </summary>
        /// <param name="value"></param>
        /// <returns>実行成否</returns>
        private bool Insert(BaseParameterContainer value)
        {
            try
            {
                _connection.Open();
                var sb = new StringBuilder();

                sb = new StringBuilder();
                sb.AppendLine($"insert into TESTTABLE");
                sb.AppendLine($"    (FILENAME, JSONDATA)");
                sb.AppendLine($"values");
                sb.AppendLine($"    (:pfilename, :pjsondata)");
                using (var cmd = new OracleCommand(sb.ToString(), _connection)
                {
                    CommandType = System.Data.CommandType.Text
                })
                {
                    cmd.Parameters.Add(new OracleParameter()
                    {
                        ParameterName = "pfilename",
                        OracleDbType  = OracleDbType.Varchar2,
                        Direction     = ParameterDirection.Input,
                        Value         = value.SynchronizeFileName(),
                    });
                    cmd.Parameters.Add(new OracleParameter()
                    {
                        ParameterName = "pjsondata",
                        OracleDbType  = OracleDbType.Varchar2,
                        Direction     = ParameterDirection.Input,
                        Value         = value.OutputJson(),
                    });
                    var val = cmd.ExecuteNonQuery();
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }