private void btnAdd_Click(object sender, EventArgs e) { IntendancePhotoList intendancePhotoList = new IntendancePhotoList(); intendancePhotoList.NoteId = Guid.NewGuid(); intendancePhotoList.InfoGuid = this.IntendanceGuid; intendancePhotoList.PhotoNumber = this.txtFileCode.Text; intendancePhotoList.PhotoExplain = this.txtRemark.Text; intendancePhotoList.UserCode = base.UserCode; intendancePhotoList.PhotoType = this.PhotoType; MakeThumbnail makeThumbnail = new MakeThumbnail(); if (makeThumbnail.AddIntendancePhotoListAction(this.fileAnnex.PostedFile, intendancePhotoList) != 1) { this.js.Text = "alert('上传文件失败!');"; return; } this.js.Text = "window.returnValue=true;alert('上传文件成功!');window.close();"; }
protected void btnDel_Click(object sender, EventArgs e) { IntendanceMasterAction intendanceMasterAction = new IntendanceMasterAction(); IntendancePhotoListAction intendancePhotoListAction = new IntendancePhotoListAction(); DataTable photoInfoList = intendancePhotoListAction.GetPhotoInfoList(this.hdnIntendanceGuid.Value); string text; if (photoInfoList.Rows.Count > 0) { for (int i = 0; i < photoInfoList.Rows.Count; i++) { MakeThumbnail makeThumbnail = new MakeThumbnail(); if (makeThumbnail.DelThumbnai(photoInfoList.Rows[i]["NoteId"].ToString())) { } } if (intendancePhotoListAction.ClearPhotosList(this.hdnIntendanceGuid.Value) > 0) { text = "1"; } else { text = "删除失败"; } } else { text = "1"; } if (!(text == "1")) { this.js.Text = "alert('" + text + "!');"; return; } if (intendanceMasterAction.Del(this.hdnIntendanceGuid.Value) > 0) { this.js.Text = "alert('删除成功!');"; this.DataBindToPage(""); return; } this.js.Text = "alert('删除失败!');"; }
public static string DelPhotosItem(string noteId) { IntendancePhotoListAction intendancePhotoListAction = new IntendancePhotoListAction(); IntendancePhotoList singlePhotoInfo = intendancePhotoListAction.GetSinglePhotoInfo(new Guid(noteId)); string result = ""; if (singlePhotoInfo != null && intendancePhotoListAction.DelAnnex(singlePhotoInfo) > 0) { MakeThumbnail makeThumbnail = new MakeThumbnail(); if (makeThumbnail.DelThumbnai(singlePhotoInfo.NoteId.ToString())) { result = "1"; } else { result = "删除失败"; } } return(result); }