public Response <ResxResult> Image(string token = null, ResxType resxType = ResxType.Other) { var ret = this.CheckToken(token); if (!ret.Item1) { return(GetResult(GMSF.ResponseResult.FAILED, "TOKEN 验证失败")); } UpfileHandler resx = new UpfileHandler(HttpContext.Current.Request.Files, new ResxModel() { UserId = ret.Item2, ResxType = resxType, //UserId = 1, //ResxType = ResxType.ChatImage, ResxSize = ResxConfigManager.IMAGE_MAX_SIZE, ResxTypes = ResxConfigManager.IMAGE_FILE_TYPES }); try { var responseResult = resx.SaveStream(); var res = GetResult(GMSF.ResponseResult.SUCCESS, null, responseResult); //log.WriterLog(Newtonsoft.Json.JsonConvert.SerializeObject(res)); return(res); } catch (Exception ex) { //log.WriterLog(ex.Message); return(GetResult(GMSF.ResponseResult.FAILED, ex.Message)); } }
public override bool IsValid(object value) { base.ErrorMessage = string.Empty; ResxType resx = ResxManager.GetResx(ResxManager.CurrentLanguage); if (resx.UICulture == ResxManager.Vi.UICulture) { base.ErrorMessageResourceType = this.VNType; } else { base.ErrorMessageResourceType = this.USType; } base.ErrorMessageResourceName = this.ErrorMessageResourceNameResx; return(base.IsValid(value)); }
/// <summary> /// 获取资源存储的目录配置信息 /// </summary> /// <returns></returns> public static string GetResxTypePath(ResxType resxType, int userId = 0) { string path = ""; switch (resxType) { case ResxType.UserHeadImage: path = string.Format("user-head/{0}/", DateTime.Now.ToString("yyyy")); break; case ResxType.ChatImage: path = string.Format("chat-image/{0}/{1}/", DateTime.Now.ToString("yyyyMMdd"), userId); break; case ResxType.ChatSound: path = string.Format("chat-sound/{0}/{1}/", DateTime.Now.ToString("yyyyMMdd"), userId); break; case ResxType.ChatVideo: path = string.Format("chat-video/{0}/{1}/", DateTime.Now.ToString("yyyyMMdd"), userId); break; case ResxType.CircleBackImage: path = string.Format("circle-back-image/{0}/", DateTime.Now.ToString("yyyy")); break; case ResxType.NearCirclePostImage: path = string.Format("circle-near-post/{0}/{1}/", DateTime.Now.ToString("yyyyMMdd"), userId); break; case ResxType.FriendCirclePostImage: path = string.Format("circle-user-post/{0}/{1}/", DateTime.Now.ToString("yyyyMMdd"), userId); break; case ResxType.Other: default: path = string.Format("other/{0}/{1}/", DateTime.Now.ToString("yyyyMMdd"), userId); break; } return(path); }
// read the passed excel file and enumerate the key/value pairs for SEC private static IEnumerable <KeyValuePair <string, string> > GetSECCodes(string file, ResxType type) { if (type == ResxType.English) { COLUMNDESC = "English"; } else { COLUMNDESC = "Chinese"; } DataTable table = new DataTable("ResxTable"); // connect to XLSX format MS2007++ file format string connString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + file + @";Extended Properties=""Excel 12.0;HDR=Yes"""; OleDbConnection dbConn = new OleDbConnection(connString); using (dbConn) { dbConn.Open(); string fetch = @"SELECT [" + COLUMNCODE + @"], [" + COLUMNDESC + @"] FROM [" + SHEETNAME + @"]"; OleDbCommand cmdSelect = new OleDbCommand(fetch, dbConn); OleDbDataAdapter dbAdapter = new OleDbDataAdapter(); dbAdapter.SelectCommand = cmdSelect; dbAdapter.Fill(table); } for (int i = 0; i < table.Rows.Count; i++) { yield return(new KeyValuePair <string, string>(table.Rows[i][COLUMNCODE].ToString(), table.Rows[i][COLUMNDESC].ToString())); } }
public static bool IsTumbnail(ResxType resxType) { return(resxType == ResxType.ChatImage || resxType == ResxType.FriendCirclePostImage || resxType == ResxType.NearCirclePostImage); }