Exemple #1
0
    protected void SaveCultures()
    {
        if (EditedBadWord == null)
        {
            return;
        }

        // Remove old items
        string newValues     = ValidationHelper.GetString(usWordCultures.Value, null);
        string currentValues = GetCurrentValues();
        string items         = DataHelper.GetNewItemsInList(newValues, currentValues);

        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            // Add all new cultures to word
            foreach (string item in newItems)
            {
                int cultureId = ValidationHelper.GetInteger(item, 0);
                BadWordCultureInfoProvider.RemoveBadWordFromCulture(EditedBadWord.WordID, cultureId);
            }
        }

        // Add new items
        items = DataHelper.GetNewItemsInList(currentValues, newValues);
        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            // Add all new cultures to word
            foreach (string item in newItems)
            {
                int cultureId = ValidationHelper.GetInteger(item, 0);
                BadWordCultureInfoProvider.AddBadWordToCulture(EditedBadWord.WordID, cultureId);
            }
        }

        ShowChangesSaved();
    }
Exemple #2
0
    protected void SaveCultures()
    {
        // Remove old items
        string newValues     = ValidationHelper.GetString(usWordCultures.Value, null);
        string currentValues = GetCurrentValues();
        string items         = DataHelper.GetNewItemsInList(newValues, currentValues);

        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (newItems != null)
            {
                // Add all new cultures to word
                foreach (string item in newItems)
                {
                    int cultureId = ValidationHelper.GetInteger(item, 0);
                    BadWordCultureInfoProvider.RemoveBadWordFromCulture(badWordId, cultureId);
                }
            }
        }

        // Add new items
        items = DataHelper.GetNewItemsInList(currentValues, newValues);
        if (!String.IsNullOrEmpty(items))
        {
            string[] newItems = items.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            if (newItems != null)
            {
                // Add all new cultures to word
                foreach (string item in newItems)
                {
                    int cultureId = ValidationHelper.GetInteger(item, 0);
                    BadWordCultureInfoProvider.AddBadWordToCulture(badWordId, cultureId);
                }
            }
        }

        lblInfo.Visible = true;
        lblInfo.Text    = GetString("General.ChangesSaved");
    }