예제 #1
0
        /// <summary>
        /// </summary>
        /// <param name="context"></param>
        /// <return>
        /// 2: not login
        /// json string: saved data in json STRING, not object
        /// </return>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //check login state:
            if (!new LoginStateManager().CheckLoginState(context))
            {
                context.Response.Write("2");
                context.Response.End();
            }

            string           username            = context.Session["loginAs"].ToString();
            UserSitesManager userSitesManager    = new UserSitesManager();
            string           userSitesListString = userSitesManager.GetUserSitesJsonStringByUsername(username);

            context.Response.Write(userSitesListString);
        }
예제 #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (!new LoginStateManager().CheckLoginState(context))
            {
                context.Response.Write("2");
                context.Response.End();
            }

            string siteName = context.Request.QueryString["siteName"].ToString();
            string siteUrl  = context.Request.QueryString["siteUrl"].ToString();
            string username = context.Session["loginAs"].ToString();

            UserSitesManager userSitesManager = new UserSitesManager();

            context.Response.Write(userSitesManager.DeleteUserSite(username, siteName, siteUrl));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        /// <return>
        /// -1: invalid params
        /// 0: ok
        /// 1: nothing changed
        /// 2: not login
        /// </return>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            //check login state:
            if (!new LoginStateManager().CheckLoginState(context))
            {
                context.Response.Write("2");
                context.Response.End();
            }

            string siteName   = context.Request.Form["siteName"];
            string iconBase64 = context.Request.Form["iconBase64"];
            string userName   = context.Session["loginAs"].ToString();

            if (siteName == null || siteName.Trim() == string.Empty)
            {
                context.Response.Write("-1");
                context.Response.End();
            }
            if (iconBase64 == null || iconBase64.Trim() == string.Empty)
            {
                context.Response.Write("-1");
                context.Response.End();
            }

            UserSitesManager userSitesManager = new UserSitesManager();
            int result = userSitesManager.SetCustomBGImage(iconBase64, siteName, userName);

            if (result == 0)
            {
                context.Response.Write("1");
            }
            else
            {
                context.Response.Write("0");
            }
        }