protected void InitHiddenField() { if (!string.IsNullOrEmpty(base.Request["id"])) { string text = base.Request["id"]; this.hfldconModifyID.Value = text; BudConModify byConInModifyID = this.budModifySev.GetByConInModifyID(text); if (byConInModifyID != null) { this.hfldconBudModifyID.Value = byConInModifyID.ModifyId; } else { this.hfldconBudModifyID.Value = Guid.NewGuid().ToString(); } } else { this.hfldconModifyID.Value = this.hdGuid.Value; this.hfldconBudModifyID.Value = Guid.NewGuid().ToString(); } if (!string.IsNullOrEmpty(base.Request["ContractID"])) { string text2 = base.Request["ContractID"]; this.hfldConIncometID.Value = text2; ConIncometContract byContractId = this.conInConSev.GetByContractId(text2); this.hfldPrjGuid.Value = byContractId.Project; } }
protected override void OnInit(System.EventArgs e) { if (!string.IsNullOrEmpty(base.Request["ContractId"])) { this.hfldContractID.Value = base.Request["ContractId"]; ConIncometContract byContractId = this.conIncometSev.GetByContractId(base.Request["ContractId"]); this.hfldPrjGuid.Value = byContractId.Project; } base.OnInit(e); }
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对不起删除失败!');"); } } }
protected void Initial() { if (!string.IsNullOrEmpty(base.Request["ContractID"])) { string text = base.Request["ContractID"]; this.hfldContractId.Value = text; ConIncometContract byContractId = this.conIncometSev.GetByContractId(text); this.hfldPrjGuid.Value = byContractId.Project; this.lblContractName.Text = byContractId.ContractName; } if (!string.IsNullOrEmpty(base.Request["id"])) { string rptId = base.Request["id"]; if (rptId != string.Empty) { this.hfldType.Value = "edit"; } else { this.hfldType.Value = "add"; } this.hfldRptId.Value = rptId; BudContractConsReport byId = this.rptSer.GetById(this.hfldRptId.Value); this.txtDate.Text = byId.InputDate.ToString("yyyy-MM-dd"); this.txtNode.Value = byId.Note; System.Collections.Generic.List <BudContractConsTask> list = ( from ct in this.ctSer where ct.RptId == rptId select ct).ToList <BudContractConsTask>(); BudContractTaskService budContractTaskService = new BudContractTaskService(); DataTable dataTable = new DataTable(); foreach (BudContractConsTask current in list) { if (current.ContractTask == null) { current.ContractTask = budContractTaskService.GetTaskById(current.TaskId); dataTable = cn.justwin.Domain.BudContractTask.GetSingleBudContractTask(this.hfldPrjGuid.Value, current.TaskId); if (dataTable.Rows.Count > 0) { current.ContractTask.Quantity = System.Convert.ToDecimal(dataTable.Rows[0]["Quantity"]); current.ContractTask.Total = new decimal?(System.Convert.ToDecimal(dataTable.Rows[0]["total"])); } } } this.SaveToViewState(list); this.BindConsTask(list); } else { this.hfldRptId.Value = System.Guid.NewGuid().ToString(); } if (!string.IsNullOrEmpty(this.hfldPrjGuid.Value)) { PTPrjInfoService pTPrjInfoService = new PTPrjInfoService(); PTPrjInfo byId2 = pTPrjInfoService.GetById(this.hfldPrjGuid.Value); if (byId2 != null) { this.lblPrjName.Text = byId2.PrjName; this.txtDate.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); } } }