private void GetWebLink(ListViewItem Litem, cNavigRules nRuls)
        {
            this.listWeblink.Items.Add(Litem);

            m_listNaviRules.Add(nRuls);

            //this.listWeblink

            if (Litem.SubItems[1].Text == "Y")
            {
                //��ӵ�������

                this.dataNRule.Rows.Clear();

                for (int i = 0; i < m_listNaviRules.Count; i++)
                {
                    if (Litem.Text == m_listNaviRules[i].Url)
                    {
                        for (int j = 0; j < m_listNaviRules[i].NavigRule.Count; j++)
                        {
                            this.dataNRule.Rows.Add(m_listNaviRules[i].NavigRule[j].Level, m_listNaviRules[i].NavigRule[j].NavigRule);
                        }
                    }
                }

            }
            else
            {
                this.dataNRule.Rows.Clear();
            }

             this.listWeblink.Items[this.listWeblink.Items.Count - 1].Selected = true;
        }
Exemplo n.º 2
0
        private void cmdEditWeblink_Click(object sender, EventArgs e)
        {
            if (this.listWeblink.SelectedItems.Count == 0)
            {
                return;
            }

            this.errorProvider1.Clear();
            int UrlCount = 0;

            if (this.txtWebLink.Text.ToString() == null || this.txtWebLink.Text.Trim().ToString() == "")
            {
                this.errorProvider1.SetError(this.txtWebLink, rm.GetString("Error1"));
                return;
            }
            else
            {
                if (!Regex.IsMatch(this.txtWebLink.Text.Trim().ToString(), "http://", RegexOptions.IgnoreCase))
                {
                    this.errorProvider1.SetError(this.txtWebLink, rm.GetString("Error2"));
                    return;
                }
            }

            this.listWeblink.SelectedItems[0].Text = this.txtWebLink.Text.ToString();
            if (this.IsNavigPage.Checked == true)
            {
                this.listWeblink.SelectedItems[0].SubItems [1].Text ="Y";

                //ɾ���洢�ĵ�������
                for (int i = 0; i < m_listNaviRules.Count; i++)
                {
                    if (this.listWeblink.SelectedItems[0].Text == m_listNaviRules[i].Url)
                        m_listNaviRules.Remove(m_listNaviRules[i]);
                }

                cNavigRule cn;
                cNavigRules m_listNaviRule = new cNavigRules();

                for (int m = 0; m < this.dataNRule.Rows.Count; m++)
                {
                    cn = new cNavigRule();
                    cn.Url = this.txtWebLink.Text;
                    cn.Level = m+1;
                    cn.NavigRule = this.dataNRule.Rows[m].Cells[1].Value.ToString();

                    m_listNaviRule.Url = this.txtWebLink.Text;
                    m_listNaviRule.NavigRule.Add(cn);
                }

                m_listNaviRules.Add(m_listNaviRule);

                this.listWeblink.SelectedItems[0].SubItems[2].Text = this.dataNRule.Rows.Count.ToString();

            }
            else
            {
                this.listWeblink.SelectedItems[0].SubItems[1].Text = "N";
                this.listWeblink.SelectedItems[0].SubItems[2].Text = "0";
            }

            if (this.IsAutoNextPage.Checked == true)
            {
                this.listWeblink.SelectedItems[0].SubItems[3].Text=this.txtNextPage.Text.ToString();
            }
            else
            {
                this.listWeblink.SelectedItems[0].SubItems[3].Text="";
            }

            UrlCount = gUrl.GetUrlCount(this.txtWebLink.Text.ToString());
            this.listWeblink.SelectedItems[0].SubItems[4].Text = UrlCount.ToString ();

            this.txtWebLink.Text = "http://";
            this.IsNavigPage.Checked = false;
            this.IsAutoNextPage.Checked = false;
            this.txtNag.Text = "";
            this.txtNextPage.Text = "";
            this.dataNRule.Rows.Clear();

            this.IsSave.Text = "true";
        }
