Beispiel #1
0
        /// <summary>
        /// Get message from resource
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="screen"></param>
        /// <param name="module"></param>
        /// <param name="code"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public static MessageModel GetMessageForScreen(string controller, string screen, string module, string code, params string[] param)
        {
            MessageModel msg = new MessageModel();

            msg.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
            msg.Code        = code;

            try
            {
                string assembly = string.Format("{0}.{1}.dll", CommonValue.MESSAGE_ASSEMBLY, module);

                CommonUtil util = new CommonUtil();
                System.Resources.ResourceSet rs = util.GetResource(assembly, CommonValue.MESSAGE_NAMESPACE);

                MessageUtil m      = new MessageUtil();
                string[]    nparam = m.ConvertParameters(controller, screen, param);
                msg.Message = string.Format(rs.GetString(code), nparam);
            }
            catch
            {
                msg.Message = CommonValue.MESSAGE_NOTFOUND;
            }

            return(msg);
        }
Beispiel #2
0
        /// <summary>
        /// Get message from resource
        /// </summary>
        /// <param name="module"></param>
        /// <param name="code"></param>
        /// <param name="param"></param>
        /// <returns></returns>
        public static MessageModel GetMessage(string module, string code, params string[] param)
        {
            MessageModel msg = new MessageModel();

            msg.MessageType = MessageModel.MESSAGE_TYPE.INFORMATION;
            msg.Code        = code;

            try
            {
                string assembly = string.Format("{0}.{1}.dll", CommonValue.MESSAGE_ASSEMBLY, module);

                CommonUtil util = new CommonUtil();
                System.Resources.ResourceSet rs = util.GetResource(assembly, CommonValue.MESSAGE_NAMESPACE);

                msg.Message = string.Format(rs.GetString(code), param == null ? new string[] { "" } : param);
            }
            catch
            {
                msg.Message = CommonValue.MESSAGE_NOTFOUND;
            }

            return(msg);
        }