@{
var fact = ViewBag.Factory as IEntityOperate;
var fi = fact.Fields.FirstOrDefault(e => e.Name.EqualIgnoreCase("Deleted", "IsDelete", "IsDeleted"));
var entity = Model as IEntity;
var key = entity[fact.Unique];
var user = ViewBag.User as IUser ?? User.Identity as IUser;
var ajax = true;
if (ViewBag.AjaxDelete is Boolean)
{
ajax = (Boolean)ViewBag.AjaxDelete;
}
}
@if (user.Has(PermissionFlags.Update))
{
<i class="glyphicon glyphicon-edit" style="color: blue;"></i>
@Html.ActionLink("编辑", "Edit", new { id = @key }, new { @class = "editcell" })
}
else if (user.Has(PermissionFlags.Detail))
{
<i class="glyphicon glyphicon-edit" style="color: blue;"></i>
@Html.ActionLink("查看", "Detail", new { id = @key }, new { @class = "editcell" })
}
@if (user.Has(PermissionFlags.Delete))
{
if (fi != null && fi.Type == typeof(Boolean) && (Boolean)entity[fi.Name])
{
<i class="glyphicon glyphicon-transfer" style="color: green;"></i>
if (ajax)
{
@Html.ActionLink("恢复", "DeleteAjax", new { id = @key }, new { data_action = "delete", data_ajax = "1", onclick = "return confirm('确认恢复?');" })
}
else
{
@Html.ActionLink("恢复", "Delete", new { id = @key }, new { onclick = "return confirm('确认恢复?');" })
}
}
else
{
<i class="glyphicon glyphicon-remove" style="color: red;"></i>
if (ajax)
{
@Html.ActionLink("删除", "DeleteAjax", new { id = @key }, new { data_action = "delete", data_ajax = "1", onclick = "return confirm('确认删除?');" })
}
else
{
@Html.ActionLink("删除", "Delete", new { id = @key }, new { onclick = "return confirm('确认删除?');" })
}
}
}
|