Ejemplo n.º 1
0
        private void GetMuluZhishi()
        {
            ActionResultModel actoinResultModel = new ActionResultModel();
            try
            {
                int muluId = int.Parse(Request["muluId"]);
                int kaishiHang = int.Parse(Request["kaishiHang"]);
                if (kaishiHang <= 0)
                {
                    kaishiHang = 0;
                }
                int jieshuHang = int.Parse(Request["jieshuHang"]);
                if (jieshuHang <= 0)
                {
                    jieshuHang = 19;
                }
                string chaxunWenti = Request["chaxunWenti"];
                string chaxunDaan = Request["chaxunDaan"];
                string chaxunFujian = Request["chaxunFujian"];
                bool baohanZiMulu = !string.IsNullOrEmpty(chaxunWenti) || !string.IsNullOrEmpty(chaxunDaan);
                Mulu mulu = WebHelper.Zhishiku.GetMulu(muluId);
                List<Zhishi> zhishiList = mulu.ChaxunZhishiList(WebHelper.DangqianYonghuZhanghao, chaxunWenti, chaxunDaan, chaxunFujian, baohanZiMulu);
                DataGridModel model = new DataGridModel();
                model.grid = zhishiList.Skip(kaishiHang).Take(20).Select(x => new ZhishiModel(x)).ToList();
                model.kaishiHang = kaishiHang;
                model.jieshuHang = jieshuHang;
                model.yedaxiao = 20;
                model.zongHangshu = zhishiList.Count;

                actoinResultModel.data = model;
            }
            catch (Exception ex)
            {
                actoinResultModel.result = ActionResult.Error;
                actoinResultModel.message = ex.Message;
                WebHelper.Logger.Error(ex.Message, ex);
            }
            Response.Write(JsonConvert.SerializeObject(actoinResultModel));
        }
Ejemplo n.º 2
0
        private void GetMuluZhishi()
        {
            ActionResultModel actoinResultModel = new ActionResultModel();
            try
            {
                int muluId = int.Parse(Request["muluId"]);
                int kaishiHang = int.Parse(Request["kaishiHang"]);
                if (kaishiHang <= 0)
                {
                    kaishiHang = 0;
                }
                int jieshuHang = int.Parse(Request["jieshuHang"]);
                if (jieshuHang <= 0)
                {
                    jieshuHang = 19;
                }
                string chaxunWenti = Request["chaxunWenti"];
                string chaxunDaan = Request["chaxunDaan"];
                string chaxunFujian = Request["chaxunFujian"];
                string chaxunWentiHuoDaan = Request["chaxunWentiHuoDaan"];
                List<Zhishi> zhishiList = null;
                Mulu mulu = WebHelper.Zhishiku.GetMulu(muluId);

                if (mulu == null)
                {
                    throw new Exception("找不到目录,可能目录已经被删除!");
                }
                if (string.IsNullOrEmpty(chaxunWentiHuoDaan))
                {
                    bool baohanZiMulu = !(string.IsNullOrEmpty(chaxunWenti) &&
                                          string.IsNullOrEmpty(chaxunDaan) &&
                                          string.IsNullOrEmpty(chaxunFujian));
                    zhishiList = mulu.ChaxunZhishiList(WebHelper.DangqianYonghuZhanghao, chaxunWenti, chaxunDaan,
                                                       chaxunFujian, baohanZiMulu);
                }
                else
                {
                    zhishiList = mulu.ChaxunZhishiList(WebHelper.DangqianYonghuZhanghao,
                                                       chaxunWentiHuoDaan.Split(new[] {' '},
                                                                                StringSplitOptions.RemoveEmptyEntries)
                                                                         .ToList(), true);
                }

                DataGridModel model = new DataGridModel();
                model.grid = zhishiList.Skip(kaishiHang).Take(20).Select(x => new ZhishiModel(x)).ToList();
                model.kaishiHang = kaishiHang;
                model.jieshuHang = jieshuHang;
                model.yedaxiao = 20;
                model.zongHangshu = zhishiList.Count;

                actoinResultModel.data = model;
            }
            catch (Exception ex)
            {
                actoinResultModel.result = ActionResult.Error;
                actoinResultModel.message = ex.Message;
                WebHelper.Logger.Error(ex.Message, ex);
            }
            Response.Write(JsonConvert.SerializeObject(actoinResultModel));
        }