示例#1
0
        public string L(string key)
        {
            var restr       = string.Empty;
            var localcookie = GetCookies("__locallang");

            var localquery = HttpContext.Request.Query["lang"];

            if (!string.IsNullOrEmpty(localquery))
            {
                var lmodel = APPCommon.GetLoalLang(key, localquery).Result;
                restr = GetDefaultValue(key, ref lmodel);
                SetCookies("__locallang", localquery);
            }
            else
            {
                if (string.IsNullOrEmpty(localcookie))
                {
                    var lmodel = APPCommon.GetLoalLang(key, null, 0).Result;
                    restr = GetDefaultValue(key, ref lmodel);
                    restr = lmodel?.Value;
                }
                else
                {
                    var lmodel = APPCommon.GetLoalLang(key, localcookie).Result;
                    restr = GetDefaultValue(key, ref lmodel);
                    restr = lmodel.Value;
                }
            }
            return(restr);
        }
示例#2
0
 public void  Auth()
 {
     if (!HttpContext.User.Identity.IsAuthenticated)
     {
         APPCommon.ResponseUnAuth(ActionContext, null);
     }
 }
示例#3
0
 public ResultInfoBase SaveFiles(bool isReName = true, string dirName = null)
 {
     if (string.IsNullOrEmpty(dirName))
     {
         dirName = "/upload";
         dirName.ToServerFullPathEnEnsure();
     }
     return(APPCommon.UploadFile(Request, dirName, isReName));
 }
示例#4
0
        public int InsertForm(bool isPrefixTableName = false)
        {
            var tablename = Form("_tablename");

            var obj = FormToDic(tablename);

            if (isPrefixTableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            return(InsertDic(tablename, obj));
        }
示例#5
0
        public int InsertQuery(bool isPrefixTableName = false)
        {
            var tablename = Url("_tablename");

            if (isPrefixTableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            var obj = QueryToDic(tablename);

            return(DB.Kata.Query(tablename).Insert(obj));
        }
示例#6
0
        public int UpdateForm(bool isPrefixTableName = false)
        {
            var tablename = Form("_tablename");
            var id        = Form("_id").ToInt();
            var obj       = FormToDic(tablename);

            if (isPrefixTableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            Logger.LogInfo(nameof(UpdateForm), $"UpdateForm {tablename} dic {obj.ToJson() }");
            return(Update(tablename, id, obj));
        }
示例#7
0
        public Dictionary <string, object> FormToDic(string tablename, bool isprefixtableName = false)
        {
            if (isprefixtableName)
            {
                tablename = APPCommon.GetWTableName(tablename);
            }
            var cols = DB.UniClient.DbMaintenance.GetColumnInfosByTableName(tablename);
            Dictionary <string, object> dic = new Dictionary <string, object>();

            foreach (var cinfo in cols)
            {
                if (cinfo.DbColumnName.ToLower() != "id" && FormCollection.ContainsKey(cinfo.DbColumnName))
                {
                    dic.Add(cinfo.DbColumnName, FormCollection[cinfo.DbColumnName]);
                }
            }
            return(dic);
        }
示例#8
0
        private static string GetDefaultValue(string key, ref LocalLangs lmodel)
        {
            string restr;

            if (lmodel == null)
            {
                lmodel = APPCommon.GetLoalLang(key, null, 0).Result;
            }
            if (lmodel == null)
            {
                restr = string.Empty;
            }
            else
            {
                restr = lmodel.Value;
            }

            return(restr);
        }
示例#9
0
        public string TmplHtml(string templateKey, object model = null, ExpandoObject viewBag = null)
        {
            var content = APPCommon.RenderRazorKey(templateKey, model, viewBag)?.GetAwaiter().GetResult();

            return(content);
        }
示例#10
0
        public string L(string key, string langName)
        {
            var s = APPCommon.GetLoalLang(key, langName).Result;

            return(s.Value);
        }
示例#11
0
        public string L(string key, int lang)
        {
            var s = APPCommon.GetLoalLang(key, null, lang).Result;

            return(s.Value);
        }
示例#12
0
 public async Task <FileStreamResult> Download(string relativeFilePath, string outfileName)
 {
     return(await APPCommon.Download(HttpContext.Response, relativeFilePath, outfileName));
 }
示例#13
0
文件: APP.cs 项目: unifare/BizWeb
 public static object GetData(string ssql, object inParamters)
 {
     return(APPCommon.GetData(ssql, inParamters));
 }
示例#14
0
文件: APP.cs 项目: unifare/BizWeb
 public static MethodInfo GetMethodFromConfig(bool IsPlugin, string libname, string typename, string methodName)
 {
     return(APPCommon.GetMethodFromConfig(IsPlugin, libname, typename, methodName));
 }