Exemplo n.º 1
0
 public static string GetCookieWXOpenID(string wxOpenID)
 {
     if (CookieUtils.IsExists(COOKIE_WXOPENID_NAME))
     {
         return(CookieUtils.GetCookie(COOKIE_WXOPENID_NAME));
     }
     else
     {
         CookieUtils.SetCookie(COOKIE_WXOPENID_NAME, wxOpenID, DateTime.MaxValue);
         return(wxOpenID);
     }
 }
Exemplo n.º 2
0
 public static string GetCookieSN()
 {
     if (CookieUtils.IsExists(COOKIE_SN_NAME))
     {
         return(CookieUtils.GetCookie(COOKIE_SN_NAME));
     }
     else
     {
         var value = StringUtils.GetShortGuid();
         CookieUtils.SetCookie(COOKIE_SN_NAME, value, DateTime.MaxValue);
         return(value);
     }
 }
Exemplo n.º 3
0
        private void FillFileSystems(bool isReload)
        {
            const string cookieName  = "SiteServer.BackgroundPages.Cms.Modal.SelectAttachment";
            var          isSetCookie = AuthRequest.IsQueryExists("ListType");

            if (!isSetCookie)
            {
                var cookieExists = false;
                if (CookieUtils.IsExists(cookieName))
                {
                    var cookieValue = CookieUtils.GetCookie(cookieName);
                    foreach (ListItem item in DdlListType.Items)
                    {
                        if (string.Equals(item.Value, cookieValue))
                        {
                            cookieExists  = true;
                            item.Selected = true;
                        }
                    }
                }
                if (!cookieExists)
                {
                    CookieUtils.SetCookie(cookieName, DdlListType.SelectedValue, DateTime.MaxValue);
                }
            }
            else
            {
                CookieUtils.SetCookie(cookieName, AuthRequest.GetQueryString("ListType"), DateTime.MaxValue);
            }
            if (DdlListType.SelectedValue == "List")
            {
                FillFileSystemsToList(isReload);
            }
            else if (DdlListType.SelectedValue == "Image")
            {
                FillFileSystemsToImage(isReload);
            }
        }
        public void Main(int publishmentSystemId, int nodeId, int contentId)
        {
            var body = new RequestBody();

            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            try
            {
                var contentInfo = DataProvider.VoteContentDao.GetContentInfo(publishmentSystemInfo, contentId);
                if ((contentInfo.EndDate - DateTime.Now).Seconds <= 0)
                {
                    throw new Exception("对不起,投票已经结束");
                }
                var cookieName = DataProvider.VoteOperationDao.GetCookieName(publishmentSystemId, nodeId, contentId);
                if (CookieUtils.IsExists(cookieName))
                {
                    throw new Exception("对不起,不能重复投票");
                }

                var optionIdArrayList = TranslateUtils.StringCollectionToIntList(HttpContext.Current.Request.Form["voteOption_" + contentId]);
                foreach (int optionId in optionIdArrayList)
                {
                    DataProvider.VoteOptionDao.AddVoteNum(optionId);
                }
                DataProvider.VoteOperationDao.Insert(new VoteOperationInfo(0, publishmentSystemId, nodeId, contentId, PageUtils.GetIpAddress(), body.UserName, DateTime.Now));

                HttpContext.Current.Response.Write(VoteTemplate.GetCallbackScript(publishmentSystemInfo, nodeId, contentId, true, string.Empty));
                CookieUtils.SetCookie(cookieName, true.ToString(), DateTime.MaxValue);
            }
            catch (Exception ex)
            {
                //HttpContext.Current.Response.Write(VoteTemplate.GetCallbackScript(publishmentSystemInfo, nodeId, contentId, false, ex.Message));
                HttpContext.Current.Response.Write(VoteTemplate.GetCallbackScript(publishmentSystemInfo, nodeId, contentId, false, "程序出错。"));
            }

            HttpContext.Current.Response.End();
        }
Exemplo n.º 5
0
 public bool IsCookieExists(string name)
 {
     return(CookieUtils.IsExists(name));
 }