コード例 #1
0
        private void UpdateStringResources(string locale)
        {
            var displayOutOfStockOnProduct = StringResourceManager.GetStringResource(AppLogic.StoreID(), locale, "OutofStock.DisplayOutOfStockOnProductPage");

            if (displayOutOfStockOnProduct != null)
            {
                displayOutOfStockOnProduct.Update("OutofStock.DisplayOutOfStockOnProductPage", locale, txtProductOutOfStockMessage.Text);
            }

            var displayOutOfStockOnEntity = StringResourceManager.GetStringResource(AppLogic.StoreID(), locale, "OutofStock.DisplayOutOfStockOnEntityPage");

            if (displayOutOfStockOnEntity != null)
            {
                displayOutOfStockOnEntity.Update("OutofStock.DisplayOutOfStockOnEntityPage", locale, txtEntityOutOfStockMessage.Text);
            }

            var displayInStockOnProduct = StringResourceManager.GetStringResource(AppLogic.StoreID(), locale, "OutofStock.DisplayInStockOnProductPage");

            if (displayInStockOnProduct != null)
            {
                displayInStockOnProduct.Update("OutofStock.DisplayInStockOnProductPage", locale, txtProductInStockMessage.Text);
            }

            var displayInStockOnEntity = StringResourceManager.GetStringResource(AppLogic.StoreID(), locale, "OutofStock.DisplayInStockOnEntityPage");

            if (displayInStockOnEntity != null)
            {
                displayInStockOnEntity.Update("OutofStock.DisplayInStockOnEntityPage", locale, txtEntityInStockMessage.Text);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Server.ScriptTimeout = 1000000;

            ShowLocaleSetting = CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting");

            var isMasterReload = CommonLogic.QueryStringBool("master");

            pnlReload.Visible = isMasterReload;
            pnlUpload.Visible = !isMasterReload;

            if (isMasterReload && !StringResourceManager.CheckStringResourceExcelFileExists(ShowLocaleSetting))
            {
                ctlAlertMessage.PushAlertMessage("The server does not have any string resource files for the chosen locale.", AlertMessage.AlertType.Error);
                pnlReload.Visible = false;
            }

            if (!IsPostBack)
            {
                litSelectFileInstructions.Text = String.Format(AppLogic.GetStringForDefaultLocale("admin.stringresources.SelectFile"), ShowLocaleSetting);
                lnkBack1.NavigateUrl           = AppLogic.AdminLinkUrl("stringresources.aspx") + "?filterlocale=" + Localization.CheckLocaleSettingForProperCase(ShowLocaleSetting);
                lnkBack2.NavigateUrl           = AppLogic.AdminLinkUrl("stringresources.aspx") + "?filterlocale=" + Localization.CheckLocaleSettingForProperCase(ShowLocaleSetting);

                if (isMasterReload)
                {
                    litStage.Text = string.Format(AppLogic.GetStringForDefaultLocale("admin.stringresources.ReloadMaster"), ShowLocaleSetting);
                }
                else
                {
                    litStage.Text = string.Format(AppLogic.GetStringForDefaultLocale("admin.stringresources.ImportFile1"), ShowLocaleSetting);
                }
            }
        }
コード例 #3
0
 internal bool IsValidServerVersion(Uri url)
 {
     using (var client = new WebClient())
     {
         client.Headers[HttpRequestHeader.UserAgent] = CmdLetContext.GetUserAgent();
         string str = null;
         try
         {
             client.DownloadData(url);
             str = client.ResponseHeaders[HEADER_SHAREPOINT_VERSION];
         }
         catch (WebException exception)
         {
             if ((exception != null) && (exception.Response != null))
             {
                 str = exception.Response.Headers[HEADER_SHAREPOINT_VERSION];
             }
         }
         if (str == null)
         {
             throw new InvalidOperationException(StringResourceManager.GetResourceString("ValidateServerVersionCouldntConnectToUri", new object[0]));
         }
         if (!string.IsNullOrEmpty(str))
         {
             string input = str.Split(new char[] { ',' })[0];
             if (Version.TryParse(input, out Version version))
             {
                 return(version.Major >= 15);
             }
         }
     }
     return(false);
 }
コード例 #4
0
        public SPOService InstantiateSPOService(Uri url, string loginUrl, PSCredential credentials,
                                                string authenticationUrl = COMMON_AUTH_URL, PromptBehavior?behavior = null)
        {
            if (!IsValidServerVersion(url))
            {
                throw new InvalidOperationException(StringResourceManager.GetResourceString(
                                                        "ValidateServerVersionInvalidVersion",
                                                        new object[0]));
            }
            var context = new CmdLetContext(url.ToString(), null, null); // this is where the site "sites/Clients" is set.

            if (credentials == null)
            {
                OAuthSession session;
                if (CTX.SP1 == null)
                {
                    session = new OAuthSession(authenticationUrl);
                    session.SignIn(loginUrl, behavior.Value);                      // the login Url is the base site though.
                }
                else
                {
                    CTX.SP1.OAuthSession.EnsureValidAuthToken();
                    session = CTX.SP1.OAuthSession;
                }

                context.OAuthSession = session;
            }
            else
            {
                var credentials2 = new SharePointOnlineCredentials(credentials.UserName, credentials.Password);
                context.Credentials = credentials2;
            }
            return(new SPOService(context));
        }
 public override PSCredential Read()
 {
     if (this.m_credential == null)
     {
         throw new InvalidOperationException(StringResourceManager.GetResourceString("CredentialCmdletPipebindReadNoPshost", new object[0]));
     }
     return(this.m_credential);
 }
コード例 #6
0
    void Awake()
    {
        stringResources = new StringResourceManager();

        string isoCode = Debug.isDebugBuild && !String.IsNullOrEmpty(debugIsoCode) ? debugIsoCode : StringResourceManager.GetISOCodeFromSystemLanguage();

        stringResources.LoadStrings(null);         // Load default language strings
        stringResources.LoadStrings(isoCode);      // Override system language existing strings
    }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowLocaleSetting = Localization.CheckLocaleSettingForProperCase(CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));
            var isMasterStringResource = CommonLogic.QueryStringBool("master");

            if (isMasterStringResource)
            {
                if (!StringResourceManager.CheckStringResourceExcelFileExists(ShowLocaleSetting))
                {
                    AlertMessageControl.PushAlertMessage(AppLogic.GetString("admin.StringResources.NoFileFound", SkinID, ShowLocaleSetting), AlertMessage.AlertType.Error);
                    return;
                }

                ImportFiles = StringResourceManager.GetStringResourceFilesForLocale(ShowLocaleSetting);
            }
            else
            {
                ImportFiles = new[] { CommonLogic.SafeMapPath("~/images/" + CommonLogic.QueryStringCanBeDangerousContent("SpreadsheetName")) };
            }

            if (!IsPostBack)
            {
                CancelLink.NavigateUrl = String.Format("{0}?filterlocale={1}", AppLogic.AdminLinkUrl("stringresources.aspx"), ShowLocaleSetting);

                if (isMasterStringResource)
                {
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginReload", SkinID, LocaleSetting);
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ReloadLocale", SkinID, LocaleSetting), ShowLocaleSetting);
                }
                else
                {
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginImport", SkinID, LocaleSetting);
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ProcessingFile", SkinID, LocaleSetting), ImportFiles.First());
                }

                // Preview the data
                try
                {
                    var validationResult = StringResourceImporter.Validate(ShowLocaleSetting, ImportFiles, (StringResourceImporter.ImportOption)CommonLogic.QueryStringUSInt("option"));
                    DataReportGrid.DataSource = validationResult;
                }
                catch (Exception exception)
                {
                    while (exception.InnerException != null)
                    {
                        exception = exception.InnerException;
                    }

                    AlertMessageControl.PushAlertMessage(exception.Message, AlertMessage.AlertType.Error);
                    ActionsPanel.Visible = false;
                }
            }
        }
 public static bool IsCredentialValid(PSCredential credential, PSHost host)
 {
     if (host == null)
     {
         throw new ArgumentNullException("host");
     }
     if ((credential == null) || ((credential.Password != null) && (credential.Password.Length != 0)))
     {
         return(true);
     }
     host.UI.WriteWarningLine(StringResourceManager.GetResourceString("AuthenticationHelperStrAuthenticateEmptyPassword", new object[0]));
     return(false);
 }
コード例 #9
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            resetError("", false);
            StringBuilder sql = new StringBuilder();

            if (ValidInput())
            {
                string name   = txtName.Text.Trim();
                string value  = txtDescription.Text.Trim();
                string locale = ddLocale.SelectedValue;

                if (locale.Equals(string.Empty))
                {
                    locale = Localization.GetDefaultLocale();
                }

                var storeId = Stores[0].StoreID;
                if (Stores.Count > 1)
                {
                    storeId = cboStoreAddString.SelectedValue.ToNativeInt();
                }


                AspDotNetStorefrontCore.StringResource sr = StringResourceManager.GetStringResource(storeId, name, locale);  //Must fully qualify this for VB
                if (sr == null)
                {
                    var stringResources = StringResourceManager.GetStringResources(storeId);

                    string err = stringResources.Add(storeId, name, locale, value);
                    if (err == string.Empty)
                    {
                        resetError("String Resource added.", false);
                        ShowAddPanel(false);
                    }
                    else
                    {
                        resetError("String Resource was not added.  The following error occured: " + err, true);
                        ShowAddPanel(true);
                    }
                }
                else
                {
                    resetError("String Resource already exists.", true);
                    ShowAddPanel(true);
                }
            }
            else
            {
                resetError("Please input all required fields.", true);
            }
        }
コード例 #10
0
        public static PSCredential PromptForCredentials(PSHost host, string userName)
        {
            if (host == null)
            {
                throw new ArgumentNullException("host");
            }
            PSCredential credential = null;

            do
            {
                credential = host.UI.PromptForCredential(StringResourceManager.GetResourceString("CmdletContextAuthenticationTitle", new object[0]), StringResourceManager.GetResourceString("CmdletContextAuthenticationMessage", new object[0]), (credential == null) ? userName : credential.UserName, string.Empty);
            }while (!IsCredentialValid(credential, host));
            return(credential);
        }
コード例 #11
0
            public void When_KeyDefined_Then_ResourceShouldExist(string key, string cultureName)
            {
                // Arrange.

                var cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);

                // Act.

                var value = StringResourceManager.GetHazardPhraseString(key, cultureInfo);

                // Assert.

                value.Should().NotBeNullOrWhiteSpace(because: $"hazard {key} is defined");
            }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.CacheControl = "private";
            Response.Expires      = 0;
            Response.AddHeader("pragma", "no-cache");
            Server.ScriptTimeout = 1000000;

            ShowLocaleSetting = Localization.CheckLocaleSettingForProperCase(CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));

            // this should tell that the excel file to be loaded
            // is a master string resource for the locale i.e. strings.fr-FR.xls
            if (isMasterStringResource)
            {
                bool exists = StringResourceManager.CheckStringResourceExcelFileExists(ShowLocaleSetting);
                if (!exists)
                {
                    resetError(AppLogic.GetString("admin.StringResources.NoFileFound", SkinID, ShowLocaleSetting), true);
                    return;
                }
                else
                {
                    ExcelFiles = StringResourceManager.GetStringResourceFilesForLocale(ShowLocaleSetting);
                }
            }
            else
            {
                SpreadsheetName = CommonLogic.QueryStringCanBeDangerousContent("SpreadsheetName");
                ExcelFiles.Add(CommonLogic.SafeMapPath("~/images" + "/" + SpreadsheetName + ".xls"));
            }

            if (!IsPostBack)
            {
                if (isMasterStringResource)
                {
                    litStage.Text       = string.Format(AppLogic.GetString("admin.stringresources.ReloadMaster", SkinID, ShowLocaleSetting), CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginReload", SkinID, LocaleSetting);
                    ltStrings.Text      = "<a href=\"" + AppLogic.AdminLinkUrl("stringresource.aspx") + "?showlocalesetting=" + ShowLocaleSetting + "\">" + AppLogic.GetString("admin.importstringresourcefile2.CancelReload", SkinID, LocaleSetting) + "</a>";
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ReloadLocale", SkinID, LocaleSetting), ShowLocaleSetting);
                }
                else
                {
                    //litStage.Text = string.Format(String.Format(AppLogic.GetString("admin.importstringresourcefile2.Step2", SkinID, LocaleSetting)), CommonLogic.QueryStringCanBeDangerousContent("ShowLocaleSetting"));
                    btnProcessFile.Text = AppLogic.GetString("admin.importstringresourcefile2.BeginImport", SkinID, LocaleSetting);
                    ltStrings.Text      = "<a href=\"" + AppLogic.AdminLinkUrl("stringresource.aspx") + "?showlocalesetting=" + ShowLocaleSetting + "\">" + AppLogic.GetString("admin.importstringresourcefile2.CancelImport", SkinID, LocaleSetting) + "</a>";
                    ltProcessing.Text   = String.Format(AppLogic.GetString("admin.importstringresourcefile2.ProcessingFile", SkinID, LocaleSetting), ExcelFiles[0]);
                }
                ltVerify.Text = AppLogic.GetString("admin.importstringresourcefile2.Good", SkinID, LocaleSetting);
                loadData();
            }
        }
