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); } }
public void ShowTaskInfo_click(object sender, System.EventArgs e) { string id = string.Empty; string arg_0B_0 = string.Empty; cn.justwin.Domain.Entities.BudContractTask budContractTask = null; DataTable dataSource = null; string contractID = null; if (!string.IsNullOrEmpty(base.Request["id"])) { contractID = base.Request["id"]; } if (!string.IsNullOrEmpty(this.hdTaskID.Value)) { id = this.hdTaskID.Value; BudContractTaskService budContractTaskService = new BudContractTaskService(); budContractTask = budContractTaskService.GetTaskById(id); this.hdOrderNumber.Value = budContractTask.OrderNumber; } if (budContractTask != null) { dataSource = cn.justwin.Domain.BudContractTask.GetConByParent(this.hdnProjectCode.Value, contractID, budContractTask.OrderNumber, "", "", "", 0); } this.gvBudget.DataSource = dataSource; this.gvBudget.DataBind(); }
public void CommitEvent(object key) { cn.justwin.Domain.Entities.BudContractTaskAudit byId = new BudContractTaskAuditService().GetById(key.ToString()); BudContractTaskService service2 = new BudContractTaskService(); IList <cn.justwin.Domain.Entities.BudContractTask> byProject = service2.GetByProject(byId.PrjId, 0x3e7); IList <int> years = service2.GetYears(byProject); if (years != null) { foreach (int num in years) { IList <cn.justwin.Domain.Entities.BudContractTask> yearTask = service2.GetYearTask(byProject, num); foreach (cn.justwin.Domain.Entities.BudContractTask task in yearTask) { service2.Add(task); } foreach (int num2 in service2.GetMonths(yearTask, num)) { foreach (cn.justwin.Domain.Entities.BudContractTask task2 in service2.GetMonthTasks(yearTask, num, num2)) { service2.Add(task2); } } } } }
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(); }
private string GetParentId(string taskId) { BudContractTaskService budContractTaskService = new BudContractTaskService(); BudContractTask byId = budContractTaskService.GetById(taskId); if (byId != null) { return(byId.ParentId); } return(string.Empty); }
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); } }
private string GetParentId(string taskId) { BudContractTaskService budContractTaskService = new BudContractTaskService(); cn.justwin.Domain.Entities.BudContractTask byId = budContractTaskService.GetById(taskId); BudConModifyTaskService source = new BudConModifyTaskService(); BudConModifyTask budConModifyTask = ( from r in source where r.TaskId == taskId select r).FirstOrDefault <BudConModifyTask>(); if (byId != null) { return(byId.ParentId); } return(budConModifyTask.ParentId); }
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 BindHtmlData() { if (this.type.ToLower() == "edit") { BudContractTaskService budContractTaskService = new BudContractTaskService(); cn.justwin.Domain.Entities.BudContractTask byId = budContractTaskService.GetById(this.id); if (byId != null) { this.txtTaskCode.Text = byId.TaskCode; this.ViewState["oldCode"] = byId.TaskCode; this.txtTaskName.Text = byId.TaskName; this.txtStartDate.Text = ((!byId.StartDate.HasValue) ? string.Empty : byId.StartDate.Value.ToString("yyyy-M-d")); this.txtEndDate.Text = ((!byId.EndDate.HasValue) ? string.Empty : byId.EndDate.Value.ToString("yyyy-M-d")); this.txtConstructionPeriod.Text = (byId.ConstructionPeriod.HasValue ? byId.ConstructionPeriod.Value.ToString() : ""); this.txtUnit.Text = byId.Unit; this.txtQuantity.Text = byId.Quantity.ToString(); this.txtUnitPrice.Text = byId.UnitPrice.ToString(); this.txtTotal.Text = byId.Total.ToString(); this.ddlTaskType.SelectedValue = (byId.OrderNumber.Length / 3).ToString(); this.txtNote.Text = byId.Note; this.txtDescription.Text = byId.FeatureDescription; this.txtMainMaterial.Text = byId.MainMaterial.ToString(); this.txtSubMaterial.Text = byId.SubMaterial.ToString(); this.txtLabor.Text = byId.Labor.ToString(); } cn.justwin.Domain.BudContractTask.GetById(this.id); this.hfldState.Value = "edit"; return; } string text = base.Request["layer"]; if (text == "") { this.ddlTaskType.SelectedValue = "1"; return; } if (text == "0") { this.ddlTaskType.SelectedValue = string.Empty; return; } this.ddlTaskType.SelectedValue = text; }
protected string GetTaskCode(string taskId) { string result = string.Empty; BudContractTaskService budContractTaskService = new BudContractTaskService(); BudContractTask byId = budContractTaskService.GetById(taskId); if (byId != null) { result = byId.TaskCode; } else { BudConModifyTask byId2 = this.conModifyTaskSer.GetById(taskId); if (byId2 != null) { result = byId2.ModifyTaskCode; } } return(result); }
protected string GetTaskCode(string taskId) { string result = string.Empty; cn.justwin.Domain.Entities.BudContractTask budContractTask = new cn.justwin.Domain.Entities.BudContractTask(); BudContractTaskService budContractTaskService = new BudContractTaskService(); budContractTask = budContractTaskService.GetById(taskId); if (budContractTask != null) { result = budContractTask.TaskCode; } else { BudConModifyTask byId = this.conModifyTaskSer.GetById(taskId); if (byId != null) { result = byId.ModifyTaskCode; } } return(result); }
private void GenerageBudgetByParent(string prjId) { PTPrjInfoService pTPrjInfoService = new PTPrjInfoService(); PTPrjInfo byId = pTPrjInfoService.GetById(prjId); PTPrjInfo parent = pTPrjInfoService.GetParent(prjId); string str = byId.TypeCode.Substring(6, 4); BudContractTaskService budContractTaskService = new BudContractTaskService(); budContractTaskService.DeleteByProject(prjId); System.Collections.Generic.IList <cn.justwin.Domain.Entities.BudContractTask> byProject = budContractTaskService.GetByProject(parent.PrjGuid.Value.ToString(), 999); for (int i = 0; i < byProject.Count; i++) { cn.justwin.Domain.Entities.BudContractTask budContractTask = byProject[i]; budContractTask.PrjId = byId.PrjGuid.Value.ToString(); budContractTask.TaskId = budContractTask.TaskId.Substring(0, 9) + str + budContractTask.TaskId.Substring(13); if (!string.IsNullOrEmpty(budContractTask.ParentId)) { budContractTask.ParentId = budContractTask.ParentId.Substring(0, 9) + str + budContractTask.ParentId.Substring(13); } budContractTaskService.Add(budContractTask); } this.BindGv(); }
protected void btnSave_Click(object sender, System.EventArgs e) { string text = this.txtQuantity.Text; string value = this.txtUnitPrice.Text.Trim(); decimal value2 = System.Convert.ToDecimal(text) * System.Convert.ToDecimal(value); if (string.IsNullOrEmpty(text)) { base.RegisterScript("top.ui.alert('工程量必须输入');"); this.txtQuantity.Focus(); return; } if (string.IsNullOrEmpty(value)) { base.RegisterScript("top.ui.alert('综合单价必须输入');"); this.txtUnitPrice.Focus(); return; } string taskCode = this.txtTaskCode.Text.Trim(); bool flag = false; if (this.ViewState["oldCode"] != null) { this.ViewState["oldCode"].ToString(); } else { string arg_B0_0 = string.Empty; } if (flag) { base.RegisterScript("top.ui.alert('清单编码不能重复');"); this.txtTaskCode.Focus(); return; } string taskName = this.txtTaskName.Text.Trim(); System.DateTime?startDate = null; if (!string.IsNullOrEmpty(this.txtStartDate.Text)) { startDate = new System.DateTime?(System.Convert.ToDateTime(this.txtStartDate.Text)); } System.DateTime?endDate = null; if (!string.IsNullOrEmpty(this.txtEndDate.Text)) { endDate = new System.DateTime?(System.Convert.ToDateTime(this.txtEndDate.Text)); } string unit = this.txtUnit.Text.Trim(); string arg_15D_0 = this.ddlTaskType.SelectedValue; string note = this.txtNote.Text.Trim(); int? constructionPeriod = null; if (!string.IsNullOrEmpty(this.txtConstructionPeriod.Text.Trim())) { constructionPeriod = new int?(System.Convert.ToInt32(this.txtConstructionPeriod.Text.Trim())); } string arg_1B6_0 = this.txtConstructionPeriod.Text; BudContractTaskService budContractTaskService = new BudContractTaskService(); cn.justwin.Domain.Entities.BudContractTask budContractTask; if (this.type.ToUpper() == "EDIT") { budContractTask = budContractTaskService.GetById(this.id); } else { budContractTask = new cn.justwin.Domain.Entities.BudContractTask(); budContractTask.TaskId = System.Guid.NewGuid().ToString(); budContractTask.OrderNumber = cn.justwin.Domain.BudContractTask.GetOrderNumber(this.prjId, this.id); if (string.IsNullOrEmpty(this.id)) { budContractTask.ParentId = null; } else { budContractTask.ParentId = this.id; } budContractTask.PrjId = this.prjId; budContractTask.InputUser = base.UserCode; budContractTask.InputDate = System.DateTime.Now; } budContractTask.TaskCode = taskCode; budContractTask.TaskName = taskName; budContractTask.Unit = unit; budContractTask.Quantity = System.Convert.ToDecimal(text); budContractTask.StartDate = startDate; budContractTask.EndDate = endDate; budContractTask.ConstructionPeriod = constructionPeriod; budContractTask.Note = note; budContractTask.UnitPrice = new decimal?(System.Convert.ToDecimal(value)); budContractTask.Total = new decimal?(value2); budContractTask.TaskType = ""; budContractTask.FeatureDescription = this.txtDescription.Text.Trim(); budContractTask.MainMaterial = new decimal?(System.Convert.ToDecimal(this.txtMainMaterial.Text.Trim())); budContractTask.SubMaterial = new decimal?(System.Convert.ToDecimal(this.txtSubMaterial.Text.Trim())); budContractTask.Labor = new decimal?(System.Convert.ToDecimal(this.txtLabor.Text.Trim())); if (this.type.ToUpper() == "EDIT") { budContractTaskService.Update(budContractTask); } else { budContractTaskService.Add(budContractTask); } string str = "resetData();"; string str2 = "top.ui.winSuccess({parentName:'_BudContractTaskTaskEdit'});"; base.RegisterScript(str + str2); }
protected void btnDel_Click(object sender, EventArgs e) { BudConModifyService budConModifyService = new BudConModifyService(); BudConModifyTaskService budConModifyTaskService = new BudConModifyTaskService(); BudContractTaskService budContractTaskService = new BudContractTaskService(); List <string> list = new List <string>(); using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString)) { sqlConnection.Open(); SqlTransaction sqlTransaction = sqlConnection.BeginTransaction(); try { foreach (GridViewRow gridViewRow in this.gvConract.Rows) { CheckBox checkBox = gridViewRow.FindControl("cbBox") as CheckBox; if (checkBox != null && checkBox.Checked) { int num = this.incometModifyBll.Delete(sqlTransaction, checkBox.ToolTip); if (num > 0) { BudConModify budConModify = budConModifyService.GetByConInModifyID(checkBox.ToolTip); if (budConModify != null) { this.DeleteInModifyTaskAndMeasure(budConModify.ModifyId); List <string> list2 = ( from r in budConModifyTaskService where r.ModifyId == budConModify.ModifyId select r.TaskId).ToList <string>(); foreach (string taskId in list2) { BudContractTask budContractTask = ( from r in budContractTaskService where r.TaskId == taskId select r).FirstOrDefault <BudContractTask>(); BudConModifyTask budConModifyTask = ( from r in budConModifyTaskService where r.TaskId == taskId && r.ModifyId == budConModify.ModifyId select r).FirstOrDefault <BudConModifyTask>(); if (budContractTask != null) { if (budContractTask.ModifyType == "0") { budContractTaskService.Delete(budContractTask); } else { budContractTask.EndDate = budConModifyTask.EndDate; budContractTask.StartDate = budConModifyTask.StartDate; budContractTask.TaskCode = budConModifyTask.ModifyTaskCode; budContractTask.TaskName = budConModifyTask.ModifyTaskContent; budContractTask.Unit = budConModifyTask.Unit; budContractTask.Total = new decimal?(Convert.ToDecimal(budContractTask.Total) - budConModifyTask.Total); budContractTask.InputDate = DateTime.Now; budContractTask.IsValid = new bool?(false); budContractTask.Note = budConModifyTask.Note; budContractTask.OrderNumber = budConModifyTask.OrderNumber; budContractTask.ParentId = budConModifyTask.ParentId; budContractTask.PrjId = budConModifyTask.PrjId2; budContractTask.Quantity = Convert.ToDecimal(budContractTask.Quantity) - budConModifyTask.Quantity; budContractTask.TaskId = budConModifyTask.TaskId; budContractTask.ModifyId = null; budContractTask.ModifyType = "1"; if (budContractTask.Quantity != 0m) { budContractTask.UnitPrice = budContractTask.Total / budContractTask.Quantity; } budContractTask.TaskType = string.Empty; budContractTask.InputUser = PageHelper.QueryUser(this, base.UserCode); budContractTask.FeatureDescription = budConModifyTask.FeatureDescription; budContractTask.ConstructionPeriod = budConModifyTask.ConstructionPeriod; budContractTask.MainMaterial = new decimal?(Convert.ToDecimal(budContractTask.MainMaterial) - Convert.ToDecimal(budConModifyTask.MainMaterial)); budContractTask.Labor = new decimal?(Convert.ToDecimal(budContractTask.Labor) - Convert.ToDecimal(budConModifyTask.Labor)); budContractTask.SubMaterial = new decimal?(Convert.ToDecimal(budContractTask.SubMaterial) - Convert.ToDecimal(budConModifyTask.SubMaterial)); budContractTaskService.Update(budContractTask); } } } budConModifyTaskService.DelModifyTask(budConModify.ModifyId); list.Add(budConModify.ModifyId); budConModifyService.Delete(list); } base.RegisterScript("top.ui.show('数据删除成功!');"); base.RegisterScript("window.location = window.location"); } } } sqlTransaction.Commit(); this.BindGv(); } catch (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"); } } }
protected void btnDelTask_Click(object sender, System.EventArgs e) { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); CheckBox checkBox = this.gvBudget.HeaderRow.Cells[0].FindControl("cbAllBox") as CheckBox; BudContractConsTaskService budContractConsTaskService = new BudContractConsTaskService(); if (checkBox != null) { if (checkBox.Checked) { cn.justwin.Domain.BudContractTask.ClearByPrjId(this.prjId); System.Collections.Generic.List <string> taskIds = ( from t in cn.justwin.Domain.BudContractTask.GetAllByPrjId(this.prjId) select t.Id).ToList <string>(); budContractConsTaskService.DeleteByTaskId(taskIds); } else { bool flag = false; System.Collections.Generic.List <string> listFromJson = JsonHelper.GetListFromJson(this.hfldCheckedIds.Value); if (listFromJson.Count == 1) { bool flag2 = cn.justwin.Domain.BudContractTask.IsLeaf(listFromJson[0]); flag = flag2; } else { System.Collections.Generic.List <string> orderNumberById = cn.justwin.Domain.BudContractTask.GetOrderNumberById(listFromJson); bool flag3 = cn.justwin.Domain.BudTask.IsStructured(orderNumberById); if (flag3) { bool flag4 = false; foreach (string current in listFromJson) { bool flag5 = cn.justwin.Domain.BudContractTask.CheckChilds(current); if (flag5) { flag4 = flag5; break; } } if (!flag4) { flag = true; } } } if (!flag) { base.RegisterScript("alert('系统提示:\\n请先删除子项!');"); return; } cn.justwin.Domain.BudContractTask.Del(listFromJson); budContractConsTaskService.DeleteByTaskId(listFromJson); } } BudContractTaskService budContractTaskService = new BudContractTaskService(); budContractTaskService.SuperDel(this.prjId); stringBuilder.Append(string.Concat(new string[] { "location='ContractTask.aspx?prjId=", this.prjId, "&year=", this.year, "';" })); base.RegisterScript(stringBuilder.ToString()); }