Example #1
0
        private void FrmTotalDetails_FormClosed(object sender, FormClosedEventArgs e)
        {
            int objectsInReality    = olvDetailedHistory.Items.Count;
            int objectsInLoadedData = 0;

            foreach (xTextFile fileInfo in tFilesArray)
            {
                foreach (xWordFrequencies xwf in fileInfo.frequencies)
                {
                    objectsInLoadedData++;
                    xDetails rowObject = new xDetails();
                }
            }
            if (objectsInLoadedData != objectsInReality)
            {
                Utils.history = DbHelper.GetHistory("", "");
            }
        }
Example #2
0
        private void search()
        {
            if (txtWord.Text.Length < 1)
            {
                return;
            }

            string word = txtWord.Text.Substring(0, 1).ToUpper() + txtWord.Text.Substring(1);
            List <xWordFrequencies> searchResults = DbHelper.FindInFrequencies(word);

            if (searchResults == null)
            {
                olvSearchResults.ClearObjects();
                ((FrmMain)this.Parent.Parent.Parent).lblStatus.Text = string.Format("Ничего не найдено");
                return;
            }

            List <xDetails> rowObjects = new List <xDetails>();

            foreach (xWordFrequencies xwf in searchResults)
            {
                xTextFile fileInfo = Utils.GetTextFile(xwf.fileId);

                xDetails rowObject = new xDetails();
                rowObject.fileId           = fileInfo.fileId;
                rowObject.fileName         = fileInfo.fileName;
                rowObject.categoryIndex    = fileInfo.categoryIndex;
                rowObject.wordsCount       = fileInfo.wordsCount;
                rowObject.uniqueWordsCount = fileInfo.uniqueWordsCount;
                rowObject.created_at       = fileInfo.created_at;
                rowObject.word             = xwf.word;
                rowObject.frequency        = xwf.frequency;
                rowObject.percentage       = xwf.percentage;
                rowObjects.Add(rowObject);
            }
            olvSearchResults.SetObjects(rowObjects);
            ((FrmMain)this.Parent.Parent.Parent).lblStatus.Text = string.Format("Найдено в {0} файлах(е)", rowObjects.GroupBy(xFile => xFile.fileId).Select(grp => grp.First()).ToList().Count.ToString());
            olvSearchResults.PrimarySortColumn = olvSearchResults.GetColumn(0);
            olvSearchResults.PrimarySortOrder  = SortOrder.Descending;
            olvSearchResults.Sort();
        }
Example #3
0
        private void FrmDetailedHistory_Load(object sender, EventArgs e)
        {
            List <xDetails> rowObjects = new List <xDetails>();

            if (tFilesArray.Count == 0)
            {
                return;
            }
            foreach (xTextFile fileInfo in tFilesArray)
            {
                string fileName         = fileInfo.fileName;
                int    categoryIndex    = fileInfo.categoryIndex;
                int    wordsCount       = fileInfo.wordsCount;
                int    uniqueWordsCount = fileInfo.uniqueWordsCount;
                string created_at       = fileInfo.created_at;
                foreach (xWordFrequencies xwf in fileInfo.frequencies)
                {
                    xDetails rowObject = new xDetails();
                    rowObject.fileName         = fileName;
                    rowObject.categoryIndex    = categoryIndex;
                    rowObject.wordsCount       = wordsCount;
                    rowObject.uniqueWordsCount = uniqueWordsCount;
                    rowObject.created_at       = created_at;
                    rowObject.wordId           = xwf.id;
                    rowObject.word             = xwf.word;
                    rowObject.frequency        = xwf.frequency;
                    rowObject.percentage       = xwf.percentage;
                    rowObjects.Add(rowObject);
                }
            }

            olvDetailedHistory.SetObjects(rowObjects);

            olvDetailedHistory.PrimarySortColumn = olvDetailedHistory.GetColumn(0);
            olvDetailedHistory.PrimarySortOrder  = SortOrder.Descending;
            olvDetailedHistory.Sort();
        }