Exemplo n.º 1
0
        private void ProcessFormHK62015(mshtml.HTMLDocument htmlDoc)
        {
            //azham 2015
            boolFilled = false;
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("textarea"))
            {
                switch (inpElement1.name)
                {
                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_nama_pembayar":
                    inpElement1.value = strData[4].ToString().ToUpper();
                    break;
                }
            }
            foreach (mshtml.HTMLSelectElement selElement in htmlDoc.getElementsByTagName("select"))
            {
                switch (selElement.name)
                {
                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$ddlEmpty_jenis_pendapatan":
                    selElement.value = strData[3];
                    break;
                }
            }
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("input"))
            {
                switch (inpElement1.name)
                {
                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_pendapatan_kasar":
                    inpElement1.value = strData[8];
                    boolFilled        = true;
                    break;

                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_cukai_dipotong":
                    inpElement1.value = strData[9];
                    break;

                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_tkh_bayaran":
                    inpElement1.value = strData[7];
                    break;

                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_no_resit":
                    inpElement1.value = strData[6];
                    break;

                //case "GridView1$ctl01$txtEmpty_div_bersih":
                //    inpElement1.value = strData[7];
                //    break;
                //case "GridView1$ctl01$txtEmpty_div_bersih2":
                //    inpElement1.value = strData[8];
                //    break;
                //case "txtfaedah":
                //    inpElement1.value = strData[8];
                //    inpElement1.blur();
                //    break;
                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$btnEmpty_Add":
                    //  inpElement1.click();
                    break;
                }
            }
        }
Exemplo n.º 2
0
    //Get element and do soming
    public mshtml.IHTMLElement GetElementByDo(ref SHDocVw.InternetExplorerMedium webApp, string fraName, string tagName, string keyName, string keyTxt)
    {
        if (ReferenceEquals(webApp, null))
        {
            return(null);
        }
        SleepAndWaitComplete(webApp);
        mshtml.HTMLDocument           Doc  = (mshtml.HTMLDocument)webApp.Document;
        mshtml.IHTMLElementCollection eles = default(mshtml.IHTMLElementCollection);
        if (fraName == "")
        {
            eles = Doc.getElementsByTagName(tagName);
        }
        else
        {
            mshtml.HTMLWindow2 fra = GetFrameWait(ref webApp, fraName);
            Doc  = (mshtml.HTMLDocument)fra.document;
            eles = Doc.getElementsByTagName(tagName);
        }

        SleepAndWaitComplete(webApp);
        foreach (mshtml.IHTMLElement ele in eles)
        {
            try
            {
                if (keyName == "innertext")
                {
                    if (ele.innerText == keyTxt)
                    {
                        return(ele);
                    }
                }
                else
                {
                    String myKey;
                    myKey = Convert.ToString(ele.getAttribute(keyName));
                    if (myKey.ToString() == keyTxt)
                    {
                        return(ele);
                    }
                }
            }
            catch (Exception)
            {
            }
        }
        return(null);
    }
Exemplo n.º 3
0
 // GetElement
 public mshtml.IHTMLElement GetElement(mshtml.HTMLWindow2 fra, string tagName, string keyName, string keyTxt)
 {
     mshtml.IHTMLElementCollection eles = default(mshtml.IHTMLElementCollection);
     mshtml.HTMLDocument           Doc  = default(mshtml.HTMLDocument);
     Doc  = (mshtml.HTMLDocument)fra.document;
     eles = Doc.getElementsByTagName(tagName);
     foreach (mshtml.IHTMLElement ele in eles)
     {
         try
         {
             if (keyName == "innertext")
             {
                 if (ele.innerText == keyTxt)
                 {
                     return(ele);
                 }
             }
             else
             {
                 if (ele.getAttribute(keyName).ToString() == keyTxt)
                 {
                     return(ele);
                 }
             }
         }
         catch (Exception)
         {
         }
     }
     return(null);
 }
Exemplo n.º 4
0
        static public bool findPoster(mshtml.HTMLDocument doc, MovieDB db)
        {
            if (db == null || doc == null)
            {
                return(false);
            }

            mshtml.IHTMLElementCollection item = doc.getElementsByTagName("img");
            string posterUrl = "";

            int cnt = 0;

            foreach (mshtml.IHTMLElement elem in item)
            {
                if (elem.getAttribute("alt") == db.title && cnt == 0)
                {
                    posterUrl = elem.getAttribute("src");
                    break;
                }
            }

            if (posterUrl.Length <= 0)
            {
                return(false);
            }

            db.posterUrl = posterUrl.Split('?')[0];

            return(true);
        }
