private void StartDeleteItemsProcessing(string listId) { try { var result = NewsDAL.DeleteAll(listId); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } lbError.Visible = false; if (result.Data != null && result.Data.Tables.Count > 0 && result.Data.Tables[0].Rows.Count > 0) { ShowDeleteMessageErrors(result.Data.Tables[0]); } } catch (Exception ex) { LogHelpers.WriteException("[ucNewsItems][StartDeleteItemsProcessing]", ex.ToString()); lbError.InnerText = ex.Message; lbError.Visible = true; } }
public void StartDeleteProjects() { if (this.grvProjectItems.Rows.Count == 0) { return; } string listId = string.Empty; for (int i = 0; i < grvProjectItems.Rows.Count; i++) { GridViewRow row = grvProjectItems.Rows[i]; HtmlInputCheckBox chx = row.Cells[0].FindControl("chkRowItem") as HtmlInputCheckBox; if (!chx.Checked) { continue; } if (!string.IsNullOrEmpty(listId)) { listId += ","; } listId += grvProjectItems.DataKeys[i].Value.ToString(); } if (!string.IsNullOrEmpty(listId)) { var result = NewsDAL.DeleteAll(listId); if (result.Code < 0) { lbError.InnerText = result.ErrorMessage; lbError.Visible = true; return; } lbError.Visible = false; if (result.Data != null && result.Data.Tables.Count > 0 && result.Data.Tables[0].Rows.Count > 0) { StartShowDeleteErrors(result); } } }
public JsonResult Delete(string listId) { LogHelpers.LogHandler.Info("Start."); try { var result = NewsDAL.DeleteAll(listId); return(Json(result, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { LogHelpers.LogHandler.Error(ex.ToString()); return(Json(new ResultData <int>() { Code = ex.HResult, ErrorMessage = ex.Message }, JsonRequestBehavior.AllowGet)); } }