示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                bool isDeleted = false;

                foreach (GridDataItem data in grid.SelectedItems)
                {
                    int tagId = Convert.ToInt32(data.GetDataKeyValue("TagId"));
                    Tag tag   = new Tag(tagId);

                    if (tag != null && tag.TagId > -1)
                    {
                        ContentLanguage.DeleteByContent(tag.Guid);
                        TagItem.DeleteByTag(tag.TagId);
                        Tag.Delete(tagId);

                        LogActivity.Write("Delete product tag", tag.TagText);

                        isDeleted = true;
                    }
                }

                if (isDeleted)
                {
                    message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage");
                    WebUtils.SetupRedirect(this, Request.RawUrl);
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
示例#2
0
        private void DeleteTag(int tagId)
        {
            try
            {
                Tag tag = new Tag(tagId);

                if (tag != null && tag.TagId > -1)
                {
                    ContentLanguage.DeleteByContent(tag.Guid);
                    TagItem.DeleteByTag(tag.TagId);
                    Tag.Delete(tagId);

                    LogActivity.Write("Delete news tag", tag.TagText);
                    //message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage");
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }