예제 #1
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);
            }
        }
예제 #2
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);
        }