public async Task <ActionResult> NewSourseAsync(Sourse ObS)
        {
            SourseAnalysis Analysis = new SourseAnalysis(repo, ObS);
            await Task.Run(() => Analysis.Start());

            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)//Найти стихи >>
        {
            Stix.Clear();
            if (SourseText.Text == "")
            {
                MessageBox.Show("Введите исходный текст пожалуйста!",
                                "Information!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string Sourse;

            Sourse = SourseText.Text;
            string[] phrase = Sourse.Split('\n');
            phrase = phrase.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
            Sourse = ReplaceNR(Sourse);

            Words = Sourse.Split(' ');
            Words = Words.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
            ////////////////////////////
            CreateDictionary(); // Формирование словаря объектов класса word.


            Stix.Text += "Найденная структура: \n";
            for (int i = 0; i < phrase.Length; i++)
            {
                Stix.Text += GenerateWordBY(phrase[i]) + "\t\t" + phrase[i];
                Stix.Text += "\n";
            }
            if (otladka.Checked == true)
            {
                debug();
            }
        }
        public int AddNewSourse(Sourse ObS)
        {
            ObS.YearRelevance = "All";
            INSERT("Sourse", new ArrayList {
                "Name", "Type", "YearCreate", "YearRelevance", "Author", "DOC"
            },
                   new ArrayList {
                "'" + ObS.Name + "'", "'" + ObS.Type + "'", "'" + ObS.Year + "'", "'" + ObS.YearRelevance + "'", "'" + ObS.Author + "'", ObS.DOC
            });

            return(SELECT <int>("idSourse", "Sourse", "Name = " + ObS.Name)[0]);
        }
        public List <Sourse> GetSources(Sourse SourseOb)
        {
            string where = "";

            if (SourseOb.Name != null)
            {
                where += "Name = '" + SourseOb.Name + "'";
            }

            if (SourseOb.Author != null)
            {
                if (where.Length > 0)
                {
                    where += " AND ";
                }

                where += "Author = '" + SourseOb.Author + "'";
            }

            if (SourseOb.Type != null)
            {
                if (where.Length > 0)
                {
                    where += " AND ";
                }

                where += "Type = '" + SourseOb.Type + "'";
            }

            if (SourseOb.Year != 0)
            {
                if (where.Length > 0)
                {
                    where += " AND ";
                }

                where += "YearCreate = '" + SourseOb.Year + "'";
            }

            if (SourseOb.YearRelevance != null)
            {
                if (where.Length > 0)
                {
                    where += " AND ";
                }

                where += "CAST(SUBSTRING('YearRelevance', 1, 5) AS INT) < " + SourseOb.YearRelevance + " AND CAST(SUBSTRING('YearRelevance', 7, 11) AS INT) > " + SourseOb.YearRelevance;
            }

            return(SELECT <Sourse>("idSourse AS id, Name, Type, Author, YearCreate AS Year, YearRelevance", "Sourse", where));
        }
Exemplo n.º 5
0
        /// <summary>
        ///remove list tags
        /// </summary>
        /// <param name="str">string to edite</param>
        /// <param name="IsNewHtml">is  new html</param>
        /// <returns></returns>
        private string TagEdit(String str, Boolean IsNewHtml)
        {
            if (Sourse.Equals(NewHtml))
            {
                return("");
            }
            int    ind = 0;
            string res = null;
            int    i;
            bool   flag;

            ind = _preSkip;
            while ((i = str.IndexOf("<")) != -1)  //ריצה על כל התגיות
            {
                flag = false;
                foreach (var item in tlist)                                                                                       //ריצה על רשימת התגיות להסרה
                {
                    if (str.Length - i - item.Key.Length > 0 && str.Substring(i + 1, item.Key.Length).ToLower().Equals(item.Key)) //בדיקה האם התגית להסרה

                    {
                        int j = str.IndexOf(item.Value, i);
                        res = res + str.Substring(0, i);
                        if (str.Length >= j + item.Value.Length + 1)
                        {
                            str = str.Substring(j + item.Value.Length + 1);
                            if (IsNewHtml)//המחרוזת שהתקבלה היא החדשה
                            {
                                for (int ii = i; ii <= j + item.Value.Length; ii++)
                                {
                                    tmp[Arr[ind + ii]] = true;
                                }
                            }
                            ind += j + item.Value.Length + 1;
                            flag = true;
                            break;
                        }
                    }
                }
                if (!flag)
                {
                    res  = res + str.Substring(0, i + 1);
                    str  = str.Substring(i + 1);
                    ind += i + 1;
                }
            }
            res += str;
            return(res);// + pos;
        }
Exemplo n.º 6
0
            private void Fill()
            {
                this.dictionary = new Dictionary <TKey, Sourse>();

                foreach (var i in source)
                {
                    var key = keySelector(i);
                    if (this.dictionary.ContainsKey(key))
                    {
                        this.dictionary[key].Add(i);
                    }
                    else
                    {
                        Sourse sourse = new Sourse(keySelector);
                        sourse.Add(i);
                        this.dictionary.Add(key, sourse);
                    }
                }
            }
        public async Task <IActionResult> SaveEdit(Sourse ObS)
        {
            await Task.Run(() => repo.UpdateSourse(ObS));

            return(Json("'SoursePanel/Index'"));
        }
 public ActionResult ListSources(Sourse SourseOb)
 {
     return(View(repo.GetSources(SourseOb)));
 }
 public void UpdateSourse(Sourse ObS)
 {
     UPDATE("Sourse",
            "Name = '" + ObS.Name + "', Author = '" + ObS.Author + "', Type = '" + ObS.Type + "', YearCreate = '" + ObS.Year + "', YearRelevance = '" + ObS.YearRelevance + "'",
            "idSourse = " + ObS.id);
 }
 public SourseAnalysis(ISoursePanelRepository r, Sourse Ob)
 {
     repo   = r;
     ObS    = Ob;
     Status = 0;
 }