本文整理匯總了C#中System.Web.UI.WebControls.FormViewDeleteEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# FormViewDeleteEventArgs類的具體用法?C# FormViewDeleteEventArgs怎麽用?C# FormViewDeleteEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FormViewDeleteEventArgs類屬於System.Web.UI.WebControls命名空間,在下文中一共展示了FormViewDeleteEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FormView1_ItemDeleting
protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
Label lblId = FormView1.FindControl("ViewId") as Label;
var longId = long.Parse(lblId.Text);
var elements = from element in _dataContext.MedicalServices
where element.medicalServiceGroupId == longId
select element;
if (elements.Count() != 0)
{
var medicalServicesArray = elements.ToArray();
for (var i = 0; i < medicalServicesArray.Count(); i++)
{
var labOrderDetails = from element in _dataContext.LabOrderDetails
where medicalServicesArray[i].medicalServiceId == element.medicalServiceId
select element;
if (labOrderDetails.Count() != 0)
{
_dataContext.LabOrderDetails.DeleteAllOnSubmit(labOrderDetails);
}
}
_dataContext.MedicalServices.DeleteAllOnSubmit(elements);
_dataContext.SubmitChanges();
return;
}
}
示例2: fvMaterialSupplierAdd_ItemDeleting
protected void fvMaterialSupplierAdd_ItemDeleting(object sender, FormViewDeleteEventArgs 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("您沒有刪除記錄權限!");
}
//當前供應商代碼
string code = Convert.ToString(e.Keys[0]);
//根據id執行刪除數據
if (DeleteData(e))
{
//調用過程執行跳轉
JumpToUrlByCode(code);
}
}
示例3: PGFV_ItemDeleting
/**
* We are in "default mode" mode, and the "delete" button was pressed
* */
protected void PGFV_ItemDeleting(Object sender, FormViewDeleteEventArgs e)
{
String id = ((TextBox)this.PGFV.FindControl("albumIdTextBox")).Text;
controller.removeAlbum(Int32.Parse(id));
//update the grid
rebind(); //rebind the grid
//Change the form view mode
this.PGFV.ChangeMode(FormViewMode.ReadOnly);
rebindForm(-1); rebindForm(-1);
//Response.Write("Deleting");
}
示例4: EventEditorFormView_ItemDeleting
/**
* We are in "default mode" mode, and the "delete" button was pressed
* */
protected void EventEditorFormView_ItemDeleting(Object sender, FormViewDeleteEventArgs e)
{
String id = ((TextBox)EventEditorFormView.FindControl("idTextBox")).Text;
controller.removeEVent(Int32.Parse(id));
//update the grid
rebind(); //rebind the grid
//Change the form view mode
EventEditorFormView.ChangeMode(FormViewMode.ReadOnly);
rebindForm(-1); rebindForm(-1);
//Response.Write("Deleting");
}
示例5: FormView1_ItemDeleting
//ItemDeleting Event Control
protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
Label lblId = FormView1.FindControl("ViewId") as Label;
var intId = long.Parse(lblId.Text);
var labOrders = from element in _dataContext.LabOrders
where element.doctorId == intId
select element;
var prescriptions = from element in _dataContext.Prescriptions
where element.doctorId == intId
select element;
var visits = from element in _dataContext.Visits
where element.doctorId == intId
select element;
if (labOrders.Count() != 0)
{
var labOrderArray = labOrders.ToArray();
for (var i = 0; i < labOrderArray.Count(); i++)
{
var labOrderDetail = from element in _dataContext.LabOrderDetails
where element.labOrderId == labOrderArray[i].labOrderId
select element;
if (labOrderDetail.Count() != 0)
{
_dataContext.LabOrderDetails.DeleteAllOnSubmit(labOrderDetail);
}
}
_dataContext.LabOrders.DeleteAllOnSubmit(labOrders);
}
else if (prescriptions.Count() != 0)
{
var prescriptArray = prescriptions.ToArray();
for (var i = 0; i < prescriptArray.Count(); i++)
{
var prescriptionDetail = from element in _dataContext.PrescriptionDetails
where element.prescriptionId == prescriptArray[i].prescriptionId
select element;
if (prescriptionDetail.Count() != 0)
{
_dataContext.PrescriptionDetails.DeleteAllOnSubmit(prescriptionDetail);
}
}
_dataContext.Prescriptions.DeleteAllOnSubmit(prescriptions);
}
else if (visits.Count() != 0)
{
_dataContext.Visits.DeleteAllOnSubmit(visits);
}
_dataContext.SubmitChanges();
}
示例6: FormView1_ItemDeleting
//ItemDeleting Event Control
protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
Label lblId = FormView1.FindControl("ViewId") as Label;
var id = long.Parse(lblId.Text);
var elements = from element in _dataContext.PrescriptionDetails
where element.drugId == id
select element;
if (elements.Count() != 0)
{
_dataContext.PrescriptionDetails.DeleteAllOnSubmit(elements);
_dataContext.SubmitChanges();
return;
}
}
示例7: FormView1_ItemDeleting
protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
Label lbl = HospitalFormView.FindControl("ViewId") as Label;
var hospitalId = long.Parse(lbl.Text);
var elements = from element in _dataContext.Visits
where element.hospitalId == hospitalId
select element;
if (elements.Count() != 0)
{
_dataContext.Visits.DeleteAllOnSubmit(elements);
_dataContext.SubmitChanges();
return;
}
}
示例8: formFeeds_ItemDeleting
protected void formFeeds_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
String name = ((Label)formFeeds.Row.Cells[0].FindControl("nameFeed")).Text;
String url = ((Label)formFeeds.Row.Cells[0].FindControl("urlFeed")).Text;
XmlDocument xdoc = XmlDataSource_feed.GetXmlDocument();
XmlElement feeds = xdoc.SelectSingleNode("feeds") as XmlElement;
XmlElement feed = xdoc.SelectSingleNode("feeds/feed[@name='" + name + "'][@url = '" + url + "']") as XmlElement;
feeds.RemoveChild(feed);
XmlDataSource_feed.Save();
e.Cancel = true;
formFeeds.DataBind();
}
示例9: FormView1_ItemDeleting
//ItemDeleting Event Control
protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
Label lblId = FormView1.FindControl("ViewId") as Label;
var id = long.Parse(lblId.Text);
var labOrderDetails = from element in _dataContext.LabOrderDetails
where element.labOrderId == id
select element;
var visits = from element in _dataContext.Visits
where element.labOrderId == id
select element;
if (labOrderDetails.Count() != 0)
{
_dataContext.LabOrderDetails.DeleteAllOnSubmit(labOrderDetails);
}
else if (visits.Count() != 0)
{
_dataContext.Visits.DeleteAllOnSubmit(visits);
}
_dataContext.SubmitChanges();
}
示例10: fvPerson_ItemDeleting
// FormView.ItemDeleting 事件
protected void fvPerson_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
// 從Web.config獲取鏈接字符串.
// 當我們使用Using語句時,
// 不需要顯式釋放代碼中的對象,
// using語句會處理他們.
using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQLServer2005DBConnectionString"].ToString()))
{
// 新建一個命令對象.
SqlCommand cmd = new SqlCommand();
// 將數據鏈接關聯到命令.
cmd.Connection = conn;
// 設定命令文本
// SQL語句或者存儲過程名字.
cmd.CommandText = "DELETE FROM Person WHERE PersonID = @PersonID";
// 設定命令類型
// CommandType.Text 表示原始SQL語句;
// CommandType.StoredProcedure 表示存儲過程.
cmd.CommandType = CommandType.Text;
// 從FormView控件的ItemTemplate中獲取PersonID.
//
string strPersonID = ((Label)fvPerson.Row.FindControl("lblPersonID")).Text;
// 向SqlCommand添加參數並設值.
cmd.Parameters.Add("@PersonID", SqlDbType.Int).Value = strPersonID;
// 打開數據鏈接.
conn.Open();
// 執行命令.
cmd.ExecuteNonQuery();
}
// 重新綁定FormView控件以顯示刪除後的數據.
BindFormView();
}
示例11: FormView1_ItemDeleting
protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
Label lblId = FormView1.FindControl("ViewId") as Label;
var longId = long.Parse(lblId.Text);
var elements = from element in _dataContext.Drugs
where element.drugGroupId == longId
select element;
if (elements.Count() != 0)
{
var drugArray = elements.ToArray();
for (var i = 0; i < drugArray.Count(); i++)
{
var prescriptionDetail = from element in _dataContext.PrescriptionDetails
where element.drugId == drugArray[i].drugId
select element;
if (prescriptionDetail.Count() != 0)
{
_dataContext.PrescriptionDetails.DeleteAllOnSubmit(prescriptionDetail);
}
}
_dataContext.Drugs.DeleteAllOnSubmit(elements);
_dataContext.SubmitChanges();
}
}
示例12: FormView1_ItemDeleting
protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
{
Label lblId = FormView1.FindControl("ViewId") as Label;
var longId = long.Parse(lblId.Text);
var elements = from element in _dataContext.Icds
where element.icdChapterId == longId
select element;
if (elements.Count() != 0)
{
var icdChapterArray = elements.ToArray();
for (var i = 0; i < icdChapterArray.Count(); i++)
{
var visit = from element in _dataContext.Visits
where element.icdId == icdChapterArray[i].icdId
select element;
if (visit.Count() != 0)
{
_dataContext.Visits.DeleteAllOnSubmit(visit);
}
}
_dataContext.Icds.DeleteAllOnSubmit(elements);
_dataContext.SubmitChanges();
}
}
示例13: d_ItemDeleting
static void d_ItemDeleting (object sender, FormViewDeleteEventArgs e)
{
if (WebTest.CurrentTest.UserData == null) {
ArrayList list = new ArrayList ();
list.Add ("ItemDeleting");
WebTest.CurrentTest.UserData = list;
}
else {
ArrayList list = WebTest.CurrentTest.UserData as ArrayList;
if (list == null)
throw new NullReferenceException ();
list.Add ("ItemDeleting");
WebTest.CurrentTest.UserData = list;
}
}
示例14: fv_ItemDeleting
private void fv_ItemDeleting (object sender, FormViewDeleteEventArgs e)
{
itemDeleting = true;
}
示例15: DeleteData
/// <summary>
/// 執行刪除數據並處理相關數據一致性
/// </summary>
/// <param name="e">傳入的帶有數據的事件參數</param>
/// <returns></returns>
private bool DeleteData(FormViewDeleteEventArgs e)
{
//當前用戶輸入的id號
Int64 id = Convert.ToInt64(e.Keys[0]);
//數據適配器
//當前數據庫連接
//當前更新語句對象
using (var da = new t_product_record_wenziTableAdapter())
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
{
//首行
var row = (DataSetProductRecord.t_product_record_wenziRow)tab.Rows[0];
//下部門名稱
string nextProcName = row.next_proc_name;
//批量卡序號
string lotId = row.lot_id;
//pnl出數
int pnlQty = row.pnl_qty;
//pcs出數
int pcsQty = row.pcs_qty;
//檢測是否超過下部門餘數
if (ydOperateBalanceLotCrad.IsOutstripProcBalance(
tran,
nextProcName,
lotId,
false,
pnlQty,
pcsQty
))
{
return false;
}
//修改下部門批量卡餘數
if (!ydOperateBalanceLotCrad.UpdateBalanceAfterInsert(
tran,
nextProcName,
lotId,
false,
pnlQty,
pcsQty
))
{
return false;
}
//部門名稱
string procName = row.proc_name;
//目標數據庫表名
string toTabName = "[t_proc_lot_card_balance]";
//添加到部門結存批量卡
if (!ydOperateBalanceLotCrad.InsertOneRecordToLotCardBalance(
tran,
ydOperateBalanceLotCrad.GetTabNameByProcName(procName),
procName,
toTabName,
id,
true
))
{
return false;
}
//從生產記錄刪除數據
if (!ydOperateBalanceLotCrad.DeleteOneRecordFromProductOrScrapRecord(cmd, id))
{
return false;
}
}
}
//提交事務
tran.Commit();
//返回成功
return true;
}
catch (Exception ex)
//.........這裏部分代碼省略.........