我目前正在尝试通过MVC验证,并且遇到了一些需要字段的问题,具体取决于另一个字段的值.下面是一个例子(我还没想到) - 如果PaymentMethod =="Check",那么应该需要ChequeName,否则可以让它通过.
[Required(ErrorMessage = "Payment Method must be selected")]
public override string PaymentMethod
{ get; set; }
[Required(ErrorMessage = "ChequeName is required")]
public override string ChequeName
{ get; set; }
Run Code Online (Sandbox Code Playgroud)
我正在为[Required]使用System.ComponentModel.DataAnnotations,并且还扩展了ValidationAttribute以尝试使其工作,但我无法通过变量来进行验证(下面的扩展名)
public class JEPaymentDetailRequired : ValidationAttribute
{
public string PaymentSelected { get; set; }
public string PaymentType { get; set; }
public override bool IsValid(object value)
{
if (PaymentSelected != PaymentType)
return true;
var stringDetail = (string) value;
if (stringDetail.Length == 0)
return false;
return true;
}
} …Run Code Online (Sandbox Code Playgroud) 我有几个项目,我正在使用Wix 3.5,以及Paraffin,这是非常好的,但我一直试图弄清楚如何创建Windows计划任务作为安装的一部分.
我可以运行一个创建任务的bat文件,但我不认为这会给我Wix的卸载功能,也不允许我将其定义为设置UI的一部分.
有谁知道如何在Wix 3.5中作为XML配置的一部分创建计划任务?