Profiles.Edit.Utilities.DataIO.GetPersonID C# (CSharp) Method

GetPersonID() public method

public GetPersonID ( System.Int64 nodeid ) : int
nodeid System.Int64
return int
        public int GetPersonID(Int64 nodeid)
        {
            SessionManagement sm = new SessionManagement();
            string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;

            using (SqlConnection dbconnection = new SqlConnection(connstr))
            {
                int personid = 0;

                try
                {
                    dbconnection.Open();
                    //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value.
                    using (SqlDataReader reader = GetDBCommand(connstr, "select i.internalid from  [RDF.Stage].internalnodemap i with(nolock) where i.nodeid = " + nodeid.ToString(), CommandType.Text, CommandBehavior.CloseConnection, null).ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            personid = Convert.ToInt32(reader[0]);
                        }
                    }
                }
                catch (Exception e)
                {
                    Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                    throw new Exception(e.Message);
                }

                return personid;
            }
        }

Usage Example

        public EditObjectTypeProperty(XmlDocument pagedata, List<ModuleParams> moduleparams, XmlNamespaceManager pagenamespaces)
            : base(pagedata, moduleparams, pagenamespaces)
        {
            Edit.Utilities.DataIO data;
            SessionManagement sm = new SessionManagement();

            Profiles.Profile.Utilities.DataIO propdata = new Profiles.Profile.Utilities.DataIO();
            data = new Profiles.Edit.Utilities.DataIO();

            if (Request.QueryString["subject"] != null)
                this.SubjectID = Convert.ToInt64(Request.QueryString["subject"]);
            else if (base.GetRawQueryStringItem("subject") != null)
                this.SubjectID = Convert.ToInt64(base.GetRawQueryStringItem("subject"));
            else
                Response.Redirect("~/search");

            this.PredicateURI = Request.QueryString["predicateuri"].Replace("!", "#");

            GetSubjectProfile();

            this.PropertyListXML = propdata.GetPropertyList(this.BaseData, base.PresentationXML, PredicateURI, false, true, false);
            this.PropertyLabel = PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@Label").Value;
            litBackLink.Text = "<a href='" + Root.Domain + "/edit/" + this.SubjectID.ToString() + "'>Edit Menu</a> &gt; <b>" + this.PropertyLabel + "</b>";

            securityOptions.Subject = this.SubjectID;
            securityOptions.PredicateURI = PredicateURI;
            this.PredicateID = data.GetStoreNode(this.PredicateURI);
            securityOptions.PrivacyCode = Convert.ToInt32(this.PropertyListXML.SelectSingleNode("PropertyList/PropertyGroup/Property/@ViewSecurityGroup").Value);
            securityOptions.SecurityGroups = new XmlDataDocument();
            securityOptions.SecurityGroups.LoadXml(base.PresentationXML.DocumentElement.LastChild.OuterXml);

            this._subject = Convert.ToInt64(Request.QueryString["subject"]);
            this._personId = data.GetPersonID(_subject);
        }
All Usage Examples Of Profiles.Edit.Utilities.DataIO::GetPersonID