/// <summary>
        /// Handles the ItemDeleting event of dtlvCustomer.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The DetailsViewDeleteEventArgs.</param>
        protected void dtlvCustomer_ItemDeleting(object sender, DetailsViewDeleteEventArgs e)
        {
            try
            {
                using (Bll::ICustomer blCustomer = new Bll::Customer())
                {
                    if (Request.QueryString["CustomerId"] != null)
                    {
                        blCustomer.Delete(Request.QueryString["CustomerId"]);
                    }

                    Response.Redirect("~/Customer.aspx"); // Go and show all data.
                }
            }
            catch (SqlException ex)
            {
                Response.Write(ex.ToString());
            }
            catch (ObjectDisposedException ex)
            {
                Response.Write(ex.ToString());
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
Exemplo n.º 2
0
        //DELETE zaposlenog
        protected void DetailsViewZaposleniDetalji_ItemDeleting(object sender, DetailsViewDeleteEventArgs e)
        {
            // ID selektovanog zaposlenog
            int ID = Convert.ToInt32(DetailsViewZaposleniDetalji.DataKey.Value);

            Dictionary<string, string> parametri = new Dictionary<string, string>();
            parametri.Add("@ZaposleniID", ID.ToString());

            bool rezultat = RadSaBazom.InsertUpdateDeleteSaParametrima("DELETE FROM Zaposleni WHERE ID = @ZaposleniID", parametri);

            /////////////////////////////////////////////////////////////////////////////////////////
            if (rezultat == false)
            {
                Response.Redirect("~/Greska.aspx");
            }
            ////////////////////////////////////////////////////////////////////////////////////////
            Response.Redirect("./Zaposleni.aspx");
        }
Exemplo n.º 3
0
 protected virtual new void OnItemDeleting(DetailsViewDeleteEventArgs e)
 {
     Contract.Requires(e != null);
 }
Exemplo n.º 4
0
        //DELETE Musterije
        protected void dvMusterijeDetalji_ItemDeleting(object sender, DetailsViewDeleteEventArgs e)
        {
            DataSet dsTalaris = (DataSet)ViewState["dsTalaris"];
            DataRow redDelete = dsTalaris.Tables["Musterije"].Rows.Find(dvMusterijeDetalji.DataKey.Value);

            SqlDataAdapter daMusterije = new SqlDataAdapter("SELECT * FROM Musterije", RadSaBazom.konekcija);
            SqlCommandBuilder bilder = new SqlCommandBuilder(daMusterije);

            redDelete.Delete();

            try
            {
                //update tabele
                daMusterije.Update(dsTalaris, "Musterije");
                ViewState["dsTalaris"] = null;
                NapuniGridMusterije();
                Response.Redirect("./Musterije.aspx");
            }
            catch
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Alert", "alert('Nije uspelo brisanje mušterije. Pokušajte ponovo.');window.open('./Musterije.aspx','_self');", true);
            }
        }
Exemplo n.º 5
0
        private void HandleDelete(string commandArg) {
            int pageIndex = PageIndex;
            if (pageIndex < 0) {    // don't attempt to delete in Insert mode
                return;
            }

            DataSourceView view = null;
            bool isBoundToDataSourceControl = IsDataBindingAutomatic;

            if (isBoundToDataSourceControl) {
                view = GetData();
                if (view == null) {
                    throw new HttpException(SR.GetString(SR.View_DataSourceReturnedNullView, ID));
                }
            }

            DetailsViewDeleteEventArgs e = new DetailsViewDeleteEventArgs(pageIndex);


            ExtractRowValues(e.Values, true/*includeReadOnlyFields*/, false/*includePrimaryKey*/);
            foreach (DictionaryEntry entry in DataKey.Values) {
                e.Keys.Add(entry.Key, entry.Value);
                if (e.Values.Contains(entry.Key)) {
                    e.Values.Remove(entry.Key);
                }
            }
            

            OnItemDeleting(e);

            if (e.Cancel) {
                return;
            }

            if (isBoundToDataSourceControl) {
                _deleteKeys = e.Keys;
                _deleteValues = e.Values;
                view.Delete(e.Keys, e.Values, HandleDeleteCallback);
            }
        }
Exemplo n.º 6
0
        /// <devdoc>
        /// <para>Raises the <see langword='Delete'/> event.</para>
        /// </devdoc>
        protected virtual void OnItemDeleting(DetailsViewDeleteEventArgs e) {
            bool isBoundToDataSourceControl = IsDataBindingAutomatic;

            DetailsViewDeleteEventHandler handler = (DetailsViewDeleteEventHandler)Events[EventItemDeleting];
            if (handler != null) {
                handler(this, e);
            } else {
                if (isBoundToDataSourceControl == false && e.Cancel == false) {
                    throw new HttpException(SR.GetString(SR.DetailsView_UnhandledEvent, ID, "ItemDeleting"));
                }
            }
        }
Exemplo n.º 7
0
		public void DeleteItem ()
		{
			currentEditRowKeys = DataKey.Values;
			currentEditNewValues = GetRowValues (true, true);
			
			DetailsViewDeleteEventArgs args = new DetailsViewDeleteEventArgs (PageIndex, currentEditRowKeys, currentEditNewValues);
			OnItemDeleting (args);

			if (!args.Cancel) {
				if (PageIndex == PageCount - 1)
					PageIndex --;
				RequireBinding ();
				DataSourceView view = GetData ();
				if (view != null)
					view.Delete (currentEditRowKeys, currentEditNewValues, new DataSourceViewOperationCallback (DeleteCallback));
				else {
					DetailsViewDeletedEventArgs dargs = new DetailsViewDeletedEventArgs (0, null, currentEditRowKeys, currentEditNewValues);
					OnItemDeleted (dargs);
				}
			}
		}
Exemplo n.º 8
0
		protected virtual void OnItemDeleting (DetailsViewDeleteEventArgs e)
		{
			if (Events != null) {
				DetailsViewDeleteEventHandler eh = (DetailsViewDeleteEventHandler) Events [ItemDeletingEvent];
				if (eh != null) eh (this, e);
			}
		}
		void dv_ItemDeleting (object sender, DetailsViewDeleteEventArgs e)
		{
			itemDeleting = true;
		}
 protected virtual void OnItemDeleting(DetailsViewDeleteEventArgs e)
 {
     bool isBoundUsingDataSourceID = base.IsBoundUsingDataSourceID;
     DetailsViewDeleteEventHandler handler = (DetailsViewDeleteEventHandler) base.Events[EventItemDeleting];
     if (handler != null)
     {
         handler(this, e);
     }
     else if (!isBoundUsingDataSourceID && !e.Cancel)
     {
         throw new HttpException(System.Web.SR.GetString("DetailsView_UnhandledEvent", new object[] { this.ID, "ItemDeleting" }));
     }
 }
Exemplo n.º 11
0
		protected virtual void OnItemDeleting (DetailsViewDeleteEventArgs e)
		{
			if (Events != null) {
				DetailsViewDeleteEventHandler eh = (DetailsViewDeleteEventHandler) Events [ItemDeletingEvent];
				if (eh != null) {
					eh (this, e);
					return;
				}
			}
			if (!IsBoundUsingDataSourceID)
				throw new HttpException (String.Format (unhandledEventExceptionMessage, ID, "ItemDeleting"));
		}
Exemplo n.º 12
0
 protected void eliminazioneRecord(object sender, DetailsViewDeleteEventArgs e)
 {
     result.Text = "Struttura eliminata correttamente";
 }
 protected virtual new void OnItemDeleting(DetailsViewDeleteEventArgs e)
 {
 }
Exemplo n.º 14
0
 protected void DetailsView1_ItemDeleting(object sender, DetailsViewDeleteEventArgs e)
 {
     int fotoid = Convert.ToInt32(DetailsView1.DataKey[0]);
     FotoDAL.Delete(fotoid);
 }
Exemplo n.º 15
0
 protected override void OnItemDeleting(DetailsViewDeleteEventArgs e)
 {
     WebDataSource ds = (WebDataSource)this.GetObjByID(this.DataSourceID);
     if (ds.AllowDelete)
     {
         base.OnItemDeleting(e);
         if (ds.IsEmpty)
         {
             e.Cancel = true;
         }
         if (ds.AutoRecordLock)
         {
             object[] value = new object[ds.PrimaryKey.Length];
             for (int i = 0; i < ds.PrimaryKey.Length; i++)
             {
                 string columnName = ds.PrimaryKey[i].ColumnName;
                 if (e.Values.Contains(columnName))
                 {
                     value[i] = e.Values[columnName];
                 }
                 else if (ds.RelationValues != null && ds.RelationValues.Contains(columnName))
                 {
                     value[i] = ds.RelationValues[columnName];
                 }
                 else
                 {
                     throw new EEPException(EEPException.ExceptionType.ColumnValueNotFound, ds.GetType(), ds.ID, columnName, null);
                 }
             }
             if (!ds.AddLock("Deleting", value))
             {
                 e.Cancel = true;
             }
         }
     }
     else
     {
         language = CliUtils.fClientLang;
         String message = SysMsg.GetSystemMessage(language, "Srvtools", "WebDataSource", "rightToDelete", true);
         Page.Response.Write("<script>alert('" + message + "');</script>");
         e.Cancel = true;
     }
 }
		static void d_ItemDeleting (object sender, DetailsViewDeleteEventArgs 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;
			}
		}
 protected virtual new void OnItemDeleting(DetailsViewDeleteEventArgs e)
 {
 }
			public void DoOnItemDeleting  (DetailsViewDeleteEventArgs e)
			{
				OnItemDeleting (e);
			}
 private void HandleDelete(string commandArg)
 {
     int pageIndex = this.PageIndex;
     if (pageIndex >= 0)
     {
         DataSourceView data = null;
         bool isBoundUsingDataSourceID = base.IsBoundUsingDataSourceID;
         if (isBoundUsingDataSourceID)
         {
             data = this.GetData();
             if (data == null)
             {
                 throw new HttpException(System.Web.SR.GetString("View_DataSourceReturnedNullView", new object[] { this.ID }));
             }
         }
         DetailsViewDeleteEventArgs e = new DetailsViewDeleteEventArgs(pageIndex);
         this.ExtractRowValues(e.Values, true, false);
         foreach (DictionaryEntry entry in this.DataKey.Values)
         {
             e.Keys.Add(entry.Key, entry.Value);
             if (e.Values.Contains(entry.Key))
             {
                 e.Values.Remove(entry.Key);
             }
         }
         this.OnItemDeleting(e);
         if (!e.Cancel && isBoundUsingDataSourceID)
         {
             this._deleteKeys = e.Keys;
             this._deleteValues = e.Values;
             data.Delete(e.Keys, e.Values, new DataSourceViewOperationCallback(this.HandleDeleteCallback));
         }
     }
 }
		public void dv_DeleteingHandler (Object sender, DetailsViewDeleteEventArgs e)
		{
			isDeleted = true;
		}
 protected virtual new void OnItemDeleting (DetailsViewDeleteEventArgs e)
 {
   Contract.Requires (e != null);
 }