Beispiel #1
0
        public int GetDOIID(SqlConnection con, String doi)
        {
            SuperSQL sql = new SuperSQL(con, null, Response);

            sql.add("fDOI", doi);
            object id = sql.select("TblDOI", "fDOIID");

            return(id == null ? 0 : (int)id);
        }
Beispiel #2
0
        protected string AddDOIToDB(String doi, String user, String portal, String xml, String view)
        {
            string guid = "";

            //using (SqlConnection con = new SqlConnection(species.DataSources.dbConResolver))
            using (SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["Database"]))
            {
                con.Open();

                int id = GetDOIID(con, doi);


                SuperSQL sql = new SuperSQL(con, null, Response);
                sql.add("fDOI", doi);
                sql.add("fUserName", user);
                sql.add("fPortalName", portal);
                sql.add("fXML", xml);
                sql.add("fView", view);

                if (id == 0)
                {
                    Response.Write("add doi<br>");
                    sql.insert("TblDOI");
                    id = GetDOIID(con, doi);
                }
                else
                {
                    Response.Write("edit doi<br>");
                    sql.where ("fDOIID", id);
                    sql.edit("TblDOI");
                }

                sql.clear();
                sql.add("fDOIID", id);
                guid = sql.select("TblDOI", "fGUID").ToString();
            }

            return(guid);
        }