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); }
public void Auth() { if (!HttpContext.User.Identity.IsAuthenticated) { APPCommon.ResponseUnAuth(ActionContext, null); } }
public ResultInfoBase SaveFiles(bool isReName = true, string dirName = null) { if (string.IsNullOrEmpty(dirName)) { dirName = "/upload"; dirName.ToServerFullPathEnEnsure(); } return(APPCommon.UploadFile(Request, dirName, isReName)); }
public int InsertForm(bool isPrefixTableName = false) { var tablename = Form("_tablename"); var obj = FormToDic(tablename); if (isPrefixTableName) { tablename = APPCommon.GetWTableName(tablename); } return(InsertDic(tablename, obj)); }
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)); }
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)); }
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); }
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); }
public string TmplHtml(string templateKey, object model = null, ExpandoObject viewBag = null) { var content = APPCommon.RenderRazorKey(templateKey, model, viewBag)?.GetAwaiter().GetResult(); return(content); }
public string L(string key, string langName) { var s = APPCommon.GetLoalLang(key, langName).Result; return(s.Value); }
public string L(string key, int lang) { var s = APPCommon.GetLoalLang(key, null, lang).Result; return(s.Value); }
public async Task <FileStreamResult> Download(string relativeFilePath, string outfileName) { return(await APPCommon.Download(HttpContext.Response, relativeFilePath, outfileName)); }
public static object GetData(string ssql, object inParamters) { return(APPCommon.GetData(ssql, inParamters)); }
public static MethodInfo GetMethodFromConfig(bool IsPlugin, string libname, string typename, string methodName) { return(APPCommon.GetMethodFromConfig(IsPlugin, libname, typename, methodName)); }