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

UpdateSecuritySetting() public méthode

public UpdateSecuritySetting ( Int64 subjectid, Int64 predicateid, int securitygroup ) : bool
subjectid Int64
predicateid Int64
securitygroup int
Résultat bool
        public bool UpdateSecuritySetting(Int64 subjectid, Int64 predicateid, int securitygroup)
        {
            EditActivityLog(subjectid, GetProperty(predicateid), "" + securitygroup);

            string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;
            SqlConnection dbconnection = new SqlConnection(connstr);
            SqlParameter[] param = new SqlParameter[3];

            bool error = false;

            try
            {

                dbconnection.Open();

                param[0] = new SqlParameter("@NodeID", subjectid);
                param[1] = new SqlParameter("@PropertyID", predicateid);

                param[2] = new SqlParameter("@ViewSecurityGroup", securitygroup);

                SqlCommand comm = GetDBCommand(ref dbconnection, "[RDF.].SetNodePropertySecurity", 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.Closed)
                    dbconnection.Close();
            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                error = true;
                throw new Exception(e.Message);

            }

            return error;
        }

Usage Example

Exemple #1
0
        private void UpdateVisibility()
        {
            Edit.Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO();
            int securitygroup          = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);

            data.UpdateSecuritySetting(this.SubjectID, data.GetStoreNode(this.PredicateURI), securitygroup);

            if (securitygroup >= -10 && securitygroup < 0)
            {
                data.UpdateSecuritySetting(this.SubjectID, data.GetStoreNode("http://vivoweb.org/ontology/core#email"), -20);
            }
            else
            {
                data.UpdateSecuritySetting(this.SubjectID, data.GetStoreNode("http://vivoweb.org/ontology/core#email"), securitygroup);
            }
        }
All Usage Examples Of Profiles.Edit.Utilities.DataIO::UpdateSecuritySetting