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; } }
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); } } }
private void button1_Click(object sender, EventArgs e) {//std_no,fn,mi,ln,email,home,contact,bday,age,yr,comitte,guar_name,gard_no,dpa bool sn_flag = SN.MaskCompleted != false; bool fn_flag = FN.Text != ""; bool mi_flag = MI.Text != ""; bool ln_flag = LN.Text != ""; bool email_flag = EMail.Text != ""; bool address_flag = Address.Text != ""; bool contact_flag = Contact.MaskCompleted != false; bool bday_flag = Bday.Value.ToShortDateString() != DateTime.Now.ToShortDateString(); bool age_flag = Int32.Parse(Age.Text) > 0; bool year_flag = Year.Text != ""; bool com_flag = Comm.Text != ""; bool Guardname_flag = GuardName.Text != ""; bool Guardcontact_flag = GuardContact.MaskCompleted != false; bool DPA_flag = checkBox1.Checked != false; bool membership = radioButton1.Checked != false || radioButton2.Checked != false; error = null; if (!sn_flag || !fn_flag || !mi_flag || !ln_flag || !email_flag || !address_flag || !contact_flag || !bday_flag || !year_flag || !com_flag || !Guardname_flag || !Guardcontact_flag || !DPA_flag || !age_flag || !membership) { if (!fn_flag) { error += "First Name must not be Empty \n"; } if (!mi_flag) { error += "Middle Initial must not be Empty \n"; } if (!ln_flag) { error += "Last Name must not be Empty \n"; } if (!sn_flag) { error += "Student Number must not be Empty \n"; } if (!email_flag) { error += "Email must not be Empty \n"; } if (!address_flag) { error += "Address must not be Empty \n"; } if (!contact_flag) { error += "Contact Number must not be Empty\n"; } if (!bday_flag) { if (Bday.Value.ToShortDateString() == DateTime.Now.ToShortDateString()) { error += "Date of Birth must not the same as Date Today\n"; } else { error += "Date of Birth does not match your Age\n"; } } if (!age_flag) { error += "Age must not be 0 or a Negative Value"; } if (!year_flag) { error += "Year Level must not be Empty\n"; } if (!com_flag) { error += "Commitee Affiliation must not be Empty\n"; } if (!Guardname_flag) { error += "Guardian Name must not be Empty\n"; } if (!Guardcontact_flag) { error += "Guardian Contact Number must not be Empty\n"; } if (!DPA_flag) { error += "Data Privacy Act of 2012 not checked"; } if (!membership) { error += "Select Membership Type"; } MessageBox.Show(error, "Invalid Data", MessageBoxButtons.OK, MessageBoxIcon.Warning); //Error Message Box for Invalid Data } else { MainMenu.Insert("insert into member_list(SN,FN,MI,LN,Email,Address,Contact_No,BDay,Age,Year_Level,Comm,Guard_Name,Guard_Contact,Membership,ID_Address) values('" + requirements() + "');"); FN.Text = null; MI.Text = null; LN.Text = null; SN.Text = null; EMail.Text = null; Address.Text = null; Contact.Text = null; Bday.Value = DateTime.Today; Age.Text = null; Year.Text = null; Comm.Text = null; GuardName.Text = null; GuardContact.Text = null; radioButton1.Checked = false; radioButton2.Checked = false; if (DialogResult.Yes == MessageBox.Show("New Member Registered!\n\nWould you like to go back?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { Form mainmenu = new MainMenu(); mainmenu.Show(); Close(); } } }
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 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; }