private void Add_Attendance_Click(object sender, RoutedEventArgs e) { try { attendanceEntity.EmployeeID = int.Parse(txtEmpId.Text); attendanceEntity.ProjectID = int.Parse(txtPId.Text); attendanceEntity.AttendanceType = cmbAType.Text; attendanceEntity.AttendanceDate = txtDate.SelectedDate.Value; attendanceEntity.InTime = txtInTime.Text; attendanceEntity.OutTime = txtOutTime.Text; if (attendanceBLL.ValidateAttendanceBLL(attendanceEntity) == true) { MessageBox.Show("Attendace Addedd Succesfully!!"); //dgAttendance.DataContext = attendanceDAL.LoadGridDAL(); LoadGrid(); } else { MessageBox.Show("Leave Is Already Applied For This Date!!!"); LoadGrid(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }