private void createSlaveAccountToolStripMenuItem_Click(object sender, EventArgs e) { MainMenu.Initialize("server=localhost;user=root;sslmode=none;"); checkuser(); if (user_accounts != 1) { Insert("create user 'access'@'%';"); Insert("GRANT USAGE ON *.* TO 'access'@'%';"); Insert("GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `coess\\_events`.*TO 'access'@'%';"); Insert("GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON `coess`.*TO 'access'@'%';"); Insert("GRANT ALL PRIVILEGES ON `access\\_ %`.*TO 'access'@'%';"); MessageBox.Show("User Accounts Created!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Report_Form_Load(object sender, EventArgs e) { report.Load(); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } Insert("Delete from report_table;"); crystalReportViewer1.ReportSource = report; crystalReportViewer1.RefreshReport(); }
private void button1_Click(object sender, EventArgs e) { finalevent = event_name.Text; finalevent = finalevent.Replace(' ', '_'); GetEname(event_name.Text); if (!duplicate) { MainMenu.Insert("insert into event_list (event_name,event_date,event_location,event_pubmat) values ('" + event_req() + "');"); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia_events;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia_events;sslmode=none;"); } MainMenu.Insert("create table " + finalevent + " (ID_No int(3) null, FN varchar(255) not null, LN varchar(255) not null, SN varchar(255) not null, Year_Level varchar(255) null, Time_In varchar(255) null, Time_Out varchar(255) null, primary key(SN));"); File.Copy(pickedImage, @"C:\\JPIA\\Images\\Pubmat\\" + fileName); event_name.Text = null; event_location.Text = null; event_date.Value = DateTime.Today; Image dump = event_pubmat.BackgroundImage; if (dump != null) { dump.Dispose(); } event_pubmat.BackgroundImage = System.Properties.Resources.JPIA_BACKGROUND; if (DialogResult.No == MessageBox.Show("Event Created!\n\nWould you like to create another event?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { Form events = new Events(); events.Show(); Close(); } } else { MessageBox.Show("Event is already in the database!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); event_name.Text = null; event_location.Text = null; event_date.Value = DateTime.Today; Image dump = event_pubmat.BackgroundImage; if (dump != null) { dump.Dispose(); } event_pubmat.BackgroundImage = System.Properties.Resources.JPIA_BACKGROUND; } }
public Event_List() { InitializeComponent(); // Create an instance of a ListView column sorter and assign it // to the ListView control. lvwColumnSorter = new ListViewColumnSorter(); this.listView2.ListViewItemSorter = lvwColumnSorter; if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } }
public New_Event() { InitializeComponent(); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } event_location.Text = "Event Location"; event_location.ForeColor = SystemColors.GrayText; event_name.Text = "Event Name"; event_name.ForeColor = SystemColors.GrayText; lblEnterEventName.Visible = false; lblEnterLocation.Visible = false; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } if (comboBox1.Text == "CoESS") { Populate_Combobox("Show Tables where tables_in_coess = 'member_list'"); } else { Populate_Combobox("Show Tables"); } }
private void button2_Click(object sender, EventArgs e)//remove button { foreach (ListViewItem item in listView2.SelectedItems) { SN = item.SubItems[2].Text; if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia_events;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia_events;sslmode=none;"); } MainMenu.Insert("delete from " + event_name + " where SN = '" + EnCryptDecrypt.CryptorEngine.Encrypt(SN, true) + "';"); listView2.Items.Remove(item); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } if (label5.Text == "0") { MessageBox.Show("There are no more participants!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { label5.Text = Convert.ToString(Convert.ToInt32(label5.Text) - 1); } } }
public New_Member() { InitializeComponent(); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } FN.Text = "First Name"; FN.ForeColor = SystemColors.GrayText; MI.Text = "Middle Initial"; MI.ForeColor = SystemColors.GrayText; LN.Text = "Last Name"; LN.ForeColor = SystemColors.GrayText; EMail.Text = "*****@*****.**"; EMail.ForeColor = SystemColors.GrayText; Address.Text = "Address"; Address.ForeColor = SystemColors.GrayText; GuardName.Text = "Guardian Name"; GuardName.ForeColor = SystemColors.GrayText; }
private void button1_Click(object sender, EventArgs e) { if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } Insert("Delete from report_table;"); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } if (comboBox1.Text == "CoESS") { if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } if (comboBox3.Text != "All") { Populate_ListView("Select ln,fn,sn,year_level from member_list where year_level = '" + EnCryptDecrypt.CryptorEngine.Encrypt(comboBox3.Text, true) + "';"); foreach (ListViewItem item in listView1.Items) { string sn, ln, fn, yr; ln = item.SubItems[0].Text; fn = item.SubItems[1].Text; sn = item.SubItems[2].Text; yr = item.SubItems[3].Text; Insert("insert into report_table values ('" + ln + "','" + fn + "','" + sn + "','" + yr + "')"); } } else { Populate_ListView("Select ln,fn,sn,year_level from member_list;"); foreach (ListViewItem item in listView1.Items) { string sn, ln, fn, yr; ln = item.SubItems[0].Text; fn = item.SubItems[1].Text; sn = item.SubItems[2].Text; yr = item.SubItems[3].Text; Insert("insert into report_table values ('" + ln + "','" + fn + "','" + sn + "','" + yr + "')"); } } } else if (comboBox1.Text == "CoESS_Events") { if (comboBox3.Text != "All") { Populate_ListView("Select ln,fn,sn,year_level from " + comboBox2.Text + " where year_level = '" + EnCryptDecrypt.CryptorEngine.Encrypt(comboBox3.Text, true) + "';"); foreach (ListViewItem item in listView1.Items) { string sn, ln, fn, yr; ln = item.SubItems[0].Text; fn = item.SubItems[1].Text; sn = item.SubItems[2].Text; yr = item.SubItems[3].Text; if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } Insert("insert into report_table values ('" + ln + "','" + fn + "','" + sn + "','" + yr + "')"); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } } } else { Populate_ListView("Select ln,fn,sn,year_level from " + comboBox2.Text + ";"); foreach (ListViewItem item in listView1.Items) { string sn, ln, fn, yr; ln = item.SubItems[0].Text; fn = item.SubItems[1].Text; sn = item.SubItems[2].Text; yr = item.SubItems[3].Text; if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } Insert("insert into report_table values ('" + ln + "','" + fn + "','" + sn + "','" + yr + "')"); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=" + comboBox1.Text + ";sslmode=none;"); } } } } crystalReportViewer1.RefreshReport(); }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (eventlist.checkBox1.Checked == true) { if (e.KeyCode == Keys.Enter) { ID = Convert.ToInt32(textBox1.Text); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } Max_ID(); if (ID <= query_ID) { if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia_events;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia_events;sslmode=none;"); } GetSN(ID); if (!duplicate) { MainMenu.Insert("insert into " + Event_List.event_name + " (ID_No, FN, LN, SN, Year_Level) select ID_No, FN, LN, SN,Year_Level from jpia.member_list where ID_No = " + ID + ";"); MainMenu.Insert("update " + Event_List.event_name + " set Time_In = '" + DateTime.Now.ToString("HH:mm") + "' where ID_No = " + ID + ";"); textBox1.Text = null; eventlist.LA(Event_List.event_name); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } } else { MessageBox.Show("Duplicate Entry Found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Invalid ID Number! Try Again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); textBox1.Text = null; } } } else if (eventlist.checkBox1.Checked == false) { if (e.KeyCode == Keys.Enter) { ID = Convert.ToInt32(textBox1.Text); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } Max_ID(); if (ID <= query_ID) { if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia_events;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia_events;sslmode=none;"); } MainMenu.Insert("update " + Event_List.event_name + " set Time_Out = '" + DateTime.Now.ToString("HH:mm") + "' where ID_No = " + ID + ";"); textBox1.Text = null; eventlist.LA(Event_List.event_name); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } } else { MessageBox.Show("Invalid ID Number! Try Again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop); textBox1.Text = null; } } } }
private void exportDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { Form access = new Access(); access.ShowDialog(); if (Access.access) { crystalReportViewer1.ReportSource = report; if (isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } checkdb("report_table_1", reporttable); if (!report_table) { if (isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } Insert("create table report_table_1 (First varchar(255) not null, Middle varchar(255) not null, Last varchar(255) not null,Year_Level varchar(255) not null, SN varchar(255) not null, Guardian_Name varchar(255) not null, `Guardian_Contact` VARCHAR(255) NOT NULL,address varchar(255) not null,bday varchar(255) not null);"); Insert("Delete from report_table_1;"); Populate_ListView("Select fn,mi,ln,year_level,SN,Guard_name,Guard_contact,address,bday from member_list;"); foreach (ListViewItem item in listView1.Items) { string ln, mi, fn, yr, sn, guard_name, guard_contact, address, bday; fn = item.SubItems[0].Text; mi = item.SubItems[1].Text; ln = item.SubItems[2].Text; yr = item.SubItems[3].Text; sn = item.SubItems[4].Text; guard_name = item.SubItems[5].Text; guard_contact = item.SubItems[6].Text; address = item.SubItems[7].Text; bday = item.SubItems[8].Text; Insert("insert into report_table_1 values ('" + fn + "','" + mi + "','" + ln + "','" + yr + "','" + sn + "','" + guard_name + "','" + guard_contact + "','" + address + "','" + bday + "');"); } crystalReportViewer1.RefreshReport(); crystalReportViewer1.ExportReport(); Insert("Delete from report_table_1;"); } else { if (isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=coess;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=coess;sslmode=none;"); } Insert("Delete from report_table_1;"); Populate_ListView("Select fn,mi,ln,year_level,SN,Guard_name,Guard_contact,address,bday from member_list;"); foreach (ListViewItem item in listView1.Items) { string ln, mi, fn, yr, sn, guard_name, guard_contact, address, bday; fn = item.SubItems[0].Text; mi = item.SubItems[1].Text; ln = item.SubItems[2].Text; yr = item.SubItems[3].Text; sn = item.SubItems[4].Text; guard_name = item.SubItems[5].Text; guard_contact = item.SubItems[6].Text; address = item.SubItems[7].Text; bday = item.SubItems[8].Text; Insert("insert into report_table_1 values ('" + fn + "','" + mi + "','" + ln + "','" + yr + "','" + sn + "','" + guard_name + "','" + guard_contact + "','" + address + "','" + bday + "');"); } crystalReportViewer1.RefreshReport(); crystalReportViewer1.ExportReport(); Insert("Delete from report_table_1;"); } } }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text == null || textBox2.Text == null || !maskedTextBox1.MaskCompleted || comboBox1.SelectedIndex == -1) { MessageBox.Show("Fill up all fields!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (eventlist.checkBox1.Checked) { if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia_events;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia_events;sslmode=none;"); } GetSN(EnCryptDecrypt.CryptorEngine.Encrypt(maskedTextBox1.Text, true));//Finish dis tonight verifying for duplicate SN to avoid error in primary key if (!duplicate) { MainMenu.Insert("insert into " + Event_List.event_name + " (FN, LN, SN,Year_Level) values ('" + EnCryptDecrypt.CryptorEngine.Encrypt(textBox1.Text, true) + "','" + EnCryptDecrypt.CryptorEngine.Encrypt(textBox2.Text, true) + "','" + EnCryptDecrypt.CryptorEngine.Encrypt(maskedTextBox1.Text, true) + "','" + EnCryptDecrypt.CryptorEngine.Encrypt(comboBox1.Text, true) + "');"); MainMenu.Insert("update " + Event_List.event_name + " set Time_In = '" + DateTime.Now.ToString("HH:mm") + "' where SN = '" + EnCryptDecrypt.CryptorEngine.Encrypt(maskedTextBox1.Text, true) + "';"); textBox1.Text = null; textBox2.Text = null; maskedTextBox1.Text = null; eventlist.LA(Event_List.event_name); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } } else { MessageBox.Show("Duplicate Entry Found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBox1.Text = null; textBox2.Text = null; maskedTextBox1.Text = null; eventlist.LA(Event_List.event_name); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } } } else { if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia_events;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia_events;sslmode=none;"); } MainMenu.Insert("update " + Event_List.event_name + " set Time_Out = '" + DateTime.Now.ToString("HH:mm") + "' where SN = '" + EnCryptDecrypt.CryptorEngine.Encrypt(maskedTextBox1.Text, true) + "';"); eventlist.LA(Event_List.event_name); if (MainMenu.isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } } } duplicate = false; }
private void exportDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { crystalReportViewer1.ReportSource = report; if (isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } checkdb("report_table_1", reporttable); if (!report_table) { if (isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } Insert("DROP TABLE ` report_table_1 `"); Insert("create table report_table_1 (First varchar(255) not null, Middle varchar(255) not null, Last varchar(255) not null,Gender varchar(255) not null, Year_Level varchar(255) not null, Contact_Number varchar(255) not null, Email varchar(255) not null);"); Insert("Delete from report_table_1;"); Populate_ListView("Select fn,mi,ln,gender,year_level,contact_no,email from member_list;"); foreach (ListViewItem item in listView1.Items) { string ln, mi, fn, yr, con, email, gen; fn = item.SubItems[0].Text; mi = item.SubItems[1].Text; ln = item.SubItems[2].Text; gen = item.SubItems[3].Text; yr = item.SubItems[4].Text; con = item.SubItems[5].Text; email = item.SubItems[6].Text; Insert("insert into report_table_1 values ('" + fn + "','" + mi + "','" + ln + "','" + gen + "','" + yr + "','" + con + "','" + email + "');"); } crystalReportViewer1.RefreshReport(); crystalReportViewer1.ExportReport(); Insert("Delete from report_table_1;"); } else { if (isMaster == true) { MainMenu.Initialize("server=localhost;uid=root;pwd=;database=jpia;sslmode=none;"); } else { MainMenu.Initialize("server=192.168.1.4;uid=access;pwd=;database=jpia;sslmode=none;"); } Insert("Delete from report_table_1;"); Populate_ListView("Select fn,mi,ln,gender,year_level,contact_no,email from member_list;"); foreach (ListViewItem item in listView1.Items) { string ln, mi, fn, yr, con, email, gen; fn = item.SubItems[0].Text; mi = item.SubItems[1].Text; ln = item.SubItems[2].Text; gen = item.SubItems[3].Text; yr = item.SubItems[4].Text; con = item.SubItems[5].Text; email = item.SubItems[6].Text; Insert("insert into report_table_1 values ('" + fn + "','" + mi + "','" + ln + "','" + gen + "','" + yr + "','" + con + "','" + email + "');"); } crystalReportViewer1.RefreshReport(); crystalReportViewer1.ExportReport(); Insert("Delete from report_table_1;"); } }