Пример #1
0
 public JsonResult DownloadContact(Guid sid)
 {
     IWXContactsService srv = new WXContactsService();
     Simulator smr = new Simulator();
     List<Contact> cntList = smr.GetWxContacts(sid);
     foreach (Contact cnt in cntList)
     {
         IEnumerable<WX_Contacts> temp = srv.FindByConditions(null, f => f.AccountId == sid && f.fake_id == cnt.id);
         if (temp != null && temp.Count() > 0)
         {
             //更新
             //WX_Contacts tempCnt = temp.FirstOrDefault();
             //tempCnt.nick_name = cnt.nick_name;
             //tempCnt.city = cnt.city;
             //tempCnt.province = cnt.province;
             //tempCnt.signature = cnt.signature;
             //tempCnt.country = cnt.country;
             //tempCnt.remark_name = cnt.remark_name;
             //srv.Update(tempCnt);
             continue;
         }
         //新增
         WX_Contacts tempNewCnt = new WX_Contacts();
         tempNewCnt.fake_id = cnt.id;
         tempNewCnt.nick_name = cnt.nick_name;
         tempNewCnt.city = cnt.city;
         tempNewCnt.province = cnt.province;
         tempNewCnt.signature = cnt.signature;
         tempNewCnt.country = cnt.country;
         tempNewCnt.remark_name = cnt.remark_name;
         tempNewCnt.AccountId = sid;
         tempNewCnt.groupName = cnt.group;
         srv.Insert(tempNewCnt);
     }
     return Json(ResultMsg.Success("微信账号同步已完成!共计:" + cntList.Count.ToString() + "条"));
 }
Пример #2
0
        public JsonResult ContactsDetail(Guid sid, long fakeId)
        {
            Simulator smr = new Simulator();
            Contact cnt = smr.GetContactDetail(sid, fakeId);

            IWXContactsService srv = new WXContactsService();
            IEnumerable<WX_Contacts> temp = srv.FindByConditions(null, f => f.AccountId == sid && f.fake_id == fakeId);
            if (temp != null && temp.Count() > 0)
            {
                //更新
                WX_Contacts tempCnt = temp.FirstOrDefault();
                tempCnt.nick_name = cnt.nick_name;
                tempCnt.city = cnt.city;
                tempCnt.province = cnt.province;
                tempCnt.signature = cnt.signature;
                tempCnt.country = cnt.country;
                tempCnt.remark_name = cnt.remark_name;
                srv.Update(tempCnt);
            }
            return Json(cnt);
        }