本文整理汇总了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)
//.........这里部分代码省略.........