//定义 启用 禁用 方法
private void IsEnable(bool flag)
{
//获得每行UserID记录
List<object> keyValues = this.gvUser.GetSelectedFieldValues("UserID");
System.Data.Linq.Table<Entities.User> dtModuleForm = eDataContext.GetTable<Entities.User>();
for (int i = 0; i < keyValues.Count; i++)
{
var results = from user in dtModuleForm
where user.UserID == int.Parse(keyValues[i].ToString().Trim())
select user;
foreach (Casagroup.Entities.User us in results)
{
us.IsEnabled = flag;
}
eDataContext.SubmitChanges();
}
BindUserInfo();
}
//启用
protected void btnEnable_Click(object sender, EventArgs e)
{
IsEnable(true);
}
//禁用
protected void btnEnableNO_Click(object sender, EventArgs e)
{
IsEnable(false);
}