private static bool checkSignpic(businessType bt, string id, string home) { var picp = string.Format("{2}/server/pictures/{0}/{1}", id, bt.ToString(), home); if (!Directory.Exists(picp)) { return(false); } var pp = new DirectoryInfo(picp).GetFiles(); foreach (var ff in pp) { if (ff.Name.Contains(picType.declaration_sign.ToString())) { return(true); } } return(false); }
private bool savePic(string picstr, picType picType, string identity, businessType btype) { try { var fpath = Path.Combine(_picpath, identity); if (!Directory.Exists(fpath)) { Directory.CreateDirectory(fpath); } var fname = Path.Combine(fpath, identity, btype.ToString(), picType + ".jpg"); var index = picstr.IndexOf("base64,"); System.IO.File.WriteAllBytes(fname, Convert.FromBase64String(picstr.Substring(index + 7))); } catch (Exception ex) { _log.LogInformation("savePic error: {0}", ex); return(false); } return(true); }
/// <summary> /// 获取某业务类型下所有的下拉框 /// </summary> /// <param name="type"></param> /// <returns></returns> public static DataView getEnumDisplayNameList(businessType type) { object businessType = WebCache.Get("FileCache-businessType"); if (businessType == null) { #region 初始化枚举数据 DataTable dtData = new DataTable(); dtData.Columns.Add("type", typeof(string)); dtData.Columns.Add("name", typeof(string)); dtData.Columns.Add("value", typeof(int)); dtData.Rows.Add(new object[] { "productType", 0, "实体商品" }); dtData.Rows.Add(new object[] { "productType", 1, "卡密商品" }); dtData.Rows.Add(new object[] { "productType", 2, "游戏商品" }); dtData.Rows.Add(new object[] { "productStatus", 0, "正常" }); dtData.Rows.Add(new object[] { "productStatus", 1, "下架" }); WebCache.Max("FileCache-businessType", dtData, new CacheDependency("businessType")); #endregion } DataTable dataTable = businessType as DataTable; DataView dvResult = new DataView(dataTable, string.Format("type='{0}' "), type.ToString() , DataViewRowState.CurrentRows); return(dvResult); }