Profiles.Edit.Utilities.DataIO.DeleteTriple C# (CSharp) Méthode

DeleteTriple() public méthode

public DeleteTriple ( System.Int64 subjectid, System.Int64 predicateid, System.Int64 objectid ) : bool
subjectid System.Int64
predicateid System.Int64
objectid System.Int64
Résultat bool
        public bool DeleteTriple(Int64 subjectid, Int64 predicateid, Int64 objectid)
        {
            SessionManagement sm = new SessionManagement();
            string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;

            SqlConnection dbconnection = new SqlConnection(connstr);
            SqlCommand dbcommand = new SqlCommand();

            SqlParameter[] param = new SqlParameter[6];
            bool error = false;

            try
            {

                param[0] = new SqlParameter("@SubjectID", subjectid);
                param[1] = new SqlParameter("@PredicateID", predicateid);
                param[2] = new SqlParameter("@ObjectID", objectid);
                param[3] = new SqlParameter("@SessionID", sm.Session().SessionID);
                param[4] = new SqlParameter("@DeleteInverse", 1);

                param[5] = new SqlParameter("@Error", "");
                param[5].DbType = DbType.Boolean;
                param[5].Direction = ParameterDirection.Output;

                SqlCommand comm = GetDBCommand(ref dbconnection, "[RDF.].DeleteTriple", 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(comm);

                comm.Connection.Close();

                if (dbconnection.State == ConnectionState.Open)
                    dbconnection.Close();

                error = Convert.ToBoolean(param[5].Value);

                Framework.Utilities.Cache.AlterDependency(subjectid.ToString());

                if (error)
                    Framework.Utilities.DebugLogging.Log("Delete Triple blew up with the following values -- {[RDF.].DeleteTriple} DeleteInverse: 1 SubjectID:" + subjectid.ToString() + " PredicateID:" + predicateid.ToString() + " ObjectID:" + objectid.ToString() + " SessionID:" + sm.Session().SessionID);

            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                throw new Exception(e.Message);
            }

            return error;
        }

Usage Example

        protected void gridEntities_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Edit.Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO();

            Int64 _object = Convert.ToInt64(data.GetStoreNode(gridEntities.DataKeys[e.RowIndex].Values[0].ToString()));

            data.DeleteTriple(this.SubjectID, this.PredicateID, _object);
            this.LoadEntityGrid(true);

            upnlEditSection.Update();
        }
All Usage Examples Of Profiles.Edit.Utilities.DataIO::DeleteTriple