private void employeeAttendanceToolStripMenuItem_Click(object sender, EventArgs e) { Employee.EmpAtnd er = new Employee.EmpAtnd(); // ag.MdiParent = this ; er.StartPosition = FormStartPosition.CenterScreen; er.Show(); }
private void button1_Click(object sender, EventArgs e) { try { if (atndExist(label7.Text, comboBox1.Text, comboBox2.Text)) { MessageBox.Show("Attendance Already Given!"); ClearData(); LoadData(); Employee.EmpAtnd er = new Employee.EmpAtnd(); // ag.MdiParent = this ; er.StartPosition = FormStartPosition.CenterScreen; er.Show(); this.Close(); // ClearData(); //break; } // else // { /* if (NoEmpName(textBox3.Text) == true) * { * MessageBox.Show("Employee Doesn't Exists!"); * ClearData(); * LoadData(); * Employee.EmpAtnd er = new Employee.EmpAtnd(); * // ag.MdiParent = this ; * er.StartPosition = FormStartPosition.CenterScreen; * er.Show(); * this.Close(); * }*/ /* else if (atndExist(textBox3.Text, comboBox1.Text, comboBox2.Text)) * { * MessageBox.Show("Attendance Already Given!"); * ClearData(); * LoadData(); * Employee.EmpAtnd er = new Employee.EmpAtnd(); * // ag.MdiParent = this ; * er.StartPosition = FormStartPosition.CenterScreen; * er.Show(); * this.Close(); * // ClearData(); * * //break; * }*/ else { string query = " insert into EmpAtnd3(E_ID,Year,Month,WD,PD) values ('" + Int32.Parse(label7.Text) + "','" + comboBox1.Text + "','" + comboBox2.Text + "','" + textBox1.Text + "','" + textBox2.Text + "')"; // private SqlCommand sqlCommand; sqlCommand = new SqlCommand(query, sqlConnection); // sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); // sqlConnection.Close(); //LoadData(); MessageBox.Show("Data Added Successfully"); ClearData(); LoadData(); } // } } catch (Exception ex) { // MessageBox.Show("Error"); } }