コード例 #13
0
            public string When_KeyIsComposite_Then_ReturnConcatenatedStrings(string key, string cultureName)
            {
                // Arrange.

                var cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);

                // Act.

                var value = StringResourceManager.GetPCodePhraseString(key, cultureInfo);

                // Assert.

                value.Should().NotBeNullOrWhiteSpace();
                return(value);
            }
コード例 #14
0
            public string When_PartofCompositeKeyNotDefined_Then_ReturnNull(string key, string cultureName)
            {
                // Arrange.

                var cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);

                // Act.

                var value = StringResourceManager.GetPCodePhraseString(key, cultureInfo);

                // Assert.

                value.Should().BeNull();
                return(value);
            }
コード例 #15
0
            public void When_KeyDefined_Then_ResourceShouldExist(int ordinalValue, string cultureName)
            {
                // Arrange.

                var key         = (GHSDatabase.HazardClass)ordinalValue;
                var cultureInfo = CultureInfo.CreateSpecificCulture(cultureName);

                // Act.

                var value = StringResourceManager.GetHazardClassString(key, cultureInfo);

                // Assert.

                value.Should().NotBeNullOrWhiteSpace(because: $"hazard class {key} is defined");
            }
コード例 #16
0
        private void UpdateStringResource(string name, string value, string locale, int storeId)
        {
            var stringResource = StringResourceManager.GetStringResource(storeId, locale, name);

            if (stringResource == null)
            {
                StringResource.Create(storeId, name, locale, value.Trim());

                // Reload string resources from DB. Necessary after creating a new string resource.
                StringResourceManager.LoadAllStrings(false);
            }
            else
            {
                stringResource.Update(storeId, name, locale, value.Trim());
            }
        }
コード例 #17
0
        private void Init()
        {
            resourceMgrs          = new Dictionary <string, IResourceRegistry>(StringComparer.OrdinalIgnoreCase);
            StringResourceManager = new StringResourceManager(NLiteEnvironment.App_LocalResources);

            #if !SILVERLIGHT
            ImageResourceManager = new ImageResourceManager(NLiteEnvironment.App_LocalResources);
            IconResourceManager  = new IconResourceManager(NLiteEnvironment.App_LocalResources);
            resourceMgrs[Constance.ImageResources] = ImageResourceManager;
            resourceMgrs[Constance.IconResources]  = IconResourceManager;
            #endif
            resourceMgrs[Constance.StringResources] = StringResourceManager;


            Task.Set();
        }
コード例 #18
0
        protected void btnProcessFile_Click(object sender, EventArgs e)
        {
            ActionsPanel.Visible = false;

            try
            {
                var importResult = StringResourceImporter.Import(ShowLocaleSetting, ImportFiles, (StringResourceImporter.ImportOption)CommonLogic.QueryStringUSInt("option"));
                DataReportGrid.DataSource = importResult;

                StringResourceManager.LoadAllStrings(false);
                AlertMessageControl.PushAlertMessage(AppLogic.GetString("admin.importstringresourcefile2.Done", SkinID, LocaleSetting), AlertMessage.AlertType.Success);
            }
            catch (Exception exception)
            {
                AlertMessageControl.PushAlertMessage(String.Format(AppLogic.GetString("admin.importstringresourcefile2.ErrorProcessingStrings", SkinID, LocaleSetting), exception), AlertMessage.AlertType.Error);
            }
        }
コード例 #19
0
        protected void btnLoadExcelServer_Click(object sender, EventArgs e)
        {
            resetError("", false);

            string selectedLocale = ddLocales.SelectedValue;

            string stringResourceFilePath   = string.Empty;
            bool   stringResourceFileExists = StringResourceManager.CheckStringResourceExcelFileExists(selectedLocale);

            if (stringResourceFileExists)
            {
                Response.Redirect(string.Format(AppLogic.AdminLinkUrl("importstringresourcefile1.aspx") + "?showlocalesetting={0}&master=true", selectedLocale));
            }
            else
            {
                resetError(string.Format("String Resource File {0} not found!!!", stringResourceFilePath), true);
            }
        }
コード例 #20
0
        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)
        {
            string str = value as string;

            if (str != null)
            {
                if (str == StringResourceManager.GetString(typeof(Resources.StringResources), Constants.BuildAction.Merge, culture))
                {
                    return(BuildAction.Merge);
                }

                if (str == StringResourceManager.GetString(typeof(Resources.StringResources), Constants.BuildAction.None, culture))
                {
                    return(BuildAction.None);
                }
            }

            return(base.ConvertFrom(context, culture, value));
        }
