Ejemplo n.º 1
0
        /// <summary>
        /// 帮助逻辑
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                var service = new CustomHelper();
                context.Response.ContentType = "text/plain";

                var    op  = context.Request.Form.Get("op");
                object res = "";
                switch (op)
                {
                case "GetHelpInfo":
                    var id = context.Request.Form.Get("id");
                    res = service.GetHelpInfo(id);
                    break;

                case "GetHelpData":
                case "GetHelpDataSearch":
                    var helpID   = context.Request.Form.Get("id");
                    var filter   = context.Request.Form.Get("filter");
                    var order    = context.Request.Form.Get("order");
                    var row      = context.Request.Form.Get("row");
                    var dwbh     = context.Request.Form.Get("dwbh");
                    var page     = int.Parse(context.Request.Form.Get("page"));
                    var pageSize = int.Parse(context.Request.Form.Get("pageSize"));
                    res = service.GetDataList(helpID, filter, order, page, pageSize);
                    break;

                case "GetFunc":

                    res = service.GetFuncList();
                    break;

                case "GetVersion":     //获取版本信息
                    res = service.GetVersion();
                    break;

                default:
                    break;
                }
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { res = true, data = res }));
            }
            catch (Exception ex)
            {
                context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { res = false, msg = ex.Message }));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取帮助数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GetHelpData(object sender, Chromium.Remote.Event.CfrV8HandlerExecuteEventArgs e)
 {
     try
     {
         if (e.Arguments.Length > 0)
         {
             var helpID   = e.Arguments[0].ToString();
             var filter   = e.Arguments[1].ToString();
             var order    = e.Arguments[2].ToString();
             var page     = int.Parse(e.Arguments[3].ToString());
             var pageSize = int.Parse(e.Arguments[4].ToString());
             e.SetReturnValue(JSON.SerializeObject(service.GetDataList(helpID, filter, order, page, pageSize)));
         }
     }
     catch (Exception ex)
     {
         parentForm.ExecuteJavascript("ImportController.msg('" + ex.Message + "');");
     }
 }