• Js调用一般处理文件自动完成


    JS
    <%@ WebHandler Language="C#" Class="Handler" %>
    
    using System;
    using System.Web;
    using GIS.Service;
    using System.Text;
    
    public class Handler : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
    {
    
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Cache.SetNoStore();
    
            if(context.Session["UserName"] == null)
            {
                context.Response.Write("");
                return;
            }
            context.Session["UserName"] = context.Session["UserName"];
            string vid = context.Request.QueryString["vid"].ToString();
            string type = context.Request.QueryString["type"].ToString();
            string returnValue = "";
            switch(type)
            {
                case "vehicleInfo":
                    returnValue = VehicleInfo(vid);
                    break;
                case "driverInfo":
                    returnValue = DriverInfo(vid);
                    break;
                case "VehicleLastInfo":
                    returnValue = VehicleLastInfo(vid);
                    break;
                case "KeepInfo":
                    returnValue = GetKeepInfo(vid, context);
                    break;
                case "InsuranceInfo":
                    returnValue = GetInsuranceInfo(vid, context);
                    break;
                case "LogInfo":
                    returnValue = GetCEMLogInfo(context);
                    break;
                case "SIMinfo":
                    returnValue = GetSIMinfo(context);
                    break;
                case "CMDinfo":
                    returnValue = GetCMDinfo(context);
                    break;
                case "AdertiseInfo":
                    returnValue = GetCRMAdvertise(context);
                    break;
                case "YearCarefulInfo":
                    returnValue = GetCRMYearCarefulInfo(vid, context);
                    break;
                case "UserAgento":
                    returnValue = GetUserAgento(context);
                    break;
                case "SendCar":
                    returnValue = SendCar(context);
                    break;
                case "CarInfoByCarsimd":
                    returnValue = GetCarInfoByCarsimd(context);
                    break;
                case "CarNumber":
                    returnValue = GetCarNumber(context);
                    break;
                case "AllInfoByCarNumber":
                    returnValue = GetAllInfoByCarNumber(context);
                    break;
                case "online":
                    returnValue = online(context);
                    break;
                case "datacount":
                    returnValue = datacount(context);
                    break;
                case "useNmae":
                    returnValue = GetUserInfo(context);
                    break;
                case "PhoneManage":
                    returnValue = GetPhoneInfo(context);
                    break;
            }
            context.Response.Write(returnValue);
        }
    
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
        /// <summary>
        /// 车辆详细信息
        /// </summary>
        /// <param name="vid"></param>
        /// <returns></returns>
        public string VehicleInfo(string vid)
        {
            GIS.Service.CRMService service = new GIS.Service.CRMService();
            return service.GetVehicleInfo(vid);
        }
    
        /// <summary>
        /// 车主详细信息
        /// </summary>
        /// <param name="vid"></param>
        /// <returns></returns>
        public string DriverInfo(string driverid)
        {
            GIS.Service.CRMService service = new GIS.Service.CRMService();
            return service.GetDriverInfo(driverid);
        }
        /// <summary>
        /// 车辆最后信息
    
    
        /// </summary>
        /// <param name="vid"></param>
        /// <returns></returns>
        public string VehicleLastInfo(string vid)
        {
            GIS.Service.CRMService service = new GIS.Service.CRMService();
            return service.VehicleLastInfoByID(vid);
        }
    
        /// <summary>
        /// 车辆保养信息
        /// </summary>
        /// <param name="vid"></param>
        /// <returns></returns>
        public string GetKeepInfo(string vid, HttpContext context)
        {
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
            GIS.Service.KeepService service = new GIS.Service.KeepService();
            return service.GetKeepInfo(start, limit, vid);
        }
        /// <summary>
        /// 车辆保险信息
        /// </summary>
        /// <param name="vid"></param>
        /// <returns></returns>
        public string GetInsuranceInfo(string vid, HttpContext context)
        {
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
            GIS.Service.InsuranceService service = new GIS.Service.InsuranceService();
            return service.GetInsurance(start, limit, vid);
        }
        /// <summary>
        /// 跟踪记录
        /// </summary>
        /// <param name="vid"></param>
        /// <returns></returns>                                                 
        public string GetCEMLogInfo(HttpContext context)
        {
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
            GIS.Service.LogService service = new GIS.Service.LogService();
            return service.GetCEMLogInfo(int.Parse(start), int.Parse(limit), "");
        }
    
        public string GetCRMYearCarefulInfo(string vid, HttpContext context)
        {
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
            GIS.Service.YearCarefulService service = new GIS.Service.YearCarefulService();
            return service.GetyearCareful(start, limit, vid);
        }
    
    
        /// <summary>
        /// SIM 卡信息
    
    
        /// </summary>
        /// <returns></returns>
        public string GetSIMinfo(HttpContext context)
        {
            string SIMnumber = context.Request.QueryString["SIMnumber"].ToString();
            string SIMstime = context.Request.QueryString["SIMstime"].ToString();
            string SIMetime = context.Request.QueryString["SIMetime"].ToString();
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
            string SIMdepno = context.Request.QueryString["SIMdepno"].ToString();
    
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if(SIMdepno != "")
            {
                sb.Append(" and s.DEPNO like '" + SIMdepno + "%'");
            }
            if(SIMnumber != "")
            {
                sb.Append(" and s.SIMCARD like '%" + SIMnumber + "%'");
            }
            if(SIMstime != "")
            {
                sb.Append(" and s.STIME >='" + SIMstime.ToString() + "'");
            }
            if(SIMetime != "")
            {
                sb.Append(" and s.ETIME<='" + SIMetime.ToString() + "'");
            }
            GIS.Service.SimcardService service = new GIS.Service.SimcardService();
            return service.GetCRMSimCardInfo(int.Parse(start), int.Parse(limit), sb.ToString());
        }
        public string GetPhoneInfo(HttpContext context)
        {
            string SIM = context.Request.QueryString["SIM"].ToString();
            string stime = context.Request.QueryString["time"].ToString();
            string etime = context.Request.QueryString["etime"].ToString();
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
    
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if(SIM != "")
            {
                sb.Append(" and SIM like '%" + SIM + "%'");
            }
            if(stime != "")
            {
                sb.Append(" and times>='" + stime + "'");
            }
            if(etime != "")
            {
                sb.Append(" and times<='" + etime + "'");
            }
            GIS.Service.HistoryPhoneService service = new GIS.Service.HistoryPhoneService();
            return service.GetHistoryPhoneInfo(limit, start, sb.ToString());
        }
        /// <summary>
        /// 历史指令
        /// </summary>
        /// <returns></returns>
        public string GetCMDinfo(HttpContext context)
        {
            string CMDname = context.Request.QueryString["CMDname"].ToString();
            string CMDcarnumber = context.Request.QueryString["CMDcarnumber"].ToString();
            string CMDstime = context.Request.QueryString["CMDstime"].ToString();
            string CMDetime = context.Request.QueryString["CMDetime"].ToString();
    
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if(CMDname != "")
            {
                sb.Append(" and USERNAME like '%" + CMDname + "%'");
            }
            if(CMDcarnumber != "")
            {
                sb.Append(" and license like '%" + CMDcarnumber + "%'");
            }
            if(CMDstime != "")
            {
                sb.Append(" and opeTime>='" + CMDstime + "'  ");
            }
            if(CMDetime != "")
            {
                sb.Append(" and opeTime<='" + CMDetime + "'");
            }
            GIS.Service.OperateService service = new GIS.Service.OperateService();
            return service.SelectCRMOprateInf(int.Parse(start), int.Parse(limit), sb.ToString());
        }
    
    
        /// <summary>
        /// 信息发布查询
        /// </summary>
        /// <returns></returns>
        public string GetCRMAdvertise(HttpContext context)
        {
            string AderContent = context.Request.QueryString["AderContent"].ToString();
            string AderStime = context.Request.QueryString["AderStime"].ToString();
            string AderEtime = context.Request.QueryString["AderEtime"].ToString();
            string start = context.Request.QueryString["start"].ToString();
            string limit = context.Request.QueryString["limit"].ToString();
            string LicensePlate = context.Request.QueryString["LicensePlate"].ToString();
            string AdType = context.Request.QueryString["AdType"].ToString();
            string UserName = context.Request.QueryString["UserName"].ToString();
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if(AderContent != "")
            {
                sb.Append(" and ad_content like '%" + AderContent + "%'");
            }
            if(AderStime != "")
            {
                sb.Append(" and AD_AddTime >='" + AderStime + "'");
            }
            if(AderEtime != "")
            {
                sb.Append(" and AD_AddTime <='" + AderEtime.ToString() + "'");
            }
            if(!string.IsNullOrEmpty(LicensePlate))
            {
                sb.Append(" and AD_LicensePlate like '%" + LicensePlate + "%'");
            }
            if(!string.IsNullOrEmpty(AdType))
            {
                sb.Append(" and AD_Type='" + AdType + "'");
            }
            if(!string.IsNullOrEmpty(UserName))
            {
                sb.Append(" and AD_UserName='" + UserName + "'");
            }
            return GIS.Service.AdvertiseService.GetCRMAdvertise(int.Parse(start), int.Parse(limit), sb.ToString());
        }
        public string GetUserAgento(HttpContext context)
        {
            string name = context.Session["UserName"].ToString();
            GIS.Service.UserService service = new GIS.Service.UserService();
            return service.GetUserByName(name).AgentNO;
        }
        public string SendCar(HttpContext context)
        {
            string returnValue = "已提交!";
            string carNumber = context.Request.QueryString["carNumber"].ToString();
            string value = context.Request.QueryString["value"].ToString();
            GIS.DAO.Tool tool = new GIS.DAO.Tool();
            string[] carInfo = value.Split(',');
            double[] lnglat = tool.SqllocltoAdjustLnglat(double.Parse(carInfo[0]), double.Parse(carInfo[1]));
            value = lnglat[0].ToString() + ',' + lnglat[1].ToString() + ',' + carInfo[2];
            GIS.Domain.OperateInfo operateinfo = new GIS.Domain.OperateInfo();
            //写入数据库
    
            GIS.Service.OperateService service = new GIS.Service.OperateService();
            operateinfo.License = carNumber;
            operateinfo.UserName = context.Session["UserName"].ToString();
            operateinfo.Cmd = "900";
            operateinfo.Param = value;
            operateinfo.Response = "已提交";
            int opID = service.SaveOperate(operateinfo);//流水号
    
            try
            {
                CMDNOTIFYLib.NotifyClass cmd = new CMDNOTIFYLib.NotifyClass();
                if(cmd.Submit(carNumber, "900,2" + opID + ";" + value) != 0)//失败
                {
                    returnValue = "已提交!";
                }
            }
            catch(Exception ex)
            {
                returnValue = "提交失败![原因:" + ex.Message + "]";
                service.DeleteByOpID(opID);//删除此记录
    
            }
            return returnValue;
        }
        public string GetCarInfoByCarsimd(HttpContext context)
        {
            string simcard = context.Request.QueryString["simcard"].ToString();
            GIS.Service.CRMService service = new GIS.Service.CRMService();
            return service.GetCarInfoBySimcard(simcard).ToString();
        }
        /// <summary>
        /// 模糊查询车牌号
        /// </summary>
        /// <returns></returns>
        public string GetCarNumber(HttpContext context)
        {
            CommonClass cc = new CommonClass();
            StringBuilder sb = new StringBuilder();
    
            //当前组织
            if(!cc.HasRight(context.Session["UserName"].ToString(), "10A"))
            {
                sb.Append(" AND DEPNO IN (" + BaseService.GetDeparts(context.Session["dno"].ToString()) + ")");
            }
            
            string carnumber = context.Request.QueryString["q"].ToString();
    
            sb.Append(" AND licenseplate LIKE '%" + carnumber + "%'");
            
            GIS.Service.VehicleService service = new GIS.Service.VehicleService();
            return service.GetCarNumberByNumber(sb.ToString());
        }
    
        public string GetAllInfoByCarNumber(HttpContext context)
        {
            CommonClass cc = new CommonClass();
            StringBuilder sb = new StringBuilder();
    
            //车辆编号
            string vid = context.Request.QueryString["carNumber"].ToString();
            sb.AppendFormat(" AND VID = {0}", vid);
            
            GIS.Service.VehicleService service = new GIS.Service.VehicleService();
            return service.GetAllInfoByCarNumber(sb.ToString());
        }
    
        public string online(HttpContext context)
        {
            return new GIS.Service.CRMService().OnLine(context.Session["dno"].ToString());
        }
        public string datacount(HttpContext context)
        {
            return new GIS.Service.CRMService().DataCount();
        }
        public string GetUserName(HttpContext context)
        {
            return context.Session["UserName"].ToString();
        }
        public string GetUserInfo(HttpContext context)
        {
            string name = context.Session["UserName"].ToString();
            GIS.Service.UserService service = new GIS.Service.UserService();
            GIS.Domain.UserInfo usinfo = service.GetUserNameInfo(name);
            GIS.Service.UserService u = new GIS.Service.UserService();
            string dno = u.GetDNO(context.Session["UserName"].ToString());
            GIS.Service.DepartmentService d = new GIS.Service.DepartmentService();
            string DepCompName = d.GetIDByDNO(dno).DepCompName;
            string UserName = usinfo.RealName + "" + DepCompName + "";
            return UserName;
    
        }
    }       
    View Code

    一般处理文件自动完成

    $(function()
    {
        //首页搜索
        BindSearch();
        
        //反馈意见
        SelectFeedback();
        window.setInterval(SelectFeedback, 3000);
        
        //保养预约
        SelectAppointment();
        window.setInterval(SelectAppointment, 5000);
        
        //统计访问量
        TotalTodayLoginLog();
        
        //统计报警提醒
        TotalAlertInfo();
    });
    
    //首页搜索
    function BindSearch()
    {
        //提示语
        var alertMessage = "请输入车牌号...";
        
        //默认值
        $("#txtKeywords").addClass("alert").val(alertMessage);
        
        //焦点绑定
        $("#txtKeywords").focus(function()
        {
            if($(this).val() == alertMessage)
            {
                $(this).val("");
                $(this).removeClass("alert");
            }
        });
    
        //回车键处理
        $("#txtKeywords").bind("keydown", function(e)
        {
            if(e.keyCode == 13)
            {
                $("#btnSubmit").click();
                e.stopPropagation();
                return false;
            }
        });
        
        //绑定自动完成
        $("#txtKeywords").autocomplete("Data/CRM/VehicleAllInfo.ashx?vid=1&type=CarNumber", 
        {
            selectFirst: true,
            mustMatch : true
        });
        
        //结果处理
        $("#txtKeywords").result(function(event, data, formatted) 
        {
            if(!data || !data[0] || !data[1])
            {
                return;
            }
            
            $("#hidVehicle").val(data[1]);
            $("#btnSubmit").click();
        });
        
        //提交数据
        $("#btnSubmit").click(function()
        {
            if($("#txtKeywords").val() == "")
            {
                $("#hidVehicle").val("")
            }
            
            var value = $("#hidVehicle").val();
            
            if(value == "")
            {
                $("#Licenseplate span").html("");
                $("#Driver_Name span").html("");
                $("#Sex span").html("");
                $("#Telephone span").html("");
                $("#TypeName span").html("");
                $("#SeriesName span").html("");
                $("#MaintenanceCount span").html("");
                $("#LastMaintenanceTime span").html("");
            }
            else
            {
                $.ajax
                ({
                    type: 'GET',
                    url: 'Data/CRM/VehicleAllInfo.ashx',
                    data: 'vid=1&type=AllInfoByCarNumber&carNumber=' + value + '',
                    success: function (result) 
                    {
                        var data = eval('(' + result + ')');
                        
                        if(data.data[0]) 
                        {
                            $("#Licenseplate span").html(data.data[0].Licenseplate);
                            $("#Driver_Name span").html(data.data[0].Driver_Name);
                            $("#Sex span").html(data.data[0].Sex);
                            $("#Telephone span").html(data.data[0].Telephone);
                            $("#TypeName span").html(data.data[0].TypeName);
                            $("#SeriesName span").html(data.data[0].SeriesName);
                            $("#MaintenanceCount span").html(data.data[0].MaintenanceCount);
                            $("#LastMaintenanceTime span").html(data.data[0].LastMaintenanceTime);
                        }
                    }
                });
            }
            
        });
    }
    
    window.DocumentTitle = document.title;
    
    function ShakeTitle(msg1, msg2)
    {
        var m1 = !msg1 ? "您有新的消息," : msg1;
        var m2 = !msg2 ? "请注意查收。" : msg2;
        var msg = m2 + m1;
    
        return setInterval(function()
        {
            msg = msg.substring(1, msg.length) + msg.substring(0, 1);
            document.title = msg;
    
        }, 200);
    }
    
    function StopShakeTitle(id)
    {
        clearInterval(id);
        document.title = window.DocumentTitle;
    }
    
    function ShakeElement(ele, cls)
    {
        var i = 0, o = ele.attr("class") + " ", c = "";
    
        return setInterval(function()
        {
            i++;
            c = i % 2 ? o + cls : o;
            ele.attr("class", c);
    
        }, 150);
    };
    
    //访问量统计
    function TotalTodayLoginLog()
    {
        $.ajax
        ({
            type: "GET",
            url: "Handler/Account.ashx",
            data: "type=TotalTodayLoginLog",
            success: function(msg)
            {
                var response = eval('(' + msg + ')');
                $("#lblTotalTodayLoginLog").html(response.data[0].count);
                
                //$("#div_datacount").html("今日总访问量:" + response.data[0].count);
            }
        });
    }
    
    //格式化报警结果
    function FormatResult(result)
    {
        return !result ? "(0)" : "(" + result + ")";
    }
    
    //统计报警提醒
    function TotalAlertInfo()
    {
        //保养到期
        $.ajax
        ({
            type: 'POST',
            url: 'URL/4S/AlarmParam/SelectMaintenance.aspx',
            data: 'Total=1&start=-1&limit=-1',
            async: true,
            cache: false,
            success: function(msg)
            {
                if(msg != "")
                {
                    var data = eval('(' + msg + ')');
                    
                    if(data.success != 'nopower')
                    {
                        $("#Alarm_c2").show();
                        $("#Alarm_c2 span").html(FormatResult(data.totalCount));
                    }
                }
            }
        });
        
        //保险到期
        $.ajax
        ({
            type: 'POST',
            url: 'Data/BaseData/Insurance/InsuranceInfo.aspx',
            data: 'Alerm=1&Total=1&start=-1&limit=-1',
            async: true,
            cache: false,
            success: function(msg)
            {
                if(msg != "")
                {
                    var data = eval('(' + msg + ')');
                    
                    if(data.success != 'nopower')
                    {
                        $("#Alarm_c4").show();
                        $("#Alarm_c4 span").html(FormatResult(data.totalCount));
                    }
                }
            }
        });
        
        //驾照到期
        $.ajax
        ({
            type: 'POST',
            url: 'Handler/4S.ashx',
            data: "type=SelectDriving&Total=1&start=-1&limit=-1",
            async: true,
            cache: false,
            success: function(msg)
            {
                if(msg != "")
                {
                    var data = eval('(' + msg + ')');
                    
                    if(data.success != 'nopower')
                    {
                        $("#Alarm_c7").show();
                        $("#Alarm_c7 span").html(FormatResult(data.totalCount));
                    }
                }
            }
        });
        
        //年审到期
        $.ajax
        ({
            type: 'POST',
            url: 'Handler/4S.ashx',
            data: "type=SelectVerification&Total=1&start=-1&limit=-1",
            async: true,
            cache: false,
            success: function(msg)
            {
                if(msg != "")
                {
                    var data = eval('(' + msg + ')');
                    
                    if(data.success != 'nopower')
                    {
                        $("#Alarm_c8").show();
                        $("#Alarm_c8 span").html(FormatResult(data.totalCount));
                    }
                }
            }
        });
    }
    
    //反馈意见
    function SelectFeedback()
    {
        $.ajax
        ({
            type: 'POST',
            url: 'Data/SoftWare/FreeBack/SelectFreeBack.aspx',
            data: 'Total=1&start=-1&limit=-1',
            async: true,
            cache: false,
            success: function(msg)
            {
                if(msg != "")
                {
                    var data = eval('(' + msg + ')');
    
                    if(data.success != 'nopower')
                    {
                        $("#Alarm_c13").show();
    
                        var count = data.totalCount;
    
                        $("#Alarm_c13 span").html(FormatResult(count));
    
                        if(count > 0)
                        {
                            if(!window.AlarmFeedBackId)
                            {
                                window.AlarmFeedBackId = ShakeElement($("#Alarm_c13"), "red");
                            }
    
                            if(!window.AlarmFeedBackTitleId)
                            {
                                window.AlarmFeedBackTitleId = ShakeTitle("有新的反馈意见,", "请注意查收。");
                            }
                        }
                        else
                        {
                            if(window.AlarmFeedBackId)
                            {
                                clearInterval(window.AlarmFeedBackId);
                                window.AlarmFeedBackId = null;
                                $("#Alarm_c13").removeClass("red");
                            }
    
                            if(window.AlarmFeedBackTitleId)
                            {
                                StopShakeTitle(window.AlarmFeedBackTitleId);
                                window.AlarmFeedBackTitleId = null;
                            }
                        }
                    }
                }
            }
        });
    }
    
    //保养预约
    function SelectAppointment()
    {
        $.ajax
        ({
            type: 'POST',
            url: 'Handler/Maintain.ashx',
            data: 'type=selectApp&Total=1&start=-1&limit=-1',
            async: true,
            cache: false,
            success: function(msg)
            {
                if(msg != "")
                {
                    var data = eval('(' + msg + ')');
    
                    if(data.success != 'nopower')
                    {
                        $("#Alarm_c14").show();
                        $("#Alarm_c14 span").html(FormatResult(data.totalCount));
    
                        if(parseInt(data.totalCount) > 0)
                        {
                            if(!window.AlarmAppointmentId)
                            {
                                window.AlarmAppointmentId = ShakeElement($("#Alarm_c14"), "red");
                            }
    
                            if(!window.AlarmAppointmentTitleId)
                            {
                                window.AlarmAppointmentTitleId = ShakeTitle("有新的保养预约,", "请留意处理。");
                            }
                        }
                        else
                        {
                            if(window.AlarmAppointmentId)
                            {
                                clearInterval(window.AlarmAppointmentId);
                                window.AlarmAppointmentId = null;
                                $("#Alarm_c14").removeClass("red");
                            }
    
                            if(window.AlarmAppointmentTitleId)
                            {
                                StopShakeTitle(window.AlarmAppointmentTitleId);
                                window.AlarmAppointmentTitleId = null;
                            }
                        }
                    }
                }
            }
        });
    };
    View Code

      

  • 相关阅读:
    UVA 11149.Power of Matrix-矩阵快速幂倍增
    51nod 1137.矩阵乘法-矩阵乘法
    HDU 4920.Matrix multiplication-矩阵乘法
    HDU 6237.A Simple Stone Game-欧拉函数找素因子 (2017中国大学生程序设计竞赛-哈尔滨站-重现赛)
    HDU 6235.Permutation (2017中国大学生程序设计竞赛-哈尔滨站-重现赛)
    POJ 2226.Muddy Fields-二分图最大匹配(最小点覆盖)
    POJ 3041.Asteroids-Hungary(匈牙利算法)
    HDU 2063.过山车-Hungary(匈牙利算法)
    Codeforces 832 B. Petya and Exam-字符串匹配
    HDU 6038.Function-数学+思维 (2017 Multi-University Training Contest
  • 原文地址:https://www.cnblogs.com/aiky/p/3425043.html
Copyright © 2020-2023  润新知