Ejemplo n.º 1
0
 void functionAdd(object postText)
 {
     string[] vallString = (string[])postText;
     #region описание модели
     //id
     //откуда взят
     //дата публикации
     //текст
     //количество комментариев
     //количество лайков
     //количество дизлайков
     //количество репостов
     //количество репостов пользователями
     //public int Id { get; set; }
     //public string post_id { get; set; }
     //public string from_id { get; set; }
     //public string date { get; set; }
     //public string text { get; set; }
     //public string count_comments { get; set; }
     //public string count_likes { get; set; }
     //public string count_user_likes { get; set; }
     //public string count_repost { get; set; }
     //public string count_user_repost { get; set; }
     #endregion
     using (ContextGroupWallTextPost db = new ContextGroupWallTextPost())
     {
         GroupWallTextPost cgp = new GroupWallTextPost {
             post_id = Convert.ToInt32(vallString[0]), from_id = Convert.ToInt32(vallString[1]), date = Convert.ToInt32(vallString[2]), text = vallString[3], count_comments = Convert.ToInt32(vallString[4]), count_likes = Convert.ToInt32(vallString[5]), count_user_likes = Convert.ToInt32(vallString[6]), count_repost = Convert.ToInt32(vallString[7]), count_user_repost = Convert.ToInt32(vallString[8]), postedTable = false
         };
         db.GroupWallTextPosts.Add(cgp);
         db.SaveChanges();
     }
 }
Ejemplo n.º 2
0
 private void bdVallUpdate(int Id)
 {
     using (ContextGroupWallTextPost db = new ContextGroupWallTextPost())
     {
         GroupWallTextPost PostedParametr = db.GroupWallTextPosts.Find(Id);
         PostedParametr.postedTable = true;
         db.SaveChanges();
     }
 }
Ejemplo n.º 3
0
        private bool bdChek(string[] postText)
        {
            int postID  = Convert.ToInt32(postText[0]);
            int groupID = Convert.ToInt32(postText[1]);

            using (ContextGroupWallTextPost db = new ContextGroupWallTextPost())
            {
                var tt = db.GroupWallTextPosts.Where(p => p.post_id == postID).Intersect(db.GroupWallTextPosts.Where(p => p.from_id == groupID));
                if (tt.Count() == 0)
                {
                    return(true);
                }
                return(false);
            }
        }
Ejemplo n.º 4
0
 private static void parametrUpdate(int groupId)
 {
     using (ContextGroupWallTextPost db = new ContextGroupWallTextPost())
     {
         var tt = db.GroupWallTextPosts
                  .Select(p => new { Text = p.text, LickeCount = p.count_likes, RepostCount = p.count_repost, PostedTable = p.postedTable, postId = p.post_id, groupId = p.from_id, ID = p.Id })
                  .Where(p => p.PostedTable == false && p.groupId == groupId)
                  //.Intersect(db.GroupWallTextPosts.Where(p => p.from_id == groupId))
                  .OrderByDescending(p => p.LickeCount)
                  .Take(10);
         foreach (var p in tt)
         {
             PostInfo[i, 0] = Convert.ToString(p.LickeCount);
             PostInfo[i, 1] = Convert.ToString(p.RepostCount);
             PostInfo[i, 2] = p.Text;
             PostInfo[i, 3] = Convert.ToString(p.postId);
             PostInfo[i, 4] = Convert.ToString(p.groupId);
             PostInfo[i, 5] = Convert.ToString(p.ID);
             i++;
         }
         i = 0;
     }
 }