protected void btnDelete_Click(object sender, EventArgs e) { MonthDetailService monthDetailService = new MonthDetailService(); Fund_Plan_MonthMainAction fund_Plan_MonthMainAction = new Fund_Plan_MonthMainAction(); List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldPurchaseChecked.Value); string arrayToInStr = StringUtility.GetArrayToInStr(listFromJson.ToArray()); List <string> monthDetailId = fund_Plan_MonthMainAction.getMonthDetailId(listFromJson); string text = string.Empty; if (monthDetailId.Count > 0) { text = StringUtility.GetArrayToInStr(monthDetailId.ToArray()); } try { using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection.Open(); SqlTransaction sqlTransaction = sqlConnection.BeginTransaction(); if (!string.IsNullOrEmpty(text)) { monthDetailService.DeleteList(text, sqlTransaction); } fund_Plan_MonthMainAction.DeleteMainInfoList(arrayToInStr); sqlTransaction.Commit(); } base.RegisterScript("alert('系统提示:\\n\\n删除成功!');"); this.BindGv(); } catch { base.RegisterScript("alert('系统提示:\\n\\n删除失败!');"); } }
public void BindGv() { this.hfldPrjId.Value = this.prjId; this.hfldYear.Value = this.year; this.hfldPurchaseChecked.Value = string.Empty; Fund_Plan_MonthMainAction fund_Plan_MonthMainAction = new Fund_Plan_MonthMainAction(); if (this.hfldPrjId.Value.ToString() != "" && this.hfldYear.Value.ToString() != "") { this.setTitle(); Fund_Plan_MonthMainInfo fund_Plan_MonthMainInfo = new Fund_Plan_MonthMainInfo(); fund_Plan_MonthMainInfo.PrjGuid = new Guid(this.hfldPrjId.Value.ToString()); fund_Plan_MonthMainInfo.PlanType = this.plantype; fund_Plan_MonthMainInfo.PlanYear = Convert.ToInt32(this.hfldYear.Value.ToString()); Random random = new Random(); this.framShowDetail.Attributes["src"] = "showDetailMonthPlan.aspx?e=" + random.Next(1, 999) + "&mpid="; this.gvBudget.DataSource = fund_Plan_MonthMainAction.GetMainList(fund_Plan_MonthMainInfo); } this.gvBudget.DataBind(); }