Exemplo n.º 1
0
        public XmlReaderScope ProfileSearch(string searchQuery, bool isSecure)
        {
            string         spName = "usp_GetPersonList_xml";
            XmlReaderScope scope  = null;

            try
            {
                SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

                DbCommand dbCommand = db.GetStoredProcCommand(spName);

                db.AddInParameter(dbCommand, "xMessage", DbType.Xml, searchQuery);

                if (isSecure)
                {
                    db.AddInParameter(dbCommand, "isSecure", DbType.Boolean, isSecure);
                }

                XmlReader reader = db.ExecuteXmlReader(dbCommand);
                scope = new XmlReaderScope(dbCommand.Connection, reader);
            }
            catch (Exception ex)
            {
                XmlDataUtility.logit("---- ERROR==> " + ex.Message + " STACK:" + ex.StackTrace + " SOURCE:" + ex.Source);;

                throw ex;
            }

            return(scope);
        }
Exemplo n.º 2
0
        public XmlReaderScope GetProfileNetworkForBrowser(int profileId)
        {
            string spName = "usp_GetFlashNetwork_XML";
            //This is a good debug tool.  You will need to add a flag to your web.config to enable it. See method for flag name.
            XmlDataUtility.logit("- line 1: NetworkBrowserDA.GetProfileNetworkForBrowser(" + profileId.ToString() + ")");
            XmlReaderScope scope = null;

            try
            {

                SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

                DbCommand dbCommand = db.GetStoredProcCommand(spName);

                db.AddInParameter(dbCommand, "personid1", DbType.Int32, profileId);

                XmlReader reader = db.ExecuteXmlReader(dbCommand);

                scope = new XmlReaderScope(dbCommand.Connection, reader);

            }
            catch (Exception ex)
            {

                //this is a good debug tool.
                //XmlDataUtility.logit("- GetProfileNetworkForBrowser MESSAGE==> " + ex.Message + " STACKTRACE==>" + ex.StackTrace + " SOURCE==>" + ex.Source);

                bool rethrow = ExceptionPolicy.HandleException(ex, "Log Only Policy");
                if (rethrow)
                    throw ex;
            }

            return scope;
        }
