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 Boolean AddNewBug(T_BugList tbList) { return Save<T_BugList>(tbList) > 0 ? true : false; }