参数传递

来源:互联网 发布:js调用api截屏 qt mac 编辑:程序博客网 时间:2024/05/22 16:03
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Services;using Newtonsoft.Json;using Newtonsoft.Json.Converters;using OAServiceBLLBase;using Ynhosp.Portal.BLL;using Ynhosp.Portal.BLL.DTO;namespace Ynhosp.Portal.Web.Portal.ashx{    /// <summary>    /// $codebehindclassname$ 的摘要说明    /// </summary>    [WebService(Namespace = "http://tempuri.org/")]    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]    public class QueryEmergencyDep : IHttpHandler    {        public void ProcessRequest(HttpContext context)        {            bool success = false;            //int limit = Int32.Parse(context.Request.QueryString["limit"].ToString().Trim());            //int offset = Int32.Parse(context.Request.QueryString["offset"].ToString().Trim());            int limit = 100;            int offset = 0;            IList<DTODutyPerson> outDatas = new List<DTODutyPerson>();            context.Response.ContentType = "text/plain";            try            {                DateTime date = DateTime.Parse(context.Request.QueryString["date"].ToString().Trim());                QueryEmergencyDepService core = new QueryEmergencyDepService();                var lstRes = new List<DTODutyPerson>();                success = core.Query(date, out outDatas);                var total = outDatas.Count;                var rows = outDatas.Skip(offset).Take(limit).ToList();                string output = JsonConvert.SerializeObject(new { total = total, rows = rows }, Newtonsoft.Json.Formatting.Indented);                HttpContext.Current.Response.Write(output);            }            catch (Exception e)            {                            }        }        public bool IsReusable        {            get            {                return false;            }        }    }}

原创粉丝点击