Beispiel #1
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());
            }
        }
Beispiel #2
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);
            }
        }
        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();
        }