本文整理汇总了C#中umbraco.cms.businesslogic.media.Media.delete方法的典型用法代码示例。如果您正苦于以下问题:C# Media.delete方法的具体用法?C# Media.delete怎么用?C# Media.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.media.Media
的用法示例。
在下文中一共展示了Media.delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Delete
public bool Delete()
{
cms.businesslogic.media.Media d = new cms.businesslogic.media.Media(ParentID);
// Log
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Delete, User.GetCurrent(), d.Id, "");
d.delete();
return true;
}
示例2: Delete
public bool Delete()
{
cms.businesslogic.media.Media d = new cms.businesslogic.media.Media(ParentID);
// Log
LogHelper.Debug<mediaTasks>(string.Format("Delete media item {0} by user {1}", d.Id, User.GetCurrent().Id));
d.delete();
return true;
}
示例3: rptMedia_ItemCommand
protected void rptMedia_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
{
int id = Convert.ToInt32(e.CommandArgument);
if (e.CommandName == "delete")
{
Media deleteFile = new Media(id);
deleteFile.delete();
Response.Redirect(Request.RawUrl);
}
}
}
示例4: delete
public void delete(int id, string username, string password)
{
Authenticate(username, password);
Media m = new Media(id);
if (m.HasChildren)
throw new Exception("Cannot delete Media " + id + " as it has child nodes");
Property p = m.getProperty("umbracoFile");
if (p != null)
{
if (!(p.Value == System.DBNull.Value))
{
var path = _fs.GetRelativePath(p.Value.ToString());
if(_fs.FileExists(path))
_fs.DeleteFile(path, true);
}
}
m.delete();
}
示例5: RecycleAndDelete
private void RecycleAndDelete(Media m)
{
if (m == null)
{
return;
}
var id = m.Id;
//check if it is already trashed
var alreadyTrashed = m.IsTrashed;
if (!alreadyTrashed)
{
//now recycle it
m.delete();
Assert.IsTrue(m.IsTrashed);
}
//now permanently delete
m.delete(true);
Assert.IsFalse(Media.IsNode(id));
//check with sql that it is gone
var count = Application.SqlHelper.ExecuteScalar<int>("SELECT COUNT(*) FROM umbracoNode WHERE [email protected]",
Application.SqlHelper.CreateParameter("@id", id));
Assert.AreEqual(0, count);
}