コード例 #1
0
        public DataSet FindWordsAA(string strQuery)
        {
            if (strQuery.Trim() == string.Empty)
            {
                return(null);
            }

            DataSet dsSplitString = TTextProcess.SplitString(strQuery, TTextProcess.enmsf_StrFilter.sf_CapitalizeSmart | TTextProcess.enmsf_StrFilter.sf_DenyStopWords, TSWDB_Decl.CMAX_WORD_LENGTH);

            EXException.CheckEXError(dsSplitString != null, "EX-{60B7D234-F4CB-4f5e-B8CF-988023368446}");
            if (dsSplitString.Tables[0].Rows.Count <= 0)
            {
                return(null);
            }

            DataSet dsResult = CreateSWDB_SearchTableWordsSchema();

            string strCurrentWord = string.Empty;

            System.Collections.IEnumerator enumerator = dsSplitString.Tables[0].Rows.GetEnumerator();
            while (enumerator.MoveNext())
            {
                strCurrentWord = ((enumerator.Current) as DataRow)[0].ToString();
                dsResult.Tables[0].Rows.Add(new object[] { strCurrentWord, FindWordAA(strCurrentWord) });
            }

            return(dsResult);
        }
コード例 #2
0
        //private		System.Data.SqlClient.SqlCommand SQLCmd_SelectURLsToWordProc;
        //private		System.Data.SqlClient.SqlCommand SQLCmd_GetURLData;


        private void WordProcSingleURL(int intURLID)
        {
            using (SqlCommand sqcm_UrlHasProcessedWords = SQLConSW.CreateCommand())
            {
                //sqcm_UrlHasProcessedWords.Transaction = myWordInsTransaction;
                sqcm_UrlHasProcessedWords.CommandText = "exec dbo.sp_SW_UrlHasProcessedWords " + intURLID.ToString();
                sqcm_UrlHasProcessedWords.ExecuteNonQuery();
            }

            string strURLData = string.Empty;
            //const string CLocalTransName = "Trans_WordProcSingleURL";

            SqlDataAdapter daGETUrlData = new SqlDataAdapter("EXEC dbo.sp_SW_GetURLData " + intURLID.ToString(), SQLConSW.ConnectionString);
            DataSet        dsGetURLData = new DataSet();

            daGETUrlData.Fill(dsGetURLData);

            strURLData = dsGetURLData.Tables[0].Rows[0][0].ToString().Trim();
            strURLData = TEXStrUtl.StripTagsFromHTML(strURLData).Trim();
            if (strURLData == string.Empty)
            {
                return;
            }

            if (TimeAllowsToReport())
            {
                Report(string.Format("Δεδομένα του URL [{0}:\r\n [{1}]", intURLID, strURLData));
            }

            SqlCommand sqcm_ConnectWord = SQLConSW.CreateCommand();

            sqcm_ConnectWord.CommandType = CommandType.StoredProcedure;
            sqcm_ConnectWord.CommandText = "dbo.sp_SW_ConnectWord";
            System.Data.SqlClient.SqlCommandBuilder.DeriveParameters(sqcm_ConnectWord);

            //using (SqlTransaction myWordInsTransaction = SQLConSW.BeginTransaction(IsolationLevel.ReadCommitted,CLocalTransName ))
            //{
            try
            {
                DataSet dsSplitString = TTextProcess.SplitString(strURLData, TTextProcess.enmsf_StrFilter.sf_CapitalizeSmart | TTextProcess.enmsf_StrFilter.sf_DenyStopWords, TSWDB_Decl.CMAX_WORD_LENGTH);
                EXException.CheckEXError(dsSplitString != null, "EX-{A3270330-505B-4eb5-98E2-313AA1879AE6}");
                EXException.CheckEXError(dsSplitString.Tables[0].Rows.Count > 0, "Δεν βρέθηκαν λέξεις. EX-{E06D3CB0-B22F-49e2-87E9-D373704AB80A}");

                using (SqlCommand sqcm_UnconnectURLFromUrlLinkWord = SQLConSW.CreateCommand())
                {
                    //sqcm_UnconnectURLFromUrlLinkWord.Transaction = myWordInsTransaction;
                    sqcm_UnconnectURLFromUrlLinkWord.CommandText = "exec dbo.sp_SW_UnconnectURLFromUrlLinkWord " + intURLID.ToString();
                    sqcm_UnconnectURLFromUrlLinkWord.ExecuteNonQuery();
                }

                //sqcm_ConnectWord.Transaction = myWordInsTransaction;
                System.Collections.IEnumerator enumerator = dsSplitString.Tables[0].Rows.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    if (CancelProcess)
                    {
                        throw new EXUserBreak();
                    }

                    sqcm_ConnectWord.Parameters["@intURLID"].Value       = intURLID;
                    sqcm_ConnectWord.Parameters["@strWord"].Value        = ((enumerator.Current) as DataRow)[TTextProcess.CTPSplitField_Word].ToString();
                    sqcm_ConnectWord.Parameters["@intAppearCount"].Value = Convert.ToInt32(((enumerator.Current) as DataRow)[TTextProcess.CTPSplitField_CountWord]);
                    if (TimeAllowsToReport())
                    {
                        Report(string.Format("Σύνδεση του URL:[{0}] με την λέξη:[{1}] και με συχνότητα εμφάνισης:[{2}].", intURLID,
                                             ((enumerator.Current) as DataRow)[TTextProcess.CTPSplitField_Word].ToString(),
                                             Convert.ToInt32(((enumerator.Current) as DataRow)[TTextProcess.CTPSplitField_CountWord])
                                             ));
                    }
                    sqcm_ConnectWord.ExecuteNonQuery();
                }

                //myWordInsTransaction.Commit();
            }
            catch (Exception exc)
            {
                //myWordInsTransaction.Rollback(CLocalTransName);
                EXException.ThrowEXException("Πρόβλημα κατά την αποκωδικοπόιηση του URL: " + intURLID.ToString(), exc);
            }

            //}
        }