楼栋查询

 

 

<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>

  



 

posted @ 2015-12-28 11:03  $扁桃体发炎$  阅读(390)  评论(0编辑  收藏  举报