コード例 #1
0
        public AccountViewModel(HTMLTableRow tr)
        {
            var spans = tr.getElementsByTagName("span").Cast <IHTMLElement>().ToList();

            Id   = spans[1].innerHTML;
            Name = spans[0].innerText;

            StartElement = tr.getElementsByTagName("img").Cast <IHTMLElement>().Skip(1).First();
        }
コード例 #2
0
        public void GetServersFromWeb(InternetExplorer ie, bool visible)
        {
            if (!groupName.Equals("PPE"))
            {
                try
                {
                    object Empty = 0;
                    object URL   = Index.CreateInstance().temcurl + "?query=ON&group=" + groupName;

                    ie.Visible = visible;
                    ie.Navigate2(ref URL, ref Empty, ref Empty, ref Empty, ref Empty);

                    System.Threading.Thread.Sleep(5000);

                    while (ie.Busy)
                    {
                        System.Threading.Thread.Sleep(1000);
                    }

                    IHTMLDocument3 document = (IHTMLDocument3)ie.Document;
                    if (document != null)
                    {
                        HTMLTable queryTable = (HTMLTable)document.getElementById("query_table");
                        if (queryTable != null && queryTable.rows != null && queryTable.rows.length > 1)
                        {
                            servers = new List <Server>();
                            for (int i = 1; i < queryTable.rows.length; i++)
                            {
                                HTMLTableRow row = (HTMLTableRow)queryTable.rows.item(i, i);
                                if (row != null && row.cells != null && row.cells.length > 4)
                                {
                                    HTMLTableCell serverCell       = (HTMLTableCell)row.cells.item(0, 0);
                                    HTMLTableCell travelServerCell = (HTMLTableCell)row.cells.item(4, 4);
                                    if (serverCell != null && serverCell.innerText != null && !serverCell.innerText.Equals("") &&
                                        travelServerCell != null && travelServerCell.innerText != null && !travelServerCell.innerText.Equals(""))
                                    {
                                        foreach (string singleTravelServer in travelServerCell.innerText.Split(new char[] { ',' }))
                                        {
                                            servers.Add(new Server(serverCell.innerText, singleTravelServer));
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception exception)
                { Console.WriteLine(exception.Message); }
                finally
                {
                    updateDate = DateTime.Now;
                    OnUpdated(EventArgs.Empty);
                }
            }
        }
コード例 #3
0
        private bool SelectCase(string erID)
        {
            WaitForWebPage(spage);
            int rowIndex = 0;
            List <CaseModel> caseList = new List <CaseModel>();

            foreach (HTMLTableRow tr in spage.tblSearchResult.getElementsByTagName("TR"))
            {
                if (rowIndex == 0)
                {
                    rowIndex++;
                    continue;
                }
                HTMLTableCell FormType  = tr.getElementsByTagName("TD").item(2) as HTMLTableCell;
                HTMLTableCell ERID      = tr.getElementsByTagName("TD").item(3) as HTMLTableCell;
                HTMLTableCell PCID      = tr.getElementsByTagName("TD").item(14) as HTMLTableCell;
                HTMLTableCell WorkQueue = tr.getElementsByTagName("TD").item(16) as HTMLTableCell;
                CaseModel     model     = new CaseModel {
                    index = rowIndex, FormType = FormType.innerText, ERID = ERID.innerText, PCID = PCID.innerText, WorkQueue = WorkQueue.innerText
                };
                caseList.Add(model);
                rowIndex++;
            }
            //Tag of Debug comment line
            caseList = caseList.Where(t => t.WorkQueue.Trim() == "SA-03 Processing by SA" || t.WorkQueue.Trim() == "FU-05 Follow-up").ToList();
            if (caseList == null || caseList.Count < 1)
            {
                throw new Exception("no item could be located in related queue.");
            }
            List <CaseModel> selectCase = caseList.Where(t => t.ERID == erID).ToList();
            CaseModel        casemodel  = selectCase.FirstOrDefault();

            if (casemodel == null)
            {
                return(false);
            }
            else
            {
                HTMLTableRow  tr = spage.tblSearchResult.getElementsByTagName("TR").item(casemodel.index) as HTMLTableRow;
                HTMLTableCell td = tr.getElementsByTagName("TD").item(1) as HTMLTableCell;
                var           t  = td.getElementsByTagName("INPUT").item(0) as HTMLInputElement;
                Thread.Sleep(2000);
                t.click();
                Thread.Sleep(500);
                return(true);
            }
        }
コード例 #4
0
        private OvertimeBooking parseRow(HTMLTableRow row)
        {
            OvertimeBooking overtimeBooking = new OvertimeBooking();

            List <string> cells = new List <string>();

            foreach (var item in row.all)
            {
                cells.Add(item.innerText);
            }

            if (cells.Count > 9 && (cells[10] == "OT1" || cells[10] == "OT2" || cells[10] == "OT3"))
            {
                overtimeBooking.date        = cells[0].Substring(4);
                overtimeBooking.projectNo   = cells[1];
                overtimeBooking.description = cells[6];
                overtimeBooking.hours       = cells[9];
                if (cells[10] == "OT1")
                {
                    overtimeBooking.multiplier = "1";
                }
                if (cells[10] == "OT2")
                {
                    overtimeBooking.multiplier = "1.5";
                }
                if (cells[10] == "OT3")
                {
                    overtimeBooking.multiplier = "2";
                }

                return(overtimeBooking);
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
        public bool SearchCase(TransferCase ts, Dictionary <string, List <TrusteInfoModel> > trusteInfodDic)
        {
            bool find_case = false;

            //if (actionpage.WaitForCreate())
            //{
            //    if (actionpage.btnCancel != null)
            //    {
            //        actionpage.btnCancel.click();
            //    }
            //}

            if (blankSearch.WaitForCreate())
            {
                blankSearch.btnSearch.click();
            }
            WaitForWebPage(spage);

            spage.txtHKID.value = ts.MemHKIDNo + "(" + ts.MemHKIDCheckDigit + ")";

            spage.btnsearch.click();

            WaitForWebPage(spage);
            int       index    = -1;
            int       rowIndex = 0;
            HTMLTable table    = spage.tblSearchResult;

            if (table == null)
            {
                throw new Exception("This search has no return result.");
            }
            #region SelectCase
            List <CaseModel> caseList = new List <CaseModel>();
            foreach (HTMLTableRow tr in spage.tblSearchResult.getElementsByTagName("TR"))
            {
                if (rowIndex == 0)
                {
                    rowIndex++;
                    continue;
                }
                HTMLTableCell FormType  = tr.getElementsByTagName("TD").item(2) as HTMLTableCell;
                HTMLTableCell ERID      = tr.getElementsByTagName("TD").item(3) as HTMLTableCell;
                HTMLTableCell PCID      = tr.getElementsByTagName("TD").item(14) as HTMLTableCell;
                HTMLTableCell WorkQueue = tr.getElementsByTagName("TD").item(16) as HTMLTableCell;
                CaseModel     model     = new CaseModel {
                    index = rowIndex, FormType = FormType.innerText, ERID = ERID.innerText, PCID = PCID.innerText, WorkQueue = WorkQueue.innerText
                };
                caseList.Add(model);
                rowIndex++;
            }
            //Tag of Debug comment line
            caseList = caseList.Where(t => t.WorkQueue.Trim() == "SA-03 Processing by SA" || t.WorkQueue.Trim() == "FU-05 Follow-up").ToList();
            if (caseList == null || caseList.Count < 1)
            {
                throw new IgnoreCaseException("no item could be located in related queue.");
            }
            List <CaseModel> selectCase = caseList.Where(t => t.ERID == ts.OriSchAcctMemNo.Split('-')[0]).ToList();
            if (selectCase == null || selectCase.Count < 1)
            {
                var tsinfo = trusteInfodDic["Trustee info"].Where(x => x.Scheme_Registration_No == ts.OriSchRegNo).FirstOrDefault();
                if (tsinfo.Scheme_name.StartsWith("HANG"))
                {
                    if (ts.RequestFormType == "PC")
                    {
                        selectCase = caseList.Where(t => t.FormType == "HAAC").ToList();
                    }
                    else if (ts.RequestFormType == "PM")
                    {
                        selectCase = caseList.Where(t => t.FormType == "HAPM" && t.PCID == "PR01").ToList();
                    }
                }
                else if (tsinfo.Scheme_name.StartsWith("HSBC"))
                {
                    if (ts.RequestFormType == "PC")
                    {
                        selectCase = caseList.Where(t => t.FormType == "INAC").ToList();
                    }
                    else if (ts.RequestFormType == "PM")
                    {
                        selectCase = caseList.Where(t => t.FormType == "INPM" && t.PCID == "PR01").ToList();
                    }
                }
            }
            if (selectCase == null || selectCase.Count < 1)
            {
                if (ts.RequestFormType == "PC")
                {
                    selectCase = caseList;
                }
                else if (ts.RequestFormType == "PM")
                {
                    selectCase = caseList.Where(t => t.PCID == "PR01").ToList();
                }
                //throw new Exception("Can't find item in gwis");
            }
            foreach (CaseModel model in selectCase)
            {
                HTMLTableRow  tr = spage.tblSearchResult.getElementsByTagName("TR").item(model.index) as HTMLTableRow;
                HTMLTableCell td = tr.getElementsByTagName("TD").item(1) as HTMLTableCell;
                var           t  = td.getElementsByTagName("INPUT").item(0) as HTMLInputElement;
                Thread.Sleep(2000);
                t.click();
                Thread.Sleep(3000);
                if (CheckGwisDetailInfo(ts))
                {
                    find_case = true;
                    break;
                }
            }
            #endregion

            #region 注释旧逻辑
            //foreach (HTMLTableRow tr in spage.tblSearchResult.getElementsByTagName("TR"))
            //{
            //    if (rowIndex == 0)
            //    {
            //        rowIndex++;
            //        continue;
            //    }
            //    HTMLTableCell ERIDCell = tr.getElementsByTagName("TD").item(3) as HTMLTableCell;
            //    HTMLTableCell WorkQueue = tr.getElementsByTagName("TD").item(16) as HTMLTableCell;
            //    HTMLTableCell FormType = tr.getElementsByTagName("TD").item(2) as HTMLTableCell;
            //    //string a = ERIDCell.innerText;
            //    //string b = WorkQueue.innerText;
            //    if (ERIDCell.innerText.Trim() != ts.OriSchAcctMemNo.Split('-')[0]/*||WorkQueue.innerText.Trim()!= "SA-03 Processing by SA"*/)
            //    {
            //        continue;
            //    }
            //    else
            //    {
            //        HTMLTableCell td = tr.getElementsByTagName("TD").item(1) as HTMLTableCell;
            //        var t = td.getElementsByTagName("INPUT").item(0) as HTMLInputElement;
            //        t.click();
            //        if (CheckGwisDetailInfo(ts))
            //        {
            //            find_case = true;
            //            break;
            //        }
            //    }
            //    #region 注释旧逻辑
            //    //foreach (HTMLTableCell td in tr.getElementsByTagName("TD"))
            //    //{
            //    //    //var t = td as HTMLInputElement;
            //    //    index++;
            //    //    if (index == 0)
            //    //    {
            //    //        td.click();
            //    //        string innerHtml = td.innerHTML;
            //    //        var t = td.getElementsByTagName("INPUT").item(0) as HTMLInputElement;
            //    //        //var t = td as HTMLInputElement;
            //    //        t.select();
            //    //        t.click();
            //    //    }
            //    //    else if (index == 1)

            //    //    {
            //    //        var t = td.getElementsByTagName("INPUT").item(0) as HTMLInputElement;
            //    //        t.click();
            //    //    }
            //    //    // SA-03 Processing by SA

            //    //    else if (index == 2)
            //    //    {
            //    //        //var t = td as HTMLInputElement;
            //    //        Thread.Sleep(3000);
            //    //        WaitForWebPage(mpfTerminationPage);

            //    //        var optQueueList = mpfTerminationPage.sltWFCKTOCompMatch.getElementsByTagName("option");

            //    //        foreach (var obj in optQueueList)
            //    //        {
            //    //            HTMLOptionElement option = obj as HTMLOptionElement;

            //    //            if (ts.OriSchAcctMemNo.IndexOf('-') != -1)
            //    //            {
            //    //                if (option.innerText == "Matched" &&
            //    //                                                option.selected == true &&
            //    //                                                mpfTerminationPage.txtERIDInfo.value == ts.OriSchAcctMemNo.Split('-')[0] &&
            //    //                                                mpfTerminationPage.txtCaseNumber.value == ts.TransferCaseNo)
            //    //                {
            //    //                    Member = option.innerText;
            //    //                    find_case = true;
            //    //                }
            //    //                else if (option.selected)
            //    //                {
            //    //                    Member = option.innerText;
            //    //                }
            //    //            }
            //    //            else
            //    //            {
            //    //                Member = "invalid" + ts.OriSchAcctMemNo;
            //    //            }

            //    //        }

            //    //        if (!find_case)
            //    //        {
            //    //            actionpage.btnCancel.click();
            //    //            break;
            //    //        }

            //    //        //foreach (var ahref in t.getElementsByTagName("a"))
            //    //        //{

            //    //        //    foreach (var input in td.GetElementsByTagName("input"))
            //    //        //    {

            //    //        //        var ckbox = input as HTMLInputElement;
            //    //        //        ckbox.click();
            //    //        //    }

            //    //        //    var b = a as HTMLAnchorElement;

            //    //        //    var weburl = b.nodeValue();


            //    //        //    XmlAttribute att = b.attributes["href"];

            //    //        //    var url = att.Value;

            //    //        //    var content = GetPageSource(att.Value);

            //    //        //    if (content.IndexOf("") == -1)
            //    //        //    {
            //    //        //        continue;
            //    //        //    }
            //    //        //    else
            //    //        //    {
            //    //        //        b.click();
            //    //        //    }

            //    //        //    Thread.Sleep(3000);
            //    //        //    WaitForWebPage(mpfTerminationPage);

            //    //        //    var optQueueList = mpfTerminationPage.sltWFCKTOCompMatch.getElementsByTagName("option");

            //    //        //    foreach (var obj in optQueueList)
            //    //        //    {
            //    //        //        HTMLOptionElement option = obj as HTMLOptionElement;
            //    //        //        if (option.innerText == "Matched" &&
            //    //        //            option.selected == true &&
            //    //        //            mpfTerminationPage.txtERIDInfo.value == ts.OriSchAcctMemNo.Split('-')[0] &&
            //    //        //            mpfTerminationPage.txtCaseNumber.value == ts.TransferCaseNo)
            //    //        //        {
            //    //        //            find_case = true;
            //    //        //        }
            //    //        //    }
            //    //        //}
            //    //    }

            //    //}
            //    #endregion
            //
            //}
            #endregion
            return(find_case);
        }
コード例 #6
0
        private static void HMA_ParseProxies(string table)
        {
            try
            {
                IHTMLDocument2 doc = (IHTMLDocument2)new HTMLDocument();
                doc.write(string.Format("<table>{0}</table>", table.Replace("\r\n", string.Empty)));
                IHTMLElementCollection rows = ((IHTMLDocument3)doc).getElementsByTagName("tr");
                for (int i = 0; i < rows.length; i++)
                {
                    try
                    {
                        HTMLTableRow row = rows.item(i);
                        var type = (protocol)Enum.Parse(typeof(protocol), rows.item(i).cells.item(6).innerText.Replace("/", string.Empty).ToUpperInvariant());
                        var security = (anonymity_level)Enum.Parse(typeof(anonymity_level), rows.item(i).cells.item(7).innerText.Replace(" +", string.Empty).ToUpperInvariant());
                        if (type == protocol.SOCKS45 || security < anonymity_level.HIGH) continue;

                        var ipChilds = ((IHTMLDOMNode)row.cells.item(1)).firstChild.childNodes;
                        string ipaddress = "";
                        for (int j = 0; j < ipChilds.length; j++)
                        {
                            var element = ipChilds.item(j) as IHTMLDOMNode;
                            string tagname = element.nodeName;
                            if (tagname == "#text") ipaddress += element.nodeValue;
                            else
                            {
                                var element2 = (IHTMLElement2)element;
                                string display = element2.currentStyle.display;
                                if (display != "none") ipaddress += ((IHTMLElement)element).innerText;
                            }
                        }
                        var port = ushort.Parse(((IHTMLElement)row.cells.item(2)).innerText);
                        var key = string.Format("{0}:{1}", ipaddress, port);
                        TeknarProxy newProxy = new TeknarProxy
                        {
                            ip = ipaddress,
                            port = ushort.Parse(((IHTMLElement)row.cells.item(2)).innerText),
                            country = ((IHTMLElement)row.cells.item(3)).innerText,
                            type = type,
                            security = security
                        };
                        TeknarProxy proxy;
                        if (proxyList.TryGetValue(key, out proxy))
                        {
                            proxy._pheromone = TeknarProxy.InitialPheromoneValue;
                            proxy.security = newProxy.security;
                            proxy.type = newProxy.type;
                            proxy.country = newProxy.country;
                        }
                        else
                        {
                            proxyList[key] = newProxy;
                        }
                        doOnProxyListChange(proxyList[key]);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception)
            {
            }
        }