private bool GetStoreTriple(StoreTripleRequest str)
{
SessionManagement sm = new SessionManagement();
string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;
SqlConnection dbconnection = new SqlConnection(connstr);
SqlParameter[] param = new SqlParameter[str.Length];
bool error = false;
try
{
dbconnection.Open();
if (str.Subject != null)
param[str.Subject.ParamOrdinal] = new SqlParameter("@subjectid", Convert.ToInt64(str.Subject.Value));
if (str.Predicate != null)
param[str.Predicate.ParamOrdinal] = new SqlParameter("@predicateid", Convert.ToInt64(str.Predicate.Value));
if (str.Object != null)
param[str.Object.ParamOrdinal] = new SqlParameter("@objectid", Convert.ToInt64(str.Object.Value));
if (str.OldObject != null)
param[str.OldObject.ParamOrdinal] = new SqlParameter("@oldobjectid", Convert.ToInt64(str.OldObject.Value));
if (str.MoveUpOne != null)
param[str.MoveUpOne.ParamOrdinal] = new SqlParameter("@MoveUpOne", Convert.ToInt16(str.MoveUpOne.Value));
if (str.MoveDownOne != null)
param[str.MoveDownOne.ParamOrdinal] = new SqlParameter("@MoveDownOne", Convert.ToInt16(str.MoveDownOne.Value));
if (str.StoreInverse != null)
param[str.StoreInverse.ParamOrdinal] = new SqlParameter("@StoreInverse", Convert.ToInt16(str.StoreInverse.Value));
param[str.Length - 2] = new SqlParameter("@sessionID", sm.Session().SessionID);
param[str.Length - 1] = new SqlParameter("@error", null);
param[str.Length - 1].DbType = DbType.Boolean;
param[str.Length - 1].Direction = ParameterDirection.Output;
using (var cmd = GetDBCommand("", "[RDF.].GetStoreTriple", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param))
{
//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(cmd);
cmd.Connection.Close();
}
error = Convert.ToBoolean(param[str.Length - 1].Value);
Framework.Utilities.Cache.AlterDependency(str.Subject.Value.ToString());
}
catch (Exception e)
{
Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
throw new Exception(e.Message);
}
return error;
}