Exemple #1
0
 public bool Add(KelimeModel kelime)
 {
     try
     {
         return(kelimeDAL.Insert(kelime));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public void ReadMetinGrid1(string value1)
        {
            kelimelist1 = new List <KelimeModelGrid>();
            System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
            // dosyayı okuduk.
            char[] delimiterChars = { ' ', ',', '.', ':', '\t' };
            //byte[] b = p.get(2); //Hangi sayfasını texte dökecek

            string[] Kelimeler = value1.Split(delimiterChars);
            //Kelim
            List <KelimeModel> _model = new List <KelimeModel>();

            foreach (var item in Kelimeler)
            {
                string key = item.Trim();

                if (!string.IsNullOrEmpty(key) && key.Length > 1)
                {
                    KelimeModel kelime = new KelimeModel();
                    kelime.Kelime = key;
                    _model.Add(kelime);
                }
            }

            int count = CountWordsModified(value1);

            lblkelimecount.Text = " " + count;
            int tekrar = _model.GroupBy(x => x.Kelime).Count(x => x.Count() > 1);
            //  string[] essizIsımDizisi = count.Distinct().ToArray();
            var pl = from r in _model
                     orderby r.Kelime
                     group r by r.Kelime into grp
                     select new { key = grp.Key, cnt = grp.Count() };

            foreach (var item in pl)
            {
                KelimeModelGrid grid = new KelimeModelGrid();
                if (item.cnt > 1)
                {
                    grid.Sayi   = item.cnt;
                    grid.Kelime = item.key;
                    grid.Sayi   = item.cnt;
                    kelimelist1.Add(grid);
                }
            }
            label3.Text = " " + tekrar;
            dataGridView1.CurrentCell = null;
            dataGridView1.DataSource  = kelimelist1.OrderByDescending(t => t.Sayi).ToList();
        }
Exemple #3
0
        public KelimeModel GetByID(int kelimeID)
        {
            KelimeModel kelime = db.Kelimeler.AsNoTracking().SingleOrDefault(a => a.KelimeID == kelimeID);

            return(kelime);
        }
Exemple #4
0
 public bool Delete(KelimeModel kelime)
 {
     db.Kelimeler.Remove(kelime);
     return(db.SaveChanges() > 0);
 }
Exemple #5
0
 public bool Insert(KelimeModel kelime)
 {
     db.Kelimeler.Add(kelime);
     return(db.SaveChanges() > 0);
 }
Exemple #6
0
        public bool DeleteByID(int kelimeID)
        {
            KelimeModel kelime = kelimeDAL.GetByID(kelimeID);

            return(kelimeDAL.Delete(kelime));
        }
Exemple #7
0
 public bool Delete(KelimeModel kelime)
 {
     return(kelimeDAL.Delete(kelime));
 }
Exemple #8
0
 public bool Insert(KelimeModel kelime)
 {
     //db.Entry(kelime).State = System.Data.Entity.EntityState.Added;
     db.Kelimeler.Add(kelime);
     return(db.SaveChanges() > 0);
 }