本文整理匯總了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);
}
}
}
}