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;
}
}
}
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.