Exemplo n.º 5
0
        public static bool PRAP_NewClaimSearch(SHDocVw.InternetExplorer wb, SHDocVw.ShellWindows shells, string Dcn)
        {
            if (wb != null)
            {
                mshtml.HTMLDocument iePrapDoc = wb.Document;

                mshtml.HTMLInputElement prapDCNinput = null;

                iePrapDoc.getElementById("advancedSearch").click();

                while (IELib.IEGet(shells, "Advanced Search") == null)
                {
                }

                wb = IELib.IEGet(shells, "Advanced Search");
                IELib.IeWait(wb);
                iePrapDoc = wb.Document;

                int timeOutCounter = 0;
                while (prapDCNinput == null)
                {
                    prapDCNinput = iePrapDoc.getElementsByName("documentControlNumber").item(0);
                    timeOutCounter++;
                    if (timeOutCounter == 50)
                    {
                        PRAP_Functions.PRAP_CloseWindows(shells); return(false);
                    }
                }

                try { prapDCNinput.value = "0201" + Dcn; } catch (Exception) { PRAP_Functions.PRAP_CloseWindows(shells); return(false); }

                try { iePrapDoc.getElementById("searchButn").click(); } catch (Exception) { PRAP_Functions.PRAP_CloseWindows(shells); return(false); }

                while (IELib.IEGet(shells, "Search Results") == null)
                {
                }

                wb        = IELib.IEGet(shells, "Search Results");
                iePrapDoc = wb.Document;
                foreach (mshtml.IHTMLElement a in iePrapDoc.getElementsByTagName("a"))
                {
                    if (a.innerText == "0201" + Dcn)
                    {
                        a.click();
                    }
                }

                while (IELib.IEGet(shells, "Claim Inquiry Details") == null)
                {
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 6
0
 public static void PRAP_Login(SHDocVw.InternetExplorer wb, string p) //Start back here
 {
     mshtml.HTMLDocument      wbDoc = wb.Document;
     mshtml.HTMLButtonElement wbButton;
     wbDoc.getElementById("user-name").innerText = System.Environment.UserName;
     wbDoc.getElementById("password").innerText  = p;
     wbButton = wbDoc.getElementsByTagName("button").item(0);
     try { wbButton.click(); } catch (Exception) { }
     IELib.IeWait(wb);
 }
Exemplo n.º 7
0
        public static string PRAP_GetProviderInfo(SHDocVw.InternetExplorer wb, SHDocVw.ShellWindows shells, string Type, string DCN)
        {
            /*
             * This is to return the single string listed (null or valid) in PRAP's claim inquiry details screen
             * Parameters are as follows:
             * WB: current valid shdocvw.internet explorer object
             * Shells: current shdocvw Shellwindows
             * Type: must be the exact field you're looking for in the provider tab. e.g. "Rendering Provider NPI:"
             * DCN: must be the full DCN number. e.g. 02018888888888x
             */
            mshtml.HTMLDocument wbDoc = wb.Document;
            int p = 0;

            wbDoc = wb.Document;
            foreach (mshtml.IHTMLElement a in wbDoc.getElementsByTagName("a"))
            {
                if (a.innerText == "Provider")
                {
                    a.click();
                }
            }
            //IELib.IeWait(wb);

            if (Type != null)
            {
                foreach (mshtml.IHTMLElement a in wbDoc.getElementsByTagName("td"))
                {
                    if (p == 1)
                    {
                        Console.WriteLine("returnd: " + a.innerText);
                        return(a.innerText);
                    }
                    if (a.innerText == Type)
                    {
                        p = 1;
                    }
                }
            }
            return(null);
        }
Exemplo n.º 8
0
        private void try_to_gather_messages()
        {
            status_Label.Content = "Gathering messages...";

            #region to close model
            if (Close_models())
            {
                now_gather_messages();
            }
            #endregion

            void now_gather_messages()
            {
                mshtml.HTMLDocument doc = (mshtml.HTMLDocument)Main_Web.Document;
                var Raw_Person_List     = doc.getElementsByTagName("li");
                var Person_list         = Raw_Person_List.OfType <mshtml.HTMLLIElement>().ToList();

                if (Person_list != null && Person_list.Count() > 0)
                {
                    Person_list.ForEach(person =>
                    {
                        string classname = person.getAttribute("className");

                        if (classname != null)
                        {
                            if (classname.Contains(className1) && classname.Contains(className2))
                            {
                                string identifier = person.getAttribute("data-id");
                                messageLinks.Add(Twoo_message_select_by_id_url + identifier);
                            }
                            else if (classname.Contains(className1) && classname.Contains(className2) && classname.Contains(className3))
                            {
                                string identifier = person.getAttribute("data-id");
                                messageLinks.Add(Twoo_message_select_by_id_url + identifier);
                            }
                        }
                    });

                    if (messageLinks.Count() > 0)
                    {
                        status_Label.Content = "I have found " + messageLinks.Count() + " messages unread";
                        Start_timer(Stages.navigate_to_unread_messages, Waits.wait_navigate_to_unread_messages);
                    }
                    else
                    {
                        status_Label.Content = "No person found";
                        Start_timer(Stages.stop_program, Waits.wait_to_stop);
                    }
                }
            }
        }
Exemplo n.º 9
0
        private void Try_to_inject_message()
        {
            mshtml.HTMLDocument doc = (mshtml.HTMLDocument)Main_Web.Document;

            #region to accept chatting
            if (Accept_chatting())
            {
                if (!Is_duplicate(doc))
                {
                    now_inject_message();
                }
                else
                {
                    status_Label.Content = "This user already have the message.";
                    Start_timer(Stages.navigate_to_unread_messages, Waits.wait_navigate_to_unread_messages);
                }
            }
            #endregion

            void now_inject_message()
            {
                var Raw_Message_Box  = doc.getElementsByTagName("textarea");
                var Message_Box_list = Raw_Message_Box.OfType <mshtml.HTMLTextAreaElement>().ToList();

                if (Message_Box_list != null && Message_Box_list.Count() > 0)
                {
                    Message_Box_list.ForEach(box =>
                    {
                        string classname = box.getAttribute("className");

                        if (classname != null)
                        {
                            if (classname.Contains(Twoo_message_box))
                            {
                                box.click();
                                box.focus();
                                box.innerText = Engine.getMessage();
                            }
                        }
                    });
                }
                else
                {
                    status_Label.Content = "No input box found";
                }
            }

            status_Label.Content = "Message injected succesfully.";
            Start_timer(Stages.send_message, Waits.wait_to_send_message);
        }
Exemplo n.º 10
0
        private void frmBrowser_Navigated(object sender, NavigationEventArgs e)
        {
            SetStatusRight("RSS completely loaded.");
            WebBrowser Browser = sender as WebBrowser;

            mshtml.HTMLDocument       HTMLDoc    = Browser.Document as mshtml.HTMLDocument;
            mshtml.IHTMLScriptElement HTMLScript = (mshtml.IHTMLScriptElement)HTMLDoc.createElement("SCRIPT");
            HTMLScript.type = "text/javascript";
            HTMLScript.text = @"function noError() { return true; } window.onerror = noError;";
            mshtml.IHTMLElementCollection Nodes = HTMLDoc.getElementsByTagName("HEAD");
            foreach (mshtml.HTMLHeadElement HTMLElementItem in Nodes)
            {
                HTMLElementItem.appendChild((mshtml.IHTMLDOMNode)HTMLScript);
            }
        }
Exemplo n.º 11
0
        public static string PRAP_GetOtherInsurancePaymentName(SHDocVw.InternetExplorer wb, SHDocVw.ShellWindows shells)
        {
            mshtml.HTMLDocument wbDoc = wb.Document;

            foreach (mshtml.IHTMLElement a in wbDoc.getElementsByTagName("a"))
            {
                if (a.innerText == "Third Party Liability")
                {
                    a.click();
                }
            }

            /*
             * find the table by document index of tables. if that table only has 1 row, the table is empty. otherwise, those rows should
             * be investigated for TPL payments
             *
             * Table[1] > TR[1]
             * foreach table in TR[1]
             *  table[0] > TR ID="claimBody" > td id="claimTab4" > table[0] > tr[3] > table[0] > *tr[1]*
             */
            // todo: test elements and values found
            mshtml.HTMLTableCell claimTabCell       = wb.Document.getElementById("claimTab4");
            mshtml.HTMLTable     otherInsTable      = claimTabCell.getElementsByTagName("table").item(0);
            mshtml.HTMLTableRow  otherInsTableRow   = otherInsTable.rows.item(3); //.getElementsByTagName("tr").item(4);
            mshtml.HTMLTableCell otherInshtableCell = otherInsTableRow.getElementsByTagName("td").item(0);
            mshtml.HTMLTable     oiSubTable         = otherInshtableCell.getElementsByTagName("table").item(0);

            foreach (mshtml.HTMLTableRow Row in oiSubTable.rows)
            {
                //Console.WriteLine("row counts of subTable: " + oiSubTable.rows.length);
                try
                {
                    mshtml.HTMLTable table = Row.getElementsByTagName("table").item(0);
                    otherInsTableRow = table.getElementsByTagName("tr").item(1);
                    table            = otherInsTableRow.getElementsByTagName("table").item(0);
                    otherInsTableRow = table.getElementsByTagName("tr").item(0);
                    mshtml.IHTMLElement oiName = otherInsTableRow.getElementsByTagName("a").item(0);
                    string carrier             = oiName.innerText;
                    //Console.WriteLine("carrier: " + carrier);
                    if (carrier != "")
                    {
                        return(carrier); //Console.WriteLine("OI found, provider: " + carrier);
                    }
                } catch (Exception) { Console.WriteLine("OI Exception"); return(null); }
            }
            return(null);
        }
        private void btnGetImg_Click(object sender, EventArgs e)
        {
            lstImg.Items.Clear();

            mshtml.HTMLDocument doc = explorer.Document as mshtml.HTMLDocument;

            var imgs = doc.getElementsByTagName("img");

            foreach (var img in imgs)
            {
                mshtml.IHTMLImgElement imgElement = img as mshtml.IHTMLImgElement;
                if (imgElement != null && !lstImg.Items.Contains(imgElement.src))
                {
                    lstImg.Items.Add(imgElement.src);
                }
            }
        }
Exemplo n.º 13
0
        public ReplicaPage(string html)
        {
            Raw      = html;
            Supplier = new Dictionary <string, string>();
            var parser = new FMWW.Http.HTMLParser(html);

            mshtml.HTMLDocument           document = parser.Document;
            mshtml.IHTMLElementCollection inputs   = document.getElementsByTagName("input");
            foreach (mshtml.IHTMLElement elm in inputs)
            {
                string title = elm.getAttribute("title") ?? "";
                var    id    = elm.id ?? "";
                if ((title.Length == 0) || (id.Length == 0))
                {
                    continue;
                }
                string value = elm.getAttribute("value");
                Supplier.Add(title, value);
                Trace.WriteLine(String.Format("{0} {1} {2}", elm.id, title, value));

                try
                {
                    var input  = elm as mshtml.IHTMLInputElement;
                    var suffix = ":select";
                    var t      = title + suffix;
                    var v      = "";
                    mshtml.IHTMLElementCollection spans = document.getElementById(elm.id + suffix).children;
                    foreach (mshtml.IHTMLElement span in spans)
                    {
                        if (span.getAttribute("value") == input.value)
                        {
                            v = span.getAttribute("text");
                            continue;
                        }
                    }
                    Supplier.Add(t, v);
                    Trace.WriteLine(String.Format("{0} {1} {2}", elm.id + suffix, t, v));
                }
                catch (Exception e)
                {
                    Trace.WriteLine(e.Message);
                }
            }
            mshtml.IHTMLElement remark = document.getElementById("remark");
            Supplier.Add("備考", remark.innerText);
        }
Exemplo n.º 14
0
        private void try_to_inject_credentials()
        {
            #region to close model
            if (Close_models())
            {
                now_inject_credentials();
            }
            #endregion

            void now_inject_credentials()
            {
                mshtml.HTMLDocument doc = (mshtml.HTMLDocument)Main_Web.Document;
                var Raw_Input_List      = doc.getElementsByTagName("input");
                var Input_list          = Raw_Input_List.OfType <mshtml.HTMLInputElement>().ToList();

                Input_list.ForEach(inputs => {
                    string id   = inputs.id;
                    string name = inputs.getAttribute("name");

                    Console.WriteLine(Engine.getUsername());

                    if (id != null)
                    {
                        if (id.Contains("fy-ident"))
                        {
                            inputs.click();
                            inputs.focus();
                            inputs.innerText = Engine.getUsername();
                        }
                        else if (id.Contains("fy-pwd"))
                        {
                            inputs.click();
                            inputs.focus();
                            inputs.innerText = Engine.getPassword();
                        }
                    }
                    else if (name != null)
                    {
                        if (name.Contains("buttonLogon"))
                        {
                            inputs.click();
                        }
                    }
                });
            }
        }
        public string RefreshForm(SHDocVw.InternetExplorer ieTemp)
        {
            string href = "";

            if (ieTemp.ReadyState.Equals(SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE))
            {
                if (typeof(mshtml.HTMLDocumentClass).IsAssignableFrom(ieTemp.Document.GetType()))
                {
                    htmlDoc = ieTemp.Document as mshtml.HTMLDocument;
                }
            }

            if (htmlDoc != null)
            {
                foreach (mshtml.HTMLFormElement frmElement in htmlDoc.getElementsByTagName("form"))
                {
                    if (frmElement.action.Length > 0)
                    {
                        href = htmlDoc.url.Substring(0, (htmlDoc.url.LastIndexOf("\\") + 1)) + frmElement.action;//+ ".aspx"
                        //if (frmElement.action.ToLower() == System.Drawing.Color.LightYellow.Name.ToLower())
                        //{
                        //    if (arcElement.href != null)
                        //    {
                        //        href = arcElement.href;
                        //    }
                        //}
                    }
                }
                //foreach (mshtml.HTMLAnchorElement arcElement in htmlDoc.getElementsByTagName("a"))
                //{
                //    if (arcElement.style.backgroundColor != null)
                //    {
                //        if (arcElement.style.backgroundColor.ToString().ToLower() == System.Drawing.Color.LightYellow.Name.ToLower())
                //        {
                //            //arcElement.click();
                //            if (arcElement.href != null)
                //            {
                //                href = arcElement.href;
                //            }
                //        }
                //    }
                //}
            }
            return(href);
        }
Exemplo n.º 16
0
        static public void GetRecommendMovies(mshtml.HTMLDocument doc, MovieDB db)
        {
            mshtml.IHTMLElementCollection item = doc.getElementsByTagName("ul");

            foreach (mshtml.IHTMLElement elem in item)
            {
                if (elem.getAttribute("className") == "thumb_link_mv")
                {
                    string text = elem.innerText;
                    text = text.Replace("\r\n", ",");
                    text = text.Replace(",,, ,", string.Empty);
                    text = text.Substring(4);

                    string[] movies = text.Split(',');
                    db.recommendMovies.AddRange(movies);

                    break;
                }
            }
        }
Exemplo n.º 17
0
        public static string PRAP_GetOnsetDate(SHDocVw.InternetExplorer wb, SHDocVw.ShellWindows shells)
        {
            mshtml.HTMLDocument wbDoc = wb.Document;
            int p = 0;

            foreach (mshtml.IHTMLElement td in wbDoc.getElementsByTagName("td"))
            {
                if (p == 1)
                {
                    //Console.WriteLine("PRAP Auth: " + td.innerText);
                    return(td.innerText);
                }
                if (td != null)
                {
                    if (td.innerText == "Onset Date:")
                    {
                        p = 1;
                    }
                }
            }
            return(null);
        }
Exemplo n.º 18
0
 // コピペ
 private mshtml.HTMLDivElement getDivElementsByClassName(mshtml.HTMLDocument document, string className)
 {
     try
     {
         if (document == null)
         {
             return(null);
         }
         var divs = document.getElementsByTagName("div");
         foreach (mshtml.HTMLDivElement item in divs)
         {
             if (item.className == className)
             {
                 return(item);
             }
         }
         return(null);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 19
0
 public static void PRAP_ResetSearch(SHDocVw.InternetExplorer wb, SHDocVw.ShellWindows shells)
 {
     wb.Quit();
     foreach (SHDocVw.InternetExplorer ie in shells)
     {
         if (ie.LocationName == "Search Results")
         {
             wb = IELib.IEGet(shells, "Search Results");
             if (wb != null)
             {
                 mshtml.HTMLDocument wbDoc = wb.Document;
                 foreach (mshtml.IHTMLElement elem in wbDoc.getElementsByTagName("a"))
                 {
                     if (elem.innerText == "Return to Search")
                     {
                         elem.click();
                         IELib.IeWait(ie);
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 20
0
        private void Try_to_send_message()
        {
            mshtml.HTMLDocument doc = (mshtml.HTMLDocument)Main_Web.Document;
            var Raw_Button_list     = doc.getElementsByTagName("button");
            var Button_List         = Raw_Button_list.OfType <mshtml.HTMLButtonElement>().ToList();

            if (Button_List != null && Button_List.Count() > 0)
            {
                Button_List.ForEach(btn =>
                {
                    string ident = btn.id;

                    if (ident != null)
                    {
                        if (ident.Equals(Finya_send_button))
                        {
                            btn.click();
                        }
                    }
                });
                Start_timer(Stages.navigate_to_unread_messages, Waits.wait_navigate_to_unread_messages);
            }
        }
Exemplo n.º 21
0
        private void Try_to_send_message()
        {
            mshtml.HTMLDocument doc = (mshtml.HTMLDocument)Main_Web.Document;
            var Raw_Anchor_Button   = doc.getElementsByTagName("a");
            var Anchor_Button_List  = Raw_Anchor_Button.OfType <mshtml.HTMLAnchorElement>().ToList();

            if (Anchor_Button_List != null && Anchor_Button_List.Count() > 0)
            {
                Anchor_Button_List.ForEach(anchor =>
                {
                    string classname = anchor.getAttribute("className");

                    if (classname != null)
                    {
                        if (classname.Contains(Twoo_send_button))
                        {
                            anchor.click();
                        }
                    }
                });
                Start_timer(Stages.navigate_to_unread_messages, Waits.wait_navigate_to_unread_messages);
            }
        }
Exemplo n.º 22
0
        public static List <mshtml.IHTMLElement> getElementsByClassName(
            this mshtml.HTMLDocument document,
            string className
            )
        {
            var elements = document.getElementsByTagName("*");
            var results  = new List <mshtml.IHTMLElement>();

            foreach (mshtml.IHTMLElement element in elements)
            {
                if (element.className != null)
                {
                    var classNames = element.className.Split(' ');

                    if (Array.IndexOf(classNames, className) > -1)
                    {
                        results.Add(element);
                    }
                }
            }

            return(results);
        }
Exemplo n.º 23
0
        static public void GetRatings(mshtml.HTMLDocument doc, MovieDB db)
        {
            mshtml.IHTMLElementCollection item = doc.getElementsByTagName("div");

            int lineIndex = 0;

            foreach (mshtml.IHTMLElement elem in item)
            {
                var score = elem.getAttribute("className");
                if (score == "star_score" || score == "star_score ")
                {
                    string text = elem.innerText;
                    text = text.Replace("\r\n", "");

                    if (lineIndex == 0)
                    {
                        text         = text.Replace("관람객 평점 ", "");
                        text         = text.Replace("점", ",");
                        db.audRating = text.Split(',')[0];
                    }
                    else if (lineIndex == 1)
                    {
                        db.expRating = text;
                    }
                    else if (lineIndex == 2)
                    {
                        db.netRating = text;
                    }

                    lineIndex++;
                    if (lineIndex >= 3)
                    {
                        break;
                    }
                }
            }
        }
Exemplo n.º 24
0
        private void ProcessDocument(mshtml.HTMLDocument htmlDoc)
        {
            Boolean  boolFilled = false;
            int      intIndex;
            DateTime dtTemp1 = DateTime.Parse(dgEFHK6.SelectedRows[0].Cells[7].Value.ToString());

            //DateTime dtTemp2 = DateTime.Parse(dgEFHK6.SelectedRows[0].Cells[1].Value.ToString());
            string[] strData = new string[9];
            strData[0] = dgEFHK6.SelectedRows[0].Cells[0].Value.ToString();
            strData[1] = dgEFHK6.SelectedRows[0].Cells[1].Value.ToString();
            strData[2] = dgEFHK6.SelectedRows[0].Cells[2].Value.ToString();
            strData[3] = dgEFHK6.SelectedRows[0].Cells[3].Value.ToString();
            strData[4] = dgEFHK6.SelectedRows[0].Cells[4].Value.ToString();
            strData[5] = dgEFHK6.SelectedRows[0].Cells[5].Value.ToString();
            strData[6] = dgEFHK6.SelectedRows[0].Cells[6].Value.ToString();
            strData[7] = dtTemp1.ToString("ddMMyyyy");
            strData[8] = dgEFHK6.SelectedRows[0].Cells[8].Value.ToString();
            strData[9] = dgEFHK6.SelectedRows[0].Cells[9].Value.ToString();

            //   strData[8] = dgEFHK6.SelectedRows[0].Cells[8].Value.ToString();
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("textarea"))
            {
                switch (inpElement1.name)
                {
                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_nama_pembayar":
                    inpElement1.value = strData[4].ToString().ToUpper();
                    break;
                }
            }
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("input"))
            {
                if (inpElement1.name == "txtfaedah")
                {
                    inpElement1.value = strData[8];
                    inpElement1.blur();
                    break;
                }
            }
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("input"))
            {
                switch (inpElement1.name)
                {
                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_pendapatan_kasar":
                    inpElement1.value = strData[8];
                    boolFilled        = true;
                    break;

                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_cukai_dipotong":
                    inpElement1.value = strData[1];
                    break;

                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_tkh_bayaran":
                    inpElement1.value = strData[7];
                    break;

                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$txtEmpty_no_resit":
                    inpElement1.value = strData[6];
                    break;

                //case "GridView1$ctl01$txtEmpty_div_bersih":
                //    inpElement1.value = strData[7];
                //    break;
                //case "GridView1$ctl01$txtEmpty_div_bersih2":
                //    inpElement1.value = strData[8];
                //    break;
                //case "txtfaedah":
                //    inpElement1.value = strData[8];
                //    inpElement1.blur();
                //    break;
                case "ctl00$ContentPlaceHolder1$GridView1$ctl01$btnEmpty_Add":
                    inpElement1.click();
                    break;
                }
            }
            for (intIndex = 3;  ; intIndex++)
            {
                if (boolFilled == true)
                {
                    break;
                }
                else
                {
                    string strWaranNo     = "GridView1$ctl" + intIndex.ToString("0#") + "$txtno_waran_siri_Add";
                    string strCompanyName = "GridView1$ctl" + intIndex.ToString("0#") + "$txtnama_syarikat_Add";
                    string strPaymentDate = "GridView1$ctl" + intIndex.ToString("0#") + "$txtTkh_bayaran_Add";
                    string strYearEnd     = "GridView1$ctl" + intIndex.ToString("0#") + "$txtbg_thn_berakhir_Add";
                    string strGrossDiv    = "GridView1$ctl" + intIndex.ToString("0#") + "$txtdiv_kasar_Add";
                    string strTaxRate     = "GridView1$ctl" + intIndex.ToString("0#") + "$txtkadar_cukai_Add";
                    string strTaxDeduct   = "GridView1$ctl" + intIndex.ToString("0#") + "$txtcukai_dipotong_Add";
                    //string strFaedah = "txtfaedah";
                    //string strNetDiv = "GridView1$ctl" + intIndex.ToString("0#") + "$txtdiv_bersih_Add";

                    foreach (mshtml.HTMLInputElement inpElement2 in htmlDoc.getElementsByTagName("input"))
                    {
                        if (inpElement2.name.ToString() == strWaranNo)
                        {
                            inpElement2.value = strData[2];
                            boolFilled        = true;
                        }
                        else if (inpElement2.name.ToString() == strCompanyName)
                        {
                            inpElement2.value = strData[3].ToString().ToUpper();
                        }
                        else if (inpElement2.name.ToString() == strPaymentDate)
                        {
                            inpElement2.value = strData[0];
                        }
                        else if (inpElement2.name.ToString() == strYearEnd)
                        {
                            inpElement2.value = strData[1];
                        }
                        else if (inpElement2.name.ToString() == strGrossDiv)
                        {
                            inpElement2.value = strData[4];
                        }
                        else if (inpElement2.name.ToString() == strTaxRate)
                        {
                            inpElement2.value = strData[5];
                        }
                        else if (inpElement2.name.ToString() == strTaxDeduct)
                        {
                            inpElement2.value = strData[6];
                        }
                        //else if (inpElement2.name.ToString() == strFaedah)
                        //{
                        //    inpElement2.value = strData[8];
                        //}
                        //else if (inpElement2.name.ToString() == strNetDiv)
                        //{
                        //    inpElement2.value = strData[7];
                        //}
                    }
                }
            }

            if (boolFilled == true)
            {
                intIndex = intIndex - 1;
                string strLnkAdd = "GridView1_ctl" + intIndex.ToString("0#") + "_btnTambahFooter";
                foreach (mshtml.HTMLAnchorElement ancElement in htmlDoc.getElementsByTagName("a"))
                {
                    if (ancElement.id != null)
                    {
                        if (ancElement.id.ToString() == strLnkAdd)
                        {
                            ancElement.click();
                        }
                    }
                }
            }
        }
Exemplo n.º 25
0
        private void ProcessFormHK62014(mshtml.HTMLDocument htmlDoc)
        {
            //LEESH FEB 2012
            boolFilled = false;
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("textarea"))
            {
                switch (inpElement1.name)
                {
                case "GridView1$ctl01$txtEmpty_nama_syarikat":
                    inpElement1.value = strData[3].ToString().ToUpper();
                    break;
                }
            }
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("input"))
            {
                if (inpElement1.name == "txtfaedah")
                {
                    inpElement1.value = strData[8];
                    inpElement1.blur();
                    break;
                }
            }
            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("input"))
            {
                switch (inpElement1.name)
                {
                case "GridView1$ctl01$txtEmpty_tkh_bayaran":
                    inpElement1.value = strData[0];
                    boolFilled        = true;
                    break;

                case "GridView1$ctl01$txtEmpty_bg_thn_berakhir":
                    inpElement1.value = strData[1];
                    break;

                case "GridView1$ctl01$txtEmpty_no_waran_siri":
                    inpElement1.value = strData[2];
                    break;

                case "GridView1$ctl01$txtEmpty_div_kasar":
                    inpElement1.value = strData[4];
                    break;

                case "GridView1$ctl01$txtEmpty_kadar_cukai":
                    inpElement1.value = strData[5];
                    break;

                case "GridView1$ctl01$txtEmpty_cukai_dipotong":
                    inpElement1.value = strData[6];
                    break;

                //case "GridView1$ctl01$txtEmpty_div_bersih":
                //    inpElement1.value = strData[7];
                //    break;
                //case "GridView1$ctl01$txtEmpty_div_bersih2":
                //    inpElement1.value = strData[8];
                //    break;
                //case "txtfaedah":
                //    inpElement1.value = strData[8];
                //    inpElement1.blur();
                //    break;
                case "GridView1$ctl01$btnEmpty_Add":
                    inpElement1.click();
                    break;
                }
            }
            for (intIndex = 3; ; intIndex++)
            {
                if (boolFilled == true)
                {
                    break;
                }
                else
                {
                    string strWaranNo     = "GridView1$ctl" + intIndex.ToString("0#") + "$txtno_waran_siri_Add";
                    string strCompanyName = "GridView1$ctl" + intIndex.ToString("0#") + "$txtnama_syarikat_Add";
                    string strPaymentDate = "GridView1$ctl" + intIndex.ToString("0#") + "$txtTkh_bayaran_Add";
                    string strYearEnd     = "GridView1$ctl" + intIndex.ToString("0#") + "$txtbg_thn_berakhir_Add";
                    string strGrossDiv    = "GridView1$ctl" + intIndex.ToString("0#") + "$txtdiv_kasar_Add";
                    string strTaxRate     = "GridView1$ctl" + intIndex.ToString("0#") + "$txtkadar_cukai_Add";
                    string strTaxDeduct   = "GridView1$ctl" + intIndex.ToString("0#") + "$txtcukai_dipotong_Add";
                    //string strFaedah = "txtfaedah";
                    string strNetDiv = "GridView1$ctl" + intIndex.ToString("0#") + "$txtdiv_bersih_Add";

                    foreach (mshtml.HTMLInputElement inpElement2 in htmlDoc.getElementsByTagName("textarea"))
                    {
                        if (inpElement2.name.ToString() == strCompanyName)
                        {
                            inpElement2.value = strData[3].ToString().ToUpper();
                        }
                    }
                    foreach (mshtml.HTMLInputElement inpElement2 in htmlDoc.getElementsByTagName("input"))
                    {
                        if (inpElement2.name.ToString() == strWaranNo)
                        {
                            inpElement2.value = strData[2];
                            boolFilled        = true;
                        }
                        else if (inpElement2.name.ToString() == strPaymentDate)
                        {
                            inpElement2.value = strData[0];
                        }
                        else if (inpElement2.name.ToString() == strYearEnd)
                        {
                            inpElement2.value = strData[1];
                        }
                        else if (inpElement2.name.ToString() == strGrossDiv)
                        {
                            inpElement2.value = strData[4];
                        }
                        else if (inpElement2.name.ToString() == strTaxRate)
                        {
                            inpElement2.value = strData[5];
                        }
                        else if (inpElement2.name.ToString() == strTaxDeduct)
                        {
                            inpElement2.value = strData[6];
                        }
                        //else if (inpElement2.name.ToString() == strFaedah)
                        //{
                        //    inpElement2.value = strData[8];
                        //}
                        else if (inpElement2.name.ToString() == strNetDiv)
                        {
                            inpElement2.value = strData[7];
                        }
                    }
                }
            }

            if (boolFilled == true)
            {
                intIndex = intIndex - 1;
                string strLnkAdd = "GridView1_ctl" + intIndex.ToString("0#") + "_btnTambahFooter";
                foreach (mshtml.HTMLAnchorElement ancElement in htmlDoc.getElementsByTagName("a"))
                {
                    if (ancElement.id != null)
                    {
                        if (ancElement.id.ToString() == strLnkAdd)
                        {
                            ancElement.click();
                        }
                    }
                }
                //LEESH END
            }
        }
        private void ProcessDocument(mshtml.HTMLDocument htmlDoc)
        {
            Boolean boolFilled = false;
            int     intIndex   = 0;

            string[] strData = new string[11];
            if (!String.IsNullOrEmpty(dgEFMAK.SelectedRows[0].Cells[5].Value.ToString()))
            {
                strData[0] = DateTime.Parse(dgEFMAK.SelectedRows[0].Cells[5].Value.ToString()).ToString("dd/MM/yyyy");//tarik masuk
            }
            if (!String.IsNullOrEmpty(dgEFMAK.SelectedRows[0].Cells[6].Value.ToString()))
            {
                strData[1] = DateTime.Parse(dgEFMAK.SelectedRows[0].Cells[6].Value.ToString()).ToString("dd/MM/yyyy"); //tarik keluar
            }
            strData[2]  = dgEFMAK.SelectedRows[0].Cells[0].Value.ToString();                                           //PREFIX
            strData[3]  = dgEFMAK.SelectedRows[0].Cells[1].Value.ToString();                                           //REF
            strData[4]  = dgEFMAK.SelectedRows[0].Cells[2].Value.ToString();                                           //NAME
            strData[5]  = dgEFMAK.SelectedRows[0].Cells[3].Value.ToString();                                           //IC
            strData[6]  = dgEFMAK.SelectedRows[0].Cells[4].Value.ToString();                                           //COUNTRY
            strData[7]  = dgEFMAK.SelectedRows[0].Cells[7].Value.ToString();                                           //share
            strData[8]  = dgEFMAK.SelectedRows[0].Cells[8].Value.ToString();                                           //b1
            strData[9]  = dgEFMAK.SelectedRows[0].Cells[9].Value.ToString();                                           //b2
            strData[10] = dgEFMAK.SelectedRows[0].Cells[10].Value.ToString();                                          //b3


            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("textarea"))
            {
                switch (inpElement1.name)
                {
                case "ctl00_ContentPlaceHolder2_GridView1_ctl02_Nama":
                    inpElement1.value = strData[4].ToString().ToUpper();
                    break;
                }
            }

            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("input"))
            {
                switch (inpElement1.name)
                {
                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$ddlEmpty_Negara":
                    inpElement1.value = strData[6];
                    //MessageBox.Show("input1");
                    boolFilled = true;
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_No_kp":
                    inpElement1.value = strData[5];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_No_rujukan":
                    inpElement1.value = strData[3];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$ddlJ_Fail":
                    inpElement1.value = strData[2];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_tarikh_masuk":
                    inpElement1.value = strData[0];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_tarikh_keluar":
                    inpElement1.value = strData[1];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_bhgn_ahli":
                    inpElement1.value = strData[7];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_manfaat1":
                    inpElement1.value = strData[8];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_manfaat2":
                    inpElement1.value = strData[9];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$txtEmpty_manfaat3":
                    inpElement1.value = strData[10];
                    break;

                case "ctl00$ContentPlaceHolder2$GridView1$ctl01$Button1":
                    inpElement1.click();
                    break;
                }
            }

            // ctl00$ContentPlaceHolder2$GridView1$ctl03$txtNama_Add
            for (intIndex = 3; intIndex < 20; intIndex++)
            {
                if (boolFilled == true)
                {
                    break;
                }
                else
                {
                    string strPrefix  = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$ddlJenis_Fail_Add";
                    string strRef     = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtNoRujukan2_Add";
                    string strName    = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtNama_Add";
                    string strIC      = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtNoPengenalan_Add";
                    string strCountry = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtNegara_Add";
                    string strDateIn  = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtTkhMasuk_Add";
                    string strDateOut = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtTkhKeluar_Add";
                    string strShare   = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtBhg_Ahli_Add";
                    string strB1      = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtManfaat1_Add";
                    string strB2      = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtManfaat2_Add";
                    string strB3      = "ctl00$ContentPlaceHolder2$GridView1$ctl" + intIndex.ToString("0#") + "$txtManfaat3_Add";

                    //string strNetDiv = "GridView1$ctl" + intIndex.ToString("0#") + "$txtdiv_bersih_Add";

                    foreach (mshtml.HTMLInputElement inpElement2 in htmlDoc.getElementsByTagName("input"))
                    {
                        if (inpElement2.name.ToString() == strRef)
                        {
                            inpElement2.value = strData[3].ToString().ToUpper();
                            boolFilled        = true;
                        }

                        else if (inpElement2.name.ToString() == strIC)
                        {
                            inpElement2.value = strData[5];
                            boolFilled        = true;
                        }

                        else if (inpElement2.name.ToString() == strDateIn)
                        {
                            inpElement2.value = strData[0];
                            boolFilled        = true;
                        }
                        else if (inpElement2.name.ToString() == strDateOut)
                        {
                            inpElement2.value = strData[1];
                            boolFilled        = true;
                        }
                        else if (inpElement2.name.ToString() == strShare)
                        {
                            inpElement2.value = strData[7];
                            boolFilled        = true;
                        }
                    }


                    foreach (mshtml.HTMLInputElement inpElement2 in htmlDoc.getElementsByTagName("textarea"))
                    {
                        if (inpElement2.name.ToString() == strName)
                        {
                            //inpElement2.value = strData[2];
                            inpElement2.value = strData[4].ToString().ToUpper();
                            boolFilled        = true;
                        }
                    }


                    foreach (mshtml.HTMLSelectElement selElement in htmlDoc.getElementsByTagName("select"))
                    {
                        if (selElement.name.ToString() == strCountry)
                        {
                            selElement.value = strData[6];
                            boolFilled       = true;
                        }

                        else if (selElement.name.ToString() == strPrefix)
                        {
                            selElement.value = strData[2];
                            boolFilled       = true;
                        }
                        else if (selElement.name.ToString() == strB1)
                        {
                            selElement.value = strData[8];
                            boolFilled       = true;
                        }

                        else if (selElement.name.ToString() == strB2)
                        {
                            if (strData[9] == "1")
                            {
                                selElement.value = "2";
                                boolFilled       = true;
                            }
                            else
                            {
                                selElement.value = "";
                                boolFilled       = true;
                            }
                        }

                        else if (selElement.name.ToString() == strB3)
                        {
                            if (strData[10] == "1")
                            {
                                selElement.value = "3";
                                boolFilled       = true;
                            }
                            else
                            {
                                selElement.value = "";
                                boolFilled       = true;
                            }
                        }
                    }
                }
            }

            if (boolFilled == true)
            {
                intIndex = intIndex - 1;
                string strLnkAdd = "ctl00_ContentPlaceHolder2_GridView1_ctl" + intIndex.ToString("0#") + "_btnTambahFooter";
                foreach (mshtml.HTMLAnchorElement ancElement in htmlDoc.getElementsByTagName("a"))
                {
                    if (ancElement.id != null)
                    {
                        if (ancElement.id.ToString() == strLnkAdd)
                        {
                            ancElement.click();
                        }
                    }
                }
            }
        }
Exemplo n.º 27
0
        static public bool UpdateMovieDB(mshtml.HTMLDocument doc, MovieDB db)
        {
            if (db == null || doc == null)
            {
                return(false);
            }

            mshtml.IHTMLElementCollection item = doc.getElementsByTagName("dd");

            int lineIndex = 0;

            foreach (mshtml.IHTMLElement elem in item)
            {
                string text = elem.innerText;

                if (lineIndex == 0)
                {
                    // 감독
                    text = text.Replace(", ", ",");

                    string[] director = text.Split(',');
                    db.director.AddRange(director);
                }
                else if (lineIndex == 1)
                {
                    // 배우
                    text = text.Replace(", ", ",");

                    string[] actor = text.Split(',');
                    db.actor.AddRange(actor);
                }
                else if (lineIndex == 2)
                {
                    // 장르, 국가, 상영시간, 개봉일
                    text = text.Replace(", ", ",");
                    text = text.Replace("  ", "+");
                    text = text.Replace(" ", string.Empty);

                    string[] tmp = text.Split('+');

                    string[] genre = tmp[0].Split(',');
                    db.genre.AddRange(genre);

                    string[] nation = tmp[1].Split(',');
                    db.nation.AddRange(nation);

                    db.runningTime = tmp[2];
                    db.releaseDate = tmp[3];
                }
                else if (lineIndex == 5)
                {
                    // 관람 등급
                    text           = text.Replace("\r\n", "");
                    text           = text.Replace("도움말", "");
                    db.movieRating = text;
                    break;
                }

                lineIndex++;
            }

            // 유사한 영화들
            GetRecommendMovies(doc, db);

            // 관람객, 전문가, 네티즌 평점
            GetRatings(doc, db);

            return(db.Is());
        }
Exemplo n.º 28
0
        private void browser_LoadCompleted(object sender, NavigationEventArgs e)
        {
            if (browser.Document != null)
            {
                try
                {
                    mshtml.HTMLDocument dom = (mshtml.HTMLDocument)browser.Document;
                    //mshtml.IHTMLElement temper=null;
                    switch (model.ToUpper())
                    {
                    case "ALPHA":    //读取温度 Scanner Block Temperature [°C] Alpha仪器
                        mshtml.IHTMLElement temper = dom.getElementById("SCRTMPCORR");
                        if (temper != null)
                        {
                            if (!double.TryParse(temper.innerHTML, out Temperature))
                            {
                                Temperature = -1;
                            }
                        }
                        break;

                    case "MATRIX-I":    //读取温度 Scanner Block Temperature [°C] Matrix仪器
                        mshtml.IHTMLElementCollection temperM = dom.getElementsByTagName("TD");
                        if (temperM != null)
                        {
                            bool IsFindOut = false;
                            foreach (mshtml.IHTMLElement p in temperM)
                            {
                                if (IsFindOut)
                                {
                                    string temp = p.innerHTML;
                                    if (!double.TryParse(p.innerHTML, out Temperature))
                                    {
                                        Temperature = -1;
                                    }
                                    break;
                                }
                                if (p.innerHTML.Contains("Scannerblock Temperature"))
                                {
                                    //已经找到
                                    IsFindOut = true;
                                }
                            }
                        }
                        break;

                    case "TANGO":
                        mshtml.IHTMLElementCollection temperT = dom.getElementsByTagName("TD");
                        if (temperT != null)
                        {
                            bool IsFindOut = false;
                            foreach (mshtml.IHTMLElement p in temperT)
                            {
                                if (IsFindOut)
                                {
                                    string temp = p.innerHTML;
                                    if (!double.TryParse(p.innerHTML, out Temperature))
                                    {
                                        Temperature = -1;
                                    }
                                    break;
                                }
                                if (p.innerHTML != null)
                                {
                                    if (p.innerHTML.Contains("Scanner Block Temperature"))
                                    {
                                        //已经找到
                                        IsFindOut = true;
                                    }
                                }
                            }
                        }
                        break;

                    default: break;
                    }
                    //读取激光波数
                    mshtml.IHTMLElementCollection textArea = dom.getElementsByTagName("B");
                    foreach (mshtml.IHTMLElement p in textArea)
                    {
                        if (p.parentElement.parentElement.innerHTML != null && p.parentElement.parentElement.innerHTML.Contains("Current NvRAM Data"))//NvRamDataPrev"))
                        {
                            string htmlText = p.parentElement.parentElement.innerHTML;
                            int    fx       = htmlText.IndexOf("CLWN");
                            int    lx       = htmlText.LastIndexOf("CLWN");
                            string result   = htmlText.Substring(fx, lx - fx);
                            result = result.Replace("CLWN&gt;", string.Empty).Replace("&lt;/", string.Empty);
                            //string temp1="";
                            ////result = Regex.Replace(result, @"[\d+.]*", "");
                            double temp = -1;
                            if (double.TryParse(result, out temp))
                            {
                                laserWave = temp;
                            }
                            else
                            {
                                laserWave = -1;
                            }
                            // break;
                            //string tempString = p.innerHTML;// lwn.parentElement.innerHTML;

                            //string[] result = tempString.Replace("<TD id=LWN>LWN\r\n<TD>Laser Wavenumber</TD>\r\n<TD>", string.Empty).Split('\r');
                            ////string[] res=result.s
                            //if (result != null && result.Count() > 0)
                            //{
                            //    if (!double.TryParse(result[0], out laserWave))
                            //    {
                            //        laserWave = -1;
                            //    }
                            //}
                        }
                    }
                    //int i = 0;
                    //foreach(mshtml.IHTMLElement p in lwn.parentElement.children)
                    //{
                    //    if (i == 0)
                    //    {
                    //        i++;
                    //        continue;
                    //    }

                    //    if (!double.TryParse(p.innerHTML, out laserWave))
                    //    {
                    //        laserWave = -1;
                    //    }
                    //}
                    //}
                    //mshtml.IHTMLElementCollection laser = dom.getElementsByTagName("TEXTAREA");
                    //mshtml.IHTMLElementCollection node = dom.getElementsByTagName("B");
                    //mshtml.IHTMLElement element=null;

                    //foreach (mshtml.IHTMLElement html in node)
                    //{
                    //    if (html.innerHTML == "Previous Start-Up NvRAM Data")
                    //    {
                    //        element=html;
                    //    }
                    //}
                    //foreach(mshtml.IHTMLElement html in laser)
                    //{
                    //    if(html.parentElement.parentElement.parentElement.parentElement.parentElement==element.parentElement.parentElement)
                    //    {
                    //        XmlDocument doc = new XmlDocument();
                    //        doc.LoadXml(html.parentElement.parentElement.innerHTML);    //加载Xml文件
                    //        XmlElement rootElem = doc.DocumentElement;   //获取根节点
                    //        XmlNodeList personNodes = rootElem.GetElementsByTagName("TABLE"); //获取person子节点集合
                    //        foreach (XmlElement node1 in personNodes)
                    //        {
                    //            foreach (XmlElement child in node1.ChildNodes)
                    //            {
                    //                //读取IP地址
                    //                if (string.Equals(child.Name, "URL"))
                    //                {

                    //                }

                    //            }
                    //        }
                    //    }
                    //}
                    //foreach (mshtml.IHTMLElement html in node)
                    //{
                    //    if (html.innerHTML == "Previous Start-Up NvRAM Data")
                    //    {
                    //        string htmlText = html.parentElement.parentElement.innerHTML;
                    //        int fx = htmlText.IndexOf("CLWN");
                    //        int lx = htmlText.LastIndexOf("CLWN");
                    //        string result = htmlText.Substring(fx, lx - fx);
                    //        result = result.Replace("CLWN&gt;", string.Empty).Replace("&lt;/", string.Empty);
                    //        //string temp1="";
                    //        ////result = Regex.Replace(result, @"[\d+.]*", "");
                    //        double temp = -1;
                    //        if (double.TryParse(result, out temp))
                    //        {
                    //            laserWave = temp;
                    //        }
                    //        else
                    //        {
                    //            laserWave = -1;
                    //        }
                    //        break;
                    //    }
                    //}
                }
                catch { }
                this.Hide();
            }
            else
            {
                Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new RefreshDelgate(Refresh));
            }
        }
Exemplo n.º 29
0
        private void ProcessDocument(mshtml.HTMLDocument htmlDoc)
        {
            Boolean  boolFilled = false;
            int      intIndex;
            DateTime dtTemp1 = DateTime.Parse(dgEFRKTRKS.SelectedRows[0].Cells[2].Value.ToString());
            DateTime dtTemp2 = DateTime.Parse(dgEFRKTRKS.SelectedRows[0].Cells[3].Value.ToString());
            DateTime dtTemp3 = DateTime.Parse(dsData.Tables["P20_RKT_RKS_ACCPERIOD"].Rows[0].ItemArray[0].ToString());
            DateTime dtTemp4 = DateTime.Parse(dsData.Tables["P20_RKT_RKS_ACCPERIOD"].Rows[0].ItemArray[1].ToString());

            string[] strData = new string[7];
            strData[0] = dgEFRKTRKS.SelectedRows[0].Cells[0].Value.ToString();
            strData[1] = dgEFRKTRKS.SelectedRows[0].Cells[1].Value.ToString();
            strData[2] = dtTemp1.ToString("dd/MM/yyyy");
            strData[3] = dtTemp2.ToString("dd/MM/yyyy");
            strData[4] = dgEFRKTRKS.SelectedRows[0].Cells[4].Value.ToString();
            strData[5] = dtTemp3.ToString("dd/MM/yyyy");
            strData[6] = dtTemp4.ToString("dd/MM/yyyy");

            foreach (mshtml.HTMLInputElement inpElement1 in htmlDoc.getElementsByTagName("input"))
            {
                switch (inpElement1.name)
                {
                case "txtMula_Asas":
                    inpElement1.value = strData[5];
                    break;

                case "txtTutup_Asas":
                    inpElement1.value = strData[6];
                    break;

                case "GridView1$ctl01$txtEmpty_No_Rujukan2":
                    inpElement1.value = strData[0];
                    boolFilled        = true;
                    break;

                case "GridView1$ctl01$txtEmpty_Nama_Sykt2":
                    inpElement1.value = strData[1];
                    break;

                case "GridView1$ctl01$txtEmpty_Mula_Asas2":
                    inpElement1.value = strData[2];
                    break;

                case "GridView1$ctl01$txtEmpty_Tutup_Asas2":
                    inpElement1.value = strData[3];
                    break;

                case "GridView1$ctl01$txtEmpty_Amaun_Diserah2":
                    inpElement1.value = strData[4].Replace(",", "");
                    break;

                case "GridView1$ctl01$Button1":
                    inpElement1.click();
                    break;
                }
            }

            for (intIndex = 3; intIndex < 20; intIndex++)
            {
                if (boolFilled == true)
                {
                    break;
                }
                else
                {
                    string strRefno       = "GridView1$ctl" + intIndex.ToString("0#") + "$txtNoRujukan2_Add";
                    string strCompanyName = "GridView1$ctl" + intIndex.ToString("0#") + "$txtNama_Sykt2_Add";
                    string strPeriodFrom  = "GridView1$ctl" + intIndex.ToString("0#") + "$txtMula_Asas2_Add";
                    string strPeriodTo    = "GridView1$ctl" + intIndex.ToString("0#") + "$txtTutup_Asas2_Add";
                    string strAmount      = "GridView1$ctl" + intIndex.ToString("0#") + "$txtAmaun_Diserah2_Add";

                    foreach (mshtml.HTMLInputElement inpElement2 in htmlDoc.getElementsByTagName("input"))
                    {
                        if (inpElement2.name.ToString() == strRefno)
                        {
                            inpElement2.value = strData[0];
                            boolFilled        = true;
                        }
                        else if (inpElement2.name.ToString() == strCompanyName)
                        {
                            inpElement2.value = strData[1];
                        }
                        else if (inpElement2.name.ToString() == strPeriodFrom)
                        {
                            inpElement2.value = strData[2];
                        }
                        else if (inpElement2.name.ToString() == strPeriodTo)
                        {
                            inpElement2.value = strData[3];
                        }
                        else if (inpElement2.name.ToString() == strAmount)
                        {
                            inpElement2.value = strData[4].Replace(",", "");
                        }
                    }
                }
            }

            if (boolFilled == true)
            {
                intIndex = intIndex - 1;
                string strLnkAdd = "GridView1_ctl" + intIndex.ToString("0#") + "_btnAdd";
                foreach (mshtml.HTMLAnchorElement ancElement in htmlDoc.getElementsByTagName("a"))
                {
                    if (ancElement.id != null)
                    {
                        if (ancElement.id.ToString() == strLnkAdd)
                        {
                            ancElement.click();
                        }
                    }
                }
            }
        }
Exemplo n.º 30
0
        private void ProcessFormCP204(mshtml.HTMLDocument htmlDoc, String strPageIndex)
        {
            try
            {
                EFilingDALCP204 dal    = new EFilingDALCP204(strTaxPayer, strYA, strAuditor, strTaxAgent);
                DataSet         dsData = dal.GetFormDataCP204(strPageIndex);
                dal.CloseConn();
                Boolean boolPindaan = false;
                //Boolean boolNoRecord = false;

                if (dsData.Tables["P1_BORANG_CP204"].Rows.Count > 0)
                {
                    #region "INPUT"
                    foreach (mshtml.HTMLInputElement inpElement in htmlDoc.getElementsByTagName("input"))
                    {
                        //switch (strPageIndex)
                        //{
                        #region "Page 1"
                        //case "CP2042009Page1":

                        string[] arrCorrespondAddress  = new string[3];
                        string[] arrCorrespondAddress2 = new string[3];
                        string[] arrTaxAgentAddress    = new string[3];

                        arrCorrespondAddress[0] = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[0].ToString();
                        arrCorrespondAddress[1] = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[1].ToString();
                        arrCorrespondAddress[2] = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[2].ToString();
                        arrCorrespondAddress    = TextSpliterAddress(arrCorrespondAddress, 30);

                        if (!String.IsNullOrEmpty(dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[6].ToString()))
                        {
                            arrCorrespondAddress2[0] = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[6].ToString();
                            arrCorrespondAddress2[1] = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[7].ToString();
                            arrCorrespondAddress2[2] = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[8].ToString();
                            arrCorrespondAddress2    = TextSpliterAddress(arrCorrespondAddress2, 30);
                            boolPindaan = true;
                        }

                        arrTaxAgentAddress[0] = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[0].ToString();
                        arrTaxAgentAddress[1] = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[1].ToString();
                        arrTaxAgentAddress[2] = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[2].ToString();
                        arrTaxAgentAddress    = TextSpliterAddress(arrTaxAgentAddress, 30);

                        switch (inpElement.name)
                        {
                        case "btnPindaan":
                            FireInpElementEvent(inpElement, "onclick");
                            break;

                        case "txtAlamat1":
                            if (boolPindaan)
                            {
                                inpElement.value = arrCorrespondAddress2[0].ToUpper();
                            }
                            else
                            {
                                inpElement.value = arrCorrespondAddress[0].ToUpper();
                            }
                            break;

                        case "txtAlamat2":
                            if (boolPindaan)
                            {
                                inpElement.value = arrCorrespondAddress2[1].ToUpper();
                            }
                            else
                            {
                                inpElement.value = arrCorrespondAddress[1].ToUpper();
                            }
                            break;

                        case "txtAlamat3":
                            if (boolPindaan)
                            {
                                inpElement.value = arrCorrespondAddress2[2].ToUpper();
                            }
                            else
                            {
                                inpElement.value = arrCorrespondAddress[2].ToUpper();
                            }
                            break;

                        case "txtPoskod":
                            if (boolPindaan)
                            {
                                inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[9].ToString();
                            }
                            else
                            {
                                inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[3].ToString();
                            }
                            break;

                        case "txtBandar":
                            if (boolPindaan)
                            {
                                inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[10].ToString().ToUpper();
                                FireInpElementEvent(inpElement, "onchange");
                            }
                            else
                            {
                                inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[4].ToString().ToUpper();
                                FireInpElementEvent(inpElement, "onchange");
                            }
                            break;

                        case "txtAnggaran_Cukai2":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[12].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        //case "btnPindaanSME": //weihong
                        //if (!String.IsNullOrEmpty(dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[23].ToString()))
                        //{
                        //    FireInpElementEvent(inpElement, "onclick");
                        //}
                        //break;
                        case "txtTarikh_SyktBaru":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[13].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "TxtThnPertama":             //weihong Status SME FROM
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[23].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "TxtThnKedua":             //weihong Status SME TO
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[24].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_Perakaunan1":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[15].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_Perakaunan2":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[16].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_Asas1":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[17].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_Asas2":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[18].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_Asas3":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[19].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_Asas4":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[20].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_Asas5":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[21].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtTmph_asas6":
                            inpElement.value = dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[22].ToString();
                            FireInpElementEvent(inpElement, "onblur");
                            break;

                        case "txtAgAdd1":
                            inpElement.value = arrTaxAgentAddress[0].ToUpper();
                            break;

                        case "txtAgAdd2":
                            inpElement.value = arrTaxAgentAddress[1].ToUpper();
                            break;

                        case "txtAgAdd3":
                            inpElement.value = arrTaxAgentAddress[2].ToUpper();
                            break;

                        case "txtAgPostcode":
                            inpElement.value = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[3].ToString();
                            break;

                        case "txtAgCity":
                            inpElement.value = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[4].ToString().ToUpper();
                            break;

                        case "txtAgTelephone":
                            inpElement.value = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[6].ToString();
                            break;

                        case "txtAgDaftar":
                            inpElement.value = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[7].ToString().ToUpper();
                            break;

                        case "txtAgEmail":
                            inpElement.value = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[8].ToString().ToUpper();
                            break;

                        case "txtNo_Telefon":
                            inpElement.value = dsData.Tables["P1_FIRM"].Rows[0].ItemArray[6].ToString().ToUpper();
                            break;
                        }
                        //break;

                        #endregion
                        //}
                    }
                    //if (boolNoRecord)
                    //{
                    //    MessageBox.Show("No record found for current document.", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //}
                    #endregion

                    #region "SELECT"
                    foreach (mshtml.HTMLSelectElement selElement in htmlDoc.getElementsByTagName("select"))
                    {
                        //switch (strPageIndex)
                        //{
                        #region "Page 1"
                        //case "CP2042009Page1":
                        switch (selElement.name)
                        {
                        case "ddlNegeri":
                            if (boolPindaan)
                            {
                                selElement.value = SelectState(dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[11].ToString());
                            }
                            else
                            {
                                selElement.value = SelectState(dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[5].ToString());
                            }
                            break;

                        case "ddlStatus_Akaun":
                            if (dsData.Tables["P1_BORANG_CP204"].Rows[0].ItemArray[14].ToString() == "1")
                            {
                                selElement.value = "Ya";
                                FireSelElementEvent(selElement, "onblur");
                            }
                            else
                            {
                                selElement.value = "Tidak";
                                FireSelElementEvent(selElement, "onblur");
                            }
                            break;

                        case "ddlAgState":
                            selElement.value = SelectState(dsData.Tables["P1_FIRM"].Rows[0].ItemArray[5].ToString());
                            break;
                        }
                        //break;

                        #endregion
                        //}
                    }
                    //if (boolNoRecord)
                    //{
                    //    MessageBox.Show("No record found for current document.", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    //}
                    #endregion
                }
                else
                {
                    MessageBox.Show("No record found for current document.", "TAXcom E-Filing", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }