private AG_IAS_SUBPAYMENT_D_T CreateSubPaymentDT(AG_IAS_SUBPAYMENT_H_T ht, String paymentNo, String idCard,
                                                         String status, String receiptNo, DateTime receiptDate)
        {
            AG_IAS_LICENSE_D licenD = LicenseDs.Single(l => l.ID_CARD_NO == idCard);
            AG_IAS_LICENSE_H licenH = LicenseHs.Single(l => l.UPLOAD_GROUP_NO == licenD.UPLOAD_GROUP_NO);

            return(new AG_IAS_SUBPAYMENT_D_T()
            {
                PAYMENT_NO = paymentNo,
                HEAD_REQUEST_NO = ht.HEAD_REQUEST_NO,
                ID_CARD_NO = licenD.ID_CARD_NO,
                LICENSE_NO = licenD.LICENSE_NO,
                LICENSE_TYPE_CODE = licenH.LICENSE_TYPE_CODE,
                RECORD_STATUS = status,
                RECEIPT_NO = receiptNo,
                RECEIPT_DATE = receiptDate,
                UPLOAD_GROUP_NO = licenD.UPLOAD_GROUP_NO,
                SEQ_NO = licenD.SEQ_NO
            });
        }
        public void TestSelect_PaymentRequestLicense_From_MockData()
        {
            String zipName = "TestZip6";

            DirectoryInfo zipFolder = CreateDirectory(Path.Combine(_netDrive, _oicPath), zipName, 0);

            //ดึงข้อมูลการเงินจากธนาคารใน Temp ตาม BatchID
            IEnumerable <AG_IAS_PAYMENT_G_T> paymentGTs = GetPaymentGTs();

            foreach (AG_IAS_PAYMENT_G_T paymentGT in paymentGTs)
            {
                //หาข้อมูลที่ Sub Payment Head
                IEnumerable <AG_IAS_SUBPAYMENT_H_T> subPaymentHTs = GetSubPaymentHead(paymentGT);

                foreach (AG_IAS_SUBPAYMENT_H_T SubPaymentHT in subPaymentHTs)
                {
                    IEnumerable <AG_IAS_SUBPAYMENT_D_T> subPaymentDTs = GetSubPaymentDetails(SubPaymentHT);


                    foreach (AG_IAS_SUBPAYMENT_D_T subPaymentDT in subPaymentDTs)
                    {
                        AG_IAS_LICENSE_D licenD = LicenseDs.SingleOrDefault(w => w.UPLOAD_GROUP_NO == subPaymentDT.UPLOAD_GROUP_NO &&
                                                                            w.SEQ_NO == subPaymentDT.SEQ_NO);
                        AG_IAS_LICENSE_H licenH = LicenseHs.Single(w => w.UPLOAD_GROUP_NO == licenD.UPLOAD_GROUP_NO);

                        AG_IAS_LICENSE_TYPE_R licenType = LicenseTypeRs.Single(l => l.LICENSE_TYPE_CODE == subPaymentDT.LICENSE_TYPE_CODE);

                        AG_IAS_ATTACH_FILE_LICENSE attach = AttachLicenses.Single(a => a.ID_CARD_NO == licenD.ID_CARD_NO &&
                                                                                  a.GROUP_LICENSE_ID == licenD.UPLOAD_GROUP_NO &&
                                                                                  a.ATTACH_FILE_PATH.EndsWith("03.jpg"));
                        AddLicenseRequest(zipFolder, SubPaymentHT, subPaymentDT, licenD, licenH, licenType, attach);
                    }
                }
            }

            using (ZipFile zip = new ZipFile())
            {
                zip.AddDirectory(zipFolder.FullName); // recurses subdirectories
                zip.Save(zipFolder.FullName + ".zip");
            }
        }