本文整理汇总了C#中System.Web.UI.WebControls.ListViewDeleteEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ListViewDeleteEventArgs类的具体用法?C# ListViewDeleteEventArgs怎么用?C# ListViewDeleteEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ListViewDeleteEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了ListViewDeleteEventArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:pear171902790,项目名称:SomePractices,代码行数:7,代码来源:WebForm2.aspx.cs
示例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);
}
开发者ID:wichtounet,项目名称:ICM,代码行数:17,代码来源:Persons.aspx.cs
示例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);
}
开发者ID:wichtounet,项目名称:ICM,代码行数:18,代码来源:Institutions.aspx.cs
示例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;
}
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:14,代码来源:UserRole.aspx.cs
示例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);
}
开发者ID:wichtounet,项目名称:ICM,代码行数:20,代码来源:Default.aspx.cs
示例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();
}
}
}
开发者ID:nguyenppt,项目名称:1pubcreditnew,代码行数:20,代码来源:NewNormalLoan_Repayment.ascx.cs
示例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");
}
}
开发者ID:reyrahadian,项目名称:PFM,代码行数:22,代码来源:PayeeListing.aspx.cs
示例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();
}
}
}
开发者ID:nguyenppt,项目名称:1pubcreditnew,代码行数:22,代码来源:RateExchange.ascx.cs
示例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();
}
}
}
开发者ID:nguyenppt,项目名称:1pubcreditnew,代码行数:22,代码来源:InterestedRateAutomatic.ascx.cs
示例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>");
}
}
}
}
开发者ID:yschulmann,项目名称:Anglodeals,代码行数:22,代码来源:CatgoryManager.aspx.cs
示例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控件
}
开发者ID:kinggod,项目名称:21SourceCode,代码行数:24,代码来源:Photo_list.aspx.cs
示例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";
}
}
}
开发者ID:yschulmann,项目名称:Anglodeals,代码行数:23,代码来源:BannersManager.aspx.cs
示例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;
}
}
开发者ID:amishmehta21,项目名称:hello-amish,代码行数:11,代码来源:UM_HomePageList.aspx.cs
示例14: OnItemDeleting
protected override void OnItemDeleting (ListViewDeleteEventArgs e)
{
RecordEvent ("Enter");
base.OnItemDeleting (e);
RecordEvent ("Leave");
}
开发者ID:Profit0004,项目名称:mono,代码行数:6,代码来源:ListViewTest.cs
示例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);
}
}
}
}
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:91,代码来源:MaterialIn.aspx.cs
示例16: lvMaterialSupplier_ItemDeleting
protected void lvMaterialSupplier_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
//取消请求执行自定义的方法
e.Cancel = true;
//检测是否含有session
if (Session.Count < 5)
{
//跳转
Response.Redirect("/Account/Login", true);
//停止加载后续内容
Response.End();
//直接返回
return;
}
//当前用户所在部门
string deptName = Session["dept_name"].ToString();
//当前角色id
Int16 roleId = Convert.ToInt16(Session["role_id"]);
//检测是否有权限
if (deptName != mustDeptName || roleId < 0 || roleId > 4)
{
throw new Exception("您没有删除记录权限!");
}
//允许执行删除
e.Cancel = false;
}
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:26,代码来源:MaterialSupplier.aspx.cs
示例17: lvEmployees_ItemDeleting
protected void lvEmployees_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
e.Cancel = true;
//没有权限
if (!HasRight())
{
throw new Exception("您没有删除记录权限!");
}
//根据id执行删除数据
if (DeleteData(e))
{
//刷新本页
lBtnRefresh_Click(null, null);
}
}
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:15,代码来源:Employees.aspx.cs
示例18: lvUseWater_ItemDeleting
protected void lvUseWater_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
//取消请求执行自定义的方法
e.Cancel = true;
if (!HasRight())
{
throw new Exception("您没有删除记录权限!");
}
//当前id号
Int64 id = Convert.ToInt64(e.Keys[0]);
//根据id执行删除数据
if (DeleteData(e))
{
//刷新本页
lBtnRefresh_Click(null, null);
}
}
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:17,代码来源:UseWater.aspx.cs
示例19: DeleteData
/// <summary>
/// 执行删除数据并处理相关数据一致性
/// </summary>
/// <param name="e">传入的带有数据的事件参数</param>
/// <returns></returns>
private bool DeleteData(ListViewDeleteEventArgs e)
{
//当前用户输入的id号
int id = Convert.ToInt32(e.Keys[0]);
//数据适配器
//当前数据库连接
//当前更新语句对象
using (var da = new ydERPTY.DAL.AD.DataSetADTableAdapters.t_employeesTableAdapter())
using (var cmd = da.Adapter.DeleteCommand)
using (var conn = cmd.Connection)
{
//打开数据库连接
conn.Open();
//开启事务
using (var tran = conn.BeginTransaction())
{
//试运行
try
{
//设置事务
da.Transaction = tran;
//获取数据
using (var tab = da.GetDataById(id))
{
//检查是否获取到行
if (tab.Rows.Count == 0)
{
//显示失败
throw new Exception("当前员工信息记录已经被其他用户删除!");
}
else
{
//删除当前数据
da.Delete(id);
}
}
//提交事务
tran.Commit();
//返回成功
return true;
}
catch (Exception ex)
{
//回滚事务
tran.Rollback();
//非数字返回失败
throw new Exception(ex.Message);
}
}
}
}
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:56,代码来源:Employees.aspx.cs
示例20: lvLoseRecord_ItemDeleting
protected void lvLoseRecord_ItemDeleting(object sender, ListViewDeleteEventArgs e)
{
//取消请求执行自定义的方法
e.Cancel = true;
//检测是否含有session
if (Session.Count < 5)
{
//跳转
Response.Redirect("/Account/Login", true);
//停止加载后续内容
Response.End();
//直接返回
return;
}
//当前用户所在部门
string deptName = Session["dept_name"].ToString();
//当前角色id
Int16 roleId = Convert.ToInt16(Session["role_id"]);
//检测是否有权限
if ((deptName != mustDeptName && deptName != "计划" && deptName != "样板") || roleId < 0 || roleId > 4)
{
throw new Exception("您没有删除记录权限!");
}
//当前id号
Int64 id = Convert.ToInt64(e.Keys[0]);
//根据id执行删除数据
if (DeleteData(e))
{
//刷新本页
lBtnRefresh_Click(null, null);
}
}
开发者ID:yangdan8,项目名称:ydERPTY,代码行数:32,代码来源:LoseRecord.aspx.cs
注:本文中的System.Web.UI.WebControls.ListViewDeleteEventArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论