protected void btnFinish_Click(object sender, EventArgs e) { var ChooseProId = Request.Form["ChooseProId"]; if (!string.IsNullOrEmpty(ChooseProId)) { var chooseProArr = ChooseProId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); int sucessNum = 0; foreach (var chooseProId in chooseProArr) { var param = GetParam(chooseProId); var result = new InstalledProductBLL().ConfigurationItemAdd(param, GetLoginUserId()); if (result) { sucessNum++; } } if (sucessNum > 0) { conCost.create_ci = 1; AddChargeDto dto = new AddChargeDto() { cost = conCost, isAddCongigItem = false }; bool isDelShiCost = false; var isHasPurchaseOrder = ""; new ContractCostBLL().UpdateCost(dto, GetLoginUserId(), out isDelShiCost, out isHasPurchaseOrder); ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('配置项向导成功!');window.close();self.opener.location.reload();</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('配置项向导失败!');window.close();self.opener.location.reload();</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>window.close();self.opener.location.reload();</script>"); } }
/// <summary> /// 获取到页面参数 /// </summary> /// <returns></returns> protected AddChargeDto GetParam() { var thisConCost = AssembleModel <ctt_contract_cost>(); thisConCost.bill_status = 0; AddChargeDto param = new AddChargeDto(); param.isAddCongigItem = AddConfigItem.Checked; if (!isAdd) { if (conCost.create_ci == 1) { param.isAddCongigItem = false; } } thisConCost.is_billable = (sbyte)(isbillable.Checked?1:0); //thisConCost.create_ci = (sbyte)(AddConfigItem.Checked ? 1 : 0); if (!isAdd) { thisConCost.id = conCost.id; thisConCost.contract_block_id = conCost.contract_block_id; thisConCost.project_id = conCost.project_id; thisConCost.task_id = conCost.task_id; thisConCost.opportunity_id = conCost.opportunity_id; thisConCost.quote_item_id = conCost.quote_item_id; thisConCost.creatorobjectid = conCost.creatorobjectid; thisConCost.create_time = conCost.create_time; thisConCost.create_user_id = conCost.create_user_id; thisConCost.extended_price = thisConCost.unit_price * thisConCost.quantity; thisConCost.contract_id = conCost.contract_id; thisConCost.sub_cate_id = conCost.sub_cate_id; thisConCost.create_time = conCost.create_time; thisConCost.create_user_id = conCost.create_user_id; thisConCost.create_ci = conCost.create_ci; } if (contract != null) { thisConCost.contract_id = contract.id; thisConCost.sub_cate_id = (int)DicEnum.BILLING_ENTITY_SUB_TYPE.CONTRACT_COST; } if (thisTask != null) { thisConCost.task_id = thisTask.id; if (thisConCost.changeorder != null && thisConCost.changeorder != 0) { thisTask.projected_variance += (decimal)thisConCost.changeorder; new TaskBLL().OnlyEditTask(thisTask, LoginUserId); // 修改任务的预估偏差 } var change_order_hours = Request.Form["change_order_hours"]; if (!string.IsNullOrEmpty(change_order_hours)) { thisConCost.change_order_hours = decimal.Parse(change_order_hours); } else { thisConCost.change_order_hours = 0; } //thisConCost.change_order_hours = thisConCost.change_order_hours; thisConCost.sub_cate_id = (int)DicEnum.BILLING_ENTITY_SUB_TYPE.TICKET_COST; thisConCost.contract_id = null; } if (thisTicket != null) { thisConCost.task_id = thisTicket.id; thisConCost.sub_cate_id = (int)DicEnum.BILLING_ENTITY_SUB_TYPE.TICKET_COST; thisConCost.contract_id = null; } if (thisProject != null) { thisConCost.project_id = thisProject.id; thisConCost.sub_cate_id = (int)DicEnum.BILLING_ENTITY_SUB_TYPE.PROJECT_COST; thisConCost.contract_id = null; } param.cost = thisConCost; return(param); }