Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BrandIdea po = new BrandIdea();

            po.biType    = "type";
            po.biContent = "content";
            BrandIdeaDAO dao = new BrandIdeaDAO();

            dao.insert(po);
        }
Beispiel #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string method = context.Request.Params["method"];

            if ("list".Equals(method))
            {
                string       ajax = context.Request.Params["ajax"];
                BrandIdeaDAO dao  = new BrandIdeaDAO();
                BrandIdea    bi   = new BrandIdea();
                bi.biType = context.Request.Params["biType"];
                DataSet ds     = dao.select(bi);
                string  result = "";
                if (String.IsNullOrEmpty(ajax))
                {
                    result = "_list = " + JsonCommon.ds2json(ds);
                }
                else
                {
                    result = JsonCommon.ds2json(ds);
                }
                context.Response.Write(result);
            }
            else if ("detail".Equals(method))
            {
                BrandIdeaDAO dao = new BrandIdeaDAO();
                BrandIdea    bi  = new BrandIdea();
                bi.biId = context.Request.Params["biId"];
                DataSet ds   = dao.select(bi);
                string  json = JsonCommon.ds2json(ds);
                context.Response.Write(json);
            }
            else if ("save".Equals(method))
            {
                string       biContent = HttpUtility.UrlDecode((context.Request.Params["biContent"]).Replace("@", "%"));
                string       biType    = context.Request.Params["biType"];
                string       biId      = context.Request.Params["biId"];
                BrandIdeaDAO dao       = new BrandIdeaDAO();
                BrandIdea    bi        = new BrandIdea();
                bi.biId      = biId;
                bi.biContent = biContent;
                bi.biType    = biType;
                dao.update(bi);
            }
        }