void btnDelete_Click(object sender, EventArgs e) { try { int iRecordDeleted = 0; foreach (Telerik.Web.UI.GridDataItem data in grid.SelectedItems) { int orderId = Convert.ToInt32(data.GetDataKeyValue("OrderId")); Order order = new Order(orderId); if (order != null && order.OrderId > 0 && order.SiteId == siteSettings.SiteId && !order.IsDeleted) { ContentDeleted.Create(siteSettings.SiteId, order.OrderId.ToString(), "Order", typeof(OrderDeleted).AssemblyQualifiedName, order.OrderId.ToString(), Page.User.Identity.Name); order.IsDeleted = true; order.Save(); iRecordDeleted += 1; } } if (iRecordDeleted > 0) { LogActivity.Write("Delete " + iRecordDeleted.ToString() + " order(s)", "Order"); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage"); grid.Rebind(); } } catch (Exception ex) { log.Error(ex); } }
private void btnDelete_Click(object sender, EventArgs e) { try { int iRecordDeleted = 0; foreach (Telerik.Web.UI.GridDataItem data in grid.SelectedItems) { int shippingMethodId = Convert.ToInt32(data.GetDataKeyValue("ShippingMethodId")); ShippingMethod method = new ShippingMethod(shippingMethodId); if (method != null && method.ShippingMethodId > 0 && method.SiteId == siteSettings.SiteId && !method.IsDeleted) { ContentDeleted.Create(siteSettings.SiteId, method.ShippingMethodId.ToString(), "ShippingMethod", typeof(ShippingMethodDeleted).AssemblyQualifiedName, method.ShippingMethodId.ToString(), Page.User.Identity.Name); method.IsDeleted = true; method.Save(); iRecordDeleted += 1; } } if (iRecordDeleted > 0) { LogActivity.Write("Delete " + iRecordDeleted.ToString() + " shipping method(s)", "Shipping method"); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage"); grid.Rebind(); } } catch (Exception ex) { log.Error(ex); } }
protected Task On(ContentDeleted @event, EnvelopeHeaders headers) { return(ForSchemaIdAsync(@event.SchemaId.Id, collection => { return collection.DeleteOneAsync(x => x.Id == headers.AggregateId()); })); }
public void Should_calculate_name_for_deleted() { var @event = new ContentDeleted { SchemaId = schemaMatch }; Assert.Equal("MySchema1Deleted", sut.GetName(@event)); }
protected Task On(ContentDeleted @event) { return(Collection.UpdateManyAsync( Filter.And( Filter.AnyEq(x => x.ReferencedIds, @event.ContentId), Filter.AnyNe(x => x.ReferencedIdsDeleted, @event.ContentId)), Update.AddToSet(x => x.ReferencedIdsDeleted, @event.ContentId))); }
protected Task On(ContentDeleted @event, EnvelopeHeaders headers) { return(ForAppIdAsync(@event.AppId.Id, async collection => { await collection.UpdateManyAsync( Filter.And( Filter.AnyEq(x => x.ReferencedIds, @event.ContentId), Filter.AnyNe(x => x.ReferencedIdsDeleted, @event.ContentId)), Update.AddToSet(x => x.ReferencedIdsDeleted, @event.ContentId)); await collection.DeleteOneAsync(x => x.Id == headers.AggregateId()); })); }
void btnDelete_Click(object sender, EventArgs e) { try { if (!NewsPermission.CanDelete) { SiteUtils.RedirectToEditAccessDeniedPage(); return; } bool isDeleted = false; foreach (GridDataItem data in grid.SelectedItems) { int newsId = Convert.ToInt32(data.GetDataKeyValue("NewsID")); News news = new News(SiteId, newsId); if (news != null && news.NewsID != -1 && !news.IsDeleted) { ContentDeleted.Create(siteSettings.SiteId, news.Title, "News", typeof(NewsDeleted).AssemblyQualifiedName, news.NewsID.ToString(), Page.User.Identity.Name); news.IsDeleted = true; news.ContentChanged += new ContentChangedEventHandler(news_ContentChanged); news.SaveDeleted(); LogActivity.Write("Delete news", news.Title); isDeleted = true; } } if (isDeleted) { SiteUtils.QueueIndexing(); grid.Rebind(); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage"); } } catch (Exception ex) { log.Error(ex); } }
private async Task DeleteAsync(ContentDeleted @event) { var state = await textIndexerState.GetAsync(@event.ContentId); if (state != null) { await IndexAsync(@event, new DeleteIndexEntry { DocId = state.DocIdCurrent }, new DeleteIndexEntry { DocId = state.DocIdNew ?? NotFound, }); await textIndexerState.RemoveAsync(state.ContentId); } }
private void btnDelete_Click(object sender, EventArgs e) { try { if (method != null && method.PaymentMethodId > -1) { ContentDeleted.Create(siteSettings.SiteId, method.PaymentMethodId.ToString(), "PaymentMethod", typeof(PaymentMethodDeleted).AssemblyQualifiedName, method.PaymentMethodId.ToString(), Page.User.Identity.Name); method.IsDeleted = true; method.Save(); LogActivity.Write("Delete payment method", method.Name); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage"); } WebUtils.SetupRedirect(this, SiteRoot + "/Product/AdminCP/PaymentMethods.aspx"); } catch (Exception ex) { log.Error(ex); } }
protected void On(ContentDeleted @event) { IsDeleted = true; }
protected Task On(ContentDeleted @event) { return(contents.CleanupAsync(@event.ContentId)); }
protected Task On(ContentDeleted @event) { return(Task.WhenAll( contentsDraft.CleanupAsync(@event.ContentId), contentsPublished.CleanupAsync(@event.ContentId))); }
void btnDelete_Click(object sender, EventArgs e) { try { if (!ProductPermission.CanDelete) { SiteUtils.RedirectToEditAccessDeniedPage(); return; } bool isDeleted = false; foreach (GridDataItem data in grid.SelectedItems) { int productId = Convert.ToInt32(data.GetDataKeyValue("ProductId")); Product product = new Product(siteSettings.SiteId, productId); if (product != null && product.ProductId != -1 && !product.IsDeleted) { if (product.ZoneId.ToString() != ddZones.SelectedValue && ddZones.SelectedValue != "-1") { ZoneSettings objZone = new ZoneSettings(siteSettings.SiteId, Convert.ToInt32(ddZones.SelectedValue)); if (objZone != null && objZone.ZoneId > 0) { ZoneItem zoneNews = new ZoneItem(objZone.ZoneGuid, product.ProductGuid); ZoneItem.Delete(zoneNews.ZoneGuid, zoneNews.ItemGuid); } } else { ContentDeleted.Create(siteSettings.SiteId, product.Title, "Product", typeof(ProductDeleted).AssemblyQualifiedName, product.ProductId.ToString(), Page.User.Identity.Name); product.IsDeleted = true; product.ContentChanged += new ContentChangedEventHandler(product_ContentChanged); product.SaveDeleted(); LogActivity.Write("Delete product", product.Title); } //ContentDeleted.Create(siteSettings.SiteId, product.Title, "Product", typeof(ProductDeleted).AssemblyQualifiedName, product.ProductId.ToString(), Page.User.Identity.Name); //product.IsDeleted = true; //product.ContentChanged += new ContentChangedEventHandler(product_ContentChanged); //product.SaveDeleted(); //LogActivity.Write("Delete product", product.Title); isDeleted = true; } } if (isDeleted) { SiteUtils.QueueIndexing(); grid.Rebind(); message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage"); } } catch (Exception ex) { log.Error(ex); } }