using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
namespace helper
{
public class NSRLClass
{
public SqlConnection globalSQLConnection;
public void startSqlConnection(string sqlConnectionString)
{
if (globalSQLConnection == null)
{
globalSQLConnection = new SqlConnection(sqlConnectionString);
globalSQLConnection.Open();
}
if (globalSQLConnection == null)
{
globalSQLConnection = new SqlConnection(sqlConnectionString);
globalSQLConnection.Open();
}
}
public void closeSqlConnection()
{
if (globalSQLConnection != null)
{
globalSQLConnection.Close();
}
}
public bool isInNSRL(string sqlConnectionString, string md5String, string fileSizeString, ref string OpSystemCodeString)
{
bool returnBool = false;
if (globalSQLConnection == null)
{
globalSQLConnection = new SqlConnection(sqlConnectionString);
globalSQLConnection.Open();
}
SqlConnection connection = new SqlConnection(sqlConnectionString);
SqlCommand command = new SqlCommand("dbo.[pr_checkMd5AndSize]", globalSQLConnection);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@md5", md5String);
command.Parameters.AddWithValue("@filesize", fileSizeString);
SqlParameter nameSqlParameter = new SqlParameter("@isInNsrl", SqlDbType.Int);
nameSqlParameter.Direction = ParameterDirection.Output;
command.Parameters.Add(nameSqlParameter);
SqlParameter nameSqlParameter2 = new SqlParameter("@OpSystemCode", SqlDbType.VarChar, 50);
nameSqlParameter2.Direction = ParameterDirection.Output;
command.Parameters.Add(nameSqlParameter2);
command.ExecuteNonQuery();
OpSystemCodeString = nameSqlParameter2.Value.ToString();
if (Convert.ToInt32(nameSqlParameter.Value.ToString()) == 0)
{
returnBool = false;
}
else
{
returnBool = true;
}
return returnBool;
}
}
}
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE