Skip to content

Instantly share code, notes, and snippets.

/wtf.cs Secret

Created April 12, 2017 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/a970d54ca9ac05c8ac16625058ff43c3 to your computer and use it in GitHub Desktop.
Save anonymous/a970d54ca9ac05c8ac16625058ff43c3 to your computer and use it in GitHub Desktop.
WTF?
public static string CreateFileName(string jobReference, string type, string user, string fileType)
{
string documentName = string.Empty;
string sql = "Select 'tfr_in'||:P_Job_Reference||:P_User_Id ||to_char(Sysdate, 'yyyymmddhh24miss')||'.'||lower(:P_Doc_Type) From Dual";
List<framework.db.IDatabaseParameter> paramList = new List<framework.db.IDatabaseParameter>();
paramList.Add(localClass.NewParameter(":p_job_reference", ParameterDirection.Input, DbType.String, jobReference));
paramList.Add(localClass.NewParameter(":P_User_Id", ParameterDirection.Input, DbType.String, user));
paramList.Add(localClass.NewParameter(":P_Doc_Type", ParameterDirection.Input, DbType.String, type));
using (var connection = framework.db.DatabaseConnectionFactory.createDatabaseConnection(framework.db.DatabaseType.ORACLE))
{
connection.open();
DataTable dt = connection.executeSelect(sql, CommandType.Text, paramList);
if (dt != null && dt.Rows.Count > 0)
{
documentName = dt.Rows[0][0].ToString();
}
}
return documentName;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment