protected void btnDel_Click(object sender, System.EventArgs e) { bool flag = true; string value = this.hfldPurchaseChecked.Value; System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(value); foreach (string current in listFromJson) { int count = this.personalFileBll.GetListArray(string.Concat(new string[] { " where (parentId!=id and parentId='", current, "') or (fileType='2' and id='", current, "')" })).Count; if (count > 0) { flag = false; break; } } if (!flag) { base.RegisterLoadEvent("function() {alert('系统提示: \\n\\n 此文件夹不可删除,请检查是否包含子项!')}"); return; } try { this.DelFile(listFromJson); int num = Common2.DelByStrWhere("F_PersonalFile", " where id in(" + StringUtility.GetArrayToInStr(listFromJson.ToArray()) + ")"); if (num > 0) { base.RegisterLoadEvent(string.Concat(new object[] { "function() {alert('系统提示: \\n\\n 删除成功!');location='PersonalFileList.aspx?id=", this.tvFile.SelectedValue, "&did=", this.ddlScope.SelectedValue, "&search=", this.ViewState["search"], "'}" })); } else { base.RegisterScript("alert('系统提示: \\n\\n 删除失败!');"); } } catch { base.RegisterScript("alert('系统提示: \\n\\n 出现异常删除失败!');"); } }
protected void btnDel_Click(object sender, System.EventArgs e) { ConIncometContractService conIncometContractService = new ConIncometContractService(); BudContractTaskService budContractTaskService = new BudContractTaskService(); using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection.Open(); SqlTransaction sqlTransaction = sqlConnection.BeginTransaction(); try { string message = ""; System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>(); foreach (GridViewRow gridViewRow in this.gvConract.Rows) { CheckBox checkBox = gridViewRow.FindControl("cbBox") as CheckBox; if (checkBox != null && checkBox.Checked) { if (!this.incometContractBll.IsDel(checkBox.ToolTip)) { list.Clear(); message = "alert('系统提示:\\n\\n请先删除与收款合同相关的其他数据!')"; break; } ConIncometContract byContractId = conIncometContractService.GetByContractId(checkBox.ToolTip); budContractTaskService.DelRalationBudgetAndContract(byContractId.Project, checkBox.ToolTip); this.rptSev.DelByContractId(checkBox.ToolTip); list.Add(checkBox.ToolTip); message = "alert('系统提示:\\n\\n数据删除成功!');location='IncometContractList.aspx'"; } } Common2.DelByStrWhere("Con_Incomet_Contract", " where ContractId in (" + StringUtility.GetArrayToInStr(list.ToArray()) + ")"); ConConfigContractService conConfigContractService = new ConConfigContractService(); conConfigContractService.Deltes(list); base.RegisterScript(message); sqlTransaction.Commit(); this.BindGv(); } catch (System.Exception) { sqlTransaction.Rollback(); base.RegisterScript("alert('系统提示:\\n\\n对不起删除失败!');"); } } }
public void delInfoCode() { Common2.DelByStrWhere("Sm_AlarmNum", " where infoCode='0'"); }