Ejemplo n.º 1
0
 /// <summary>
 /// 檢查繳費截止日期是否未填
 /// </summary>
 /// <param name="payEndDate"></param>
 /// <param name="customer"></param>
 /// <returns></returns>
 private static void CheckPayEndDate(SysMessageLog message, BillModel bill)
 {
     if ((bill.BizCustomer.MarketEnable || bill.BizCustomer.PostEnable) && (bill.PayEndDate == null || bill.PayEndDate.Equals(DateTime.MinValue)))
     {
         message.AddCustErrorMessage(MessageCode.Code0001, ResxManage.GetDescription <BillModel>(p => p.PayEndDate));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 檢查「繳款人編號」是否皆為數字
 /// </summary>
 /// <param name="payerNo"></param>
 /// <returns></returns>
 private static void CheckPayerNoIsNotNum(SysMessageLog message, string payerNo)
 {
     if (!payerNo.IsNumberString())
     {
         message.AddCustErrorMessage(MessageCode.Code1006, ResxManage.GetDescription <PayerModel>(p => p.PayerNo));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 檢查超商代收項目
 /// </summary>
 /// <param name="payEndDate"></param>
 /// <param name="customer"></param>
 /// <returns></returns>
 private static void CheckCollectionTypeId(SysMessageLog message, ApplicationDbContext dataAccess, BillModel bill)
 {
     if (bill.BizCustomer.MarketEnable)
     {
         if (bill.CollectionTypeId.IsNullOrEmpty())
         {
             message.AddCustErrorMessage(MessageCode.Code0001, ResxManage.GetDescription <BillModel>(p => p.CollectionTypeId));
         }
         else
         {
             if (!bill.BizCustomer.CollectionTypeIds.Split(',').Contains(bill.CollectionTypeId))
             {
                 message.AddCustErrorMessage(MessageCode.Code1015, bill.CollectionTypeId);
             }
             else
             {
                 CollectionTypeDetailModel colDet = dataAccess.Set <CollectionTypeDetailModel>().FirstOrDefault(p => p.CollectionTypeId.Equals(bill.CollectionTypeId) && p.SRange <= bill.PayAmount && p.ERange >= bill.PayAmount);
                 if (null == colDet)
                 {
                     message.AddCustErrorMessage(MessageCode.Code1016, bill.CollectionTypeId);
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 檢查「繳款人編號」長度
 /// </summary>
 /// <param name="payer"></param>
 private static void CheckPayerNoLen(SysMessageLog message, PayerModel payer)
 {
     if (payer.PayerNo.Length != payer.BizCustomer.PayerNoLen)
     {
         message.AddCustErrorMessage(MessageCode.Code1005, ResxManage.GetDescription <PayerModel>(p => p.PayerNo), payer.BizCustomer.PayerNoLen);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 檢查繳款人是否為約定扣款帳號
 /// </summary>
 /// <param name="message"></param>
 /// <param name="payer"></param>
 private static void CheckPayerType(SysMessageLog message, PayerModel payer)
 {
     if (payer.PayerType != PayerType.Account)
     {
         message.AddCustErrorMessage(MessageCode.Code1017, payer.PayerName, ResxManage.GetDescription(PayerType.Account));
     }
 }
 /// <summary>
 /// 檢查資料
 /// </summary>
 /// <param name="set"></param>
 public static void CheckData(DepositBillSet set, SysMessageLog message, ApplicationDbContext dataAccess)
 {
     if (BizVirtualAccountCode.CheckBankCodeExist(dataAccess, set.DepositBill.VirtualAccountCode, out _))
     {
         message.AddCustErrorMessage(MessageCode.Code1008, ResxManage.GetDescription <DepositBillModel>(p => p.VirtualAccountCode), set.DepositBill.VirtualAccountCode);
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// 檢查「期別編號」是否為數字
 /// </summary>
 /// <param name="payer"></param>
 private static void CheckTermNo(SysMessageLog message, BillTermModel billTerm)
 {
     if (!billTerm.BillTermNo.IsNumberString())
     {
         message.AddCustErrorMessage(MessageCode.Code1006, ResxManage.GetDescription <BillTermModel>(p => p.BillTermNo));
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 檢查期別編號長度
 /// </summary>
 /// <param name="billTerm"></param>
 /// <returns></returns>
 private static void CheckTermNoLen(SysMessageLog message, BillTermModel billTerm)
 {
     if (billTerm.BizCustomer.BillTermLen != billTerm.BillTermNo.Length)
     {
         message.AddCustErrorMessage(MessageCode.Code1005, ResxManage.GetDescription <BillTermModel>(p => p.BillTermNo), billTerm.BizCustomer.BillTermLen);
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lst"></param>
        /// <returns></returns>
        private static DataTable CreateDynamicDataTable(List <TotalReceiptRpt> lst)
        {
            lst.Sort((x, y) => { return(x.ChannelId.CompareTo(y.ChannelId)); });
            DataTable result = new DataTable();
            string    propName;

            foreach (var prop in typeof(TotalReceiptRpt).GetProperties())
            {
                propName = prop.Name;
                switch (propName)
                {
                case nameof(TotalReceiptRpt.ChannelId):
                case nameof(TotalReceiptRpt.ChannelName):
                    break;

                default:
                {
                    DataColumn col = new DataColumn(propName)
                    {
                        Caption = ResxManage.GetDescription(prop)
                    };
                    result.Columns.Add(col);
                }
                break;
                }
            }
            foreach (var m in lst)
            {
                string dynamicColName = $"{nameof(m.ChannelId)}_{m.ChannelId}_Count";
                if (!result.Columns.Contains(dynamicColName))
                {
                    DataColumn col = new DataColumn(dynamicColName)
                    {
                        Caption = m.ChannelName
                    };
                    result.Columns.Add(col);
                }
                dynamicColName = $"{nameof(m.ChannelId)}_{m.ChannelId}_Amount";
                if (!result.Columns.Contains(dynamicColName))
                {
                    DataColumn col = new DataColumn(dynamicColName)
                    {
                        Caption = m.ChannelName
                    };
                    result.Columns.Add(col);
                }

                dynamicColName = $"{nameof(m.ChannelId)}_{m.ChannelId}_Fee";
                if (!result.Columns.Contains(dynamicColName))
                {
                    DataColumn col = new DataColumn(dynamicColName)
                    {
                        Caption = m.ChannelName
                    };
                    result.Columns.Add(col);
                }
            }
            return(result);
        }
Ejemplo n.º 10
0
 /// <summary>
 /// 檢查期別編號是否重複
 /// </summary>
 /// <param name="dataAccess"></param>
 /// <param name="billTerm"></param>
 /// <returns></returns>
 private static void CheckTermNoExist(SysMessageLog message, ApplicationDbContext dataAccess, BillTermModel billTerm)
 {
     if (dataAccess.Set <BillTermModel>().Any(p => p.InternalId != billTerm.InternalId && p.CustomerCode == billTerm.CustomerCode &&
                                              p.BillTermNo == billTerm.BillTermNo && (p.FormStatus == FormStatus.Saved || p.FormStatus == FormStatus.Approved)))
     {
         message.AddCustErrorMessage(MessageCode.Code1008, ResxManage.GetDescription <BillTermModel>(p => p.BillTermNo), billTerm.BillTermNo);
     }
 }
Ejemplo n.º 11
0
 public BaseEnumerationGraphType()
 {
     Name        = typeof(TEnum).Name;
     Description = ResxManage.GetDescription <TEnum>();
     foreach (Enum val in Enum.GetValues(typeof(TEnum)))
     {
         AddValue(val.ToString(), ResxManage.GetDescription(val), val.GetValue());
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// 檢查資料
 /// </summary>
 /// <param name="set"></param>
 public static void CheckData(BillSet set, SysMessageLog message, ApplicationDbContext dataAccess)
 {
     if (BizVirtualAccountCode.CheckBankCodeExist(dataAccess, set.Bill.VirtualAccountCode, out _))
     {
         message.AddCustErrorMessage(MessageCode.Code1008, ResxManage.GetDescription <BillModel>(p => p.VirtualAccountCode), set.Bill.VirtualAccountCode);
     }
     CalcTotalPayAmount(set);
     CheckPayEndDate(message, set.Bill);
     CheckCollectionTypeId(message, dataAccess, set.Bill);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 檢查繳款人編號是否重複
 /// </summary>
 /// <param name="dataAccess"></param>
 /// <param name="payer"></param>
 /// <returns></returns>
 private static void CheckPayerNoExist(SysMessageLog message, ApplicationDbContext dataAccess, PayerModel payer)
 {
     if (dataAccess.Set <PayerModel>().Any(p =>
                                           !p.InternalId.Equals(payer.InternalId) &&
                                           p.CustomerCode.Equals(payer.CustomerCode) &&
                                           p.PayerNo.Equals(payer.PayerNo) &&
                                           (p.FormStatus == FormStatus.Saved) || p.FormStatus == FormStatus.Approved))
     {
         message.AddCustErrorMessage(MessageCode.Code1008, ResxManage.GetDescription <PayerModel>(p => p.PayerNo), payer.PayerNo);
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// 檢查介紹商企業代號是否有選擇
 /// </summary>
 /// <param name="set"></param>
 private static void CheckBizCustType(SysMessageLog message, BizCustomerSet set)
 {
     if (set.BizCustomerFeeDetail.Any(p => p.BankFeeType == BankFeeType.Hitrust_ClearFee_CurMonth || p.BankFeeType == BankFeeType.Hitrust_ClearFee_NextMonth))
     {
         if (set.BizCustomer.IntroCustomerCode.IsNullOrEmpty() || set.BizCustomer.IntroCustomer.BizCustType != BizCustType.Hitrust)
         {
             message.AddCustErrorMessage(MessageCode.Code1019, ResxManage.GetDescription(BizCustType.Hitrust));
         }
     }
     if (set.BizCustomerFeeDetail.Any(p => p.BankFeeType == BankFeeType.TotalFee && p.IntroPercent > 0m))
     {
         if (set.BizCustomer.IntroCustomerCode.IsNullOrEmpty() || set.BizCustomer.IntroCustomer.BizCustType != BizCustType.Introducer)
         {
             message.AddCustErrorMessage(MessageCode.Code1019, ResxManage.GetDescription(BizCustType.Introducer));
         }
     }
 }
Ejemplo n.º 15
0
 public ReceiptBillRptQuery() : base()
 {
     Field(
         type: typeof(BooleanGraphType),
         name: nameof(IBillRptRepository.BillPayProgressRpt),
         description: SystemCP.DESC_BillPayProgressRpt,
         arguments: new QueryArguments(
             new QueryArgument <NonNullGraphType <StringGraphType> > {
         Name = nameof(BillModel.CustomerCode), Description = ResxManage.GetDescription <BillModel>(p => p.CustomerCode)
     },
             new QueryArgument <NonNullGraphType <StringGraphType> > {
         Name = nameof(BillModel.BillTermId), Description = ResxManage.GetDescription <BillModel>(p => p.BillTermId)
     }
             ),
         resolve: context =>
     {
         return(null);// repository.BillPayProgressRpt(context.GetArgument<string>(nameof(BillModel.CustomerCode)), context.GetArgument<string>(nameof(BillModel.BillTermId)));
     });
 }
Ejemplo n.º 16
0
        /// <summary>
        /// 獲取帳單繳費進度報表
        /// </summary>
        public static List <BillPayProgressRptModel> GetBillPayProgressRpt(ApplicationDbContext dataAccess, string customerCode, string billTermId)
        {
            List <BillPayProgressRptModel> result = new List <BillPayProgressRptModel>();

            result.AddRange(dataAccess.Set <BillModel>().Where(p =>
                                                               (customerCode.IsNullOrEmpty() || p.CustomerCode.Equals(customerCode)) &&
                                                               (billTermId.IsNullOrEmpty() || p.BillTermId.Equals(billTermId)) &&
                                                               p.PayStatus == PayStatus.Unpaid
                                                               ).Select(p => new BillPayProgressRptModel
            {
                BillNo             = p.BillNo,
                PayEndDate         = p.PayEndDate,
                PayerId            = p.Payer.PayerId,
                PayerName          = p.Payer.PayerName,
                PayerType          = ResxManage.GetDescription(p.Payer.PayerType),
                VirtualAccountCode = p.VirtualAccountCode,
                PayStatus          = ResxManage.GetDescription(p.PayStatus),
                PayAmount          = p.PayAmount,
                HadPayAmount       = p.HadPayAmount,
            }));
            result.AddRange(dataAccess.Set <BillReceiptDetailModel>().Where(p =>
                                                                            (customerCode.IsNullOrEmpty() || p.Bill.CustomerCode.Equals(customerCode)) &&
                                                                            (billTermId.IsNullOrEmpty() || p.Bill.BillTermId.Equals(billTermId))
                                                                            ).Select(p => new BillPayProgressRptModel
            {
                BillNo             = p.BillNo,
                PayEndDate         = p.Bill.PayEndDate,
                PayerId            = p.Bill.Payer.PayerId,
                PayerName          = p.Bill.Payer.PayerName,
                PayerType          = ResxManage.GetDescription(p.Bill.Payer.PayerType),
                VirtualAccountCode = p.Bill.VirtualAccountCode,
                PayStatus          = ResxManage.GetDescription(p.Bill.PayStatus),
                PayAmount          = p.Bill.PayAmount,
                HadPayAmount       = p.Bill.HadPayAmount,
                TradeDate          = p.ReceiptBill.TradeDate,
                ExpectRemitDate    = p.ReceiptBill.ExpectRemitDate,
                ChannelId          = p.ReceiptBill.Channel.ChannelId,
                ChannelName        = p.ReceiptBill.Channel.ChannelName,
            }));
            return(result);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 添加自定義錯誤訊息
        /// </summary>
        /// <param name="messageCode"></param>
        /// <param name="args"></param>
        public void AddCustErrorMessage(MessageCode messageCode, params object[] args)
        {
            ExecutionError err = new ExecutionError(string.Format($"{Prefix}{messageCode}:{ResxManage.GetDescription(messageCode)}", args))
            {
                Code = SystemCP.CustomerMessageCode, Source = ErrStack
            };

            Errors.Add(err);
            MsgCodeList.Add(messageCode);
        }
Ejemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="expectData"></param>
 /// <param name="actualData"></param>
 private void AssertSet(BizCustomerSet expectData, BizCustomerSet actualData)
 {
     Assert.AreEqual(expectData.BizCustomer.MarketEnable, actualData.BizCustomer.MarketEnable, ResxManage.GetDescription <BizCustomerModel>(p => p.MarketEnable));
     Assert.AreEqual(expectData.BizCustomer.PostEnable, actualData.BizCustomer.PostEnable, ResxManage.GetDescription <BizCustomerModel>(p => p.PostEnable));
     for (int i = 0; i < expectData.BizCustomerFeeDetail.Count; i++)
     {
         Assert.AreEqual(expectData.BizCustomerFeeDetail[i].IntroPercent, actualData.BizCustomerFeeDetail[i].IntroPercent);
     }
 }