Пример #1
0
        public List <Page> Execute()
        {
            List <Page> pages         = new List <Page>();
            XmlDocument rqlXml        = new XmlDocument();
            XmlElement  ioDataElement = rqlXml.CreateElement("IODATA");
            XmlElement  pageElement   = rqlXml.CreateElement("PAGE");

            pageElement.SetAttribute("action", "search");
            pageElement.SetAttribute("flags", PageType.ToString());
            pageElement.SetAttribute("maxrecords", MaxRecords.ToString());
            if (Headline != null)
            {
                pageElement.SetAttribute("headline", Headline);
                pageElement.SetAttribute("headlinelike", HeadlineExact ? "0" : "-1");
            }
            if (Category != null)
            {
                pageElement.SetAttribute("section", Category);
            }
            if (Keyword != null)
            {
                pageElement.SetAttribute("keyword", Keyword);
                pageElement.SetAttribute("keywordlike", KeywordExact ? "0" : "-1");
            }
            if (Text != null)
            {
                pageElement.SetAttribute("searchtext", Text);
            }
            if (PageIdFrom != -1)
            {
                pageElement.SetAttribute("pageidfrom", PageIdFrom.ToString());
            }
            if (PageIdTo != -1)
            {
                pageElement.SetAttribute("pageidto", PageIdTo.ToString());
            }
            if (CreatedTo != DateTime.MinValue)
            {
                pageElement.SetAttribute("createdateto", ((int)CreatedTo.ToOADate()).ToString());
            }
            if (CreatedFrom != DateTime.MinValue)
            {
                pageElement.SetAttribute("createdatefrom", CreatedFrom.ToString());
            }
            if (Template != null)
            {
                pageElement.SetAttribute("templateguid", Template.GuidString);
            }
            ioDataElement.AppendChild(pageElement);
            rqlXml.AppendChild(ioDataElement);
            _xmlDoc.LoadXml(Session.Execute(rqlXml));
            XmlNodeList xmlNodes = _xmlDoc.GetElementsByTagName("PAGE");

            foreach (XmlNode xmlNode in xmlNodes)
            {
                pages.Add(new Page(xmlNode));
            }
            return(pages);
        }
Пример #2
0
        public IEnumerable <IPage> Execute()
        {
            var        rqlXml      = new XmlDocument();
            XmlElement pageElement = rqlXml.CreateElement("PAGE");

            pageElement.SetAttribute("action", "search");
            pageElement.SetAttribute("flags", ((int)PageType).ToString(CultureInfo.InvariantCulture));
            pageElement.SetAttribute("maxrecords", MaxRecords.ToString(CultureInfo.InvariantCulture));
            if (Headline != null)
            {
                pageElement.SetAttribute("headline", Headline);
                pageElement.SetAttribute("headlinelike", IsMatchingHeadlineExactly ? "0" : "-1");
            }
            if (Category != null)
            {
                pageElement.SetAttribute("section", Category);
            }
            if (Keyword != null)
            {
                pageElement.SetAttribute("keyword", Keyword);
                pageElement.SetAttribute("keywordlike", IsMatchingKeywordExactly ? "0" : "-1");
            }
            if (Text != null)
            {
                pageElement.SetAttribute("searchtext", Text);
            }
            if (PageIdFrom != -1)
            {
                pageElement.SetAttribute("pageidfrom", PageIdFrom.ToString(CultureInfo.InvariantCulture));
            }
            if (PageIdTo != -1)
            {
                pageElement.SetAttribute("pageidto", PageIdTo.ToString(CultureInfo.InvariantCulture));
            }
            if (CreatedTo != DateTime.MinValue)
            {
                pageElement.SetAttribute("createdateto", (CreatedTo.ToOADate()).ToString(CultureInfo.InvariantCulture));
            }
            if (CreatedFrom != DateTime.MinValue)
            {
                pageElement.SetAttribute("createdatefrom",
                                         (CreatedFrom.ToOADate()).ToString(CultureInfo.InvariantCulture));
            }
            if (ContentClass != null)
            {
                pageElement.SetAttribute("templateguid", ContentClass.Guid.ToRQLString());
            }

            XmlDocument xmlDoc = _project.ExecuteRQL(pageElement.OuterXml);

            return((from XmlElement curNode in xmlDoc.GetElementsByTagName("PAGE")
                    let nodeWithLanguageVariantId = AddLanguageVariantId(curNode)
                                                    select new Page(_project, nodeWithLanguageVariantId)).ToList());
        }