コード例 #21
0
ファイル: BuildAction.cs プロジェクト: formist/LinkMe
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType)
        {
            if (destinationType == typeof(string))
            {
                string result = null;
                if (value != null)
                {
                    result = StringResourceManager.GetString(typeof(Resources.StringResources), ((BuildAction)value).ToString(), culture);
                }
                else
                {
                    result = StringResourceManager.GetString(typeof(Resources.StringResources), BuildAction.None.ToString(), culture);
                }

                if (result != null)
                {
                    return(result);
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
コード例 #22
0
 public VsProjectSettingsPage()
 {
     Name = StringResourceManager.GetString(typeof(Resources.StringResources), Constants.Project.Property.Category.General);
 }
コード例 #23
0
        protected void gMain_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = gMain.Rows[e.RowIndex];

            if (row != null)
            {
                string        iden     = row.Cells[2].Text.ToString(); // the StringResourceId column
                TextBox       txtName  = (TextBox)row.FindControl("txtName");
                TextBox       txtValue = (TextBox)row.FindControl("txtValue");
                DropDownList  ddLocale = (DropDownList)row.FindControl("ddLocale");
                StringBuilder sql      = new StringBuilder(2500);

                int    stringResourceId = iden.ToNativeInt();
                string name             = txtName.Text;
                string selectedLocale   = ddLocale.SelectedValue;
                string value            = txtValue.Text;
                int    prevStoreId      = row.FindControl <HiddenField>("hdfPrevStoreId").Value.ToNativeInt();

                var defaultStore = Stores.FirstOrDefault(store => store.IsDefault);
                int storeId      = 1; // default
                if (Stores.Count > 1)
                {
                    var cboEditStores = row.FindControl <DropDownList>("cboEditStores");
                    if (cboEditStores.SelectedIndex == 0) // All means also the default store
                    {
                        storeId = defaultStore.StoreID;
                    }
                    else
                    {
                        storeId = cboEditStores.SelectedValue.ToNativeInt();
                    }
                }
                else
                {
                    storeId = row.FindControl <Label>("lblStoreId").Text.ToNativeInt();
                }

                var owningStore = Stores.FirstOrDefault(store => store.StoreID == storeId);

                // check if the user specified a different storeid
                if (storeId != prevStoreId)
                {
                    // check if we have a previous string resource with that storeid+name+locale
                    var prevStringResource = StringResourceManager.GetStringResource(prevStoreId, selectedLocale, name);
                    var newStoreString     = StringResourceManager.GetStringResource(storeId, selectedLocale, name);

                    // check if we have a duplicate on the destination store
                    if (newStoreString != null)
                    {
                        // just update that one instead
                        newStoreString.Update(name, selectedLocale, value);

                        string updateNotice = string.Format("Item [{0}] updated for store: {1} ({2})", name, owningStore.Name, owningStore.StoreID);
                        resetError(updateNotice, false);
                        gMain.EditIndex = -1;

                        // nuke the other store string
                        if (prevStringResource != null)
                        {
                            // nuke the previous one
                            prevStringResource.Owner.Remove(prevStringResource);
                        }
                    }
                    else
                    {
                        // create a copy of that string resource for this store
                        newStoreString = StringResource.Create(storeId, name, selectedLocale, value);

                        var storeStrings = StringResourceManager.GetStringResources(storeId);
                        storeStrings.Add(newStoreString);

                        DuplicatedStringResource = newStoreString.StringResourceID;
                        if (prevStringResource != null)
                        {
                            DuplicatedFromStringResource = prevStringResource.StringResourceID;
                        }

                        string updateNotice = string.Format("Item [{0}] duplicated for store: {1} ({2})", name, owningStore.Name, owningStore.StoreID);
                        resetError(updateNotice, false);
                        gMain.EditIndex = -1;
                    }
                }
                else
                {
                    // find if there's an existing string resource with that name+locale+storeid pair
                    var dupString = StringResourceManager.GetStringResource(storeId, selectedLocale, name);
                    if (dupString != null && dupString.StringResourceID != stringResourceId)
                    {
                        // prompt for error editing duplicate in same Store Strings
                        resetError("Another string exists with that Name and Locale combination.", true);
                        return;
                    }

                    // just edit the current string resource
                    var str = StringResourceManager.GetStringResource(storeId, stringResourceId);
                    if (str != null)
                    {
                        str.Update(name, selectedLocale, value);
                        resetError("Item updated", false);
                        gMain.EditIndex = -1;
                    }
                    else
                    {
                        resetError("Item could not be found in collection", true);
                    }
                }

                resultFilter("", Localization.CheckLocaleSettingForProperCase(selectedLocale));
            }
        }
コード例 #24
0
 public ConfigurationSettingsPage()
 {
     Name = StringResourceManager.GetString(typeof(Resources.StringResources), Constants.Project.Property.Category.Assemble);
 }
コード例 #25
0
        protected void btnProcessFile_Click(object sender, EventArgs e)
        {
            resetError("", false);
            ltVerify.Visible       = false;
            btnProcessFile.Visible = false;
            ltStrings.Text         = String.Empty;
            StringBuilder tmpS = new StringBuilder(4096);

            try
            {
                tmpS.Append("<p align=\"left\">" + AppLogic.GetString("admin.importstringresourcefile2.ImportNewStrings", SkinID, LocaleSetting) + "</p>");
                tmpS.Append("<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"1\">\n");
                tmpS.Append("<tr>\n");
                tmpS.Append("<td class=\"tablenormal\">" + AppLogic.GetString("admin.importstringresourcefile2.Status", SkinID, LocaleSetting) + "</td>\n");
                tmpS.Append("<td class=\"tablenormal\">" + AppLogic.GetString("admin.importstringresourcefile2.Row", SkinID, LocaleSetting) + "</td>\n");
                tmpS.Append("<td class=\"tablenormal\">" + AppLogic.GetString("admin.common.Name", SkinID, LocaleSetting) + "</td>\n");
                tmpS.Append("<td class=\"tablenormal\">" + AppLogic.GetString("admin.common.LocaleSetting", SkinID, LocaleSetting) + "</td>\n");
                tmpS.Append("<td class=\"tablenormal\">" + AppLogic.GetString("admin.importstringresourcefile2.StringValue", SkinID, LocaleSetting) + "</td>\n");
                if (isMultiStore)
                {
                    tmpS.Append("<td class=\"tablenormal\">" + AppLogic.GetString("admin.importstringresourcefile2.StringValue", SkinID, LocaleSetting) + "</td>\n");
                }
                tmpS.Append("</tr>\n");

                String NameField    = String.Empty;
                String ValueField   = String.Empty;
                String StoreIDField = String.Empty;

                ExcelToXml  exf    = new ExcelToXml(ExcelFiles.ToArray());
                XmlDocument xmlDoc = exf.LoadSheet("Sheet1", "C", 5000, "A");

                foreach (XmlNode row in xmlDoc.SelectNodes("/excel/sheet/row"))
                {
                    NameField    = exf.GetCell(row, "A");
                    ValueField   = exf.GetCell(row, "B");
                    StoreIDField = exf.GetCell(row, "C");

                    int storeid;
                    if (!int.TryParse(StoreIDField, out storeid))
                    {
                        storeid = AppLogic.StoreID();
                    }


                    String ProcessIt = ProcessLine(NameField, ShowLocaleSetting, ValueField, false, storeid);
                    tmpS.Append("<tr bgcolor=\"" + (ProcessIt.StartsWith(AppLogic.ro_OK) ? "#DEFEDD" : "#FFCCCC") + "\">\n");
                    tmpS.Append("<td>" + ProcessIt + "</td>\n");
                    tmpS.Append("<td class=\"DataCellGrid\">" + XmlCommon.XmlAttributeUSInt(row, "id").ToString() + "</td>\n");
                    tmpS.Append("<td class=\"DataCellGrid\">" + (NameField.Length == 0 ? "&nbsp;" : NameField) + "</td>\n");
                    tmpS.Append("<td class=\"DataCellGrid\">" + (ShowLocaleSetting.Length == 0 ? "&nbsp;" : ShowLocaleSetting) + "</td>\n");
                    tmpS.Append("<td class=\"DataCellGrid\">" + (ValueField.Length == 0 ? "&nbsp;" : ValueField) + "</td>\n");
                    if (isMultiStore)
                    {
                        tmpS.Append("<td class=\"DataCellGrid\">" + storeid + "</td>\n");
                    }
                    tmpS.Append("</tr>\n");
                }

                tmpS.Append("</table>\n");
                tmpS.Append("<b>" + AppLogic.GetString("admin.importstringresourcefile2.Done", SkinID, LocaleSetting) + "</b><br/><br/>");
                tmpS.Append("<a href=\"" + AppLogic.AdminLinkUrl("stringresource.aspx") + "?showlocalesetting=" + ShowLocaleSetting + "\">" + AppLogic.GetString("admin.importstringresourcefile2.Back", SkinID, LocaleSetting) + "</a>");

                StringResourceManager.LoadAllStrings(false);
            }
            catch (Exception ex)
            {
                resetError(String.Format(AppLogic.GetString("admin.importstringresourcefile2.ErrorProcessingStrings", SkinID, LocaleSetting), ex.ToString()), true);
            }
            ltData.Text = tmpS.ToString();
        }
コード例 #26
0
 public static object ReadStringResource(Type t)
 {
     return(StringResourceManager.ReadSafeStringResource(t));
 }
コード例 #27
0
 public object ReadStringResource()
 {
     return(StringResourceManager.ReadSafeStringResource(base.GetType()));
 }