Esempio n. 1
0
 public ActionResult Default(string title, int?icon)
 {
     if (string.IsNullOrEmpty(title))
     {
         title = "Msg";
     }
     return(Content(ResObj.LayerMsg(title, icon, Utils.GetPostUrlInfo())));
 }
Esempio n. 2
0
 /// <summary>
 /// 返回错误消息
 /// </summary>
 /// <param name="msg">消息</param>
 /// <param name="url">跳转链接</param>
 /// <param name="isEval">是否需要eval执行</param>
 /// <returns></returns>
 public ActionResult Success(string msg, string url = "Index", bool isEval = true)
 {
     url = Utils.GetActionUrl(url);
     if (isEval)
     {
         return(Content(ResObj.LayerScript(msg, Icon.Success, url)));
     }
     return(Content(ResObj.LayerMsg(msg, Icon.Success, url)));
 }
Esempio n. 3
0
        public ActionResult Edit(Lang model)
        {
            if (bll_Lang.Exists(c => c.msgid == model.msgid))
            {
                return(Content(ResObj.LayerMsg("请勿重复添加!", Icon.Error, indexUrl)));
            }

            model.msgstr = model.msgid;

            bll_Lang.EditEntity(model);

            return(Content(ResObj.LayerMsg("修改成功!", Icon.Success, indexUrl)));
        }
Esempio n. 4
0
        public ActionResult Index(Lang model)
        {
            if (bll_Lang.Exists(c => c.msgid == model.msgid))
            {
                return(Content(ResObj.LayerMsg("请勿重复添加!", Icon.Error)));
            }

            model.msgstr = model.msgid;

            bll_Lang.AddEntity(model);

            return(Content(ResObj.LayerMsg("添加成功!", Icon.Success)));
        }
Esempio n. 5
0
        /// <summary>
        /// 翻译
        /// </summary>
        /// <param name="path">语言包路径</param>
        /// <param name="url">翻译网址</param>
        /// <param name="Lan">翻译类型</param>
        public ActionResult Translate(string path, string url, string Lan)
        {
            string content = FileAction.ReadToStr(path);
            Dictionary <string, string> dic = new Dictionary <string, string>();

            string reg = "msgid \"(?<msgid>.*)\"\r\nmsgstr \"(?<msgstr>.*)\"";

            string[] strArr = DataCheck.GetRegStrArr(content, reg);

            foreach (var str in strArr)
            {
                MatchCollection res = Regex.Matches(str, reg, RegexOptions.IgnoreCase);
                foreach (Match item in res)
                {
                    dic.Add(item.Groups["msgid"].Value, item.Groups["msgstr"].Value);
                }
            }

            SaveLanJs(dic);
            // 发送翻译请求
            // Dictionary<string, string> dicRes= BaiduTranslate(dic, Lan, "");

            return(Content(ResObj.LayerMsg("转换成功!", Icon.Success, "Index")));
        }
Esempio n. 6
0
 public ActionResult Delete(int id)
 {
     bll_Lang.DeleteEntity(id);
     return(Content(ResObj.LayerMsg("删除成功!", Icon.Success, indexUrl)));
 }