using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.SessionState;
using TopWinCMS.BLL;
using TopWinCMS.Common;
using TopWinCMS.Model;

namespace TopWinCMS.WebUI.Shop
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class AjaxHandler : IHttpHandler, IRequiresSessionState
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.Expires = 0;
            context.Response.CacheControl = "no-cache";
            context.Response.ContentType = "text/plain";

            if (PostData.PostFormRight() == false)
            {
                context.Response.Write("来源错误。");
                return;
            }

            string Action = context.Request["Action"];
           
            switch (Action)
            {
                case "ReadGoodsInfo":
                    new Public_Shop(4).ReadGoodsInfo(context);
                    break;
                default:
                    context.Response.Write("参数错误。");
                    SecurityCenterManage.AppErr("Action参数错误。");
                    break;
            }
        }


        #region IHttpHandler Members

        public bool IsReusable
        {
            // 如果无法为其他请求重用托管处理程序，则返回 false。
            // 如果按请求保留某些状态信息，则通常这将为 false。
            get { return true; }
        }



        #endregion
    }
}