Пример #3
0
        public void SaveTreeData()
        {
            var builder = new StringBuilder();

            builder.AppendLine(MaxRecords.ToString());
            builder.AppendLine(MaxRecordsInOverflow.ToString());
            builder.AppendLine(_freeBlocks.ListToString(';'));
            builder.AppendLine(_freeBlocksOverflow.ListToString(';'));

            foreach (var trieNode in PreOrderTraversal())
            {
                builder.AppendLine(trieNode.GetStringRepresentation());
            }

            using (StreamWriter sw = new StreamWriter(_files.FileTreeData, false))
            {
                sw.Write(builder.ToString());
            }
        }
Пример #4
0
        private void Ex()
        {
            int _rtuid = RtuId;

            if (DtStartTime.Ticks >= DtEndTime.Ticks)
            {
                Remind = "时间设置错误,请检查!";
                return;
            }

            if (CurrentSelectedRecordType.Value == 0)
            {
                if (RtuId == 0)
                {
                    Remind = "请先选择终端!";
                    return;
                }

                if (RecordCount == 0)
                {
                    Remind = "记录数设置错误,请检查!";
                    return;
                }
            }
            else if (CurrentSelectedRecordType.Value == 1)
            {
                if (IsAllTmlChecked == false)
                {
                    if (RtuId == 0)
                    {
                        Remind = "请先选择终端!";
                        return;
                    }
                }
                else
                {
                    _rtuid = 0;
                }

                if (DtStartTime.Ticks >= (new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0)).Ticks)
                {
                    Remind = "时间设置错误,请检查!";
                    return;
                }
            }

            _dtQuery = DateTime.Now;

            var ntsnd = Wlst.Sr.ProtocolPhone.LxRtu.wst_rtu_sd_request;

            ntsnd.WstRtuSdRequest.CmdIdx = 1;

            ntsnd.WstRtuSdRequest.RtuId      = _rtuid;
            ntsnd.WstRtuSdRequest.RecordType = CurrentSelectedRecordType.Value + 1;

            long endTime = DtEndTime.Ticks;

            if (DtEndTime.Ticks > DateTime.Now.Ticks)
            {
                endTime = DateTime.Now.Ticks;
            }

            if (ntsnd.WstRtuSdRequest.RecordType == 1)
            {
                ntsnd.WstRtuSdRequest.DtStart        = DtStartTime.Ticks;
                ntsnd.WstRtuSdRequest.RecordCount    = RecordCount;
                ntsnd.WstRtuSdRequest.RecordDistance = (((endTime - DtStartTime.Ticks) / RecordCount / 10000000) / 2) * 2;
            }
            else if (ntsnd.WstRtuSdRequest.RecordType == 2)
            {
                var DTendTime = new DateTime(endTime);


                if (endTime < (new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0)).Ticks)
                {
                    endTime = (new DateTime(DTendTime.Year, DTendTime.Month, DTendTime.Day, 0, 0, 0).AddDays(1)).Ticks;
                }
                else
                {
                    endTime = (new DateTime(DTendTime.Year, DTendTime.Month, DTendTime.Day, 0, 0, 0)).Ticks;
                }


                ntsnd.WstRtuSdRequest.DtStart =
                    (new DateTime(DtStartTime.Year, DtStartTime.Month, DtStartTime.Day, 0, 0, 0)).Ticks;
                ntsnd.WstRtuSdRequest.RecordCount =
                    Math.Max(1, Convert.ToInt32((endTime - ntsnd.WstRtuSdRequest.DtStart) / 864000000000));
                ntsnd.WstRtuSdRequest.RecordDistance = 86400;
            }

            if (CurrentSelectedRecordType.Value == 0)
            {
                Records.Clear();
            }
            else
            {
                MaxRecords.Clear();
            }

            RecordTotalCount = 0;

            SndOrderServer.OrderSnd(ntsnd);

            Remind = "查询命令已发送...请等待数据反馈!";
        }