Exemplo n.º 3
0
 /// <summary>
 /// populate business entity object from xml stored proc xml input parameter
 /// </summary>
 /// <param name="xml">input parameter in xml format</param>
 /// <param name="ds">an instance of typed dataset derived from xml schema</param>
 /// <returns>populated typed dataset from xml storeproc</returns>
 public static DataSet FillXmlDataSet(string spName, string xml, DataSet ds)
 {
     using (XmlReaderScope scope = ExecuteXmlReader(spName, xml))
     {
         ds.ReadXml(scope.Reader);
         return(ds);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Get xml in xmlreader by xml parameter
        /// </summary>
        /// <param name="spName">xml storproc name</param>
        /// <param name="id">input xml paramter of sp, null indicates parameter-less sp</param>
        /// <returns>XmlReaderScope that encapsulates xmlreader</returns>
        public static XmlReaderScope ExecuteXmlReader(string spName, string xml)
        {
            SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

            DbCommand dbCommand = db.GetStoredProcCommand(spName);

            db.AddInParameter(dbCommand, "xMessage", DbType.Xml, xml);

            XmlReader reader = db.ExecuteXmlReader(dbCommand);
            XmlReaderScope scope = new XmlReaderScope(dbCommand.Connection, reader);

            return scope;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Get xml in xmlreader by xml parameter
        /// </summary>
        /// <param name="spName">xml storproc name</param>
        /// <param name="id">input xml paramter of sp, null indicates parameter-less sp</param>
        /// <returns>XmlReaderScope that encapsulates xmlreader</returns>
        public static XmlReaderScope ExecuteXmlReader(string spName, string xml)
        {
            SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

            DbCommand dbCommand = db.GetStoredProcCommand(spName);

            db.AddInParameter(dbCommand, "xMessage", DbType.Xml, xml);

            XmlReader      reader = db.ExecuteXmlReader(dbCommand);
            XmlReaderScope scope  = new XmlReaderScope(dbCommand.Connection, reader);

            return(scope);
        }
Exemplo n.º 6
0
        public XmlReaderScope GetMatchingKeywords(string keyword, string queryID, bool exactKeyword)
        {
            string         spName = "usp_GetMatchingKeywords_xml ";
            XmlReaderScope scope  = null;
            // Defaults
            bool returnXML = true;

            try
            {
                SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

                DbCommand dbCommand = db.GetStoredProcCommand(spName);

                db.AddInParameter(dbCommand, "Keyword", DbType.String, keyword);

                if (queryID.Length > 0)
                {
                    db.AddInParameter(dbCommand, "QueryID", DbType.String, null);
                }
                else
                {
                    db.AddInParameter(dbCommand, "QueryID", DbType.String, DBNull.Value);
                }

                db.AddInParameter(dbCommand, "ExactKeyword", DbType.Boolean, exactKeyword);
                db.AddInParameter(dbCommand, "ReturnXML", DbType.Boolean, returnXML);

                XmlReader reader = db.ExecuteXmlReader(dbCommand);
                scope = new XmlReaderScope(dbCommand.Connection, reader);
            }
            catch (Exception ex)
            {
                XmlDataUtility.logit("ERROR==> " + ex.Message + " STACK:" + ex.StackTrace + " SOURCE:" + ex.Source);;

                throw ex;
            }

            return(scope);
        }
Exemplo n.º 7
0
        public XmlReaderScope GetMatchingKeywords(string keyword, string queryID, bool exactKeyword)
        {
            string spName = "usp_GetMatchingKeywords_xml ";
            XmlReaderScope scope = null;
            // Defaults
            bool returnXML = true;

            try
            {

                SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

                DbCommand dbCommand = db.GetStoredProcCommand(spName);

                db.AddInParameter(dbCommand, "Keyword", DbType.String, keyword);

                if (queryID.Length > 0)
                    db.AddInParameter(dbCommand, "QueryID", DbType.String, null);
                else
                    db.AddInParameter(dbCommand, "QueryID", DbType.String, DBNull.Value);

                db.AddInParameter(dbCommand, "ExactKeyword", DbType.Boolean, exactKeyword);
                db.AddInParameter(dbCommand, "ReturnXML", DbType.Boolean, returnXML);

                XmlReader reader = db.ExecuteXmlReader(dbCommand);
                scope = new XmlReaderScope(dbCommand.Connection, reader);

            }
            catch (Exception ex)
            {
                XmlDataUtility.logit("ERROR==> " + ex.Message + " STACK:" + ex.StackTrace + " SOURCE:" + ex.Source); ;

                throw ex;
            }

            return scope;
        }
Exemplo n.º 8
0
        public XmlReaderScope GetProfileNetworkForBrowser(int profileId)
        {
            string spName = "usp_GetFlashNetwork_XML";

            //This is a good debug tool.  You will need to add a flag to your web.config to enable it. See method for flag name.
            XmlDataUtility.logit("- line 1: NetworkBrowserDA.GetProfileNetworkForBrowser(" + profileId.ToString() + ")");
            XmlReaderScope scope = null;

            try
            {
                SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;


                DbCommand dbCommand = db.GetStoredProcCommand(spName);


                db.AddInParameter(dbCommand, "personid1", DbType.Int32, profileId);

                XmlReader reader = db.ExecuteXmlReader(dbCommand);

                scope = new XmlReaderScope(dbCommand.Connection, reader);
            }
            catch (Exception ex)
            {
                //this is a good debug tool.
                //XmlDataUtility.logit("- GetProfileNetworkForBrowser MESSAGE==> " + ex.Message + " STACKTRACE==>" + ex.StackTrace + " SOURCE==>" + ex.Source);

                bool rethrow = ExceptionPolicy.HandleException(ex, "Log Only Policy");
                if (rethrow)
                {
                    throw ex;
                }
            }

            return(scope);
        }
Exemplo n.º 9
0
        public XmlReaderScope ProfileSearch(string searchQuery, bool isSecure)
        {
            string spName = "usp_GetPersonList_xml";
            XmlReaderScope scope = null;

            try
            {

                SqlDatabase db = DatabaseFactory.CreateDatabase() as SqlDatabase;

                DbCommand dbCommand = db.GetStoredProcCommand(spName);

                db.AddInParameter(dbCommand, "xMessage", DbType.Xml, searchQuery);

                if (isSecure)
                    db.AddInParameter(dbCommand, "isSecure", DbType.Boolean, isSecure);

                XmlReader reader = db.ExecuteXmlReader(dbCommand);
                scope = new XmlReaderScope(dbCommand.Connection, reader);

            }
            catch (Exception ex)
            {

                XmlDataUtility.logit("---- ERROR==> " + ex.Message + " STACK:" + ex.StackTrace + " SOURCE:" + ex.Source); ;

                throw ex;
            }

            return scope;
        }