Esempio n. 1
0
 protected bool SaveTabLocale(int tabId, string cultureCode, string tabName, string title, string description, string keyWords, string pageHeadText)
 {
     if (tabId > 0 && !string.IsNullOrEmpty(tabName.Trim()))
     {
         try
         {
             var tabLocaleController = new TabLocaleController();
             tabLocaleController.UpdateTabLocale(tabId, cultureCode, tabName, title, description, keyWords, pageHeadText, UserId);
             return(true);
         }
         catch (Exception ex)
         {
             Exceptions.ProcessModuleLoadException(this, ex);
         }
     }
     return(false);
 }
        private void repTabs_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "Update":
                try
                {
                    var hfTabId            = (HiddenField)e.Item.FindControl("hfTabId");
                    var txtTabName         = (TextBox)e.Item.FindControl("txtTabName");
                    var txtTabTitle        = (TextBox)e.Item.FindControl("txtTabTitle");
                    var txtTabDescription  = (TextBox)e.Item.FindControl("txtTabDescription");
                    var txtTabKeyWords     = (TextBox)e.Item.FindControl("txtTabKeyWords");
                    var txtTabPageHeadText = (TextBox)e.Item.FindControl("txtTabPageHeadText");

                    int tabId = int.Parse(hfTabId.Value);
                    if (tabId > 0 && !string.IsNullOrEmpty(txtTabName.Text.Trim()))
                    {
                        var tabLocaleController = new TabLocaleController();
                        tabLocaleController.UpdateTabLocale(tabId, ddlLocale.SelectedValue, txtTabName.Text, txtTabTitle.Text, txtTabDescription.Text, txtTabKeyWords.Text, txtTabPageHeadText.Text, UserId);

                        txtTabName.Style.Remove("border-color");
                        txtTabName.ToolTip = "";
                    }
                    else
                    {
                        txtTabName.Style.Add("border-color", "Red");
                        txtTabName.ToolTip = Localization.GetString("notTranslated", LocalResourceFile);
                    }
                }
                catch (Exception ex)
                {
                    Exceptions.ProcessModuleLoadException(this, ex);
                }
                break;
            }
        }
        private void SaveAll()
        {
            string selectedLocale = ddlLocale.SelectedValue;

            if (!string.IsNullOrEmpty(selectedLocale))
            {
                foreach (RepeaterItem item in repTabs.Items)
                {
                    var hfTabId            = (HiddenField)item.FindControl("hfTabId");
                    var txtTabName         = (TextBox)item.FindControl("txtTabName");
                    var txtTabTitle        = (TextBox)item.FindControl("txtTabTitle");
                    var txtTabDescription  = (TextBox)item.FindControl("txtTabDescription");
                    var txtTabKeyWords     = (TextBox)item.FindControl("txtTabKeyWords");
                    var txtTabPageHeadText = (TextBox)item.FindControl("txtTabPageHeadText");

                    int tabId = int.Parse(hfTabId.Value);
                    if (tabId > 0 && !string.IsNullOrEmpty(txtTabName.Text.Trim()))
                    {
                        var tabLocaleController = new TabLocaleController();
                        tabLocaleController.UpdateTabLocale(tabId, selectedLocale, txtTabName.Text, txtTabTitle.Text, txtTabDescription.Text, txtTabKeyWords.Text, txtTabPageHeadText.Text, UserId);
                    }
                }
            }
        }