private void btnPayrollExport_Click(object sender, EventArgs e) { try { DateTime dPayrollFrom = dtpAttendanceFrom.Value.Date; DateTime dPayrollTo = dtpAttedanceTo.Value.Date; if (dPayrollFrom.CompareTo(dPayrollTo) == 1) { MessageBox.Show(this, "beginDate>endDate"); return; } int iCompany = (int)cbxCompany.SelectedValue; int iDepartment = -1; if (cbxDepartment.Enabled) iDepartment = (int)cbxDepartment.SelectedValue; string errorNumber = ""; int wcalID = 0; List<PayrollExport> payrollExports = _dtCtrl.GetPayrollExportList(iCompany, iDepartment, dPayrollFrom, dPayrollTo, wcalID, ref errorNumber); //List<WorkingCalendar> workingCalendars = new List<WorkingCalendar>(); //bool payrollExports = _dtCtrl.ExistPayrollExportList(iCompany, iDepartment, dPayrollFrom, dPayrollTo, ref errorNumber, ref workingCalendars); //if (payrollExports == false) //{ // string msgAlert = ""; // switch (errorNumber) // { // case "AM01": // if (workingCalendars.Count > 1) // { // frmChooseWorkingCalendar _frmChooseWorkingCalendar = new frmChooseWorkingCalendar(workingCalendars, dPayrollFrom, dPayrollTo, iCompany, iDepartment); // DialogResult diag = _frmChooseWorkingCalendar.ShowDialog(this); // } // return; // case "AM00": // default: // msgAlert = "Not match"; // MessageBox.Show(this, msgAlert); // return; // } //} if (payrollExports.Count > 0) { frmPayrollExport formExport = new frmPayrollExport(iCompany, iDepartment, dPayrollFrom, dPayrollTo, 0); formExport.ShowDialog(this); } else { //MessageBox.Show(this, "Not match"); MessageBox.Show(this, "There's no record within the selected range."); } } catch (Exception ex) { Util.ShowErrorMessage(ex); } }
private void btnPayrollExport_Click(object sender, EventArgs e) { try { DateTime dPayrollFrom = dtpAttendanceFrom.Value.Date; DateTime dPayrollTo = dtpAttedanceTo.Value.Date; if (dPayrollFrom.CompareTo(dPayrollTo) == 1) { MessageBox.Show(this, "beginDate>endDate"); return; } int iCompany = (int)cbxCompany.SelectedValue; int iDepartment = -1; if (cbxDepartment.Enabled) { iDepartment = (int)cbxDepartment.SelectedValue; } string errorNumber = ""; int wcalID = 0; List <PayrollExport> payrollExports = _dtCtrl.GetPayrollExportList(iCompany, iDepartment, dPayrollFrom, dPayrollTo, wcalID, ref errorNumber); //List<WorkingCalendar> workingCalendars = new List<WorkingCalendar>(); //bool payrollExports = _dtCtrl.ExistPayrollExportList(iCompany, iDepartment, dPayrollFrom, dPayrollTo, ref errorNumber, ref workingCalendars); //if (payrollExports == false) //{ // string msgAlert = ""; // switch (errorNumber) // { // case "AM01": // if (workingCalendars.Count > 1) // { // frmChooseWorkingCalendar _frmChooseWorkingCalendar = new frmChooseWorkingCalendar(workingCalendars, dPayrollFrom, dPayrollTo, iCompany, iDepartment); // DialogResult diag = _frmChooseWorkingCalendar.ShowDialog(this); // } // return; // case "AM00": // default: // msgAlert = "Not match"; // MessageBox.Show(this, msgAlert); // return; // } //} if (payrollExports.Count > 0) { frmPayrollExport formExport = new frmPayrollExport(iCompany, iDepartment, dPayrollFrom, dPayrollTo, 0); formExport.ShowDialog(this); } else { //MessageBox.Show(this, "Not match"); MessageBox.Show(this, "There's no record within the selected range."); } } catch (Exception ex) { Util.ShowErrorMessage(ex); } }