Esempio n. 1
0
        private void btnConfig_Click(object sender, EventArgs e)
        {
            tmrExecute.Enabled = false;
            frmConfig frmC = new frmConfig(); //

            frmC.ShowDialog();
            if (frmC.DialogResult == DialogResult.OK)
            {
                tmrExecute.Enabled = true;
            }
        }
Esempio n. 2
0
        private void web_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (e.Url != web.Url || web.ReadyState != WebBrowserReadyState.Complete)
            {
                return;
            }
            string url = web.Url.AbsoluteUri;

            lblState.Text = url;
            if (url.IndexOf("http://i.icefish.cn/login") == 0)
            {
                string um  = Properties.Settings.Default.UM;
                string pwd = BCutEncrypt(Properties.Settings.Default.PWD);
                if (um == "")
                {
                    MessageBox.Show("检测到首次启动,请在配置中(自动登录帐号)填入冰鱼帐号及密码哈~");
                    frmConfig frmC = new frmConfig();
                    frmC.ShowDialog();
                    return;
                }
                HtmlElement UM = web.Document.GetElementById("j_username");
                UM.SetAttribute("value", um);
                HtmlElement PWD = web.Document.GetElementById("j_password");
                PWD.SetAttribute("value", pwd);
                HtmlElementCollection btnS = web.Document.GetElementsByTagName("INPUT").GetElementsByName("Submit");
                btnS[0].InvokeMember("click");

                web.Navigate("http://i.icefish.cn/tasklist.aspx");
            }
            else if (url.IndexOf("http://i.icefish.cn/tasklist.aspx") == 0)  //19更新点:newFM.do
            {
                try
                {
                    HtmlElementCollection tasks = web.Document.GetElementById("tbody1").GetElementsByTagName("tr");
                    HtmlElementCollection links = web.Document.GetElementById("tbody1").GetElementsByTagName("A");
                    analysiscExc(tasks, links);
                }
                catch
                {
                    try
                    {
                        HtmlElementCollection tasks = web.Document.GetElementById("tbody3").GetElementsByTagName("tr");
                        HtmlElementCollection links = web.Document.GetElementById("tbody3").GetElementsByTagName("A");
                        analysiscExc(tasks, links);
                    }
                    catch
                    {
                        return;
                    }
                    return;
                }
            }
            else if (url.IndexOf("http://i.icefish.cn/tasklist.aspx?TID=") == 0)
            {
                string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                string name = web.Document.GetElementById("tasktransactor").GetAttribute("value");
                string um   = web.Document.GetElementsByTagName("INPUT").GetElementsByName("SendLeader")[0].GetAttribute("value").Substring(8).Split(',')[0].ToLower();
                string tel  = web.Document.GetElementById("tel").GetAttribute("value");
                string task = web.Document.GetElementById("taskname").GetAttribute("value");
                string dep  = web.Document.GetElementById("taskdeptname").GetAttribute("value");
                dan_nums++;
                txtLog.AppendText(string.Format("[{0}] {1}  {2}  {3}({4}) {5}  {6}\r\n", dan_nums, time, dep, name, um, task, tel));
                txtLog.ScrollToCaret();

                HtmlElement leaderidea1 = web.Document.GetElementById("leaderidea1");
                leaderidea1.SetAttribute("value", "同意");
                HtmlElementCollection buttonList = web.Document.GetElementsByTagName("INPUT").GetElementsByName("btnSave");
                if (buttonList.Count == 0)  //针对被征求意见类型的单
                {
                    buttonList = web.Document.GetElementsByTagName("INPUT").GetElementsByName("btnApprove");
                }
                buttonList[0].InvokeMember("click");
            }
        }