本文整理汇总了C#中System.Web.UI.WebControls.ListViewDeleteEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ListViewDeleteEventArgs类的具体用法?C# ListViewDeleteEventArgs怎么用?C# ListViewDeleteEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListViewDeleteEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了ListViewDeleteEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Lv_ItemDeleting
protected void Lv_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
var id = Convert.ToInt32(Lv.DataKeys[e.ItemIndex].Value);
var person = Db.Persons.SingleOrDefault(p => p.Id == id);
Db.Persons.Remove(person);
Init();
}
示例2: PersonDeleting
/// <summary>
/// A person is deleted from the list view.
/// </summary>
/// <param name="sender">The sender of the events</param>
/// <param name="e">The args of the event</param>
protected void PersonDeleting(object sender, ListViewDeleteEventArgs e)
{
ListViewItem myItem = ResultsView.Items[e.ItemIndex];
var labelId = (Label) myItem.FindControl("LabelID");
this.Verified(
() => new PersonsDAO().ArchivePerson(labelId.Text.ToInt()),
ErrorLabel);
this.Verified(SearchPersons, ErrorLabel);
}
示例3: InstitutionArchiving
/// <summary>
/// Archive the selected institution.
/// </summary>
/// <param name="sender">The sender of the events</param>
/// <param name="e">The args of the event</param>
protected void InstitutionArchiving(object sender, ListViewDeleteEventArgs e)
{
Extensions.SqlOperation operation = () =>
{
ListViewItem myItem = ResultsView.Items[e.ItemIndex];
var labelId = (Label)myItem.FindControl("LabelID");
new InstitutionsDAO().ArchiveInstitution(labelId.Text.ToInt());
SearchButton_Click(sender, e); //Refresh the page
};
this.Verified(operation, ErrorLabel);
}
示例4: lvUserRole_ItemDeleting
protected void lvUserRole_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
//取消请求执行自定义的方法
e.Cancel = true;
//当前角色id
Int16 roleId = Convert.ToInt16(Session["role_id"]);
//检测是否有权限
if (roleId < 0 || roleId > 2)
{
throw new Exception("您没有删除记录权限!");
}
//根据id执行删除数据
e.Cancel = false;
}
示例5: ContractDeleting
/// <summary>
/// A contract is deleted from the list view.
/// </summary>
/// <param name="sender">The sender of the events</param>
/// <param name="e">The args of the event</param>
protected void ContractDeleting(object sender, ListViewDeleteEventArgs e)
{
Extensions.SqlOperation operation = () =>
{
ListViewItem myItem = ResultsView.Items[e.ItemIndex];
var labelId = myItem.FindControl("LabelID") as Label;
new ContractsDAO().ArchiveContract(labelId.Text.ToInt());
Search();
};
this.Verified(operation, ErrorLabel);
}
示例6: lvLoanControl_ItemDeleting
protected void lvLoanControl_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
String ids = "";
Label lbl = (lvLoanControl.Items[e.ItemIndex].FindControl("lbID")) as Label;
if (lbl != null)
ids = lbl.Text;
if (!String.IsNullOrEmpty(ids))
{
NewLoanControlRepository facade = new NewLoanControlRepository();
var itm = facade.GetById(Int16.Parse(ids));
if (itm != null)
{
facade.Delete(itm);
facade.Commit();
LoadDataTolvLoanControl();
}
}
}
示例7: lvPayees_ItemDeleting
protected void lvPayees_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
var dataKey = lvPayees.DataKeys[e.ItemIndex];
if (dataKey == null || dataKey.Values == null)
{
return;
}
var payeeId = Guid.Parse(dataKey.Values["ID"].ToString());
var isPayeeCanBeDeleted = _presenter.CheckIfPayeeCanBeDeleted(payeeId);
if (isPayeeCanBeDeleted)
{
_presenter.DeletePayee(payeeId);
_presenter.BindPayees();
//SetPageMessage("Penerima uang berhasil dihapus");
}
else
{
//SetPageMessage("Penerima uang tidak bisa dihapus karena mempunyai transaksi");
}
}
示例8: lvRateExchange_ItemDeleting
protected void lvRateExchange_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
String ids = "";
Label lbl = (lvRateExchange.Items[e.ItemIndex].FindControl("lbID")) as Label;
if (lbl != null)
ids = lbl.Text;
if (!String.IsNullOrEmpty(ids))
{
StoreProRepository storeFacade = new StoreProRepository();
ExchangeRatesRepository facade = new ExchangeRatesRepository();
var itm = facade.GetById(Int16.Parse(ids));
if (itm != null)
{
storeFacade.StoreProcessor().B_ExchangeRate_history_process(itm.Currency, itm.Rate, this.UserId, 3);
facade.Delete(itm);
facade.Commit();
LoadDataTolvRateExchange();
}
}
}
示例9: lvLoanInterestedRate_ItemDeleting
protected void lvLoanInterestedRate_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
String ids = "";
Label lbl = (lvLoanInterestedRate.Items[e.ItemIndex].FindControl("lbID")) as Label;
if (lbl != null)
ids = lbl.Text;
if (!String.IsNullOrEmpty(ids))
{
StoreProRepository storeFacade = new StoreProRepository();
NewLoanInterestedKeyRepository facade = new NewLoanInterestedKeyRepository();
var itm = facade.GetById(Int16.Parse(ids));
if (itm != null)
{
storeFacade.StoreProcessor().B_LoanInterested_Key_history_process(itm.MonthLoanRateNo, itm.VND_InterestRate, itm.USD_InterestRate, this.UserId, 3);
facade.Delete(itm);
facade.Commit();
LoadDataTolvLoanInterestedRate();
}
}
}
示例10: ListView1_ItemDeleting
protected void ListView1_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
int id = (int)e.Keys[0];
using (var db = drvvv.drvvvSettings.GetDataContextInstance())
{
var cCategories = db.Categories.Where(x => x.ID == id).SingleOrDefault();
foreach (var y in db.MailingLists.Where(x => x.CategoryID == id))
{
y.CategoryID = null;
}
db.SubmitChanges();
if (!string.IsNullOrEmpty(cCategories.Image))
{
if (!drvvv.GetFile.DeleteFile(cCategories.Image))
{
RegisterStartupScript("alert", "<script language='javascript'> { alert('The picture is not deleted');}</script>");
}
}
}
}
示例11: lvPhoto_ItemDeleting
//通过LINQ技术删除图片
protected void lvPhoto_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
//删除图片文件
LinkButton lkb = (LinkButton)lvPhoto.Items[e.ItemIndex].FindControl("lkbImg");
FileInfo fi = new FileInfo(Server.MapPath("UpSmall/" + lkb.CommandArgument.ToString()));
if (fi.Exists)
{
fi.Delete();
}
FileInfo fi2 = new FileInfo(Server.MapPath("UpFile/" + lkb.CommandArgument.ToString()));
if (fi2.Exists)
{
fi2.Delete();
}
//获取ListView控件中所要删除的数据索引值
int DataKey = Int32.Parse(lvPhoto.DataKeys[e.ItemIndex].Value.ToString());
//通过LINQ to SQL删除数据库记录
Photo p = lqc.Photo.SingleOrDefault(itm => itm.ID == DataKey);
lqc.Photo.DeleteOnSubmit(p);//执行删除操作
lqc.SubmitChanges();//提交删除动作
ScriptManager.RegisterStartupScript(this, GetType(), "", "alert('删除成功!');", true);
BindListView();//重新绑定ListView控件
}
示例12: ListView1_ItemDeleting
protected void ListView1_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
int id = (int)e.Keys[0];
using (var db = drvvv.drvvvSettings.GetDataContextInstance())
{
var cBanners = db.Banners.Where(x => x.ID == id).SingleOrDefault();
if (cBanners != null)
{
if (!drvvv.GetFile.DeleteFile(cBanners.LinkFile))
{
e.Cancel = true; // מבטל מחיקה
Label1.Text = "You can not delete now";
}
}
else
{
// התמונה לא קיימת במסד
e.Cancel = true; // מבטל מחיקה
Label1.Text = "File not found";
}
}
}
示例13: LvHomePageItems_ItemDeleting
protected void LvHomePageItems_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
if (!commonBAL.isUserAuthorisedForPageFunc(LoggedInUser.UserId, thisPageName, "delete"))
{
LoggedIn master = (LoggedIn)this.Master;
master.ShowMessage("You are not authorised to perform this function. Please contact system administrator.", false);
e.Cancel = true;
return;
}
}
示例14: OnItemDeleting
protected override void OnItemDeleting (ListViewDeleteEventArgs e)
{
RecordEvent ("Enter");
base.OnItemDeleting (e);
RecordEvent ("Leave");
}
示例15: DeleteData
/// <summary>
/// 执行删除数据并处理相关数据一致性
/// </summary>
/// <param name="e">传入的带有数据的事件参数</param>
/// <returns></returns>
private bool DeleteData(ListViewDeleteEventArgs e)
{
//实例化数据适配器
using (var da = new v_material_inTableAdapter())
//取得数据库连接
using (var conn = da.Connection)
{
//打开数据库连接
conn.Open();
//事务
using (var tran = conn.BeginTransaction())
{
//设置事务
da.Transaction = tran;
try
{
//当前入仓单号
string billNum = e.Keys[0].ToString();
//当前行号
byte rowId = Convert.ToByte(e.Keys[1]);
//取得该条入仓单清单记录
var tab = da.GetDataByBillNumAndRowId(billNum, rowId);
//检测是否存在数据
if (tab.Rows.Count <= 0)
{
throw new Exception(string.Format("当前单据:\n单号:{0}\n行号:{1}\n已经被其他用户删除!", billNum, rowId));
}
//单据内容、原料结存适配器
using (var daContent = new t_material_in_contentTableAdapter())
using (var daBalance = new t_material_balanceTableAdapter())
{
//设置连接对象
daContent.Connection = daBalance.Connection = tran.Connection;
//设置事务
daContent.Transaction = daBalance.Transaction = tran;
//遍历行执行删除各行的结存记录
foreach (DataSetMaterialIn.v_material_inRow row in tab.Rows)
{
//执行扣减结存
if (!ydOperateMaterial.DecreaseMaterialBalance(
daBalance,
BillType.In,
row.supplier_name,
row.material_name,
row.price,
row.qty
))
{
return false;
}
}
//根据入仓单号和行号删除入仓记录
if (daContent.Delete(billNum, rowId) <= 0)
{
throw new Exception("根据单号删除内容记录失败!");
}
//检测当前入仓记录内容行数
int? iCount = (int?)daContent.CountByBillNum(billNum);
if (iCount.HasValue && iCount.Value <= 0)
{
//表头适配器
using (var daHead = new t_material_in_headTableAdapter())
{
//删除表头
if (daHead.Delete(billNum) <= 0)
{
throw new Exception("根据单号删除表头记录失败!");
}
}
}
}
//提交事务
tran.Commit();
//返回成功
return true;
}
catch (Exception ex)
{
//回滚事务
tran.Rollback();
//抛出错误
throw new Exception("删除入仓单记录出现错误:\n" + ex.Message);
}
}
}
}