private void Initial() { BudContractConsReport byId = this.rptSer.GetById(this.rptId); this.lblDate.Text = byId.InputDate.ToString("yyyy-MM-dd"); this.txtNode.Value = byId.Note; PTPrjInfoService pTPrjInfoService = new PTPrjInfoService(); PTPrjInfo byId2 = pTPrjInfoService.GetById(byId.PrjId); if (byId2 != null) { this.lblPrjName.Text = byId2.PrjName; } System.Collections.Generic.List <BudContractConsTask> list = ( from ct in this.ctSer where ct.RptId == this.rptId select ct).ToList <BudContractConsTask>(); BudContractTaskService budContractTaskService = new BudContractTaskService(); foreach (BudContractConsTask current in list) { if (current.ContractTask == null) { current.ContractTask = budContractTaskService.GetTaskById(current.TaskId); } } this.gvwConsTask.DataSource = list; this.gvwConsTask.DataBind(); }
public void UpdateBudConstractConsRpt() { StringBuilder stringBuilder = new StringBuilder(); this.SaveBudConstractConsRpt(); if (this.hfldRptIDs.Value == "''") { BudContractConsReport byBalanceIdAndContractIDAndType = this.budContractRptSev.getByBalanceIdAndContractIDAndType(this.hdGuid.Value, this.hfldContractId.Value, "1"); if (byBalanceIdAndContractIDAndType != null) { stringBuilder.Append("DELETE Bud_ContractConsTask WHERE rptId='" + byBalanceIdAndContractIDAndType.RptId + "' "); this.budContractRptSev.Delete(byBalanceIdAndContractIDAndType); } } stringBuilder.Append(string.Concat(new string[] { "Update Bud_ContractConsReport SET BalanceId=NULL WHERE BalanceId='", this.hdGuid.Value, "' AND contractId='", this.hfldContractId.Value, "' AND Type='0' " })); stringBuilder.Append(string.Concat(new string[] { "Update Bud_ContractConsReport SET BalanceId='", this.hdGuid.Value, "' WHERE RptId in(", this.hfldRptIDs.Value, ") AND contractId='", this.hfldContractId.Value, "' AND Type='0' " })); this.budContractRptSev.ExcuteSql(stringBuilder.ToString()); }
protected void btnDelete_Click(object sender, System.EventArgs e) { System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldRptId.Value); foreach (string current in listFromJson) { BudContractConsReport byId = this.rSer.GetById(current); this.rSer.Delete(byId); } base.RegisterScript("top.ui.show( '删除成功');"); this.BindReport(); }
private void Initial() { PTPrjInfoService pTPrjInfoService = new PTPrjInfoService(); PTPrjInfo byId = pTPrjInfoService.GetById(this.prjId); if (byId != null) { this.lblPrjName.Text = byId.PrjName; } if (this.type == "add") { this.RptId = System.Guid.NewGuid().ToString(); this.txtDate.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); BudContractConsReport budContractConsReport = new BudContractConsReport(); budContractConsReport.RptId = this.RptId; budContractConsReport.IsValid = false; budContractConsReport.PrjId = this.prjId; budContractConsReport.InputUser = PageHelper.QueryUser(this, base.UserCode); this.rptSer.Add(budContractConsReport); return; } if (this.type == "edit") { BudContractConsReport byId2 = this.rptSer.GetById(this.RptId); if (byId2 != null) { this.txtDate.Text = byId2.InputDate.ToString("yyyy-MM-dd"); this.txtNode.Value = byId2.Note; } else { this.txtDate.Text = string.Empty; this.txtNode.Value = string.Empty; } System.Collections.Generic.List <BudContractConsTask> list = ( from ct in this.ctSer where ct.RptId == this.RptId select ct).ToList <BudContractConsTask>(); BudContractTaskService source = new BudContractTaskService(); foreach (BudContractConsTask consTask in list) { if (consTask.ContractTask == null) { consTask.ContractTask = ( from r in source where r.TaskId == consTask.TaskId select r).FirstOrDefault <BudContractTask>(); } } this.SaveToViewState(list); this.BindConsTask(list); } }
protected void btnOk_Click(object sender, System.EventArgs e) { if (this.gvwConsTask.Rows.Count == 0) { base.RegisterScript("top.ui.alert('没有选择任务不能进行保存!')"); return; } if (!string.IsNullOrEmpty(base.Request["id"])) { BudContractConsReport byId = this.rptSer.GetById(base.Request["id"]); byId.IsValid = true; byId.Note = this.txtNode.Value.Trim(); System.DateTime inputDate = default(System.DateTime); if (!string.IsNullOrEmpty(this.txtDate.Text)) { inputDate = System.Convert.ToDateTime(this.txtDate.Text); } byId.InputDate = inputDate; this.rptSer.Update(byId); } else { BudContractConsReport budContractConsReport = new BudContractConsReport(); budContractConsReport.RptId = this.hfldRptId.Value; budContractConsReport.PrjId = this.hfldPrjGuid.Value; System.DateTime inputDate2 = default(System.DateTime); if (!string.IsNullOrEmpty(this.txtDate.Text)) { inputDate2 = System.Convert.ToDateTime(this.txtDate.Text.Trim()); } budContractConsReport.InputDate = inputDate2; budContractConsReport.InputUser = PageHelper.QueryUser(this, base.UserCode); budContractConsReport.IsValid = true; budContractConsReport.ContractId = this.hfldContractId.Value; budContractConsReport.FlowState = -1; budContractConsReport.Note = this.txtNode.Value.Trim(); budContractConsReport.Type = "0"; this.rptSer.Add(budContractConsReport); } this.UpdateGvwToViewState(); this.ctSer.DeleteByReport(this.hfldRptId.Value); this.rptSer.DeleteInvalid(); System.Collections.Generic.List <BudContractConsTask> fromViewState = this.GetFromViewState(); foreach (BudContractConsTask current in fromViewState) { this.ctSer.Add(current); } base.RegisterScript("top.ui.tabSuccess({ parentName: '_AddIncometMeasure'});"); }
public void btnDel_Click(object sender, System.EventArgs e) { System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldMeasureID.Value); foreach (string current in listFromJson) { BudContractConsReport byId = this.budConRptSev.GetById(current); if (byId != null) { this.budContractConTaskSev.DeleteByReport(byId.RptId); this.budConRptSev.Delete(byId); } } this.hfldMeasureID.Value = ""; this.hfldContractID.Value = base.Request["ContractId"].ToString(); this.hfldPrjGuid.Value = base.Request["prjId"].ToString(); this.BindGV(); }
protected void delContractConsReport(object sender, EventArgs e) { List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldBtnDelMeasureIds.Value); List <BudContractConsReport> fromViewState = this.GetFromViewState(); foreach (string rptId in listFromJson) { BudContractConsReport budContractConsReport = ( from t in fromViewState where t.RptId == rptId select t).FirstOrDefault <BudContractConsReport>(); if (budContractConsReport != null) { fromViewState.Remove(budContractConsReport); } } this.SaveToViewState(fromViewState); this.BindConsTask(fromViewState); }
public void DeleteRalationBud(string balanceId) { StringBuilder stringBuilder = new StringBuilder(); BudContractConsReport byBalanceIdAndContractIDAndType = this.budContractRptSev.getByBalanceIdAndContractIDAndType(balanceId, this.hdContractID.Value, "1"); if (byBalanceIdAndContractIDAndType != null) { stringBuilder.Append("DELETE Bud_ContractConsTask WHERE rptId='" + byBalanceIdAndContractIDAndType.RptId + "' "); this.budContractRptSev.Delete(byBalanceIdAndContractIDAndType); } stringBuilder.Append(string.Concat(new string[] { " Update Bud_ContractConsReport SET BalanceId=NULL WHERE BalanceId='", balanceId, "' AND contractId='", this.hdContractID.Value, "' AND Type='0' " })); this.budContractRptSev.ExcuteSql(stringBuilder.ToString()); }
protected void btnOk_Click(object sender, System.EventArgs e) { if (this.gvwConsTask.Rows.Count == 0) { base.RegisterScript("alert('系统提示:\\n\\n没有选择任务的时候不能进行保存!')"); return; } BudContractConsReport byId = this.rptSer.GetById(this.RptId); byId.IsValid = true; byId.InputDate = System.Convert.ToDateTime(this.txtDate.Text); byId.Note = this.txtNode.Value; this.rptSer.Update(byId); this.UpdateGvwToViewState(); this.ctSer.DeleteByReport(this.RptId); this.rptSer.DeleteInvalid(); System.Collections.Generic.List <BudContractConsTask> fromViewState = this.GetFromViewState(); foreach (BudContractConsTask current in fromViewState) { this.ctSer.Add(current); } base.RegisterScript("top.ui.tabSuccess({ parentName: '_ContractReportTask' });"); }
private void UpdateGvwToViewState() { List <BudContractConsReport> fromViewState = this.GetFromViewState(); List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldMeasureIds.Value); BudContractConsReport byBalanceIdAndContractIDAndType = this.budContractRptSev.getByBalanceIdAndContractIDAndType(this.hdGuid.Value, this.hfldContractId.Value, "1"); if (byBalanceIdAndContractIDAndType != null && !listFromJson.Contains(byBalanceIdAndContractIDAndType.RptId)) { listFromJson.Add(byBalanceIdAndContractIDAndType.RptId); } foreach (string rptId in listFromJson) { if (( from t in fromViewState where t.RptId == rptId select t).FirstOrDefault <BudContractConsReport>() == null) { BudContractConsReport byId = this.budContractRptSev.GetById(rptId); fromViewState.Add(byId); } } this.SaveToViewState(fromViewState); }
public void SaveBudConstractConsRpt() { List <BudContractConsTask> list = this.ConvertGridToList(); string rptId = Guid.NewGuid().ToString(); if (list.Count > 0) { BudContractConsReport budContractConsReport = this.budContractRptSev.getByBalanceIdAndContractIDAndType(this.hdGuid.Value, this.hfldContractId.Value, "1"); if (budContractConsReport != null) { rptId = budContractConsReport.RptId; using (List <BudContractConsTask> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { BudContractConsTask current = enumerator.Current; BudContractConsTask budContractConsTask = this.consTaskSev.GetByRptIdAndTaskId(rptId, current.TaskId); if (budContractConsTask != null) { budContractConsTask.Amount += current.Amount; budContractConsTask.ApproveAmount += current.ApproveAmount; this.consTaskSev.Update(budContractConsTask); } else { budContractConsTask = new BudContractConsTask(); budContractConsTask.ConsTaskId = Guid.NewGuid().ToString(); budContractConsTask.RptId = rptId; budContractConsTask.TaskId = current.TaskId; budContractConsTask.Amount = current.Amount; budContractConsTask.Note = ""; budContractConsTask.ApproveAmount = current.ApproveAmount; this.consTaskSev.Add(budContractConsTask); } } return; } } budContractConsReport = new BudContractConsReport(); budContractConsReport.RptId = rptId; budContractConsReport.InputDate = DateTime.Now; budContractConsReport.InputUser = PageHelper.QueryUser(this, base.UserCode); budContractConsReport.IsValid = true; budContractConsReport.PrjId = this.hfldPrjid.Value; budContractConsReport.Type = "1"; budContractConsReport.FlowState = 1; budContractConsReport.Note = ""; budContractConsReport.ContractId = this.hfldContractId.Value; budContractConsReport.BalanceId = this.hdGuid.Value; this.budContractRptSev.Add(budContractConsReport); foreach (BudContractConsTask current2 in list) { BudContractConsTask budContractConsTask2 = new BudContractConsTask(); budContractConsTask2.ConsTaskId = Guid.NewGuid().ToString(); budContractConsTask2.RptId = rptId; budContractConsTask2.TaskId = current2.TaskId; budContractConsTask2.Amount = current2.Amount; budContractConsTask2.Note = ""; budContractConsTask2.ApproveAmount = current2.ApproveAmount; this.consTaskSev.Add(budContractConsTask2); } } }
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"); } } }