<p><%@ Page Language="C#" AutoEventWireup="true" %> <%@ Import Namespace="Transcend.Utility" %> <%@ Import Namespace="Newtonsoft.Json" %></p> <script type="text/javascript" src="http://www.cnblogs.com/Scripts/Extjs/ext-all-debug.js"></script> <script type="text/javascript" src="http://www.cnblogs.com/Scripts/Extjs/ext-lang-zh_CN.js"></script> <script type="text/javascript" src="http://www.cnblogs.com/JavaScript/Util/SysHelper.js"></script> <script type="text/javascript">// <![CDATA[ Ext.BLANK_IMAGE_URL = SysHelper.GetRootPath() + "Scripts/Extjs/resources/themes/images/default/tree/s.gif"; Ext.onReady(function () { var Buildingstore = Ext.create('Ext.data.Store', { pageSize:1, fields: [ { name: "RBUILDID", type: 'string' }, { name: "BUILDNO", type: 'string' }, { name: "DEVELOPER", type: 'string' }, { name: "PROJECTNAME", type: 'string' }, { name: "STREET", type: 'string' }, { name: "DOORNO", type: "string" }, { name: "BUILDNO", type: 'string' }, { name: "BUILDAREA", type: 'number' }, { name: "LOCATION", type: 'string' }, { name: "LANDNO", type: 'string' }, { name: "GRAPHNO", type: 'string' }, { name: "BUILDUNIT", type: 'number' }, { name: "FLOORS", type: 'number' }, { name: "DIVISIONID", type: 'number' }, { name: "SETS", type: 'number' }, { name: "UPFLOORS", type: 'number' }, { name: "HOUSESUITE", type: 'number' }, { name: "UNDERFLOORS", type: 'number' }, { name: "BUILDYEAR", type: "date" }, { name: "FLOORON", type: 'number' }, { name: "FL0OREND", type: 'number' }, { name: "CREATEDATE", type: 'date' }, { name: "STRUCTURE", type: 'string' }, { name: "SETAREA", type: "number" }, { name: "DOORNO", type: "number" }, { name: "REMARK", type: 'string' } ], proxy: { type: 'ajax', url: 'buildSearch.aspx?Type=Building', reader: { type: 'json', root: 'Data', totalProperty:'totalCount' }, listeners: { exception: function (sender, response, operation) { // debugger; } } }, autoLoad: true }); var grid = Ext.create("Ext.grid.Panel", { layout: 'fit', store: Buildingstore, columns: [ { xtype: "rownumberer", text: "序號", width: 40 }, { text: '樓棟編號', dataIndex: 'RBUILDID' }, { text: '開發公司', dataIndex: 'DEVELOPER' }, { text: '幢號', dataIndex: 'BUILDNO' }, { text: '街道', dataIndex: 'STREET' }, { text: '建立時間', dataIndex: 'CREATEDATE', xtype:'datecolumn', format:'Y-m-d' }, { text: '地上層數', dataIndex: 'UPFLOORS' }, { text: '地下層數', dataIndex: 'UNDERFLOORS' }, { text: '總套數', dataIndex: 'HOUSESUITE' }, { text: '區縣', dataIndex: 'DIVISIONID' }, { text: '坐落', dataIndex: 'LOCATION' }, { text: '單元', dataIndex: 'BUILDUNIT' }, { text: '所在層', dataIndex: 'FLOORON' }, { text: '終止層', dataIndex: 'FL0OREND' }, { text: '結構', dataIndex: 'STRUCTURE' }, { text: '建築面積', dataIndex: 'BUILDAREA' }, { text: '項目名稱', dataIndex: 'PROJECTNAME' }, { text: '門牌號', dataIndex: 'DOORNO' }, { text: '備註', dataIndex: 'REMARK' }, { text: '套內面積', dataIndex: 'SETAREA' } ], dockedItems: [{ xtype: 'pagingtoolbar', store: Buildingstore, dock: 'bottom', displayInfo: true }], listeners: { itemclick: function (m, r) { var id = r.get("RBUILDID"); alert(id); } } }) dockedItems: [{ xtype: 'pagingtoolbar', store: Buildingstore, dock: 'bottom', displayInfo: true }] var roomCol = [ { xtype: "rownumberer", text: "序號", width: 40 }, { header: '樓棟編號', width: 100, type: 'string' }, { header: "坐落", width: 100, type: 'string' }, { header: '開發公司', width: 100, type: 'string' }, { header: '建築面積', width: 100, type: 'number' }, { header: '街道', width: 100, type: 'number' }, { header: '地上層數', width: 100, type: 'number' }, { header: '地下層數', width: 100, type: 'number' }, { header: '總層數', width: 100, type: 'number' }, { header: "所在層", width: 100, type: 'number' }, { header: "終止層", width: 100, type: 'number' }, { header: "單元", width: 100, type: 'number' }, { header: "套內面積", width: 100, type: 'number' }, { header: "建立時間", width: 100, xtype: 'date', dateIndex: 'CREATEDATE', format:'Y-m-d' }, { header: "幢號", width: 100, type: 'number' }, { header: "區縣", width: 100, type: 'string' }, { header: "備註", width: 100, type: 'varchar2' } ]; var textFiled = [{ xtype: 'textfield', labelWidth: 45, padding: '5 5 4 0', displayField: 'TEXT', valueField: 'ID', labelAlign: "right", name: 'DIVISIONID', fieldLabel: '區縣' }, { xtype: 'textfield', labelWidth: 50, padding: '5 5 4 0', displayField: 'TEXT', valueField: 'ID', labelAlign: "right", name: 'LOCATION', fieldLabel: '坐落' }, { xtype: 'textfield', labelWidth: 50, padding: '5 5 4 0', displayField: 'TEXT', valueField: 'ID', labelAlign: "right", name: 'RBUILDID', fieldLabel: '樓棟編號' }, { xtype: 'textfield', labelWidth: 50, padding: '5 5 4 0', displayField: 'TEXT', valueField: 'ID', labelAlign: "right", name: 'BUILDNO', fieldLabel: '幢號' }, { xtype: 'textfield', labelWidth: 50, padding: '5 5 4 0', displayField: 'TEXT', valueField: 'ID', labelAlign: "right", name: 'PROJECTNAME', fieldLabel: '項目名稱' }, { xtype: 'textfield', labelWidth: 50, padding: '5 5 4 0', displayField: 'TEXT', valueField: 'ID', labelAlign: "right", name: 'DOORNO', fieldLabel: '門牌號' }, { padding: '4 3 3 3', xtype: 'button', labelWidth: 60, labelAlign: "right", name: 'Search', text: '查詢', handler: function () { // debugger; var xx = this.up('form').getValues(); var stringexp = Ext.encode(xx); Buildingstore.proxy.extraParams = { stringexp: stringexp } Buildingstore.load(); } }] function btnclick() { var Buildingstore = new Ext.data.Store({ url: 'buildSearch.aspx?Type=Building', reader: { type: 'json', root: 'Data', totalProperty: 'totalCount' } }); //Buildingstore.load(); //grid.reconfigure(Buildingstore, grid); } // debugger; Ext.create("Ext.container.Viewport", { renderTo: Ext.getBody(), layout: 'border', items: [ //{ // title: '房屋信息', // region: 'south', // xtype: 'gridpanel', // columns: roomCol, // flex: 1, // split: true //}, { layout: 'border', region: 'center', items: [{ region: 'north', xtype: 'form', height: 45, layout: { type: 'table', columns: 10 }, items: textFiled }, { title: '樓棟信息', region: 'center', xtype: 'panel', layout: 'fit', items: grid }] }] }) }) // ]]></script> <script type="text/javascript">// <![CDATA[ /// <summary> /// 加載 /// </summary> public void load() { if (!IsPostBack) { if (Request["Type"] == "Building") { GetBuildingData(); Response.End(); } } } public void GetBuildingData() { var page = int.Parse((this.Request.QueryString["page"] ?? "0").ToString()); var pagesize = int.Parse((this.Request.QueryString["limit"] ?? "0").ToString()); string mc = @"select a.* from ( Select row_number() over( order by o.rbuildid) rowindex,o.rbuildid, d.fullname, o.DEVELOPER, o.HAVEFLUE, o.PROJECTNAME, o.STREET, o.DOORNO, o.BUILDNO, o.LOCATION, o.LANDNO, o.GRAPHNO, o.FLOORS, o.SETS, o.UPFLOORS, o.UNDERFLOORS, o.BUILDYEAR, o.STRUCTURE, o.BUILDSTATUS, o.BLDSTATUSDATE, o.USAGE, o.FORECASTBUILDAREA, o.FORECASTUNDERAREA, o.FORECASTUPAREA, o.BUILDAREA, o.UNDERAREA, o.UPAREA, o.GISID, o.SETAREA, o.PUBLICAREA, o.BALCONYAREA, o.LANDAPPORAREA, o.LANDAREA, o.FORECASTSETAREA, o.FORECASTPUBLICAREA, o.FORECASTBALCONYAREA, o.createuserid, o.lmodifydate, o.lmuserid, o.createdate, o.remark from rbuilding o, division d where o.divisionid = d.id ) a where a.rowindex > " + pagesize + " * " + (page - 1) + " and a.rowindex <= " + pagesize +" * " + (page - 1) + " + " + pagesize; string sql = @"Select o.rbuildid, d.fullname, o.DEVELOPER, o.HAVEFLUE, o.PROJECTNAME, o.STREET, o.DOORNO, o.BUILDNO, o.LOCATION, o.LANDNO, o.GRAPHNO, o.FLOORS, o.SETS, o.UPFLOORS, o.UNDERFLOORS, o.BUILDYEAR, o.STRUCTURE, o.BUILDSTATUS, o.BLDSTATUSDATE, o.USAGE, o.FORECASTBUILDAREA, o.FORECASTUNDERAREA, o.FORECASTUPAREA, o.BUILDAREA, o.UNDERAREA, o.UPAREA, o.GISID, o.SETAREA, o.PUBLICAREA, o.BALCONYAREA, o.LANDAPPORAREA, o.LANDAREA, o.FORECASTSETAREA, o.FORECASTPUBLICAREA, o.FORECASTBALCONYAREA, o.createuserid, o.lmodifydate, o.lmuserid, o.createdate, o.remark from rbuilding o, division d where o.divisionid = d.id "; string stringexp = Request["stringexp"]; FindInfo find = new FindInfo(); if (stringexp != null) { find = Newtonsoft.Json.JsonConvert.DeserializeObject<FindInfo>(stringexp); } if (!string.IsNullOrEmpty(find.BUILDNO)) { sql += "and BUILDNO='" + find.BUILDNO + "'"; } if (!string.IsNullOrEmpty(find.LOCATION)) { sql += "and LOCATION ='" + find.LOCATION + "'"; } if (!string.IsNullOrEmpty(find.DIVISIONID)) { sql += "and DIVISIONID ='" + find.DIVISIONID + "'"; } if (!string.IsNullOrEmpty(find.DOORNO)) { sql += "and DOORNO ='" + find.DOORNO + "'"; } if (!string.IsNullOrEmpty(find.PROJECTNAME)) { sql += "and PROJECTNAME ='" + find.PROJECTNAME + "'"; } if (!string.IsNullOrEmpty(find.RBUILDID)) { sql += "and RBUILDID ='" + find.RBUILDID + "'"; } var data = Transcend.Utility.Db.FindDictionary(mc); var count = Convert.ToInt32(Transcend.Utility.Db.ExecuteScaler("select count(*) count from (" + sql + ")")); var datas = new ResultInfo() { Data = data, totalCount = count }; var stringdata = Newtonsoft.Json.JsonConvert.SerializeObject(datas); Response.Clear(); Response.Write(stringdata); } public class ResultInfo { public int totalCount { get; set; } public object Data { get; set; } } public class FindInfo { public string DIVISIONID { get; set; } public string LOCATION { get; set; } public string RBUILDID { get; set; } public string BUILDNO { get; set; } public string PROJECTNAME { get; set; } public string DOORNO { get; set; } } // ]]></script> <p><%load();%></p>