private void metroButton3_Click(object sender, EventArgs e) { string email = metroTextBox4.Text; if (email == "") { MetroMessageBox.Show(this, "Please add a email first in to box", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (IsEmail(metroTextBox4.Text)) { access_data d = new access_data(); d.InsertNewToCC(metroTextBox4.Text); metroGrid1.DataSource = d.ReturnEmailToCc(); ///////////////////////// MetroMessageBox.Show(this, "Email successfully addeded", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroMessageBox.Show(this, "Invalid email address", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); metroTextBox4.Text = ""; } } }
private void metroGrid2_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { DataGridViewRow selectedrow = null; if (metroGrid2.SelectedRows.Count > 0) { selectedrow = metroGrid2.SelectedRows[0]; } if (selectedrow == null) { return; } string x = selectedrow.Cells["Tag Name"].Value.ToString(); string y = selectedrow.Cells["Tag Value"].Value.ToString(); if (x == "" && y == "") { return; } else { access_data d = new access_data(); id = d.GetSite_detailsIdByUsingTag_name(x); metroTextBox2.Text = x; metroTextBox3.Text = y; EditTagNameAndTagValue = 0; } }
private void metroButton4_Click(object sender, EventArgs e) { access_data d = new access_data(); string tag_name = ""; if (metroTextBox2.Text.Contains("//")) { tag_name = metroTextBox2.Text; } else { tag_name = "//" + metroTextBox2.Text; } string tag_value = metroTextBox3.Text; if (tag_name == "" && tag_value == "") { MetroMessageBox.Show(this, "please insert tag name and tag value first", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (d.CheckDataAvailableOrNot(tag_name, tag_value) == true) { MetroMessageBox.Show(this, "Tag name andd value is already available", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (d.InsertNew_site_details(UrlId, tag_name, tag_value) == true) { MetroMessageBox.Show(this, "Data successfully inserted", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); metroTextBox2.Text = metroTextBox3.Text = ""; } } metroGrid2.DataSource = d.ReturnWebTagListAndName(UrlId); }
private void metroButton2_Click(object sender, EventArgs e) { try { if (metroTextBox1.Text == "" || metroGrid1.Rows[0].Cells["Tag Name"].Value.ToString() == "" || metroGrid1.Rows[0].Cells["Tag Value"].Value.ToString() == "") { CheckEmpty(); } else { DialogResult f = MetroMessageBox.Show(this, "Are you sure to save?", "WSH notify", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (f == DialogResult.OK) { access_data d = new access_data(); site s = new site(); s.url = metroTextBox1.Text; s.description = textBox1.Text; int site_id = d.InsertNweUrlData(s); int i = metroGrid1.Rows.Count; SqlDbDataAccess dr = new SqlDbDataAccess(); for (int j = 0; j < i; j++) { using (SqlCommand cmd = dr.GetCommand("insert into dbo.site_details (site_id,tag_name,tag_value) values(@site_id,@tag_name,@tag_value);")) { SqlParameter p = new SqlParameter("@site_id", SqlDbType.Int); p.Value = site_id; SqlParameter p1 = new SqlParameter("@tag_name", SqlDbType.VarChar, 200); p1.Value = metroGrid1.Rows[j].Cells["Tag Name"].Value.ToString(); SqlParameter p2 = new SqlParameter("@tag_value", SqlDbType.VarChar, 500); p2.Value = metroGrid1.Rows[j].Cells["Tag Value"].Value.ToString(); cmd.Parameters.Add(p); cmd.Parameters.Add(p1); cmd.Parameters.Add(p2); cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); } } MetroMessageBox.Show(this, "Data successfully Saved", "", MessageBoxButtons.OK, MessageBoxIcon.Information); metroTextBox1.Text = ""; metroTextBox2.Text = ""; textBox1.Text = ""; textBox2.Text = ""; metroGrid1.DataSource = null; } } } catch (System.ArgumentOutOfRangeException) { CheckEmpty(); } }
private void metroTextBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { access_data d = new access_data(); string selected = this.metroComboBox1.GetItemText(this.metroComboBox1.SelectedItem); if (selected == "" || metroTextBox2.Text == "") { MetroMessageBox.Show(this, "Please select username and password first", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (selected == "admin" && metroTextBox2.Text == d.GetAdminPassword()) { this.ParentForm.Hide(); Main n = new Main(0); n.Show(); } else { MetroMessageBox.Show(this, "Invalid username and password!", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public void minimize() { if (UrlBoxRow >= 1) { if (CheckForInternetConnection() == true) { access_data dd = new access_data(); int jj = dd.GetNoficationInterval(); if (jj != 0) { myTimer.Tick += new EventHandler(myEvent); myTimer.Interval = jj * 60 * 1000; myTimer.Start(); } } else { MessageBox.Show("No internet connection available,please check your internet connection or troubleshoot your internet connection", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Empty url list.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void metroTextBox2_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (metroTextBox1.Text == "" || metroTextBox2.Text == "") { MetroMessageBox.Show(this, "You cant not place new password and confirm password field empty.", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (metroTextBox1.Text != metroTextBox2.Text) { MetroMessageBox.Show(this, "New password and confirm password field value not match.", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { access_data f = new access_data(); if (f.changepassord(metroTextBox2.Text) == true) { MetroMessageBox.Show(this, "Password successfully set.", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ParentForm.Hide(); Main n = new Main(0); n.Show(); } else { MetroMessageBox.Show(this, "Something went wrong.please try again after some time.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
private void deleteRecordToolStripMenuItem_Click(object sender, EventArgs e) { access_data d = new access_data(); if (d.DeleteRow(delete_id) == true) { MetroMessageBox.Show(this, "Information successfully deleted", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); } metroGrid2.DataSource = d.ReturnWebTagListAndName(UrlId); }
public void CheckTagValue() { access_data aa = new access_data(); try { aa.get_info_by_url(aa.GetUrlByUsingId(id)); metroGrid1.DataSource = aa.CheckEveryTagValue(aa.GetUrlByUsingId(id)); HtmlWeb web = new HtmlWeb(); HtmlAgilityPack.HtmlDocument doc = web.Load("http://" + aa.a); DataGridViewImageColumn delbut = new DataGridViewImageColumn(); delbut.HeaderText = "Result"; delbut.Width = 20; delbut.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; metroGrid1.Columns.Add(delbut); int i = metroGrid1.Rows.Count; for (int j = 0; j < i; j++) { try { string tagname = metroGrid1.Rows[j].Cells["Tag Name"].Value.ToString(); string tagvalue = metroGrid1.Rows[j].Cells["Tag Value"].Value.ToString(); var link = doc.DocumentNode.SelectSingleNode(tagname); string ParsedValue = link.InnerText.ToString(); if (ParsedValue == "") { metroGrid1.Rows[j].Cells[2].Value = Image.FromFile(Environment.CurrentDirectory + "/notavailable.png"); } else if (ParsedValue == tagvalue) { metroGrid1.Rows[j].Cells[2].Value = Image.FromFile(Environment.CurrentDirectory + "/correct.png"); } else { metroGrid1.Rows[j].Cells[2].Value = Image.FromFile(Environment.CurrentDirectory + "/invalid.png"); } } catch (System.NullReferenceException) { metroGrid1.Rows[j].Cells[2].Value = Image.FromFile(Environment.CurrentDirectory + "/notavailable.png"); } } } catch (System.Net.WebException) { MetroMessageBox.Show(this, "The webpage at " + aa.a + " might be temporarily down or it may have moved permanently to a new web address", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void deleteRecordToolStripMenuItem_Click(object sender, EventArgs e) { access_data d = new access_data(); if (d.DeleteTo(e_to) == true) { MetroMessageBox.Show(this, "Information successfully deleted", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); metroGrid1.DataSource = null; } metroGrid1.DataSource = d.ReturnEmailToCc(); }
private void metroButton5_Click(object sender, EventArgs e) { if (metroTextBox4.Text == "") { access_data d = new access_data(); d.InsertNoficationInterval(0); } else { access_data d = new access_data(); d.InsertNoficationInterval(Convert.ToInt32(metroTextBox4.Text)); } MetroMessageBox.Show(this, "Information successfully updated", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void Form1_Load(object sender, EventArgs e) { metroTextBox1.Enabled = metroTextBox2.Enabled = metroTextBox3.Enabled = textBox1.Enabled = false; metroButton2.Enabled = metroButton4.Enabled = metroButton5.Enabled = false; metroGrid2.Enabled = false; richTextBox1.Clear(); metroLabel6.Text = ""; access_data ad = new access_data(); metroGrid1.DataSource = ad.ReturnWebSiteUrl(); UrlBoxRow = this.metroGrid1.RowCount; if (UrlBoxRow == 0) { textBox1.Enabled = false; metroTextBox1.Enabled = metroTextBox2.Enabled = metroTextBox3.Enabled = false; metroButton4.Enabled = metroButton5.Enabled = metroButton2.Enabled = metroButton10.Enabled = false; metroGrid2.Enabled = false; } DataGridViewButtonColumn bcol = new DataGridViewButtonColumn(); bcol.HeaderText = "Click Me"; bcol.Text = "Check"; bcol.Name = "btnClickMe"; bcol.UseColumnTextForButtonValue = true; metroGrid1.Columns.Add(bcol); string value = ad.CheckUpdateNotificationThroughEmail(); if (value == "yes" && firstTimeForm1 == 0) { if (CheckForInternetConnection() == true) { string email = ad.getemail(); if (ad.getemail() != "empty" && UrlBoxRow >= 1) { string x = ad.SendMail(GetAllTagData()); if (x != String.Empty) { MetroMessageBox.Show(this, x, "Wsh notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MetroMessageBox.Show(this, "No internet connection available,please check your internet connection or troubleshoot your internet connection", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void EmailConfiguration_Load(object sender, EventArgs e) { access_data d = new access_data(); user_details u = new user_details(); d.GetEmailConfigInfo(u); metroTextBox1.Text = u.e_from; metroTextBox2.Text = u.e_password; metroTextBox3.Text = Convert.ToString(u.port); metroComboBox1.SelectedIndex = metroComboBox1.FindStringExact(u.enablessi); metroComboBox2.SelectedIndex = metroComboBox2.FindStringExact(u.usedefaultcredentials); metroGrid1.DataSource = d.ReturnEmailToCc(); }
private void DynamicThreading() { access_data ad = new access_data(); DataTable t = new DataTable(); t = ad.ReturnWebSiteUrl(); for (int i = 0; i < metroGrid1.Rows.Count; i++) { string x = t.Rows[i]["url"].ToString(); Thread th = new Thread(() => { UseThreadForCheckingUrlTagAndValue(x); }); th.IsBackground = true; th.Start(); } }
private void check_in_Load(object sender, EventArgs e) { Main n = new Main(1); access_data a = new access_data(); if (a.GetUrlByUsingId(id) == "empty") { MetroMessageBox.Show(this, "No url available.plase add a new url first.", "Wsh notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { metroTextBox1.Text = a.GetUrlByUsingId(id); CheckTagValue(); } }
private void metroButton2_Click(object sender, EventArgs e) { access_data d = new access_data(); if (metroCheckBox1.Checked == true) { this.Hide(); EmailConfiguration n = new EmailConfiguration("yes"); n.Show(); } else { d.UpdateNotificationThroughEmail("no"); MetroMessageBox.Show(this, "Information successfully saved", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public Login() { InitializeComponent(); access_data d = new access_data(); string password = d.GetAdminPassword(); if (password == "empty") { metroPanel1.Controls.Add(new SetFirstTimePassword()); } else { metroPanel1.Controls.Add(new MainLogin()); } }
private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { if (backgroundWorker1.CancellationPending) { e.Cancel = true; } else { access_data ad = new access_data(); DataTable t = new DataTable(); t = ad.ReturnWebSiteUrl(); int count = metroGrid1.Rows.Count; int value = 100 / count; int xx = value; for (int i = 0; i < metroGrid1.Rows.Count; i++) { string x = t.Rows[i]["url"].ToString(); Thread th = new Thread(() => { UseThreadForCheckingUrlTagAndValue1(x); }); th.IsBackground = true; th.Start(); Thread.Sleep(2000); this.Invoke(new MethodInvoker(delegate() { metroLabel6.Text = "Checking URL:" + x + " Completed:" + value + " %"; })); backgroundWorker1.ReportProgress(value); value = value + xx; } this.Invoke(new MethodInvoker(delegate() { richTextBox1.AppendText("=========================================\n" + "=========================================\n" + "=========================================\n"); })); this.Invoke(new MethodInvoker(delegate() { metroLabel6.Text = "Completed..........."; })); } }
private void metroButton2_Click(object sender, EventArgs e) { if (metroTextBox1.Text == "") { CheckEmpty(); } else { if (aa == 0) { MetroMessageBox.Show(this, "please edit text first from [url or tag name or tag value or description]", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { site n = new site(); n.url = metroTextBox1.Text; n.description = textBox1.Text; access_data ad = new access_data(); DialogResult ff = MetroMessageBox.Show(this, "Are you really wants to change the information?", "WSH notify", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (ff == DialogResult.OK) { if (ad.Edit_web_info(n, UrlId) == true) { MetroMessageBox.Show(this, "information successfully update", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); access_data addd = new access_data(); metroGrid1.DataSource = addd.ReturnWebSiteUrl(); } else { DialogResult dd = MetroMessageBox.Show(this, "something went wrong!", "WSH notify", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error); if (dd == DialogResult.Cancel) { Application.Exit(); } } } } } }
private void setting_Load(object sender, EventArgs e) { access_data d = new access_data(); string checkboxvalue = d.CheckUpdateNotificationThroughEmail(); if (checkboxvalue == "yes") { metroCheckBox1.Checked = true; } if (checkboxvalue == "no") { metroCheckBox1.Checked = false; } access_data dd = new access_data(); int jj = dd.GetNoficationInterval(); metroTextBox4.Text = jj.ToString(); }
private void metroGrid2_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { DataGridViewRow selectedrow = null; if (metroGrid2.SelectedRows.Count > 0) { selectedrow = metroGrid2.SelectedRows[0]; } if (selectedrow == null) { return; } string x = selectedrow.Cells["Tag Name"].Value.ToString(); access_data d = new access_data(); delete_id = d.GetSite_detailsIdByUsingTag_name(x); this.contextMenuStrip1.Show(this.metroGrid2, e.Location); contextMenuStrip1.Show(Cursor.Position); } }
private void metroButton1_Click(object sender, EventArgs e) { access_data d = new access_data(); string currentpassword = d.GetAdminPassword(); if (metroTextBox1.Text == "" || metroTextBox2.Text == "" || metroTextBox3.Text == "") { MetroMessageBox.Show(this, "You cant place old password or new password or confirm password filed empty", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); metroTextBox1.Text = ""; metroTextBox2.Text = ""; metroTextBox3.Text = ""; } else { if (metroTextBox2.Text != metroTextBox3.Text) { MetroMessageBox.Show(this, "New password and confirm password is not match", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); metroTextBox1.Text = ""; metroTextBox2.Text = ""; metroTextBox3.Text = ""; } else if (metroTextBox1.Text != currentpassword) { MetroMessageBox.Show(this, "Old password not not correct", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); metroTextBox1.Text = ""; metroTextBox2.Text = ""; metroTextBox3.Text = ""; } else { if (d.changepassord(metroTextBox3.Text.ToString()) == true) { MetroMessageBox.Show(this, "Password successfully change", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); metroTextBox1.Text = ""; metroTextBox2.Text = ""; metroTextBox3.Text = ""; } } } }
private void metroGrid1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (metroGrid1.Rows.Count >= 1) { metroTextBox1.Enabled = metroTextBox2.Enabled = metroTextBox3.Enabled = textBox1.Enabled = true; metroButton2.Enabled = metroButton4.Enabled = metroButton5.Enabled = true; metroGrid2.Enabled = true; DataGridViewRow selectedrow = null; if (metroGrid1.SelectedRows.Count > 0) { selectedrow = metroGrid1.SelectedRows[0]; } if (selectedrow == null) { return; } string x = selectedrow.Cells["URL"].Value.ToString(); if (x == "") { return; } else { metroTextBox2.Text = ""; metroTextBox3.Text = ""; access_data d = new access_data(); d.get_info_by_url(x); UrlId = d.GetIdByUsingUrl(x); metroTextBox1.Text = d.a; textBox1.Text = d.dd; metroGrid2.DataSource = d.ReturnWebTagListAndName(UrlId); aa = 0; } } }
private void metroButton2_Click(object sender, EventArgs e) { string EnableSsl = this.metroComboBox1.GetItemText(this.metroComboBox1.SelectedItem); string UseDefaultCredentials = this.metroComboBox2.GetItemText(this.metroComboBox2.SelectedItem); if (metroTextBox1.Text == "" || metroTextBox2.Text == "" || metroTextBox3.Text == "" || EnableSsl == "" || UseDefaultCredentials == "" || metroGrid1.Rows.Count < 1) { MetroMessageBox.Show(this, "You cant place any above field ampty.[Multiple receiving email address acceptable but at least one receiving email address must be given]", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); metroTextBox1.Text = metroTextBox2.Text = metroTextBox3.Text = EnableSsl = UseDefaultCredentials = ""; } else { if (IsEmail(metroTextBox1.Text) == false || IsEmail(metroTextBox4.Text) == false) { MetroMessageBox.Show(this, "Invalid Email Address!", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); metroTextBox1.Text = metroTextBox2.Text = metroTextBox3.Text = EnableSsl = UseDefaultCredentials = ""; } else { SqlDbDataAccess dr = new SqlDbDataAccess(); access_data d = new access_data(); user_details u = new user_details(); u.e_from = metroTextBox1.Text; u.e_password = metroTextBox2.Text; u.port = Convert.ToInt32(metroTextBox3.Text); u.enablessi = EnableSsl; u.usedefaultcredentials = UseDefaultCredentials; d.InsertEmailConfiguration(u); d.InsertNewToCC(metroTextBox4.Text); metroGrid1.DataSource = d.ReturnEmailToCc(); d.UpdateNotificationThroughEmail(nofify); MetroMessageBox.Show(this, "Information successfully updated", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); metroTextBox4.Text = ""; } } }
private void metroButton2_Click(object sender, EventArgs e) { access_data d = new access_data(); string selected = this.metroComboBox1.GetItemText(this.metroComboBox1.SelectedItem); if (selected == "" || metroTextBox2.Text == "") { MetroMessageBox.Show(this, "Please select username and password first", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (selected == "admin" && metroTextBox2.Text == d.GetAdminPassword()) { this.ParentForm.Hide(); Main n = new Main(0); n.Show(); } else { MetroMessageBox.Show(this, "Invalid username and password Or check your database connection link[Tools->Connection option]!", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void metroButton5_Click(object sender, EventArgs e) { access_data d = new access_data(); string tag_name = ""; if (metroTextBox2.Text.Contains("//")) { tag_name = metroTextBox2.Text; } else { tag_name = "//" + metroTextBox2.Text; } string tag_value = metroTextBox3.Text; if (tag_name == "" && tag_value == "") { MetroMessageBox.Show(this, "please Select something from below table", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (EditTagNameAndTagValue == 0) { MetroMessageBox.Show(this, "please edit tag name or value first", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (d.Update_site_details(id, tag_name, metroTextBox3.Text) == true) { MetroMessageBox.Show(this, "Information successfully updated", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); metroTextBox2.Text = metroTextBox3.Text = ""; } } } metroGrid2.DataSource = d.ReturnWebTagListAndName(UrlId); }
private void deleteRecordToolStripMenuItem1_Click(object sender, EventArgs e) { access_data d = new access_data(); if (d.DeleteUrl(url) == true) { MetroMessageBox.Show(this, "Information successfully deleted", "WSH notify", MessageBoxButtons.OK, MessageBoxIcon.Information); metroGrid2.DataSource = null; } metroGrid1.DataSource = d.ReturnWebSiteUrl(); UrlBoxRow = this.metroGrid1.RowCount; if (UrlBoxRow < 1) { textBox1.Enabled = false; metroTextBox1.Enabled = metroTextBox2.Enabled = metroTextBox3.Enabled = false; metroButton4.Enabled = metroButton5.Enabled = metroButton2.Enabled = false; metroGrid2.Enabled = false; } textBox1.Text = ""; metroTextBox1.Text = ""; }