Exemplo n.º 3
0
        private void LoadTask(string TClassPath, string TaskName)
        {
            //ÿ�μ�������ǰ�������뽫�������ÿ�
            int i = 0;
            m_listNaviRules = null;
            m_listNaviRules = new List<cNavigRules>();

            Task.cTask t = new Task.cTask();

            try
            {
                t.LoadTask(TClassPath + "\\" + TaskName);
            }
            catch (cSoukeyException ex)
            {
                throw ex;
            }

            //��ʼ�ж�����汾�ţ��������汾�Ų�ƥ�䣬�򲻽���������Ϣ�ļ���
            if (this.SupportTaskVersion !=t.TaskVersion)
            {
                t = null;
                MessageBox.Show(rm.GetString("Info1"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            this.tTask.Text =t.TaskName ;
            this.txtTaskDemo.Text = t.TaskDemo;

            if (t.TaskClass == "")
            {
                this.comTaskClass.SelectedIndex = 0;
            }
            else
            {
                this.comTaskClass.SelectedItem=t.TaskClass ;
            }

            this.TaskType.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.TaskType));
            this.comRunType.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.RunType));

            if (this.comRunType.SelectedIndex == 0)
            {
                //���ڵ�������
                switch ((cGlobalParas.PublishType)int.Parse(t.ExportType))
                {
                    case cGlobalParas.PublishType.PublishExcel :
                        this.raExportExcel.Checked = true;
                        break;
                    case cGlobalParas.PublishType.PublishTxt :

                        this.raExportTxt.Checked = true;
                        break;
                    case cGlobalParas.PublishType.PublishAccess:
                        this.raExportAccess.Checked = true;
                        break;
                    case cGlobalParas.PublishType.PublishMSSql :
                        this.raExportMSSQL.Checked = true;
                        break;
                    case cGlobalParas.PublishType .PublishMySql :
                        this.raExportMySql.Checked = true;
                        break;
                    case cGlobalParas.PublishType .PublishWeb :
                        this.raExportWeb.Checked = true;
                        break;
                    default :
                        break;
                }
                this.txtFileName.Text = t.ExportFile;
                this.txtDataSource.Text = t.DataSource;
                this.comTableName.Text = t.DataTableName;
                this.txtInsertSql.Text  = t.InsertSql;
                this.txtExportUrl.Text  = t.ExportUrl;
                if (t.ExportUrlCode == null || t.ExportUrlCode =="")
                    this.comExportUrlCode.SelectedIndex = 0;
                else
                    this.comExportUrlCode.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.ExportUrlCode));
                this.txtExportCookie.Text  = t.ExportCookie;
            }
            else
            {
                //���ɼ�����
                this.groupBox4.Enabled = false;
                this.txtFileName.Text = "";
                this.comTableName.Text = "";

            }

            this.txtSavePath.Text = t.SavePath;
            this.udThread.Value = t.ThreadCount;
            this.txtStartPos.Text = t.StartPos;
            this.txtEndPos.Text = t.EndPos;
            this.txtWeblinkDemo.Text = t.DemoUrl;
            this.txtCookie.Text = t.Cookie;
            this.comWebCode.SelectedItem = cGlobalParas.ConvertName(int.Parse (t.WebCode));
            this.IsLogin.Checked = t.IsLogin;
            this.txtLoginUrl.Text = t.LoginUrl;
            this.IsUrlEncode.Checked = t.IsUrlEncode;
            if (t.UrlEncode == "")
            {
                this.comUrlEncode.SelectedIndex = -1;
            }
            else
            {
                this.comUrlEncode.SelectedItem = cGlobalParas.ConvertName(int.Parse(t.UrlEncode));
            }

            //���ظ߼�����
            this.udAgainNumber.Value = t.GatherAgainNumber;
            this.IsIgnore404.Checked = t.IsIgnore404;
            this.IsSaveErrorLog.Checked = t.IsErrorLog;
            this.IsDelRepRow.Checked = t.IsDelRepRow;
            this.IsIncludeHeader.Checked = t.IsExportHeader;

            this.IsStartTrigger.Checked = t.IsTrigger;

            if (t.TriggerType == ((int)cGlobalParas.TriggerType.GatheredRun).ToString ())
                this.raGatheredRun.Checked = true;
            else if (t.TriggerType == ((int)cGlobalParas.TriggerType.PublishedRun).ToString ())
                this.raPublishedRun.Checked = true;

            //������������
            if (this.IsStartTrigger.Checked == true)
            {
                ListViewItem litem;

                for (i = 0; i <t.TriggerTask.Count ; i++)
                {
                    litem = new ListViewItem();
                    litem.Text = cGlobalParas.ConvertName(t.TriggerTask[i].RunTaskType);
                    if (t.TriggerTask[i].RunTaskType == (int)cGlobalParas.RunTaskType.DataTask)
                        litem.SubItems.Add(cGlobalParas.ConvertName(int.Parse(t.TriggerTask[i].RunTaskName)));
                    else
                        litem.SubItems.Add(t.TriggerTask[i].RunTaskName);
                    litem.SubItems.Add(t.TriggerTask[i].RunTaskPara);

                    this.listTask.Items.Add(litem);
                }
            }

            ListViewItem item;

            for (i = 0; i < t.WebpageLink.Count;  i++)
            {
                item=new ListViewItem ();

                if (t.WebpageLink[i].IsNavigation == true)
                {
                    cNavigRules cns = new cNavigRules();
                    cns.Url = t.WebpageLink[i].Weblink.ToString();
                    cns.NavigRule = t.WebpageLink[i].NavigRules;

                    //for (int m=0;m<t.WebpageLink [i].NavigRules.Count;m++)
                    //{
                    //    cn=new cNavigRule ();
                    //    cn.Url =t.WebpageLink[i].NavigRules[m].Url ;
                    //    cn.Level = t.WebpageLink[i].NavigRules[m].Level;
                    //    cn.IsOppUrl = t.WebpageLink[i].NavigRules[m].IsOppUrl;
                    //    cn.NavigRule = t.WebpageLink[i].NavigRules[m].NavigRule;

                    //    cns.NavigRule.Add(cn);
                    //}

                    m_listNaviRules.Add(cns);
                }

                item.Name =t.WebpageLink[i].id.ToString ();
                item.Text =t.WebpageLink[i].Weblink.ToString ();
                if (t.WebpageLink[i].IsNavigation == true)
                {
                    item.SubItems.Add("Y");
                    item.SubItems.Add(t.WebpageLink[i].NavigRules.Count.ToString ());
                }
                else
                {
                    item.SubItems.Add("N");
                    item.SubItems.Add("0");

                }
                item.SubItems.Add(t.WebpageLink[i].NextPageRule);
                item.SubItems.Add(gUrl.GetUrlCount(t.WebpageLink[i].Weblink.ToString ()).ToString ());

                this.listWeblink.Items.Add (item);
                item=null;
            }

            for (i = 0; i < t.WebpageCutFlag.Count ; i++)
            {
                item=new ListViewItem() ;
                item.Name =t.WebpageCutFlag[i].id.ToString ();
                item.Text =t.WebpageCutFlag[i].Title.ToString ();
                item.SubItems.Add(cGlobalParas.ConvertName (t.WebpageCutFlag[i].DataType) );
                item.SubItems.Add (t.WebpageCutFlag[i].StartPos.ToString ());
                item.SubItems.Add (t.WebpageCutFlag[i].EndPos .ToString ());
                item.SubItems.Add(cGlobalParas.ConvertName (t.WebpageCutFlag[i].LimitSign));

                item.SubItems.Add(t.WebpageCutFlag [i].RegionExpression );
                if ((int)t.WebpageCutFlag[i].ExportLimit == 0)
                    item.SubItems.Add("");
                else
                    item.SubItems.Add(cGlobalParas.ConvertName(t.WebpageCutFlag[i].ExportLimit));

                item.SubItems.Add(t.WebpageCutFlag [i].ExportExpression );

                this.listWebGetFlag.Items.Add(item);
                item=null;
            }

            t=null ;
        }
Exemplo n.º 4
0
        private void cmdAddWeblink_Click(object sender, EventArgs e)
        {
            this.errorProvider1.Clear();
            int UrlCount = 0;

            if (this.txtWebLink.Text.ToString() == null || this.txtWebLink.Text.Trim().ToString() == "" || this.txtWebLink.Text .Trim().ToString ()=="http://")
            {
                this.errorProvider1.SetError(this.txtWebLink, rm.GetString("Error1"));
                this.txtWebLink.Focus();
                return;
            }
            else
            {
                if (!Regex.IsMatch (this.txtWebLink.Text.Trim().ToString (),"http://",RegexOptions.IgnoreCase))
                {
                    this.errorProvider1.SetError(this.txtWebLink, rm.GetString("Error2"));
                    this.txtWebLink.Focus();
                    return;
                }
            }

            ListViewItem litem;
            litem = new ListViewItem();
            litem.Text = this.txtWebLink.Text.ToString();

            if (this.IsNavigPage.Checked == true)
            {
                litem.SubItems.Add("Y");

                cNavigRule cn;
                cNavigRules m_listNaviRule = new cNavigRules();

                for (int m = 0; m < this.dataNRule.Rows.Count; m++)
                {
                    cn = new cNavigRule();
                    cn.Url = this.txtWebLink.Text;
                    cn.Level = m+1;
                    cn.NavigRule = this.dataNRule.Rows[m].Cells[1].Value.ToString ();

                    m_listNaviRule.Url = this.txtWebLink.Text;
                    m_listNaviRule.NavigRule.Add(cn);
                }

                m_listNaviRules.Add(m_listNaviRule);

                litem.SubItems.Add(this.dataNRule.Rows.Count.ToString ());

            }
            else
            {
                litem.SubItems.Add("N");
                litem.SubItems.Add("0");
            }

            if (this.IsAutoNextPage.Checked == true)
            {
                litem.SubItems.Add(this.txtNextPage.Text.ToString());
            }
            else
            {
                litem.SubItems.Add("");
            }

            UrlCount = gUrl.GetUrlCount(this.txtWebLink.Text.ToString());

            litem.SubItems.Add(UrlCount.ToString());

            this.listWeblink.Items.Add(litem);
            litem = null;

            this.txtWebLink.Text = "http://";
            this.IsNavigPage.Checked = false;
            this.IsAutoNextPage.Checked = false;
            this.txtNag.Text = "";
            this.txtNextPage.Text = "";
            this.dataNRule.Rows.Clear();

            this.IsSave.Text = "true";
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int UrlCount = 0;
            cNavigRules m_listNaviRule = new cNavigRules();

            if (this.txtWebLink.Text.ToString() == null || this.txtWebLink.Text.Trim().ToString() == "" || this.txtWebLink.Text.Trim().ToString() == "http://")
            {
                MessageBox.Show(rm.GetString ("Error1"), rm.GetString ("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.txtWebLink.Focus();
                return;
            }
            else
            {
                if (!Regex.IsMatch(this.txtWebLink.Text.Trim().ToString(), "http://", RegexOptions.IgnoreCase))
                {
                    MessageBox.Show(rm.GetString("Error2"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.txtWebLink.Focus();
                    return;
                }
            }

            ListViewItem litem;
            litem = new ListViewItem();
            litem.Text = this.txtWebLink.Text.ToString();

            if (this.IsNavigPage.Checked == true)
            {
                litem.SubItems.Add("Y");

                cNavigRule cn;

                for (int m = 0; m < this.dataNRule.Rows.Count; m++)
                {
                    cn = new cNavigRule();
                    cn.Url = this.txtWebLink.Text;
                    cn.Level = m + 1;
                    cn.NavigRule = this.dataNRule.Rows[m].Cells[1].Value.ToString();

                    m_listNaviRule.Url = this.txtWebLink.Text;
                    m_listNaviRule.NavigRule.Add(cn);
                }

                litem.SubItems.Add(this.dataNRule.Rows.Count.ToString());

            }
            else
            {
                litem.SubItems.Add("N");
                litem.SubItems.Add("0");
            }

            if (this.IsAutoNextPage.Checked == true)
            {
                litem.SubItems.Add(this.txtNextPage.Text.ToString());
            }
            else
            {
                litem.SubItems.Add("");
            }

            UrlCount = gUrl.GetUrlCount(this.txtWebLink.Text.ToString());

            litem.SubItems.Add(UrlCount.ToString());

            rData(litem, m_listNaviRule);

            this.Close();
        }