private void BatchActionManage(string idlist) { Products products = new Products(); Photos photos = new Photos(); int result = 0; int num2 = 0; foreach (string str in idlist.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { string[] strArray2 = str.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); if (strArray2[0] == "0") { this.Postbll.DeleteListByNormalPost(strArray2[1], true, base.CurrentUser.UserID); } else if (strArray2[0] == "1") { DataSet set = photos.DeleteListEx(strArray2[1], out result, true, base.CurrentUser.UserID); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } } else { DataSet set2 = products.DeleteListEx(strArray2[1], out num2, false, 1); if (set2 != null) { this.PhysicalFileInfo(set2.Tables[0]); } } } }
protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (!e.CommandArgument.Equals("Delete")) { return; } if ((e.CommandName == null) || (e.CommandName.ToString() == "")) { return; } int postID = Globals.SafeInt(e.CommandName, -1); Maticsoft.Model.SNS.Posts modelByCache = this.bll.GetModelByCache(postID); Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos(); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); int result = 0; DataSet set = new DataSet(); int valueOrDefault = modelByCache.Type.GetValueOrDefault(); if (modelByCache.Type.HasValue) { switch (valueOrDefault) { case 0: if ((this.bll.DeleteEx(postID, true, base.CurrentUser.UserID) && !string.IsNullOrWhiteSpace(modelByCache.ImageUrl)) && !modelByCache.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(modelByCache.ImageUrl); } goto Label_01B3; case 1: set = photos.DeleteListEx(modelByCache.TargetId.ToString(), out result, true, base.CurrentUser.UserID); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_01B3; case 2: set = products.DeleteListEx(modelByCache.TargetId.ToString(), out result, true, base.CurrentUser.UserID); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_01B3; } } if ((this.bll.DeleteEx(postID, true, base.CurrentUser.UserID) && !string.IsNullOrWhiteSpace(modelByCache.ImageUrl)) && !modelByCache.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(modelByCache.ImageUrl); } Label_01B3: this.gridView.OnBind(); LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "删除动态(PostID=" + postID + ")成功", this); MessageBox.ShowSuccessTip(this, "删除成功!"); }
public ActionResult AjaxDelPost(FormCollection Fm) { int postID = Globals.SafeInt(Fm["PostId"], 0); Maticsoft.Model.SNS.Posts model = base.PostsBll.GetModel(postID); Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos(); Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); int result = 0; DataSet set = new DataSet(); int valueOrDefault = model.Type.GetValueOrDefault(); if (model.Type.HasValue) { switch (valueOrDefault) { case 0: if ((base.PostsBll.DeleteEx(postID, false, 1) && !string.IsNullOrWhiteSpace(model.ImageUrl)) && !model.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(model.ImageUrl); } goto Label_017A; case 1: set = photos.DeleteListEx(model.TargetId.ToString(), out result, false, 1); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_017A; case 2: set = products.DeleteListEx(model.TargetId.ToString(), out result, false, 1); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } goto Label_017A; case 4: new Maticsoft.BLL.SNS.UserBlog().DeleteEx(model.TargetId); goto Label_017A; } } if ((base.PostsBll.DeleteEx(postID, false, 1) && !string.IsNullOrWhiteSpace(model.ImageUrl)) && !model.ImageUrl.StartsWith("http://")) { this.DeletePhysicalFile(model.ImageUrl); } Label_017A: return base.Content(postID.ToString()); }
protected void btnDelete_Click(object sender, EventArgs e) { Maticsoft.BLL.SNS.Products products = new Maticsoft.BLL.SNS.Products(); Maticsoft.BLL.SNS.Photos photos = new Maticsoft.BLL.SNS.Photos(); if (this.GetSelIDlist().Trim().Length != 0) { int result = 0; int num2 = 0; string selIDTypelist = this.GetSelIDTypelist("1"); if (!string.IsNullOrEmpty(selIDTypelist) && (selIDTypelist.Length > 0)) { DataSet set = photos.DeleteListEx(selIDTypelist, out result, true, base.CurrentUser.UserID); if (set != null) { this.PhysicalFileInfo(set.Tables[0]); } LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "批量删除图片动态(ProductID=" + selIDTypelist + ")成功", this); } string str3 = this.GetSelIDTypelist("2"); if (!string.IsNullOrEmpty(str3) && (str3.Length > 0)) { DataSet set2 = products.DeleteListEx(str3, out num2, true, base.CurrentUser.UserID); if (set2 != null) { this.PhysicalFileInfo(set2.Tables[0]); } LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "批量删除商品动态(ProductID=" + str3 + ")成功", this); } string postIDs = this.GetSelIDTypelist("0"); bool flag = false; if (postIDs.Length > 0) { LogHelp.AddUserLog(base.CurrentUser.UserName, base.CurrentUser.UserType, "批量删除文字动态(PostID=" + postIDs + ")成功", this); flag = this.bll.DeleteListByNormalPost(postIDs, true, base.CurrentUser.UserID); } if (((result == 1) || (num2 == 1)) || flag) { MessageBox.ShowSuccessTip(this, "删除成功!"); } else { MessageBox.ShowSuccessTip(this, "删除失败!"); } this.gridView.OnBind(); } }