예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            DataTable dt   = MySqlHelper.ExecuteDataTable("select * from wifi_area");
            string    html = CommonHelper.RenderHtml("test.html", dt.Rows);

            context.Response.Write(html);
        }
예제 #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            //string uname = context.Request["name"];

            DataTable dt = new DataTable();

            dt = MySqlHelper.ExecuteDataTable("select * from wifi_area");
            string html = CommonHelper.RenderHtml("test.html", dt.Rows);

            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    for (int j = 0; j < dt.Columns.Count; j++)
            //    {
            //        context.Response.Write(dt.Rows[i][j]);
            //    }
            //}
            context.Response.Write(html);
        }
예제 #3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string action = context.Request["action"];
            //DataEdit.ashx?action=AddNew
            //DataEdit.ashx?action=Edit%name=test3
            var area = new { name = context.Request["name"], ssid = context.Request["ssid"], pw = context.Request["pw"], description = context.Request["description"] };

            switch (action)
            {
            case null: { context.Response.Write(CommonHelper.RenderHtml("dataedit.html", MySqlHelper.ExecuteDataTable("select * from wifi_area").Rows)); break; }

            case "AddNew": { context.Response.Write(MySqlHelper.ExecuteNonQuery("insert into wifi_area (name,wifi_ssid,wifi_password,area_description) values ('" + area.name + "','" + area.ssid + "','" + area.pw + "','" + area.description + "') ") > 0 ? "Add Success" : "Add Fail"); break; }

            case "Edit": { context.Response.Write(MySqlHelper.ExecuteNonQuery("update wifi_area set name='" + area.name + "',wifi_ssid='" + area.ssid + "',wifi_password='******',area_description='" + area.description + "' where name='" + area.name + "'") > 0 ? "Edit Success" : "Edit Fail"); break; }

            default:
                context.Response.Write("Action参数错误"); break;
            }
        }