public void ProcessCloseRunFromQueue(CloseQueue closeQueue) { if (closeQueue.RunType == "T") { busClosePayrollRun.Close_TimeAttendance_Run(closeQueue.CompanyNo, closeQueue.WagePayPeriodDate, closeQueue.WagesPayCategoryNumberArray, closeQueue.UserNo); } else { if (closeQueue.RunType == "W") { busClosePayrollRun.Close_Wage_Run(closeQueue.CompanyNo, closeQueue.WagePayPeriodDate, closeQueue.WagesPayCategoryNumberArray, closeQueue.UserNo); } else { if (closeQueue.RunType == "S") { busClosePayrollRun.Close_Salary_Run(closeQueue.CompanyNo, closeQueue.SalaryPayPeriodDate, closeQueue.SalariesPayCategoryNumberArray, closeQueue.UserNo); } else { //Both busClosePayrollRun.Close_Both_Run(closeQueue.CompanyNo, closeQueue.WagePayPeriodDate, closeQueue.SalaryPayPeriodDate, closeQueue.WagesPayCategoryNumberArray, closeQueue.SalariesPayCategoryNumberArray, closeQueue.UserNo); } } } }
private void ProcessCloseQueue() { DataSet DataSetProcessCloseQueue = new DataSet(); int intWhere = 0; try { StringBuilder strQry = new StringBuilder(); strQry.Clear(); strQry.AppendLine(" SELECT TOP 2 "); strQry.AppendLine(" USER_NO"); strQry.AppendLine(",COMPANY_NO"); strQry.AppendLine(",RUN_TYPE"); strQry.AppendLine(",WAGE_PAY_PERIOD_DATE"); strQry.AppendLine(",SALARY_PAY_PERIOD_DATE"); strQry.AppendLine(",WAGES_PAY_CATEGORY_NUMBERS"); strQry.AppendLine(",SALARIES_PAY_CATEGORY_NUMBERS"); strQry.AppendLine(" FROM InteractPayroll.dbo.CLOSE_RUN_QUEUE"); strQry.AppendLine(" WHERE CLOSE_RUN_QUEUE_IND IS NULL"); intWhere = 1; clsDBConnectionObjectsProcessCloseQueue.Create_DataTable(strQry.ToString(), DataSetProcessCloseQueue, "CloseQueue", -1); if (DataSetProcessCloseQueue.Tables["CloseQueue"].Rows.Count > 0) { intWhere = 2; List <CloseQueue> closeQueueList = new List <CloseQueue>(); intWhere = 3; for (int intRow = 0; intRow < DataSetProcessCloseQueue.Tables["CloseQueue"].Rows.Count; intRow++) { intWhere = 4; CloseQueue closeQueue = new CloseQueue(); closeQueue.UserNo = Convert.ToInt64(DataSetProcessCloseQueue.Tables["CloseQueue"].Rows[intRow]["USER_NO"]); closeQueue.CompanyNo = Convert.ToInt64(DataSetProcessCloseQueue.Tables["CloseQueue"].Rows[intRow]["COMPANY_NO"]); closeQueue.RunType = DataSetProcessCloseQueue.Tables["CloseQueue"].Rows[intRow]["RUN_TYPE"].ToString(); closeQueue.WagesPayCategoryNumberArray = DataSetProcessCloseQueue.Tables["CloseQueue"].Rows[intRow]["WAGES_PAY_CATEGORY_NUMBERS"].ToString(); closeQueue.SalariesPayCategoryNumberArray = DataSetProcessCloseQueue.Tables["CloseQueue"].Rows[intRow]["SALARIES_PAY_CATEGORY_NUMBERS"].ToString(); if (closeQueue.RunType != "S") { closeQueue.WagePayPeriodDate = Convert.ToDateTime(DataSetProcessCloseQueue.Tables["CloseQueue"].Rows[intRow]["WAGE_PAY_PERIOD_DATE"]); } if (closeQueue.RunType == "B" || closeQueue.RunType == "S") { closeQueue.SalaryPayPeriodDate = Convert.ToDateTime(DataSetProcessCloseQueue.Tables["CloseQueue"].Rows[intRow]["SALARY_PAY_PERIOD_DATE"]); } intWhere = 5; closeQueueList.Add(closeQueue); } intWhere = 6; ProcessCloseRunQueueParallel(closeQueueList); } } catch (Exception ex) { WriteExceptionErrorLog("ProcessCloseQueue " + intWhere.ToString(), ex); } finally { DataSetProcessCloseQueue.Dispose(); } }