private void glassButton3_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete this employee?", "Employee Info", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { string query; StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt"); line = sr.ReadLine(); StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt"); dbP = sr3.ReadLine(); StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt"); dbU = sr4.ReadLine(); string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';"; MySqlConnection sqlConnection = new MySqlConnection(sConnection); query = "Delete From employee Where emp_id = '" + comboBox5.Text + "'"; dbQuery(query); MessageBox.Show("Successfully deleted an employee", "Employee Information", MessageBoxButtons.OK, MessageBoxIcon.Information); Employee fm = new Employee(); fm.Show(); this.Close(); } }
private void glassButton2_Click(object sender, EventArgs e) { if (adName.Text.Length < 7) { MessageBox.Show("Please enter an employee name.", "Employee Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (adRate.Text==" .") { MessageBox.Show("Please enter employee rate.", "Employee Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (adTyp.Text=="") { MessageBox.Show("Please enter employee type.", "Employee Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { string query; StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt"); line = sr.ReadLine(); StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt"); dbP = sr3.ReadLine(); StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt"); dbU = sr4.ReadLine(); string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';"; MySqlConnection sqlConnection = new MySqlConnection(sConnection); query = "Insert Into employee Values('" + System.DateTime.Now.Year + System.DateTime.Now.Month + System.DateTime.Now.Day + System.DateTime.Now.Millisecond + "','" + adName.Text.Trim().ToUpper() + "','" + adRate.Text + "','" + adAdd.Text.Trim().ToUpper() + "','" + adCon.Text.Trim().ToUpper() + "','" + adTyp.Text.Trim().ToUpper() + "' ,'" + System.DateTime.Now.ToString() + "','" + System.DateTime.Now.ToString() + "')"; dbQuery(query); MessageBox.Show("Successfully added an employee", "Employee Information", MessageBoxButtons.OK, MessageBoxIcon.Information); Employee fm = new Employee(); fm.Show(); this.Close(); } }
private void glassButton2_Click(object sender, EventArgs e) { Employee em = new Employee(); em.Show(); }
private void glassButton1_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to modify this employee information?", "Employee Info", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { { string query; StreamReader sr = new StreamReader(Application.StartupPath.ToString() + "//data.txt"); line = sr.ReadLine(); StreamReader sr3 = new StreamReader(Application.StartupPath.ToString() + "//dataP.txt"); dbP = sr3.ReadLine(); StreamReader sr4 = new StreamReader(Application.StartupPath.ToString() + "//dataU.txt"); dbU = sr4.ReadLine(); string sConnection = "SERVER=" + line + ";" + "DATABASE=lamolinventory;" + "UID=" + dbU + ";" + "PASSWORD='******';"; MySqlConnection sqlConnection = new MySqlConnection(sConnection); query = "Update employee Set emp_name = '" + edname.Text.Trim().ToUpper() + "', emp_rate = '" + edrate.Text + "', addr = '" + edadd.Text.Trim().ToUpper() + "', contactno = '" + edconta.Text.Trim().ToUpper() + "', emp_type = '" + edtype.Text.Trim().ToUpper() + "' Where emp_id = '" + comboBox2.Text + "'"; dbQuery(query); MessageBox.Show("Successfully updated an employee info", "Employee Information", MessageBoxButtons.OK, MessageBoxIcon.Information); Employee fm = new Employee(); fm.Show(); this.Close(); } } }
private void employeeInformationToolStripMenuItem_Click(object sender, EventArgs e) { Employee fm = new Employee(); fm.Show(); }