public bool CheckPublicationExists(string mpid)
{
SessionManagement sm = new SessionManagement();
string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;
SqlConnection dbconnection = new SqlConnection(connstr);
SqlParameter[] param = new SqlParameter[2];
bool exists = false;
try
{
dbconnection.Open();
param[0] = new SqlParameter("@pmid", mpid);
param[1] = new SqlParameter("@exists", null);
param[1].DbType = DbType.Boolean;
param[1].Direction = ParameterDirection.Output;
//For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value.
ExecuteSQLDataCommand(GetDBCommand(ref dbconnection, "[Profile.Data].[Publication.DoesPublicationExist]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param));
dbconnection.Close();
SqlConnection.ClearPool(dbconnection);
exists = Convert.ToBoolean(param[1].Value);
}
catch (Exception e)
{
Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
throw new Exception(e.Message);
}
return exists;
}