コード例 #1
0
        public GlobalTranslate ResolveMessage(string programCode, string translateSymbol, string languageCode)
        {
            StringBuilder strQuery = new StringBuilder();

            strQuery.AppendLine(" SELECT	TranslateWord  ");
            strQuery.AppendLine(" FROM	SuGlobalTranslate g ");
            strQuery.AppendLine(" INNER JOIN SuGlobalTranslateLang gl ");
            strQuery.AppendLine(" ON	g.TranslateID = gl.TranslateID ");
            strQuery.AppendLine(" INNER JOIN DbLanguage l ");
            strQuery.AppendLine(" ON	gl.LanguageID = l.LanguageID ");
            strQuery.AppendLine(" WHERE	l.LanguageCode = :LanguageCode ");
            strQuery.AppendLine(" AND	g.TranslateSymbol = :TranslateSymbol ");
            strQuery.AppendLine(" AND	g.ProgramCode = :ProgramCode ");
            strQuery.AppendLine(" AND	g.TranslateControl is null ");
            strQuery.AppendLine(" AND	g.Active = 1 ");
            strQuery.AppendLine(" AND	gl.Active = 1 ");
            strQuery.AppendLine(" AND	l.Active = 1 ");

            ISQLQuery query = GetCurrentSession().CreateSQLQuery(strQuery.ToString());

            query.SetString("LanguageCode", languageCode);
            query.SetString("TranslateSymbol", translateSymbol);
            query.SetString("ProgramCode", programCode);
            query.AddScalar("TranslateWord", NHibernateUtil.String);
            GlobalTranslate globalTranslate = (GlobalTranslate)query.SetResultTransformer(Transformers.AliasToBean(typeof(GlobalTranslate))).UniqueResult();

            return(globalTranslate);
        }
コード例 #2
0
        /// <summary>
        /// Applies resources of the specified culture to the specified target object.
        /// </summary>
        /// <param name="target">Target object to apply resources to.</param>
        /// <param name="messageSource"><see cref="IMessageSource"/> instance to retrieve resources from.</param>
        /// <param name="culture">Resource culture to use for resource lookup.</param>
        public new void ApplyResources(object target, IMessageSource messageSource, CultureInfo culture)
        {
            AssertUtils.ArgumentNotNull(target, "target");
            AssertUtils.ArgumentNotNull(culture, "culture");

            string programCode = string.Empty;

            if (target is SS.Standard.UI.BasePage)
            {
                programCode = ((SS.Standard.UI.BasePage)target).ProgramCode;
            }
            if (target is SS.Standard.UI.BaseUserControl)
            {
                programCode = ((SS.Standard.UI.BaseUserControl)target).ProgramCode;
            }
            if (target is SS.Standard.UI.BaseMaster)
            {
                programCode = ((SS.Standard.UI.BaseMaster)target).ProgramCode;
            }

            IList resources = GetResources(target, messageSource, culture);

            foreach (Resource resource in resources)
            {
                try
                {
                    resource.Target.SetValue(target, null, resource.Value);
                }
                catch (Exception)
                {
                    GlobalTranslate translate = resource.Value as GlobalTranslate;
                    if (!(string.IsNullOrEmpty(programCode)) && !(string.IsNullOrEmpty(translate.TranslateControl)))
                    {
                        SuGlobalTranslateService.DeleteByProgramCodeAndControl(programCode, translate.TranslateControl);
                    }
                    resources.Remove(resource);
                }
            }
        }
コード例 #3
0
        public void Show()
        {
            GlobalTranslate msg = SuGlobalTranslateQuery.ResolveMessage(msgCode, UserAccount.CurrentLanguageCode.ToString());

            if (MsgType.Equals(MessageTypeEnum.AlertMessage.Confirmation))
            {
                ctlMsgTopicLabel.Text    = MessageTypeEnum.AlertMessage.Confirmation.ToString();
                ctlMsgTypeImage.ImageUrl = "~/App_Themes/" + this.Page.StyleSheetTheme.ToString() + "/images/MsgConfirmation.gif";
            }
            else if (MsgType.Equals(MessageTypeEnum.AlertMessage.Information))
            {
                ctlMsgTopicLabel.Text           = MessageTypeEnum.AlertMessage.Information.ToString();
                ctlMsgCancelImageButton.Visible = false;
                ctlMsgTypeImage.ImageUrl        = "~/App_Themes/" + this.Page.StyleSheetTheme.ToString() + "/images/MsgInfomaton.gif";
            }
            else if (MsgType.Equals(MessageTypeEnum.AlertMessage.Error))
            {
                ctlMsgTopicLabel.Text           = MessageTypeEnum.AlertMessage.Error.ToString();
                ctlMsgCancelImageButton.Visible = false;
                ctlMsgTypeImage.ImageUrl        = "~/App_Themes/" + this.Page.StyleSheetTheme.ToString() + "/images/MsgError.gif";
            }
            else
            {
                ctlMsgTopicLabel.Text           = MessageTypeEnum.AlertMessage.Alert.ToString();
                ctlMsgCancelImageButton.Visible = false;
                ctlMsgTypeImage.ImageUrl        = "~/App_Themes/" + this.Page.StyleSheetTheme.ToString() + "/images/MsgWarning.gif";
            }
            ctlMsgHeaderLabel.Text = msgCode;
            if (msg != null)
            {
                ctlMsgBodyLabel.Text = msg.TranslateWord;
            }
            CallOnObjectLookUpCalling();
            this.UpdatePanelMessage.Update();
            this.ctlPanelModalPopupExtender.Show();
        }