小编Ful*_*ons的帖子

BizTalk平面文件架构 - 如何接受LF或CRLF作为行分隔符

我们的客户端向我们发送一个平面文件作为输入,然后我们在发送到目标系统之前将其转换为XML文件.

平面文件由多行组成,每行由LF或CRLF分隔.

如何创建平面文件架构,以便BizTalk可以解释每一行数据,无论该行是由LF(0x0A)还是CRLF(0x0D 0x0A)分隔?

biztalk flat-file biztalk-2009

6
推荐指数
1
解决办法
8304
查看次数

如何在我自己的自定义帮助程序中使用ASP.NET MVC ValidationMessage HTML Helper?

我正在尝试创建一个自定义的HTML Helper,它封装了一些表示逻辑,因为我必须在同一页面上以及将来重复使用这个逻辑几次.

如果用户的地址在北美,那么我希望为电话号码输入显示两个文本框,一个用于区号,另一个用于剩余的数字.如果地址在北美之外,那么我想要一个单独的文本框来显示完整的数字.

下面的代码按预期工作输出正确的文本框,但是,只要我添加了与每个文本框关联的验证,我现在从ValidationMessage Helper调用的ToString()调用中抛出NullReferenceException(ValidationMessage)帮助者返回空值!!).

public static string TelephoneNumberInputListItem(this HtmlHelper helper,
                                         string country,
                                         string northAmericanAreaCodeFormName,
                                         string northAmericanAreaCode,
                                         string northAmericanRemainingNumberFormName,
                                         string northAmericanRemainingNumber,
                                         string internationalFullNumberFormName,
                                         string internationalFullNumber)
    {

        //set up the error message and styling
        object errorHtmlAttributes = new { @class = "fError" };
        string validationMessage = "*";

        object htmlAttributes;

        //start building our list item tag which includes our telephone number 
        //input and validation controls
        TagBuilder listItemBuilder = new TagBuilder("li");

        //determine based on the country specified if this should be a North …
Run Code Online (Sandbox Code Playgroud)

validation asp.net-mvc html-helper

5
推荐指数
1
解决办法
3979
查看次数

如何获得当月的最后一天和下个月的最后一天

我想要获得当月的最后一天和下个月的最后一天.

这是我到目前为止提出的代码,但是我被迫在NodaTime代码和.NET方法DateTime.DaysInMonth()之间混合以实现我正在寻找的东西,这听起来不对.

class Program {

    public static void Main(string[] args)
    {
        DateTimeZone mst = DateTimeZoneProviders.Tzdb["MST"];

        Instant now = SystemClock.Instance.Now;
        ZonedDateTime mstNow = now.InZone(mst);

        LocalDate mstLastDayOfCurrentMonth = new LocalDate(mstNow.Year, mstNow.Month, DateTime.DaysInMonth(mstNow.Year, mstNow.Month));
        Console.WriteLine("Last Day of Current Month: {0}", mstLastDayOfCurrentMonth);

        //move into the next month
        LocalDate nextMonth = mstLastDayOfCurrentMonth.PlusDays(1);
        LocalDate mstLastDayOfNextMonth = new LocalDate(nextMonth.Year, nextMonth.Month, DateTime.DaysInMonth(nextMonth.Year, nextMonth.Month)); 
        Console.WriteLine("Last Day of Next Month: {0}", mstLastDayOfNextMonth);

    }

}
Run Code Online (Sandbox Code Playgroud)

你能否告诉我NodaTime推荐的方式来获得当前和下个月的最后一天?

提前致谢

c# datetime nodatime

3
推荐指数
1
解决办法
1303
查看次数