Ejemplo n.º 1
0
        public void ClickCheckbox(string anchorId)
        {
            isDocumentComplete = false;
            HTMLInputElement input = GetCheckboxElement(anchorId);

            input.click();
        }
Ejemplo n.º 2
0
        private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
        {
            switch (Task)
            {
            case 1:

                HTMLDocument myDoc = new HTMLDocumentClass();
                myDoc = (HTMLDocument)axWebBrowser1.Document;

                // a quick look at the google html source reveals:
                // <INPUT maxLength="256" size="55" name="q">
                //
                HTMLInputElement otxtSearchBox = (HTMLInputElement)myDoc.all.item("q", 0);

                otxtSearchBox.value = "intel corp";

                // google html source for the I'm Feeling Lucky Button:
                // <INPUT type=submit value="I'm Feeling Lucky" name=btnI>
                //
                HTMLInputElement btnSearch = (HTMLInputElement)myDoc.all.item("btnI", 0);
                btnSearch.click();

                Task++;
                break;

            case 2:

                // continuation of automated tasks...
                break;
            }
        }
Ejemplo n.º 3
0
        private void teamRadioButton_CheckedChanged(object sender, EventArgs e)
        {
            if (!teamRadioInput.@checked)
            {
                disableAllInputs();
                teamRadioInput.click();

                timer2.Start();
            }
        }
Ejemplo n.º 4
0
        private void okButton_Click(object sender, EventArgs e)
        {
            htmlMonInput.value = mondayInput.Text;
            htmlTueInput.value = tuesdayInput.Text;
            htmlWedInput.value = wednesdayInput.Text;
            htmlThuInput.value = thursdayInput.Text;
            htmlFriInput.value = fridayInput.Text;

            submitButton.click();
            this.Close();
        }
        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            try
            {
                if (webBrowser1.ReadyState == WebBrowserReadyState.Complete)
                {
                    if (webBrowser1.Url.ToString() == "http://intranet.cougarautomation.net/Timesheet/Timesheet.aspx")
                    {
                        Web_V1 = (SHDocVw.WebBrowser_V1)webBrowser1.ActiveXInstance;

                        timesheet = (HTMLDocument)Web_V1.Document;

                        bookingsTable = (HTMLTable)timesheet.all.item("ContentPlaceHolder1_GridViewSessions", 0);

                        if (bookingsTable != null)
                        {
                            bookingsTableInnerHTML = bookingsTable.innerHTML;
                        }
                        else
                        {
                            bookingsTableInnerHTML = "";
                        }

                        if (!thisMonth)
                        {
                            var anchorElements = timesheet.getElementsByTagName("a");

                            foreach (HTMLAnchorElement item in anchorElements)
                            {
                                if (item.title == "Go to the previous month")
                                {
                                    item.click();
                                }
                            }

                            timer1.Start();
                        }
                        else
                        {
                            HTMLInputElement monthRadioButton = (HTMLInputElement)timesheet.all.item("ContentPlaceHolder1_RadioButtonListSessions_2", 0);
                            monthRadioButton.click();
                            timer1.Start();
                        }
                    }
                }
            } catch (Exception exception)
            {
                MessageBox.Show("Unable to connect to timesheet page, please check your connection");
            }
        }
Ejemplo n.º 6
0
        public static void Login(WebUtil w, string username, string password)
        {
            HTMLInputElement user_input     = (HTMLInputElement)w.GetElementById("username");
            HTMLInputElement password_input = (HTMLInputElement)w.GetElementById("password");
            HTMLInputElement submit_input   = (HTMLInputElement)w.GetElementByValue("input", "name", "login");

            if (user_input != null && password_input != null & submit_input != null)
            {
                user_input.value     = username;
                password_input.value = password;
                w.BeginPageLoading();
                submit_input.click();
                w.WaitForComplete();
            }
        }
