public T_BugList ConvertAdd(BugModel bugModel) { T_BugList tbList = new T_BugList(); tbList.FGID = System.Guid.NewGuid().ToString(); tbList.FBugName = bugModel.FBugName; tbList.FVersion = bugModel.FVersion; tbList.FOS = bugModel.FOS; tbList.FMobile = bugModel.FMobile; tbList.FOSVersion = bugModel.FOSVersion; tbList.FMemo = bugModel.FMemo; tbList.FBugLevel = bugModel.FBugLevel; tbList.FBugType = bugModel.FBugType; tbList.FCreateName = bugModel.FCreateName; tbList.FImageList = ""; if (bugModel.FImageList != null && bugModel.FImageList.Count > 0) { for (int i = 0; i < bugModel.FImageList.Count; i++) { MemoryStream mStream = new MemoryStream(Convert.FromBase64String(bugModel.FImageList[i])); String fileName = Guid.NewGuid().ToString() + ".png"; String fileUrl = "/UploadFiles/Images/" + fileName; Bitmap bitmap = new Bitmap(mStream); var filePath = HttpContext.Current.Server.MapPath(fileUrl); bitmap.Save(filePath); if (i == 0) { tbList.FImageList = fileUrl; } else { tbList.FImageList += "|" + fileUrl; } } } tbList.FINDATE = DateTime.Now; tbList.FEditDATE = DateTime.Now; return tbList; }
public Result<String> AddBug(BugModel bugModel) { //转换类并转存 //T_BugList tbList = ConvertAdd(bugModel); Result<String> returnResult = Result<String>.CreateInstance(ResultCode.Fail); if (bugModel != null && GetService<BugService>().AddNewBug(ConvertAdd(bugModel))) { returnResult.SetSuccess(); returnResult.message = "bug提交成功!"; return returnResult; } returnResult.message = "bug提交失败!"; return returnResult; }