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

AddPublication() public method

public AddPublication ( int personID, long subjectID, int pmid, XmlDocument PropertyListXML ) : void
personID int
subjectID long
pmid int
PropertyListXML System.Xml.XmlDocument
return void
        public void AddPublication(int personID, long subjectID, int pmid, XmlDocument PropertyListXML)
        {
            ActivityLog(PropertyListXML, subjectID, "PMID", "" + pmid);
            SessionManagement sm = new SessionManagement();
            string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;

            SqlConnection dbconnection = new SqlConnection(connstr);

            SqlParameter[] param = new SqlParameter[2];

            try
            {
                dbconnection.Open();

                param[0] = new SqlParameter("@userid", personID);

                param[1] = new SqlParameter("@pmid", pmid);

                //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(dbconnection, "[Profile.Data].[Publication.Pubmed.AddPublication]", CommandType.StoredProcedure, CommandBehavior.CloseConnection, param));

                dbconnection.Close();

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

Same methods

DataIO::AddPublication ( string mpid, string pubmedxml ) : void

Usage Example

Example #1
0
        //Inserts comma seperated string of PubMed Ids into the db
        private void InsertPubMedIds(string value)
        {
            string uri = "http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?retmax=1000&db=pubmed&retmode=xml&id=" + value;

            System.Xml.XmlDocument myXml = new System.Xml.XmlDocument();
            myXml.LoadXml(this.HttpPost(uri, "Catalyst", "text/plain"));
            XmlNodeList nodes = myXml.SelectNodes("PubmedArticleSet/PubmedArticle");

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

            foreach (XmlNode node in nodes)
            {
                string pmid = node.SelectSingleNode("MedlineCitation/PMID").InnerText;

                if (!data.CheckPublicationExists(pmid))
                {
                    // Insert or update the publication
                    data.AddPublication(pmid, node.OuterXml);
                }

                // Assign the user to the publication
                data.AddPublication(_personId, Convert.ToInt32(pmid));
            }
            this.Counter = 0;
            Session["phAddPub.Visible"]           = null;
            Session["pnlAddPubMed.Visible"]       = null;
            Session["pnlAddCustomPubMed.Visible"] = null;
            Session["pnlDeletePubMed.Visible"]    = null;
        }
All Usage Examples Of Profiles.Edit.Utilities.DataIO::AddPublication