Beispiel #1
0
        private void AddBdGroupInfoFind(object GroupInfoParametr)
        {
            string[] GroupInfoParametrString = (string[])GroupInfoParametr;

            using (ContextGroupInfo db = new ContextGroupInfo())
            {
                int paramGroupId = Convert.ToInt32(GroupInfoParametrString[0]);
                var tt           = db.GroupInfos.Where(p => p.group_id == paramGroupId);
                if (tt == null || tt.Count() == 0)
                {
                    addInfoBd(GroupInfoParametrString);
                }
                else
                {
                    GroupInfoo gu = db.GroupInfos.Where(p => p.group_id == paramGroupId).FirstOrDefault();

                    gu.name          = GroupInfoParametrString[1];
                    gu.screen_name   = GroupInfoParametrString[2];
                    gu.is_closed     = Convert.ToInt32(GroupInfoParametrString[3]);
                    gu.type          = GroupInfoParametrString[4];
                    gu.is_admin      = Convert.ToInt32(GroupInfoParametrString[5]);
                    gu.admin_level   = Convert.ToInt32(GroupInfoParametrString[6]);
                    gu.is_member     = Convert.ToInt32(GroupInfoParametrString[7]);
                    gu.members_count = Convert.ToInt32(GroupInfoParametrString[8]);
                    gu.photo_50      = GroupInfoParametrString[9];
                    gu.photo_100     = GroupInfoParametrString[10];
                    gu.photo_200     = GroupInfoParametrString[11];

                    db.SaveChanges();
                }
            }
        }
Beispiel #2
0
 private void addInfoBd(string[] GroupInfoParametr)
 {
     using (ContextGroupInfo db = new ContextGroupInfo())
     {
         GroupInfoo GI = new GroupInfoo {
             group_id      = Convert.ToInt32(GroupInfoParametr[0]),
             name          = GroupInfoParametr[1],
             screen_name   = GroupInfoParametr[2],
             is_closed     = Convert.ToInt32(GroupInfoParametr[3]),
             type          = GroupInfoParametr[4],
             is_admin      = Convert.ToInt32(GroupInfoParametr[5]),
             admin_level   = Convert.ToInt32(GroupInfoParametr[6]),
             is_member     = Convert.ToInt32(GroupInfoParametr[7]),
             members_count = Convert.ToInt32(GroupInfoParametr[8]),
             photo_50      = GroupInfoParametr[9],
             photo_100     = GroupInfoParametr[10],
             photo_200     = GroupInfoParametr[11]
         };
         db.GroupInfos.Add(GI);
         db.SaveChanges();
     }
 }