加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 每月结算周期的最佳模式

发布时间:2020-12-15 08:14:57 所属栏目:百科 来源:网络整理
导读:我为我的新计费系统编写了一些代码.目的是在每个月的同一天向客户收费. (不是本月的第1天或最后一天) static bool NeedToBill(DateTime planLastBilled,DateTime cycleDate) { // is today the same date as the cycleDate AND is was the planLastBilled no
我为我的新计费系统编写了一些代码.目的是在每个月的同一天向客户收费. (不是本月的第1天或最后一天)
static bool NeedToBill(DateTime planLastBilled,DateTime cycleDate)
    {
        // is today the same date as the cycleDate AND is was the planLastBilled not the same day as today?
        if (DateTime.UtcNow.Day.Equals(cycleDate.Day) && !DateTime.UtcNow.Day.Equals(planLastBilled))
            return true;
        else
            return false;
    }

两个陷阱是:

>如果他的cycleDate.Day是31,而当前月只有29天
> cycleDate是2012年2月29日 – 他只会在闰年上收费

这里有一个共同的最佳做法吗?

所以看起来有很多事要检查

>这个帐户本月已经开帐单吗?
>周期日是否存在于当月
>是周期日大于或等于当前日期(这是理想的情况,如果
交易在前一天失败了)

谢谢!

解决方法

只允许选择1到28之间的结算日.根据我的经验,这是大多数信用卡/贷款公司在给出选择时如何处理它.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读