Пример #1
0
        /// <summary>
        /// 獲取啟用代收類別
        /// </summary>
        /// <param name="accftt"></param>
        /// <returns></returns>
        private static string GetCollectionType(ACCFTT accftt)
        {
            List <string> collections = new List <string>();

            if (!accftt.RECVITEM1.IsNullOrEmpty())
            {
                collections.Add(accftt.RECVITEM1);
            }

            if (!accftt.RECVITEM2.IsNullOrEmpty())
            {
                collections.Add(accftt.RECVITEM2);
            }

            if (!accftt.RECVITEM3.IsNullOrEmpty())
            {
                collections.Add(accftt.RECVITEM3);
            }

            if (!accftt.RECVITEM4.IsNullOrEmpty())
            {
                collections.Add(accftt.RECVITEM4);
            }

            if (!accftt.RECVITEM5.IsNullOrEmpty())
            {
                collections.Add(accftt.RECVITEM5);
            }

            collections.Sort();
            return(LibData.Merge(",", false, collections.ToArray()));
        }
Пример #2
0
            private string GetSearch(int count)
            {
                string result = string.Empty;

                for (int i = 1; i <= count; i++)
                {
                    result = LibData.Merge(", ", false, result, $"search{i}");
                }
                return(result);
            }
        /// <summary>
        /// 檢查是否有通路尚未填寫核銷規則
        /// </summary>
        /// <returns></returns>
        private static void CheckChannelVerifyPeriod(SysMessageLog message, CollectionTypeSet set)
        {
            Dictionary <string, string> detail = set.CollectionTypeDetail.Select(p => p.Channel).Distinct().ToDictionary(p => p.ChannelId, q => q.ChannelName);
            Dictionary <string, CollectionTypeVerifyPeriodModel> period = set.CollectionTypeVerifyPeriod.ToDictionary(p => p.ChannelId, q => q);
            List <string> detailExpectChannels = detail.Keys.Except(period.Keys).ToList();

            string[] notWriteChannels = detail?.Where(p => p.Key.In(detailExpectChannels.ToArray())).Select(p => p.Value).Distinct().ToArray();
            string   channelName      = LibData.Merge(",", false, notWriteChannels);

            if (!channelName.IsNullOrEmpty())
            {
                message.AddCustErrorMessage(MessageCode.Code1014, channelName);
            }
        }
        /// <summary>
        /// 檢查收款區間是否重疊
        /// </summary>
        /// <param name="detail"></param>
        /// <returns></returns>
        private static void CheckIsOverlap(SysMessageLog message, List <CollectionTypeDetailModel> detail)
        {
            List <CollectionTypeDetailModel> dt = detail.Where(p => detail.Where(q =>
                                                                                 q.RowState != RowState.Delete &&
                                                                                 p.RowId != q.RowId &&
                                                                                 p.ChannelId.Equals(q.ChannelId) &&
                                                                                 (p.SRange >= q.SRange && p.SRange <= q.ERange || p.ERange >= q.SRange && p.ERange <= q.ERange)
                                                                                 ).Any()).ToList();
            string channelName = LibData.Merge(",", false, dt?.Select(p => p.Channel.ChannelName).Distinct().ToArray());

            if (!channelName.IsNullOrEmpty())
            {
                message.AddCustErrorMessage(MessageCode.Code1013, channelName);
            }
        }
Пример #5
0
 private void CreateFragment()
 {
     foreach (Type type in GraphTypes)
     {
         string[] strs    = type.Namespace.Split('.');
         string   subPath = string.Empty;
         for (int i = 2; i < strs.Length; i++)
         {
             subPath = LibData.Merge(@"/", false, subPath, strs[i].ToCamelCase());
         }
         string fullPath = LibData.Merge(@"/", false, Path, subPath);
         Directory.CreateDirectory(fullPath);
         dynamic set = Activator.CreateInstance(type);
         using StreamWriter file = new StreamWriter($@"{fullPath}/{LibData.ToCamelCase(set.Name)}.fragment.js", true);
         file.Write(Template(set));
     }
 }
Пример #6
0
            private string Template(string subPath, dynamic set)
            {
                string frontDir = string.Empty;
                int    subLv    = subPath.Split('/').Length;

                for (int i = 0; i < subLv; i++)
                {
                    frontDir = LibData.Merge("/", false, frontDir, "..");
                }

                string fullPath = LibData.Merge("/", false, frontDir, "../fragments", subPath, $"{ LibData.ToCamelCase(set.Name)}.fragment");

                return($@"import {{ gql }} from ""apollo-boost"";
import {LibData.ToCamelCase(set.Name)}Fragment from ""{fullPath}"";
{GetDataList(set)}
{GetDataInfo(set)}
");
            }
Пример #7
0
            private string Template(string subPath, dynamic set)
            {
                List <dynamic> tableInstList = new List <dynamic>();

                foreach (var table in set.Fields)
                {
                    dynamic tableInst = Activator.CreateInstance(table.Type);
                    if (tableInst is ListGraphType)
                    {
                        tableInst = Activator.CreateInstance(tableInst.Type);
                    }
                    tableInstList.Add(tableInst);
                }

                string frontDir = string.Empty;
                int    subLv    = subPath.Split('/').Length;

                for (int i = 0; i < subLv; i++)
                {
                    frontDir = LibData.Merge("/", false, frontDir, "..");
                }

                string fullPath = LibData.Merge("/", false, frontDir, "../fragments", subPath, $"{ LibData.ToCamelCase(set.Name)}.fragment");

                return($@"import {{ gql }} from ""apollo-boost"";
import {LibData.ToCamelCase(set.Name)}Fragment from ""{fullPath}""; 

{GetReturnedFields(set.Name, tableInstList)}
{GetCreate(set.Name, tableInstList.Count)}
{GetUpdate(set.Name, tableInstList.Count)}
{GetDelete(set.Name, tableInstList.Count)}
{GetApprove(set.Name, tableInstList.Count)}
{GetInvalid(set.Name, tableInstList.Count)}
{GetEndcase(set.Name, tableInstList.Count)}
");
            }
Пример #8
0
        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;
            }
        }