Beispiel #1
0
        public void AddToAccountTest_Can_Default_Test()
        {
            try
            {
                IAS.DAL.Interfaces.IIASPersonEntities  _ctx    = DAL.DALFactory.GetPersonContext();;
                IAS.DAL.Interfaces.IIASFinanceEntities _ctxFin = DAL.DALFactory.GetFinanceContext();



                using (var ts = new TransactionScope())
                {
                    OracleConnection Connection = new OracleConnection(ConfigurationManager
                                                                       .ConnectionStrings[ConnectionFor.OraDB_Finance.ToString()]
                                                                       .ToString());
                    Connection.Open();

                    BillBiz               biz      = new BillBiz();
                    AG_IAS_PAYMENT_G_T    paymentG = _ctx.AG_IAS_PAYMENT_G_T.FirstOrDefault();
                    AG_IAS_SUBPAYMENT_D_T subd     = _ctx.AG_IAS_SUBPAYMENT_D_T.FirstOrDefault(a => a.HEAD_REQUEST_NO == "130924165707249" && a.PAYMENT_NO == "0001");

                    //var res = biz.AddToAccount(ref _ctx, ref _ctxFin, ref Connection, subd,paymentG, "52-2-034", BankType.KTB, (Decimal)subd.AMOUNT);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Beispiel #2
0
        public void AddDetail(AG_IAS_PAYMENT_G_T payment)
        {
            _currentRow++;

            AG_IAS_PERSONAL_T person = _ctx.AG_IAS_PERSONAL_T.Where(p => p.ID == payment.CREATED_BY).FirstOrDefault();
            LineKTBBankDetail detail = new LineKTBBankDetail()
            {
                SequenceNo        = _currentRow.ToString(),
                BankCode          = _bankCode,
                CompanyAccount    = _companyAccount,
                PaymentDate       = EffactiveDateString,
                PaymentTime       = _effactiveDate.AddMinutes(30).AddSeconds(8).ToString("HHmmss"),
                CustomerName      = (person == null) ? "" : String.Format("{0} {1}", person.NAMES, person.LASTNAME),
                Customer_No_Ref1  = payment.GROUP_REQUEST_NO,
                Ref2              = (payment.REF2 == null)?"":payment.REF2,
                Ref3              = "",
                BranchNo          = "0602",
                TellerNo          = "9953",
                KindOfTransaction = "C",
                TransactionCode   = "CSH",
                ChequeNo          = "",
                Amount            = ((payment.GROUP_AMOUNT == null)?"": ((Decimal)payment.GROUP_AMOUNT).ToString("0.00").Replace(".", "")),
                ChequeBankCode    = "",
                Spece             = ""
            };

            _lineKTBBankDetails.Add(detail);
        }
        public void InitialDataMocking()
        {
            // ***********  cost data ********************//
            CompanyCode = "3139";
            CompanyName = "บริษัท ไทยพาณิชย์ประกันภัย จำกัด (มหาชน)";
            _userId     = "0000000000000000";
            DateTime oneYearStart  = new DateTime(2013, 1, 1);
            DateTime oneYearEnd    = new DateTime(2014, 12, 31);
            DateTime fiveYearStart = new DateTime(2013, 1, 1);
            DateTime fiveYearEnd   = new DateTime(2018, 12, 31);
            /*********************************************/
            AG_IAS_LICENSE_H licenseH1 = CreateLicenseH("131004104328818", CompanyCode, CompanyName, 3, "13", "01");

            _licenseHs.Add(licenseH1);
            _licenseDs.Add(CreateLicenseD(licenseH1, (1).ToString("0000"), "L000000111", oneYearStart, oneYearEnd,
                                          "1111111111111", "นาย", "กไก่", "กุ่กกุ๊ก", UserId));
            _licenseDs.Add(CreateLicenseD(licenseH1, (2).ToString("0000"), "L000000112", oneYearStart, oneYearEnd,
                                          "1111111111112", "นาย", "ขไข่", "อยู่ในเล่า", UserId));
            _licenseDs.Add(CreateLicenseD(licenseH1, (3).ToString("0000"), "L000000113", oneYearStart, oneYearEnd,
                                          "1111111111113", "นาย", "คควาย", "เข้านา", UserId));

            AG_IAS_LICENSE_H licenseH2 = CreateLicenseH("131004104328819", CompanyCode, CompanyName, 3, "14", "02");

            _licenseHs.Add(licenseH2);
            _licenseDs.Add(CreateLicenseD(licenseH2, (1).ToString("0000"), "L000000221", fiveYearStart, oneYearEnd,
                                          "2222222222221", "นาง", "กไก่", "กุ่กกุ๊ก", UserId));
            _licenseDs.Add(CreateLicenseD(licenseH2, (2).ToString("0000"), "L000000222", fiveYearStart, fiveYearEnd,
                                          "2222222222222", "นาง", "ขไข่", "อยู่ในเล่า", UserId));
            _licenseDs.Add(CreateLicenseD(licenseH2, (3).ToString("0000"), "L000000223", fiveYearStart, fiveYearEnd,
                                          "2222222222223", "นาง", "คควาย", "เข้านา", UserId));


            AG_IAS_PAYMENT_G_T paymentGT = CreatePaymentGT("999999560900000001", "P", 6);

            _paymentGTs.Add(paymentGT);

            AG_IAS_SUBPAYMENT_H_T subHT1 = CreateSubPaymentHT(paymentGT, "1309231620210000", "13", "P", 3);

            _subPaymentHTs.Add(subHT1);
            DateTime d = DateTime.Now;

            _subPaymentDTs.Add(CreateSubPaymentDT(subHT1, (1).ToString("0000"), "1111111111111", "A", "12122e11300001", d));
            _subPaymentDTs.Add(CreateSubPaymentDT(subHT1, (2).ToString("0000"), "1111111111112", "A", "12122e11300002", d));
            _subPaymentDTs.Add(CreateSubPaymentDT(subHT1, (3).ToString("0000"), "1111111111113", "A", "12122e11300003", d));

            AG_IAS_SUBPAYMENT_H_T subHT2 = CreateSubPaymentHT(paymentGT, "1309231620220000", "14", "P", 3);

            _subPaymentHTs.Add(subHT2);
            _subPaymentDTs.Add(CreateSubPaymentDT(subHT2, (1).ToString("0000"), "2222222222221", "A", "12122e11300004", d));
            _subPaymentDTs.Add(CreateSubPaymentDT(subHT2, (2).ToString("0000"), "2222222222222", "A", "12122e11300005", d));
            _subPaymentDTs.Add(CreateSubPaymentDT(subHT2, (3).ToString("0000"), "2222222222223", "A", "12122e11300006", d));

            IAS.DAL.Interfaces.IIASPersonEntities ctx = DAL.DALFactory.GetPersonContext();
            _licenseTypeRs  = ctx.AG_IAS_LICENSE_TYPE_R.ToList();
            _petitionTypeRs = ctx.AG_IAS_PETITION_TYPE_R.ToList();
        }
 private AG_IAS_SUBPAYMENT_H_T CreateSubPaymentHT(AG_IAS_PAYMENT_G_T gt, String headNo, String pettNo, String status, Int16 numPerson)
 {
     return(new AG_IAS_SUBPAYMENT_H_T()
     {
         GROUP_REQUEST_NO = gt.GROUP_REQUEST_NO,
         HEAD_REQUEST_NO = headNo,
         PETITION_TYPE_CODE = pettNo,
         STATUS = status,
         PERSON_NO = numPerson
     });
 }
Beispiel #5
0
        public void TestEntityWhenNot_Save()
        {
            IAS.DAL.Interfaces.IIASPersonEntities ctx = DAL.DALFactory.GetPersonContext();

            AG_IAS_PAYMENT_G_T payment = ctx.AG_IAS_PAYMENT_G_T.FirstOrDefault(a => a.GROUP_REQUEST_NO == "999999561000000151");

            payment.STATUS = "M";

            AG_IAS_PAYMENT_G_T paymentnew   = ctx.AG_IAS_PAYMENT_G_T.FirstOrDefault(a => a.GROUP_REQUEST_NO == "999999561000000151");
            AG_IAS_PAYMENT_G_T paymentnew_3 = ctx.AG_IAS_PAYMENT_G_T.FirstOrDefault(a => a.GROUP_REQUEST_NO == "999999561000000151" && a.STATUS == "M");

            Assert.AreEqual(payment.STATUS, paymentnew.STATUS);
            Assert.IsNotNull(paymentnew_3);
        }
        private IEnumerable <AG_IAS_SUBPAYMENT_H_T> GetSubPaymentHead(AG_IAS_PAYMENT_G_T paymentGT)
        {
            IEnumerable <AG_IAS_SUBPAYMENT_H_T> subPaymentHTs = SubPaymentHTs
                                                                .Where(w => w.GROUP_REQUEST_NO == paymentGT.GROUP_REQUEST_NO &&
                                                                       (w.STATUS != null && w.STATUS == "P") &&
                                                                       (
                                                                           w.PETITION_TYPE_CODE == "11" ||
                                                                           w.PETITION_TYPE_CODE == "13" ||
                                                                           w.PETITION_TYPE_CODE == "14" ||
                                                                           w.PETITION_TYPE_CODE == "15" ||
                                                                           w.PETITION_TYPE_CODE == "16" ||
                                                                           w.PETITION_TYPE_CODE == "17" ||
                                                                           w.PETITION_TYPE_CODE == "18"
                                                                       )
                                                                       ).ToList();

            return(subPaymentHTs);
        }
Beispiel #7
0
        private static IEnumerable <AG_IAS_SUBPAYMENT_H_T> GetSubPaymentHead(IAS.DAL.Interfaces.IIASPersonEntities ctx, AG_IAS_PAYMENT_G_T paymentGT)
        {
            IEnumerable <AG_IAS_SUBPAYMENT_H_T> subPaymentHTs = ctx.AG_IAS_SUBPAYMENT_H_T
                                                                .Where(w => w.GROUP_REQUEST_NO == paymentGT.GROUP_REQUEST_NO &&
                                                                       (w.STATUS != null && w.STATUS == "P") &&
                                                                       (
                                                                           w.PETITION_TYPE_CODE == "11" ||
                                                                           w.PETITION_TYPE_CODE == "13" ||
                                                                           w.PETITION_TYPE_CODE == "14" ||
                                                                           w.PETITION_TYPE_CODE == "15" ||
                                                                           w.PETITION_TYPE_CODE == "16" ||
                                                                           w.PETITION_TYPE_CODE == "17" ||
                                                                           w.PETITION_TYPE_CODE == "18"
                                                                       )
                                                                       ).ToList();

            return(subPaymentHTs);
        }
Beispiel #8
0
        private void Validate()
        {
            _paymentStatus = DTO.ImportPaymentStatus.Valid;

            if (base.RECORD_TYPE != "6")
            {
                AddBrokenRule(BankFileDetailBusinessRules.RECORD_TYPE_Required);
            }

            if (Utils.DateUtil.ValidateDateFormatString("ddMMyyyy", base.PAYMENT_DATE, "th-TH"))
            {
                AddBrokenRule(BankFileDetailBusinessRules.PAYMENT_DATE_Required);
            }

            //if (Utils.DateUtil.ValidateDateFormatString("hhmmss", base.PAYMENT_TIME, "th-TH"))
            //    AddBrokenRule(BankFileDetailBusinessRules.PAYMENT_TIME_Required);

            if (String.IsNullOrEmpty(CUSTOMER_NO_REF1.Trim()))
            {
                AddBrokenRule(BankFileDetailBusinessRules.CUSTOMER_NO_REF1_Required);
            }

            if (base.CUSTOMER_NO_REF1.Length != 20)
            {
                AddBrokenRule(BankFileDetailBusinessRules.CUSTOMER_NO_REF1_Required);
            }

            Decimal tempInt;

            if (!Decimal.TryParse(base.AMOUNT, out tempInt))
            {
                AddBrokenRule(BankFileDetailBusinessRules.AMOUNT_Required);
            }

            if (_brokenRules.Count > 0)
            {
                _paymentStatus = DTO.ImportPaymentStatus.Invalid;
            }
            else
            {
                AG_IAS_PAYMENT_G_T payment = CityFileHeader.Context.AG_IAS_PAYMENT_G_T.FirstOrDefault(a => a.GROUP_REQUEST_NO == CUSTOMER_NO_REF1.Trim());

                if (payment == null)
                {
                    Int32 ref1 = 0;
                    if (Regex.IsMatch(CUSTOMER_NO_REF1.Trim(), @"^\d+$"))// Int32.TryParse(CUSTOMER_NO_REF1.Trim(), out ref1))
                    {
                        _paymentStatus = DTO.ImportPaymentStatus.MissingRefNo;
                    }
                    else
                    {
                        AddBrokenRule(BankFileDetailBusinessRules.CUSTOMER_NO_REF1_Required);
                        _paymentStatus = DTO.ImportPaymentStatus.Invalid;
                    }
                }
                else
                {
                    if (payment.STATUS == PaymentStatus.P.ToString())
                    {
                        AddBrokenRule(BankFileDetailBusinessRules.CUSTOMER_NO_REF1_Updated);
                        _paymentStatus = DTO.ImportPaymentStatus.Paid;
                    }
                    else
                    {
                        if (payment.EXPIRATION_DATE != null && (((DateTime)payment.EXPIRATION_DATE).Date < ParseDateFromString.ParseDateHeaderBank(PAYMENT_DATE).Date))
                        {
                            _paymentStatus = DTO.ImportPaymentStatus.Paylate;
                        }
                    }
                    //else if (PhaseAmountHelper.ConvertStringAmount(AMOUNT) != payment.GROUP_AMOUNT)
                    //{
                    //   AddBrokenRule(BankFileDetailBusinessRules.AMOUNT_Required);

                    //}
                }
            }
        }
Beispiel #9
0
 public PaymentTransaction(AG_IAS_PAYMENT_G_T transaction)
 {
     _transaction = transaction;
 }