예제 #1
0
 /// <summary>
 ///  显示记录
 /// </summary>
 /// <param name="pIndex"></param>
 private void ShowRecord(int pIndex)
 {
     TxtResult.Clear();
     TxtRecordHtml.Clear();
     if (pIndex >= 0)
     {
         if (mRecordHtmls != null && mRecordHtmls.Length > pIndex)
         {
             TxtCurrent.Text    = pIndex.ToString();
             TxtRecordHtml.Text = mRecordHtmls[pIndex];
             RegScriptTransactor sSe = new RegScriptTransactor(TxtRecordHtml.Text);
             if (mDrillRule.Feilds != null)
             {
                 for (int i = 0; i < mDrillRule.Feilds.Count; i++)
                 {
                     RegularMetaFeild sFeild = mDrillRule.Feilds[i];
                     if (sFeild.Rule != null)
                     {
                         try
                         {
                             TxtResult.AppendText(sFeild.Name);
                             TxtResult.AppendText(" : ");
                             TxtResult.AppendText(sSe.Exe(sFeild.Rule));
                             TxtResult.AppendText("\n");
                         }
                         catch (Exception E)
                         {
                             MessageBox.Show(E.Message);
                         }
                     }
                 }
             }
         }
     }
     else
     {
         TxtCurrent.Text = "0";
     }
 }
예제 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            TxtName.Text = TxtName.Text.Trim();
            if (TxtName.Text.Length == 0)
            {
                MessageBox.Show("记录区名称不能为空!");
                return;
            }
            #region 提取类型
            mDrillRule.ConditionType = (byte)CmbConditionType.SelectedIndex;
            mDrillRule.ConditionTag  = TxtConditionTag.Text.Trim();
            mDrillRule.StartTag      = TxtStartTag.Text.Trim().ToLower();
            mDrillRule.EndTag        = TxtEndTag.Text.Trim().ToLower();
            if (tabControl3.SelectedIndex == 0)
            {
                mDrillRule.DrillType = 0;
            }
            else
            {
                mDrillRule.DrillType = 2;
            }
            CDbDefine sCDbDefine;
            if (mDrillRule.DrillType == 0)
            {
                sCDbDefine = SysDbDefines.载链接;
            }
            else
            {
                if (TxtMeta.Tag != null)
                {
                    sCDbDefine = ((CDbDefine)TxtMeta.Tag);
                }
                else
                {
                    sCDbDefine = SysDbDefines.实时资讯数据库;
                }
            }
            mDrillRule.MetaModalID = sCDbDefine.DbModelID;             //确定元数据
            if (mDrillRule.Feilds.Count == 0)
            {
                for (int i = 0; i < sCDbDefine.Fields.Length; i++)     //加载预定义字段
                {
                    RegularMetaFeild sFeild = new RegularMetaFeild();
                    sFeild.Name = sCDbDefine.Fields[i].Name;
                    mDrillRule.Feilds.Add(sFeild);
                }
            }
            #endregion

            #region  载链接
            mDrillRule.FeatureType = CmbLinkType.SelectedIndex;
            mDrillRule.Feature     = TxtUrlFeatrue.Text;
            #endregion

            #region 自定义高级提取
            mDrillRule.Splitter  = TxtSpliter.Text.Trim();
            mDrillRule.Name      = TxtName.Text;
            mRegionTreeNode.Text = TxtName.Text;
            #endregion

            mRegionTreeNode.Tag                = mDrillRule;
            mRegionTreeNode.ImageIndex         = 1;
            mRegionTreeNode.SelectedImageIndex = 1;

            mWaterLine.DrillRegularRules = new List <DrillRegularRule>();
            for (int i = 0; i < TViewRegion.Nodes.Count; i++)
            {
                if (TViewRegion.Nodes[i].Tag != null)
                {
                    mWaterLine.DrillRegularRules.Add((DrillRegularRule)TViewRegion.Nodes[i].Tag);
                }
            }
        }