private void ProcessEmailPayslipQueue()
        {
            DataSet DataSetProcessEmailQueue = new DataSet();
            int     intWhere = 0;

            try
            {
                StringBuilder strQry = new StringBuilder();

                strQry.Clear();

                strQry.AppendLine(" SELECT TOP 2 ");
                strQry.AppendLine(" COMPANY_NO");
                strQry.AppendLine(",USER_NO");
                strQry.AppendLine(",PAY_PERIOD_DATE");
                strQry.AppendLine(",PAYSLIP_EMAIL_QUEUE_NO");

                strQry.AppendLine(" FROM InteractPayroll.dbo.PAYSLIP_EMAIL_QUEUE");

                strQry.AppendLine(" WHERE START_RUN_DATE IS NULL");

                intWhere = 1;

                clsDBConnectionObjectsProcessEmailPayslipQueue.Create_DataTable(strQry.ToString(), DataSetProcessEmailQueue, "EmailPayslipQueue", -1);

                if (DataSetProcessEmailQueue.Tables["EmailPayslipQueue"].Rows.Count > 0)
                {
                    intWhere = 2;

                    List <EmailPayslipQueue> emailPayslipQueueList = new List <EmailPayslipQueue>();

                    intWhere = 3;

                    for (int intRow = 0; intRow < DataSetProcessEmailQueue.Tables["EmailPayslipQueue"].Rows.Count; intRow++)
                    {
                        intWhere = 4;

                        EmailPayslipQueue emailPayslipQueue = new EmailPayslipQueue();

                        emailPayslipQueue.CompanyNo           = Convert.ToInt64(DataSetProcessEmailQueue.Tables["EmailPayslipQueue"].Rows[intRow]["COMPANY_NO"]);
                        emailPayslipQueue.UserNo              = Convert.ToInt64(DataSetProcessEmailQueue.Tables["EmailPayslipQueue"].Rows[intRow]["USER_NO"]);
                        emailPayslipQueue.PayPeriodDate       = Convert.ToDateTime(DataSetProcessEmailQueue.Tables["EmailPayslipQueue"].Rows[intRow]["PAY_PERIOD_DATE"]);
                        emailPayslipQueue.PayslipEmailQueueNo = Convert.ToInt32(DataSetProcessEmailQueue.Tables["EmailPayslipQueue"].Rows[intRow]["PAYSLIP_EMAIL_QUEUE_NO"]);

                        intWhere = 5;

                        emailPayslipQueueList.Add(emailPayslipQueue);
                    }

                    intWhere = 6;

                    ProcessEmailPayslipQueueParallel(emailPayslipQueueList);
                }
            }
            catch (Exception ex)
            {
                WriteExceptionErrorLog("ProcessEmailPayslipQueue " + intWhere.ToString(), ex);
            }
            finally
            {
                DataSetProcessEmailQueue.Dispose();
            }
        }
Exemple #2
0
 public void ProcessEmailPayslipFromQueue(EmailPayslipQueue emailPayslipQueue)
 {
     busRptPaySlip.Email_Payslips(emailPayslipQueue.CompanyNo, emailPayslipQueue.UserNo, emailPayslipQueue.PayPeriodDate, emailPayslipQueue.PayslipEmailQueueNo);
 }