コード例 #1
0
        public string GetReportList(U8LoginInfor login)
        {
            var result = new ActionResult()
            {
                Action      = "",
                Flag        = 1,
                Description = "调用失败",
                ResultData  = null
            };
            var time = System.DateTime.Now;

            System.Diagnostics.Trace.WriteLine("<<<<<<<<<<MobileReportTest>>>>>>>>>>GetReportList-->GetReportList TaskID: " + login.TaskID + " Start:" + time.ToString());
            var ds = new DataSet();

            this._loginInfo = login;
            //TimerTask timer = new TimerTask(1000, this._loginInfo);
            try
            {
                ds = this.GetDataFromDb(false, false);
            }
            catch (Exception ex)
            {
                result.Description = "获取模块信息失败:" + ex.Message;
                return(result.Description);//代码走查点修改
            }
            if (ds != null && ds.Tables.Count > 0)
            {
                ds.Tables[0].TableName = "ReportListInfo";
            }
            const string templateId  = "getReportList";
            var          token       = "";
            var          xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(login.UserToken);
            var doc       = xmlDocument.DocumentElement;
            var tokennode = doc.SelectSingleNode("/ufsoft/data/SignedToken");

            if (tokennode != null)
            {
                token = tokennode.Attributes["id"].Value;
            }

            var service = new SchemaServiceForNet();

            result.ResultData  = service.MakeSchema(token, templateId, ds, null);
            result.Flag        = 0;
            result.Description = "查询报表列表信息成功!";
            //System.Diagnostics.Trace.WriteLine("<<<<<<<<<<MobileReportTest>>>>>>>>>>GetReportList-->GetReportList  TaskID: " + token + " End:" + System.DateTime.Now.ToString());
            //System.Diagnostics.Trace.WriteLine("<<<<<<<<<<MobileReportTest>>>>>>>>>>OpenReport-->GetReportList TaskID: " + token + "  Use Time " + (DateTime.Now - time).ToString());
            var xmlResult = result.ResultData;
            var doc1      = new XmlDocument();

            doc1.LoadXml(xmlResult);
            var    dataXML = doc1.SelectSingleNode("/struct/reportList");
            string json    = Newtonsoft.Json.JsonConvert.SerializeXmlNode(dataXML);

            result.ResultData = json;
            string finalResult = JsonTransfer.ReportListToJson(result);

            return(finalResult);
        }
コード例 #2
0
        /// <summary>
        /// 重载方法,用以解析下载时传入的参数
        /// </summary>
        /// <param name="filterString"></param>
        /// <returns></returns>
        private string FillCustomFilterString(FilterSrv objfilter, string filterString)
        {
            if (string.IsNullOrEmpty(filterString))
            {
                return(string.Empty);
            }
            string parameter;

            try
            {
                var doc1 = JsonTransfer.Json2Xml(filterString);
                parameter = doc1.SelectSingleNode("root").OuterXml;
            }
            catch
            {
                parameter = "<root>" + filterString + "</root>";
            }
            var xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(parameter);
            // 这里需要将前台传入的字符串赋值到习文过滤控件中
            var doc = xmlDocument.DocumentElement;

            if (doc == null)
            {
                return(string.Empty);
            }
            foreach (XmlNode node in doc.ChildNodes)
            {
                try
                {
                    if (!(node.HasChildNodes && node.ChildNodes.Count > 1))
                    {
                        string nodeName = this.ConvertStr(node.Name);
                        nodeName = JsonTransfer.VTransfer(nodeName);
                        objfilter.FilterList[nodeName].varValue = node.InnerText;
                        ReportFilterService.FilterItem item = new ReportFilterService.FilterItem(nodeName, node.InnerText);
                        _filter.FltDAESrv.Add(item);
                        _filter.FltSrv.Add(item);
                    }
                    else
                    {
                        foreach (XmlNode childnode in node.ChildNodes)
                        {
                            string varValue1 = "", varValue2 = "";
                            string nodeName = this.ConvertStr(node.Name);
                            nodeName = JsonTransfer.VTransfer(nodeName);
                            if (childnode.Name == "start")
                            {
                                objfilter.FilterList[nodeName].varValue = childnode.InnerText;
                                varValue1 = childnode.InnerText;
                            }
                            else if (childnode.Name == "end")
                            {
                                objfilter.FilterList[nodeName].varValue2 = childnode.InnerText;
                                varValue2 = childnode.InnerText;
                            }
                            ReportFilterService.FilterItem item = new ReportFilterService.FilterItem(nodeName, varValue1, varValue2);
                            _filter.FltSrv.Add(item);
                            _filter.FltDAESrv.Add(item);
                        }
                    }
                }
                catch
                {
                }
            }
            return(objfilter.GetSQLWhere());
        }