/// <summary>
        /// 根據銷帳編號獲取商戶資料
        /// </summary>
        /// <param name="compareCode"></param>
        /// <param name="compareCodeForCheck"></param>
        /// <returns></returns>
        private static BizCustomerSet GetBizCustomerSet(ApplicationDbContext dataAccess, Dictionary <string, BizCustomerSet> BizCustSetDic, string compareCode)
        {
            compareCode = compareCode.TrimStart('0');

            BizCustomerSet bizCust   = null;
            string         custCode6 = compareCode.Substring(0, 6),
                           custCode4 = compareCode.Substring(0, 4),
                           custCode3 = compareCode.Substring(0, 3);

            if (null == bizCust && BizCustSetDic.ContainsKey(custCode6))
            {
                bizCust = BizCustSetDic[custCode6];
            }
            if (null == bizCust && BizCustSetDic.ContainsKey(custCode4))
            {
                bizCust = BizCustSetDic[custCode4];
            }
            if (null == bizCust && BizCustSetDic.ContainsKey(custCode3))
            {
                bizCust = BizCustSetDic[custCode3];
            }
            if (null == bizCust)
            {
                using BizCustomerRepository biz = new BizCustomerRepository(dataAccess);
                if (null == bizCust)
                {
                    bizCust = biz.QueryData(new object[] { custCode6 });
                    if (null != bizCust)
                    {
                        BizCustSetDic.Add(custCode6, bizCust);
                    }
                }
                if (null == bizCust)
                {
                    bizCust = biz.QueryData(new object[] { custCode4 });
                    if (null != bizCust)
                    {
                        BizCustSetDic.Add(custCode4, bizCust);
                    }
                }
                if (null == bizCust)
                {
                    bizCust = biz.QueryData(new object[] { custCode3 });
                    if (null != bizCust)
                    {
                        BizCustSetDic.Add(custCode3, bizCust);
                    }
                }
            }
            return(bizCust);
        }
        private static void BizCustomer(SysMessageLog Message, ApplicationDbContext DataAccess)
        {
            try
            {
                Message.Prefix = "新增「商戶」-初始資料:";
                using BizCustomerRepository repo = new BizCustomerRepository(DataAccess)
                      {
                          User = SystemOperator.SysOperator, Message = Message
                      };
                List <BizCustomerSet> custs = new List <BizCustomerSet>()
                {
                    new BizCustomerSet()
                    {
                        BizCustomer = new BizCustomerModel()
                        {
                            CustomerCode = "445235", CustomerId = "48577921", AccountDeptId = "0019", RealAccount = "7714815486840", VirtualAccountLen = VirtualAccountLen.Len13,
                            BillTermLen  = 2, PayerNoLen = 5, VirtualAccount1 = VirtualAccount1.BillTerm, VirtualAccount2 = VirtualAccount2.PayerNo, VirtualAccount3 = VirtualAccount3.NoverifyCode, BizCustType = BizCustType.Introducer,
                            ChannelIds   = "00,01,02,03,04,05,12,13,14", CollectionTypeIds = LibData.Merge(",", false, SystemCP.BankCollectionTypeId, SystemCP.PostCollectionTypeId, "6V1,6V2,6V3"), AccountStatus = AccountStatus.Enable, ImportBatchNo = "BeginData"
                        },
                        BizCustomerFeeDetail = new List <BizCustomerFeeDetailModel>()
                        {
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "445235", ChannelGroupType = ChannelGroupType.Bank, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "445235", ChannelGroupType = ChannelGroupType.Market, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "445235", ChannelGroupType = ChannelGroupType.Post, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                        }
                    },
                    new BizCustomerSet()
                    {
                        BizCustomer = new BizCustomerModel()
                        {
                            CustomerCode = "774336", CustomerId = "77494941", AccountDeptId = "0019", RealAccount = "7714815486840", VirtualAccountLen = VirtualAccountLen.Len13,
                            BillTermLen  = 2, PayerNoLen = 5, VirtualAccount1 = VirtualAccount1.BillTerm, VirtualAccount2 = VirtualAccount2.PayerNo, VirtualAccount3 = VirtualAccount3.NoverifyCode, BizCustType = BizCustType.Hitrust,
                            ChannelIds   = "00,01,02,03,04,05,12,13,14", CollectionTypeIds = LibData.Merge(",", false, SystemCP.BankCollectionTypeId, SystemCP.PostCollectionTypeId, "6V1,6V2,6V3"), AccountStatus = AccountStatus.Enable, ImportBatchNo = "BeginData"
                        },
                        BizCustomerFeeDetail = new List <BizCustomerFeeDetailModel>()
                        {
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "774336", ChannelGroupType = ChannelGroupType.Bank, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "774336", ChannelGroupType = ChannelGroupType.Market, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "774336", ChannelGroupType = ChannelGroupType.Post, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                        }
                    },
                    new BizCustomerSet()
                    {
                        BizCustomer = new BizCustomerModel()
                        {
                            CustomerCode = "992086", CustomerId = "30262944", AccountDeptId = "0019", RealAccount = "0514101002570", VirtualAccountLen = VirtualAccountLen.Len13,
                            BillTermLen  = 3, PayerNoLen = 4, VirtualAccount1 = VirtualAccount1.BillTerm, VirtualAccount2 = VirtualAccount2.PayerNo, VirtualAccount3 = VirtualAccount3.NoverifyCode,
                            ChannelIds   = "00,01,02,03,04,05,12,13,14", CollectionTypeIds = LibData.Merge(",", false, SystemCP.BankCollectionTypeId, SystemCP.PostCollectionTypeId, "6V1,6V2,6V3"), BizCustType = BizCustType.Cust, AccountStatus = AccountStatus.Enable, ImportBatchNo = "BeginData"
                        },
                        BizCustomerFeeDetail = new List <BizCustomerFeeDetailModel>()
                        {
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "992086", ChannelGroupType = ChannelGroupType.Bank, BankFeeType = BankFeeType.ClearFee_NextMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "992086", ChannelGroupType = ChannelGroupType.Market, BankFeeType = BankFeeType.ClearFee_NextMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "992086", ChannelGroupType = ChannelGroupType.Post, BankFeeType = BankFeeType.ClearFee_NextMonth, Fee = 15, IntroPercent = 0
                            },
                        }
                    },
                    new BizCustomerSet()
                    {
                        BizCustomer = new BizCustomerModel()
                        {
                            CustomerCode = "2143", CustomerId = "00146877", AccountDeptId = "0019", RealAccount = "0518425007840", VirtualAccountLen = VirtualAccountLen.Len16,
                            BillTermLen  = 6, PayerNoLen = 6, VirtualAccount1 = VirtualAccount1.BillTerm, VirtualAccount2 = VirtualAccount2.PayerNo, VirtualAccount3 = VirtualAccount3.NoverifyCode, IntroCustomerCode = "445235",
                            ChannelIds   = "00,01,02,03,04,05,12,13,14", CollectionTypeIds = LibData.Merge(",", false, SystemCP.BankCollectionTypeId, SystemCP.PostCollectionTypeId, "6V1,6V2,6V3"), BizCustType = BizCustType.Cust, AccountStatus = AccountStatus.Enable, ImportBatchNo = "BeginData"
                        },
                        BizCustomerFeeDetail = new List <BizCustomerFeeDetailModel>()
                        {
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "2143", ChannelGroupType = ChannelGroupType.Bank, BankFeeType = BankFeeType.TotalFee, Fee = 35, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "2143", ChannelGroupType = ChannelGroupType.Market, BankFeeType = BankFeeType.TotalFee, Fee = 35, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "2143", ChannelGroupType = ChannelGroupType.Post, BankFeeType = BankFeeType.TotalFee, Fee = 35, IntroPercent = 0
                            },
                        }
                    },
                    new BizCustomerSet()
                    {
                        BizCustomer = new BizCustomerModel()
                        {
                            CustomerCode      = "805", CustomerId = "01031142", AccountDeptId = "0019", RealAccount = "7714815486840", VirtualAccountLen = VirtualAccountLen.Len14,
                            BillTermLen       = 5, PayerNoLen = 6, VirtualAccount1 = VirtualAccount1.BillTerm, VirtualAccount2 = VirtualAccount2.PayerNo, VirtualAccount3 = VirtualAccount3.NoverifyCode, BizCustType = BizCustType.Cust,
                            IntroCustomerCode = "445235",
                            ChannelIds        = "00,01,02,03,04,05,12,13,14", CollectionTypeIds = LibData.Merge(",", false, SystemCP.BankCollectionTypeId, SystemCP.PostCollectionTypeId, "6V1,6V2,6V3"), AccountStatus = AccountStatus.Enable, ImportBatchNo = "BeginData"
                        },
                        BizCustomerFeeDetail = new List <BizCustomerFeeDetailModel>()
                        {
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "805", ChannelGroupType = ChannelGroupType.Bank, BankFeeType = BankFeeType.TotalFee, Fee = 28, IntroPercent = 50
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "805", ChannelGroupType = ChannelGroupType.Market, BankFeeType = BankFeeType.TotalFee, Fee = 28, IntroPercent = 50
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "805", ChannelGroupType = ChannelGroupType.Post, BankFeeType = BankFeeType.TotalFee, Fee = 28, IntroPercent = 50
                            },
                        }
                    },
                    new BizCustomerSet()
                    {
                        BizCustomer = new BizCustomerModel()
                        {
                            CustomerCode = "993586", CustomerId = "00973171", AccountDeptId = "0019", RealAccount = "7714815486840", VirtualAccountLen = VirtualAccountLen.Len13,
                            BillTermLen  = 2, PayerNoLen = 5, VirtualAccount1 = VirtualAccount1.BillTerm, VirtualAccount2 = VirtualAccount2.PayerNo, VirtualAccount3 = VirtualAccount3.NoverifyCode, BizCustType = BizCustType.Cust,
                            ChannelIds   = "00,01,02,03,04,05,12,13,14", CollectionTypeIds = LibData.Merge(",", false, SystemCP.BankCollectionTypeId, SystemCP.PostCollectionTypeId, "6V1,6V2,6V3"), AccountStatus = AccountStatus.Enable, ImportBatchNo = "BeginData"
                        },
                        BizCustomerFeeDetail = new List <BizCustomerFeeDetailModel>()
                        {
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "993586", ChannelGroupType = ChannelGroupType.Bank, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "993586", ChannelGroupType = ChannelGroupType.Market, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                            new BizCustomerFeeDetailModel()
                            {
                                CustomerCode = "993586", ChannelGroupType = ChannelGroupType.Post, BankFeeType = BankFeeType.ClearFee_CurMonth, Fee = 15, IntroPercent = 0
                            },
                        }
                    },
                };

                custs.ForEach(cust =>
                {
                    if (null == repo.QueryData(new[] { cust.BizCustomer.CustomerCode }))
                    {
                        repo.Create(cust);
                    }
                });
                repo.CommitData(FuncAction.Create);
            }
            finally
            {
                Message.Prefix = string.Empty;
            }
        }
Beispiel #3
0
 /// <summary>
 /// 獲取客戶資料
 /// </summary>
 /// <param name="model"></param>
 /// <param name="bizCustomerSet"></param>
 /// <param name="customerSet"></param>
 private void GetCustomerInfo(ACCFTT model, BizCustomerRepository bizCustRepo, CustomerRepository custRepo, CustUserRepository custUserRepo, out BizCustomerSet bizCustomerSet, out CustomerSet customerSet, out CustUserSet custUserSet)
 {
     bizCustomerSet = bizCustRepo.QueryData(new object[] { model.KEYNO });
     customerSet    = custRepo.QueryData(new object[] { model.IDCODE.TrimStart('0') });
     custUserSet    = custUserRepo.QueryData(new object[] { $"{model.IDCODE.TrimStart('0')},admin" });
 }