Export amazon settlement report fix

This commit is contained in:
2020-02-06 21:20:15 +00:00
committed by GitHub
parent bed529e1c8
commit 7e50da21e7
52 changed files with 4827 additions and 819 deletions

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace bnhtrade.Core.Data.Database.Programmability
{
public class Sequence : Connection
{
public Sequence (string sqlConnectionString) : base(sqlConnectionString)
{
}
public int GetNext(string sequenceName)
{
if (string.IsNullOrWhiteSpace(sequenceName))
{
throw new Exception("Sequence name is null or whitespace.");
}
using (SqlConnection conn = new SqlConnection(sqlConnectionString))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(@"
SELECT NEXT VALUE FOR " + sequenceName
, conn))
{
//cmd.Parameters.AddWithValue("@sequenceName", sequenceName);
// it wouldn't let me use parameters
object obj = cmd.ExecuteScalar();
try
{
//string whaaaat = (string)obj;
return Convert.ToInt32(obj);
}
catch (Exception ex)
{
throw new Exception("Error returning next value in sequence: " + ex.Message);
}
}
}
}
}
}