• asp.net 一般处理程序


    一般处理程序类似公共模块,所有页面都可以调用。

    一般处理程序

    <%@ WebHandler Language="C#" Class="SetGrid" %>
    
    using System;
    using System.Web;
    
    public class SetGrid : IHttpHandler {
        
        public void ProcessRequest (HttpContext context) {
    
            string sql = "";
            System.Data.DataTable dtTmp = null;
            string sf = "";
            string result = "";
            try
            {
                switch (context.Request["oper"])
                {
                    case "Supplier"://供应商
                        sql = "select ID,abbreviation,name,linkman1,Tel,trmo,currency,cess from provider";
                        if (!string.IsNullOrEmpty(context.Request["q"]))
                        {
                            sf = context.Request["q"].ToString().Trim();
                            sql += " where abbreviation like '%" + sf + "%' or linkman1 like '%" + sf + "%' or name like '%" + sf + "%' or Tel like '%" + sf + "%'";
                        }
                        dtTmp = pubCommon.GetDataTable(sql);
                        result = pubCommon.DataTableToJson(dtTmp);
                        //result = "[{"si_name":"三菱","si_linkman":"村上","si_mobile":"12-002136"},{"si_name":"西门西","si_linkman":"Jon","si_mobile":"0223-26565"}]";
                        break;
                    case "PODetail":
                        sql = "select 1 as gi_id,*,12 as pi_number,12 as qty from materiel where code = '110010030092'";
    
                        dtTmp = pubCommon.GetDataTable(sql);
                        if (dtTmp != null)
                        {
                            result = pubCommon.DataTableToJson(dtTmp);
                        }
                        break;
                    case "Query":
                        sql = "select * from materiel";
    
                        dtTmp = pubCommon.GetDataTable(sql);
                        if (dtTmp != null)
                        {
                            result = pubCommon.DataTableToJson(dtTmp);
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
            }
            context.Response.Write(result);
            context.Response.End();
    
        }
     
        public bool IsReusable {
            get {
                return false;
            }
        }
    
    }
    View Code

    脚本

        //供应商
        $('#gys_key').combogrid({
            panelWidth: 350,
            delay: 500,
            mode: 'remote',
            idField: 'ID',
            textField: 'abbreviation',
            url: '/Project2/Dispose/SetGrid.ashx?oper=Supplier',
            columns: [[
                            { field: 'abbreviation', title: '简称',  80 },
                            { field: 'name', title: '供应商名称',  120 },
                            { field: 'linkman1', title: '联系人',  80 },
                            { field: 'Tel', title: '电话',  100 }
                        ]],
            onSelect: function (rowIndex, rowData) {
                $("#txtTax").val(rowData.cess);
                $("#txtpay").val(rowData.trmo);
                $("#txtcurrency").val(rowData.currency);
            }
        });
  • 相关阅读:
    GoogleMaps 之创意应用——数码照片定位
    SGI面临破产
    Google地图搜索的触角伸向月球
    说“丛林法则”
    比Google Map更加清晰的网络地图——RealBird
    Office 12眩酷界面,先睹为快
    Paypal将正式登陆中国——贝宝
    地图技术的领导者RealBird与Google Maps的无缝结合
    微软欲封杀OpenGL?
    网络地图服务究竟商机何在?
  • 原文地址:https://www.cnblogs.com/chirs888888/p/6252628.html
Copyright © 2020-2023  润新知