private void btnDelete_Click(object sender, System.EventArgs e) { bool flag = true; string[] array = this.hdfSelIDList.Value.Trim(new char[] { ',' }).Split(new char[] { ',' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string s = array2[i]; try { int photoId = Globals.ToNum(s); if (!GalleryHelper.DeletePhoto(photoId)) { flag = false; } } catch { this.ShowMsg("删除文件错误", false); this.BindImageData(); } } if (flag) { this.ShowMsg("删除图片成功", true); } this.BindImageData(); }
private void btnDelete_Click(object sender, EventArgs e) { bool flag = true; foreach (string str in this.hdfSelIDList.Value.Trim(new char[] { ',' }).Split(new char[] { ',' })) { try { if (!GalleryHelper.DeletePhoto(Globals.ToNum(str))) { flag = false; } } catch { this.ShowMsg("删除文件错误", false); this.BindImageData(); } } if (flag) { this.ShowMsg("删除图片成功", true); } this.BindImageData(); }
private void DeleteImage(HttpContext context) { string text = context.Request["PhotoIdStr"]; int photoId = 0; string text2 = text.Trim(); if (!string.IsNullOrEmpty(text2)) { string[] array = text2.Split(','); foreach (string text3 in array) { if (!string.IsNullOrEmpty(text3)) { string[] array2 = text3.Split(':'); if (int.TryParse(array2[0], out photoId)) { StoreHelper.DeleteImage(array2[1]); if (!GalleryHelper.DeletePhoto(photoId)) { throw new HidistroAshxException("请至少选择一项"); } } } } base.ReturnResult(context, true, text2, 0, true); return; } throw new HidistroAshxException("请至少选择一项"); }
private void photoDataList_ItemCommand(object sender, DataListCommandEventArgs e) { int photoId = Convert.ToInt32(this.photoDataList.DataKeys[e.Item.ItemIndex]); string photoPath = GalleryHelper.GetPhotoPath(photoId); if (GalleryHelper.DeletePhoto(photoId)) { StoreHelper.DeleteImage(photoPath); this.ShowMsg("删除图片成功", true); } this.BindImageData(); }
public string DelImg(HttpContext context) { string str = context.Request.Form["file_id[]"]; if (string.IsNullOrEmpty(str)) { return("{\"status\": 0,\"msg\":\"请勾选图片\"}"); } foreach (string str2 in str.Split(new char[] { ',' })) { GalleryHelper.DeletePhoto(Convert.ToInt32(str2)); } return("{\"status\": 1,\"msg\":\"\"}"); }
public string DelImg(HttpContext context) { string text = context.Request.Form["file_id[]"]; if (string.IsNullOrEmpty(text)) { return("{\"status\": 0,\"msg\":\"请勾选图片\"}"); } string[] array = text.Split(','); string[] array2 = array; foreach (string value in array2) { GalleryHelper.DeletePhoto(Convert.ToInt32(value)); } return("{\"status\": 1,\"msg\":\"\"}"); }
private void DelImg(HttpContext context) { string s = context.Request["PhotoId"]; string imageUrl = context.Request["PhotoPath"]; int photoId = 0; if (int.TryParse(s, out photoId)) { StoreHelper.DeleteImage(imageUrl); if (!GalleryHelper.DeletePhoto(photoId)) { throw new HidistroAshxException("请至少选择一项"); } base.ReturnResult(context, true, "删除成功!", 0, true); return; } throw new HidistroAshxException("操作失败"); }
private void btnDelete_Click(object sender, EventArgs e) { bool flag = true; bool flag2 = true; foreach (DataListItem item in this.photoDataList.Controls) { CheckBox box = (CheckBox)item.FindControl("checkboxCol"); HiddenField field = (HiddenField)item.FindControl("HiddenFieldImag"); if ((box != null) && box.Checked) { flag2 = false; try { int photoId = (int)this.photoDataList.DataKeys[item.ItemIndex]; StoreHelper.DeleteImage(field.Value); if (!GalleryHelper.DeletePhoto(photoId)) { flag = false; } continue; } catch { this.ShowMsg("删除文件错误", false); this.BindImageData(); continue; } } } if (flag2) { this.ShowMsg("未选择删除的图片", false); } else { if (flag) { this.ShowMsg("删除图片成功", true); } this.BindImageData(); } }
private void btnDelete_Click(object sender, System.EventArgs e) { bool flag = true; bool flag2 = true; foreach (System.Web.UI.WebControls.DataListItem dataListItem in this.photoDataList.Controls) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)dataListItem.FindControl("checkboxCol"); System.Web.UI.WebControls.HiddenField hiddenField = (System.Web.UI.WebControls.HiddenField)dataListItem.FindControl("HiddenFieldImag"); if (checkBox != null && checkBox.Checked) { flag2 = false; try { int photoId = (int)this.photoDataList.DataKeys[dataListItem.ItemIndex]; string value = hiddenField.Value; StoreHelper.DeleteImage(value); if (!GalleryHelper.DeletePhoto(photoId)) { flag = false; } } catch { this.ShowMsg("删除文件错误", false); this.BindImageData(); } } } if (flag2) { this.ShowMsg("未选择删除的图片", false); return; } if (flag) { this.ShowMsg("删除图片成功", true); } this.BindImageData(); }
public string DelImg(System.Web.HttpContext context) { string text = context.Request.Form["file_id[]"]; if (string.IsNullOrEmpty(text)) { return("{\"status\": 0,\"msg\":\"请勾选图片\"}"); } if (ManagerHelper.GetCurrentManager() == null) { return("{\"status\": 0,\"msg\":\"请先登录\"}"); } string[] array = text.Split(new char[] { ',' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string value = array2[i]; GalleryHelper.DeletePhoto(System.Convert.ToInt32(value)); } return("{\"status\": 1,\"msg\":\"\"}"); }