Example #1
0
        public void RemovePageBind(string fanpagename)
        {
            var    fpage_repo  = new FanPagesRepository();
            string userid      = User.Identity.GetUserId();
            string tokenValue  = null;
            var    fpage       = fpage_repo.Select(userid, fanpagename);
            string decodeToken = ReCodeService.Base64Decode(fpage.FbPageLongToken);

            FBRequestService.DeleteTokenPermissions(decodeToken);
            fpage_repo.Update(fpage.FanPageID, userid, tokenValue);
        }
Example #2
0
        public void NewFanPage(string fanpageid, string fanpagename, string token)
        {
            string userid     = User.Identity.GetUserId();
            var    fpage_repo = new FanPagesRepository();

            if (!fpage_repo.isExist(fanpageid, userid))
            {
                string longToken = FBRequestService.GetLongToken(token);

                //byte[] longToken_bytes = System.Text.Encoding.GetEncoding("utf-8").GetBytes(longToken);
                //編成 Base64 字串
                //string encodeToken = Convert.ToBase64String(longToken_bytes);
                string encodeToken = ReCodeService.Base64Encode(longToken);
                fpage_repo.Insert(fanpageid, fanpagename, userid, encodeToken);
            }
            else
            {
                string longToken   = FBRequestService.GetLongToken(token);
                string encodeToken = ReCodeService.Base64Encode(longToken);
                fpage_repo.Update(fanpageid, userid, encodeToken);
            }
        }