private void LoadDRTEnrolleeId() { Cursor = Cursors.WaitCursor; //try catch here if (listBox1.Items.Count > 0) { _iEnrolleeId = ((EmployeeData)listBox1.SelectedItem).EnrolleeId; var enrollee = EmployeeManager.Get(_iEnrolleeId); var position = PositionManager.Get(enrollee.PositionId); if (position != null) { _principal = position.PositionName?.Substring(0, 3).ToUpper() ?? @"NO"; _employeePosition = position.PositionName; } _employeeName = String.Format(@"{0} {1}. {2}", enrollee.EmployeeFirstName, enrollee.EmployeeMiddleName.Substring(0, 1), enrollee.EmployeeLastName); labelEmployee.Text = String.Format(@"{0} - ({1})", _employeeName, _employeePosition); _listDTR = DTRManagement.LoadDTRViaDTR(enrollee, _iMonth, _iYear, DTRManager.GetAll(_iEnrolleeId), out _setting); dTRBindingSource.DataSource = _listDTR; ExecuteSaveDTRThread(); // loop to save dtr. MarkUnderOverTimeHours(); } Cursor = Cursors.Default; }
private void LoadDRTEnrollee(EmployeeData en) { Cursor = Cursors.WaitCursor; if (listBox1.Items.Count > 0) { var eName = en.GetFullName; Empoyee enrollee = EmployeeManager.Get(en.EnrolleeId); List <DtrData> lDTRSource01 = DTRManagement.LoadDTRViaDTRBatch(enrollee, iMonth, iStartDay, iEndDay, iYear, DTRManager.GetAll(en.EnrolleeId), eName, labelDuration.Text); lDTRSource.AddRange(lDTRSource01 as IEnumerable <DtrData>); } Cursor = Cursors.Default; }