Example #1
0
        private async void timer2_TickAsync(object sender, EventArgs e)
        {
            button2.PerformClick();
            //browser.ViewSource();
            String x = await browser.GetSourceAsync();

            string task   = getBetween(x, textBox1.Text, textBox2.Text);
            string defect = getBetween(x, textBox3.Text, textBox4.Text);

            richTextBox1.Text = task + " " + defect;
            try
            {
                int     newActive = Convert.ToInt32(task);
                int     newDefect = Convert.ToInt32(defect);
                Boolean hasOne    = false;
                RALLY_NOTIFYER.textnotification = "";


                if (newActive > oldActive)
                {
                    //NEGATIVE NEWS TO NOTIFY
                    RALLY_NOTIFYER.textnotification += Environment.NewLine + "NEW ACTIVE TASK ADDED!";
                    hasOne = true;
                }
                else if (newActive < oldActive)
                {
                    //POSITIVE NEWS TO NOTIFY
                    RALLY_NOTIFYER.textnotification += Environment.NewLine + "AN ACTIVE TASK HAS BEEN CLOSED!";
                    hasOne = true;
                }

                if (newDefect > oldDefect)
                {
                    //NEGATIVE NEWS TO NOTIFY
                    RALLY_NOTIFYER.textnotification += Environment.NewLine + "NEW DEFECT HAS BEEN RAISED!";
                    hasOne = true;
                }
                else if (newDefect < oldDefect)
                {
                    //POSITIVE NEWS TO NOTIFY
                    RALLY_NOTIFYER.textnotification += Environment.NewLine + "A DEFECT HAS BEEN CLOSED!";
                    hasOne = true;
                }
                if (hasOne)
                {
                    RALLY_NOTIFYER frm2 = new RALLY_NOTIFYER();
                    frm2.Show();
                }


                oldActive        = Convert.ToInt32(task);
                oldDefect        = Convert.ToInt32(defect);
                notifyIcon1.Text = "Active: " + task + " Defects:" + defect;
            }
            catch (Exception ex)
            {
                richTextBox1.Text = ex.Message;
            }
        }
Example #2
0
        public void FillDataGrids()
        {
            string filename = "export.csv";

            if (filename.Trim() != string.Empty)
            {
                try
                {
                    DataTable dt  = new DataTable();
                    DataTable dt2 = new DataTable();
                    if (dataGridView1.Rows.Count < 1)
                    {
                        dt = NewDataTable(filename, ",", false);
                        dataGridView1.DataSource = dt.DefaultView;
                    }
                    else
                    {
                        dt2 = NewDataTable(filename, ",", false);
                        dataGridView2.DataSource = dt2.DefaultView;
                        //COMPARE

                        for (int i = 0; i < dataGridView1.RowCount - 1; i++)
                        {
                            for (int j = 0; j < dataGridView1.ColumnCount - 1; j++)
                            {
                                var arg1 = dataGridView1.Rows[i].Cells[j].Value.ToString();
                                var arg2 = dataGridView2.Rows[i].Cells[j].Value.ToString();

                                if (!arg1.Equals(arg2, StringComparison.InvariantCultureIgnoreCase))
                                {
                                    if (dataGridView2.Rows[0].Cells[j].Value.ToString() != "Last Update Date")
                                    {
                                        dataGridView1.Rows[i].Cells[j].Style.BackColor = Color.Red;
                                        dataGridView2.Rows[i].Cells[j].Style.BackColor = Color.Red;
                                        notifStatement += Environment.NewLine + dataGridView2.Rows[i].Cells[0].Value.ToString() + " " + dataGridView2.Rows[i].Cells[1].Value.ToString();
                                        notifStatement += Environment.NewLine + "has changed its " + dataGridView2.Rows[0].Cells[j].Value.ToString();
                                        notifStatement += Environment.NewLine + "from " + dataGridView1.Rows[i].Cells[j].Value.ToString().ToUpper();
                                        notifStatement += " to " + dataGridView2.Rows[i].Cells[j].Value.ToString().ToUpper() + ".";

                                        RALLY_NOTIFYER.textnotification = notifStatement;
                                        RALLY_NOTIFYER frm2 = new RALLY_NOTIFYER();
                                        frm2.Show();
                                    }
                                }
                            }
                        }
                        //THEN REPLACE  dataGridView1.DataSource = dt.DefaultView
                        dt = NewDataTable(filename, ",", false);
                        dataGridView1.DataSource = dt.DefaultView;
                        //THEN CLEAR  dataGridView2.DataSource
                        dataGridView2.DataSource = null;
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }