public void UpdateContractBudget() { BudContractTaskService budContractTaskService = new BudContractTaskService(); string text = string.Empty; string value = this.hdnProjectCode.Value; if (!string.IsNullOrEmpty(base.Request["id"])) { text = base.Request["id"]; } string value2 = this.isDeteleConBudget.Value; if (value2 == "0") { if (!string.IsNullOrEmpty(text)) { budContractTaskService.DelRalationBudgetAndContract(value, text); } budContractTaskService.AddRalationBudgetAndContract(value, this.hdGuid.Value, this.hdOrderNumber.Value); return; } if (value2 == "1" && !string.IsNullOrEmpty(text)) { budContractTaskService.DelRalationBudgetAndContract(value, text); } }
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对不起删除失败!');"); } } }