/// <summary> /// Add error message /// </summary> /// <param name="controller"></param> /// <param name="screen"></param> /// <param name="module"></param> /// <param name="code"></param> /// <param name="id"></param> /// <param name="param"></param> public void AddErrorMessage(string controller, string screen, string module, MessageUtil.MessageList code, string id, params string[] param) { try { if (_iValidatorUtil.ModelState != null) { string template = string.Empty; if (CommonUtil.IsNullOrEmpty(controller) == false) { template += controller; } template += SPLIT_TEMPLATE_MESSAGE; if (CommonUtil.IsNullOrEmpty(screen) == false) { template += screen; } template += SPLIT_TEMPLATE_MESSAGE; template += module + SPLIT_TEMPLATE_MESSAGE; template += code.ToString() + SPLIT_TEMPLATE_MESSAGE; if (param != null) { foreach (string pm in param) { template += pm + SPLIT_TEMPLATE_MESSAGE; } } ModelState state = new System.Web.Mvc.ModelState(); state.Errors.Add(template); _iValidatorUtil.ModelState.Add(id, state); _iValidatorUtil.IsValid = false; this.IsValid = false; } } catch (Exception) { throw; } }
/// <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, MessageUtil.MessageList code, params string[] param) { string msgCode = code.ToString(); return(GetMessageForScreen(controller, screen, module, msgCode, param)); }
/// <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, MessageUtil.MessageList code, params string[] param) { string msgCode = code.ToString(); return(GetMessage(module, msgCode, param)); }