Ejemplo n.º 7
0
        public static void fillAllMovements(SHDocVw.WebBrowser_V1 Web_V1)
        {
            HTMLDocument movements = new HTMLDocument();

            movements = (HTMLDocument)Web_V1.Document;

            HTMLInputElement thisMonBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisMonday", 0);
            HTMLInputElement thisTueBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisTuesday", 0);
            HTMLInputElement thisWedBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisWednesday", 0);
            HTMLInputElement thisThuBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisThursday", 0);
            HTMLInputElement thisFriBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxThisFriday", 0);

            HTMLInputElement nextMonBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextMonday", 0);
            HTMLInputElement nextTueBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextTuesday", 0);
            HTMLInputElement nextWedBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextWednesday", 0);
            HTMLInputElement nextThuBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextThursday", 0);
            HTMLInputElement nextFriBox = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextFriday", 0);

            HTMLInputElement nextMon2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextMonday2", 0);
            HTMLInputElement nextTue2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextTuesday2", 0);
            HTMLInputElement nextWed2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextWednesday2", 0);
            HTMLInputElement nextThu2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextThursday2", 0);
            HTMLInputElement nextFri2Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextFriday2", 0);

            HTMLInputElement nextMon3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextMonday3", 0);
            HTMLInputElement nextTue3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextTuesday3", 0);
            HTMLInputElement nextWed3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextWednesday3", 0);
            HTMLInputElement nextThu3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextThursday3", 0);
            HTMLInputElement nextFri3Box = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_TextBoxNextFriday3", 0);

            List <HTMLInputElement> movementInputs = new List <HTMLInputElement>();

            movementInputs.Add(thisMonBox);
            movementInputs.Add(thisTueBox);
            movementInputs.Add(thisWedBox);
            movementInputs.Add(thisThuBox);
            movementInputs.Add(thisFriBox);
            movementInputs.Add(nextMonBox);
            movementInputs.Add(nextTueBox);
            movementInputs.Add(nextWedBox);
            movementInputs.Add(nextThuBox);
            movementInputs.Add(nextFriBox);
            movementInputs.Add(nextMon2Box);
            movementInputs.Add(nextTue2Box);
            movementInputs.Add(nextWed2Box);
            movementInputs.Add(nextThu2Box);
            movementInputs.Add(nextFri2Box);
            movementInputs.Add(nextMon3Box);
            movementInputs.Add(nextTue3Box);
            movementInputs.Add(nextWed3Box);
            movementInputs.Add(nextThu3Box);
            movementInputs.Add(nextFri3Box);

            foreach (var item in movementInputs)
            {
                if (string.IsNullOrEmpty(item.value))
                {
                    item.value = "IN";
                }
            }

            HTMLInputElement submit = (HTMLInputElement)movements.all.item("ContentPlaceHolder1_ButtonAccept", 0);

            submit.click();
        }
Ejemplo n.º 8
0
        private void okButton_Click(object sender, EventArgs e)
        {
            float hoursFloat;

            try
            {
                hoursFloat = float.Parse(hoursTextBox.Text);
            }
            catch (FormatException exc)
            {
                MessageBox.Show("Invalid hours format.");
                return;
            }
            hoursFloat = float.Parse(hoursTextBox.Text);
            if ((hoursFloat % 0.25) != 0)
            {
                MessageBox.Show("Invalid hours format. Must be a multiple of 0.25");
                return;
            }

            projectList.selectedIndex = projectComboBox.SelectedIndex;
            if (technologyComboBox.Items.Count > 0)
            {
                technologyList.selectedIndex = technologyComboBox.SelectedIndex;
            }
            codeList.selectedIndex = codeComboBox.SelectedIndex;
            descTextInput.value    = descTextBox.Text;

            extensionList.selectedIndex = extensionComboBox.SelectedIndex;

            hoursTextInput.value = hoursTextBox.Text;
            string overtimeText = "Normal";

            if (normalRadioButton.Checked)
            {
                normalOvertimeInput.click();
                overtimeText = "Normal";
            }
            if (Overtime1radioButton.Checked)
            {
                oneOvertimeInput.click();
                overtimeText = "1";
            }
            if (overtime15radioButton.Checked)
            {
                oneAndAHalfOvertimeInput.click();
                overtimeText = "1.5";
            }
            if (overtimer2radioButton.Checked)
            {
                twoOvertimeInput.click();
                overtimeText = "2";
            }

            string radioButtonChecked = String.Empty;

            if (allRadioButton.Checked)
            {
                radioButtonChecked = "all";
            }
            if (regionRadioButton.Checked)
            {
                radioButtonChecked = "region";
            }
            if (teamRadioButton.Checked)
            {
                radioButtonChecked = "team";
            }

            addButton.click();

            Properties.Settings.Default.lastBookedProject     = projectComboBox.Text;
            Properties.Settings.Default.lastBookedCode        = codeComboBox.Text;
            Properties.Settings.Default.lastBookedTechnology  = technologyComboBox.Text;
            Properties.Settings.Default.lastBookedExtension   = extensionComboBox.Text;
            Properties.Settings.Default.lastBookedDesc        = descTextBox.Text;
            Properties.Settings.Default.lastBookedHours       = hoursTextBox.Text;
            Properties.Settings.Default.lastBookedOvertime    = overtimeText;
            Properties.Settings.Default.lastBookedRadioButton = radioButtonChecked;

            Properties.Settings.Default.Save();

            string booking = projectComboBox.Text + "\n" + codeComboBox.Text + "\n" +
                             descTextBox.Text + "\n" + hoursTextBox.Text + "\n" + technologyComboBox.Text + "\n" +
                             extensionComboBox.Text + "\n" + overtimeText + "\n" + radioButtonChecked;

            if (!Properties.Settings.Default.prevTenBookings.Contains(booking))
            {
                Properties.Settings.Default.prevTenBookings.Insert(0, booking);
            }
            else
            {
                if (Properties.Settings.Default.prevTenBookings.IndexOf(booking) != 0)
                {
                    Properties.Settings.Default.prevTenBookings.Remove(booking);
                    Properties.Settings.Default.prevTenBookings.Insert(0, booking);
                }
            }
            while (Properties.Settings.Default.prevTenBookings.Count > 10)
            {
                Properties.Settings.Default.prevTenBookings.RemoveAt(10);
            }
            this.Close();
        }