Esempio n. 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);
        }
Esempio n. 2
0
 public void  Auth()
 {
     if (!HttpContext.User.Identity.IsAuthenticated)
     {
         APPCommon.ResponseUnAuth(ActionContext, null);
     }
 }
Esempio n. 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));
 }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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));
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 9
0
        public string TmplHtml(string templateKey, object model = null, ExpandoObject viewBag = null)
        {
            var content = APPCommon.RenderRazorKey(templateKey, model, viewBag)?.GetAwaiter().GetResult();

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

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

            return(s.Value);
        }
Esempio n. 12
0
 public async Task <FileStreamResult> Download(string relativeFilePath, string outfileName)
 {
     return(await APPCommon.Download(HttpContext.Response, relativeFilePath, outfileName));
 }
Esempio n. 13
0
 public static object GetData(string ssql, object inParamters)
 {
     return(APPCommon.GetData(ssql, inParamters));
 }
Esempio n. 14
0
 public static MethodInfo GetMethodFromConfig(bool IsPlugin, string libname, string typename, string methodName)
 {
     return(APPCommon.GetMethodFromConfig(IsPlugin, libname, typename, methodName));
 }