#region 验证非空
if (e.NewValues["Driver"] == null || e.NewValues["Driver"].ToString().Trim() == "")
{
UseUtility.Alert("汽车司机不能为空!", this.Page);
e.Cancel = true;
return;
}
if (e.NewValues["AutomobileLicensePlate"] == null || e.NewValues["AutomobileLicensePlate"].ToString().Trim() == "")
{
UseUtility.Alert("汽车牌照不能为空!", this.Page);
e.Cancel = true;
return;
}
if (e.NewValues["AutomobileType"] == null || e.NewValues["AutomobileType"].ToString().Trim() == "")
{
UseUtility.Alert("汽车型号不能为空!", this.Page);
e.Cancel = true;
return;
}
#endregion
#region 验证非法输入
int seat, Capacity;
try
{
seat = Convert.ToInt32(e.NewValues["AutomobileSeatings"]); //座位号
Capacity = Convert.ToInt32(e.NewValues["AutomobileCapacity"]); //载重
}
catch
{
UseUtility.Alert("输入有误,请重新输入!", this.Page);
e.Cancel = true;
return;
}
if (seat <= 0)
{
UseUtility.Alert("座位号必须大于零!", this.Page);
e.Cancel = true;
return;
}
if (Capacity <= 0)
{
UseUtility.Alert("载重必须大于零!", this.Page);
e.Cancel = true;
return;
}
#endregion