protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { SqlDataSource2.DeleteCommand = "UPDATE carrera SET estado=0 WHERE id=@codi"; SqlDataSource2.DeleteParameters.Add("codi", GridView1.DataKeys[e.RowIndex].Values["id"].ToString()); SqlDataSource2.Delete(); GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { SqlDataSource2.DeleteCommand = "DELETE FROM incidentes WHERE id =@id"; SqlDataSource2.DeleteParameters.Add("id", GridView1.DataKeys[e.RowIndex].Values["id"].ToString()); SqlDataSource2.Delete(); GridView1.DataBind(); }
protected void DltAccBut_Click(object sender, EventArgs e) { //delete profile try { SqlDataSource1.DeleteParameters.Add("val1", uid); SqlDataSource1.Delete(); } catch (SqlException ex) { System.Diagnostics.Debug.Print("Delete profile failed! " + ex.Message); } //delete account try { SqlDataSource2.DeleteParameters.Add("val1", uid); SqlDataSource2.Delete(); } catch (SqlException ex) { System.Diagnostics.Debug.Print("Delete account failed! " + ex.Message); } Comment.Visible = true; Comment.Text = "Delete successful!"; }
protected void DtateList1_DeleteCommand(object source, DataListCommandEventArgs e) { SqlDataSource2.DeleteParameters["Ingredient_id"].DefaultValue = e.CommandArgument.ToString(); SqlDataSource2.Delete(); DataList1.DataBind(); }
protected void DeleteComment_Click(object sender, EventArgs e) { try { SqlDataSource2.Delete(); MultiView1.ActiveViewIndex = 0; btnRead.Enabled = false; } catch { MultiView1.ActiveViewIndex = 0; } }
protected void Page_Load(object sender, EventArgs e) { hfLocation.Value = "Home"; hfDate.Value = DateTime.Today.ToString(); SqlDataSource2.Delete(); HiddenField1.Value = "Not Read"; if (Request.Cookies["userid"] != null && Request.Cookies["pwd"] != null) { HttpCookie c1 = Request.Cookies["userid"]; HttpCookie c2 = Request.Cookies["pwd"]; hfUserID.Value = c1.Value; hfPwd.Value = c2.Value; DataView dv = (DataView)sqlLogin.Select(new DataSourceSelectArguments()); if (dv == null) { return; } if (dv.Count == 1) { Session.Add("Name", dv[0][0]); Session.Add("Gender", dv[0][1]); Session.Add("UserId", dv[0][2]); Session.Add("Password", dv[0][3]); if (dv[0][4] == DBNull.Value) { Session.Add("EmailId", "-"); } Session.Add("EmailId", dv[0][4]); } } if (Session["UserId"] != null) { DataView dv = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments()); if (dv.Count == 1) { if (!dv[0][0].ToString().Equals("0")) { Label5.Text = dv[0][0].ToString(); Label6.Text = "Notifications: "; } } PanelLogin.Visible = false; String s = (String)Session["Name"]; String[] arr = s.Split(' '); String fname = arr[0]; lblName.Text = fname; PanelLogout.Visible = true; } }
protected void btn_borrar_Click(object sender, EventArgs e) { int cant; cant = SqlDataSource2.Delete(); if (cant == 1) { lbl_resultado.Text = "El participante se ha borrado correctamente."; } else { lbl_resultado.Text = "Se ha producido un error al borrar" + "el participante."; } }
protected void ButtonОк2_Click(object sender, EventArgs e) { //Удаляем Вопрос SqlDataSource2.DeleteCommand = @"DELETE FROM Tests WHERE (Номер = '" + GridView2.SelectedDataKey.Values[0].ToString() + "') AND (TestSeriesId = '" + GridView2.SelectedDataKey.Values[1].ToString() + "')"; SqlDataSource2.Delete(); GridView2.SelectRow(-1); Panel2.Visible = false; GridView2.Enabled = true; }
protected void btnEliminar_Click(object sender, EventArgs e) { SqlDataSource2.DeleteParameters["id"].DefaultValue = txtCodigo.Text; int cant; cant = SqlDataSource2.Delete(); if (cant == 1) { Response.Write("<script>alert('Se elimino el Rol')</script>"); } else { Response.Write("<script>alert('No existe el Rol')</script>"); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { SqlDataSource2.DeleteCommand = "UPDATE universidad SET estado=0 WHERE id=@codi"; SqlDataSource2.DeleteParameters.Add("codi", GridView1.DataKeys[e.RowIndex].Values["id"].ToString()); SqlDataSource2.Delete(); GridView1.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "eliminarCarrera();", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "error();", true); } }
protected void Button3_Click(object sender, EventArgs e) { try { SqlDataSource2.Delete(); MultiView1.ActiveViewIndex = 0; btnDelete.Enabled = btnEdit.Enabled = false; btnDelete.Visible = btnEdit.Visible = false; } catch { MultiView1.ActiveViewIndex = 0; btnDelete.Enabled = btnEdit.Enabled = btnEdit.Visible = btnDelete.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { try { SqlDataSource1.Delete(); SqlDataSource2.Delete(); SqlDataSource3.Delete(); Response.Write("<script>alert('School Deleted Successfully...')</script>"); Server.Transfer("Registration.aspx"); } catch (Exception er) { Response.Write(er); } }
protected void Button3_Click(object sender, EventArgs e) { try { if (txtUserType1.Text != "مدیر") { SqlDataSource2.Delete(); MultiView1.ActiveViewIndex = 0; } } catch { MultiView1.ActiveViewIndex = 0; } }
protected void Button2_Click(object sender, EventArgs e) { int thisID = Convert.ToInt32(TextBox3.Text); String sql = "DELETE FROM Table1 WHERE ID = "; sql = sql + thisID; Label2.Text = sql; SqlDataSource2.DeleteCommand = sql; SqlDataSource2.Delete(); Label2.Text = SqlDataSource2.DeleteCommand.ToString(); }
protected void Button1_Click(object sender, EventArgs e) { int y = 0, x = 0; DataView dv2 = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); foreach (DataRow dr in dv2.Table.Rows) { x = (int)dv2.Table.Rows[y][0]; iid.Text = x.ToString(); DeleteTrail.Insert(); y++; } SqlDataSource2.Delete(); Response.Redirect("~/Maintenance/facilities.aspx"); }
protected void ButtonОк2_Click(object sender, EventArgs e) { // Удаление файла, записи в БД и физически //Находим физический путь файла string appPath = Request.PhysicalApplicationPath; SqlConnection connection = new SqlConnection(SqlDataSource2.ConnectionString); SqlCommand getFile = new SqlCommand( "SELECT Путь FROM TaskFiles " + "WHERE (TaskFileId LIKE '" + GridView2.SelectedValue + "');", connection); connection.Open(); SqlDataReader reader = getFile.ExecuteReader(); try { reader.Read(); File.Delete(appPath + reader[0].ToString()); } catch { } finally { reader.Close(); connection.Close(); } // Удаление записи из БД SqlDataSource2.DeleteCommand = @"DELETE FROM TaskFiles WHERE (TaskFileId LIKE '" + GridView2.SelectedValue + "')"; SqlDataSource2.Delete(); GridView2.SelectRow(-1); Panel2.Visible = false; GridView2.Enabled = true; }
protected void lbDelete1_Click(object sender, EventArgs e) { for (int i = 0; i <= GridView1.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("chkSelectRow"); if (cbox.Checked) { try { SqlDataSource2.DeleteParameters["Stu_Hw_ID"].DefaultValue = ((Label)GridView2.Rows[i].FindControl("txtStu_Hw_ID")).Text; SqlDataSource2.Delete(); } catch (SqlException) { lblTooltip1.Text = string.Format("无法删除学生作业号为‘{0}'的作业!", ((Label)GridView2.Rows[i].FindControl("txtStu_Hw_ID")).Text); } } } }
protected void Button3_Click(object sender, EventArgs e) { try { if (Convert.ToInt32(TextBox2.Text) > Convert.ToInt32(Totalprod)) { Response.Write("<script>alert('El valor ingresado es mayor al total del producto en el sistema')</script>"); } else { if (Convert.ToInt32(Totalprod) == Convert.ToInt32(TextBox2.Text)) { // SubtotalProd = Convert.ToInt32(Totalprod) - Convert.ToInt32(TextBox2.Text); try { totalPrecio = Convert.ToDecimal(precio) * Convert.ToDecimal(SubtotalProd); SqlDataSource2.UpdateParameters["Monto"].DefaultValue = totalDirecto; SqlDataSource2.UpdateParameters["SaldoPendiente"].DefaultValue = totalDirecto; SqlDataSource2.UpdateParameters["ID_Credito"].DefaultValue = idCredito; SqlDataSource2.Update(); SqlDataSource2.DeleteParameters["ID_Credito"].DefaultValue = idCredito; SqlDataSource2.DeleteParameters["ID_Existencia"].DefaultValue = idStock; SqlDataSource2.Delete(); } catch { } datos2.EliminarDetallV(Convert.ToInt32(IDdetalleVenta), Convert.ToInt32(Totalprod), Convert.ToInt32(idStock)); SqlDataSource1.SelectParameters["ID_Venta"].DefaultValue = TextBox1.Text; SqlDataSource1.DataBind(); Label3.Text = "Se ha devuelto: " + TextBox2.Text + " productos con exitos!"; } else { decimal totalCredito = 0; SubtotalProd = Convert.ToInt32(Totalprod) - Convert.ToInt32(TextBox2.Text); totalPrecio = Convert.ToDecimal(precioProdConDescuento) * Convert.ToDecimal(SubtotalProd); datos2.EditarDetalleVenta(SubtotalProd, totalPrecio, Convert.ToInt32(IDdetalleVenta)); datos2.EditarStockDevol(Convert.ToInt32(TextBox2.Text), Convert.ToInt32(idStock)); try { totalCredito = precioProdConDescuento * Convert.ToDecimal(TextBox2.Text); SqlDataSource2.UpdateParameters["Monto"].DefaultValue = totalCredito.ToString(); SqlDataSource2.UpdateParameters["SaldoPendiente"].DefaultValue = totalCredito.ToString(); SqlDataSource2.UpdateParameters["ID_Credito"].DefaultValue = idCredito; SqlDataSource2.Update(); } catch { } SqlDataSource1.SelectParameters["ID_Venta"].DefaultValue = TextBox1.Text; SqlDataSource1.DataBind(); Label3.Text = "Se ha devuelto: " + TextBox2.Text + " productos con exitos!"; } } } catch { Response.Write("<script>alert('Hay un error!')</script>"); } }
protected void LinkButton4_Click(object sender, EventArgs e) { SqlDataSource2.Delete(); SqlDataSource1.Delete(); Response.Redirect("~/Default.aspx"); }
protected void btnEmptyList_Click(object sender, EventArgs e) { SqlDataSource2.Delete(); }
protected void Button1_Click(object sender, EventArgs e) { SqlDataSource2.DeleteCommand = "Delete from [account] where Id=" + DropDownList1.SelectedValue; SqlDataSource2.Delete(); DropDownList1.DataBind(); }
protected void dg_SelectedIndexChanged(object sender, EventArgs e) { SqlDataSource2.DeleteCommand = "DELETE FROM tSells WHERE (fCode = '" + dg.SelectedValue.ToString() + "')"; SqlDataSource2.Delete(); dg.SelectedIndex = -1; }