private void Init_theWork(Guid projectCode) { this.dtWork.Columns.Add(new DataColumn("ParentWorkCode", typeof(string))); this.dtWork.Columns.Add(new DataColumn("WorkCode", typeof(string))); this.dtWork.Columns.Add(new DataColumn("WorkName", typeof(string))); this.dtWork.Columns.Add(new DataColumn("WorkMoney", typeof(string))); this.dtWork.Columns.Add(new DataColumn("IsHaveChild", typeof(string))); DateTime startDate = Convert.ToDateTime(((this.DDLYear.SelectedValue == "") ? DateTime.Now.Year.ToString() : this.DDLYear.SelectedValue) + "-" + ((this.DDLMonth.SelectedValue == "") ? DateTime.Now.Month.ToString() : this.DDLMonth.SelectedValue) + "-1"); ArrayList arrayList; if (this.ProjectCode.ToString() != Guid.Empty.ToString()) { this.theCBS.InitialzeCBS(this.ProjectCode.ToString(), startDate); arrayList = this.theCBS.GetAllCBSFee(this.ProjectCode.ToString(), startDate); } else { arrayList = new ArrayList(); } for (int i = 0; i < arrayList.Count; i++) { DataRow dataRow = this.dtWork.NewRow(); CBSFeeNodeInfo cBSFeeNodeInfo = (CBSFeeNodeInfo)arrayList[i]; dataRow["ParentWorkCode"] = cBSFeeNodeInfo.PNode; dataRow["WorkCode"] = cBSFeeNodeInfo.NodeCode; dataRow["WorkName"] = cBSFeeNodeInfo.NodeName.Replace(" ", "").Trim(); dataRow["WorkMoney"] = cBSFeeNodeInfo.Money.ToString() + " "; this.dtWork.Rows.Add(dataRow); } }
private void DgCostCbs_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemIndex != -1) { CBSFeeNodeInfo cBSFeeNodeInfo = (CBSFeeNodeInfo)e.Item.DataItem; LinkButton linkButton = (LinkButton)e.Item.Cells[5].Controls[1]; if (cBSFeeNodeInfo.IsHaveChild) { linkButton.Visible = false; } else { linkButton.Attributes["onclick"] = string.Concat(new string[] { "if(!OpenWindow('", this.prjcode.Value.Trim(), "','", cBSFeeNodeInfo.NodeCode, "','", base.Server.UrlEncode(cBSFeeNodeInfo.NodeName.Replace(" ", "")), "')) return false;" }); } e.Item.Attributes["onclick"] = "doClick(this,'" + this.DgCostCbs.ClientID + "');"; e.Item.Attributes["onmouseover"] = "doMouseOver(this);"; e.Item.Attributes["onmouseout"] = "doMouseOut(this);"; } }
protected void BtnSave_Click(object sender, EventArgs e) { CBSFeeNodeInfo costApproveData = this.GetCostApproveData(); if (base.DealType == OpType.Add) { int num = this.theCBS.AddCBSNodeInfo(costApproveData); if (num == 1) { this.JS.Text = "alert('添加成功!');"; JavaScriptControl expr_37 = this.JS; expr_37.Text += "location.href='CostFrameAnalyze.aspx';"; } else { this.JS.Text = "alert('添加失败!');location.href='CostFrameAnalyze.aspx';"; } } if (base.DealType == OpType.Upd) { int num2 = this.theCBS.UpdateCBSNodeInfo(costApproveData); if (num2 == 1) { this.JS.Text = "alert('编辑成功!');location.href='CostFrameAnalyze.aspx';"; return; } this.JS.Text = "alert('编辑失败!');location.href='CostFrameAnalyze.aspx';"; } }
public int UpdateCBSNodeInfo(CBSFeeNodeInfo CBSNode) { string sqlString = ""; sqlString = ((((sqlString + " update EPM_CostApprove_CBS_Analyze set ") + " NodeName = '" + CBSNode.NodeName + "', ") + " CostType = '" + CBSNode.CostType + "', ") + " Remark = '" + CBSNode.Remark + "' ") + " where NodeCode = '" + CBSNode.NodeCode + "'"; try { publicDbOpClass.ExecSqlString(sqlString); return(1); } catch { return(0); } }
protected void Page_Load(object sender, EventArgs e) { if (base.Request["nc"] == null || base.Request["t"] == null) { this.RegisterStartupScript("", "<script>alert('参数错误!');</script>"); return; } this.NodeCode = base.Request["nc"].ToString(); base.DealType = (OpType)Enum.Parse(typeof(OpType), base.Request["t"].ToString()); if (base.Request["tf"] != null && base.Request["tf"].ToString() != "") { this.IsHaveChild = (base.Request["tf"].ToString() == "true"); } if (!this.Page.IsPostBack) { if (base.Request["ct"] != null && base.Request["ct"].ToString() != "") { this.DDLCostType.SelectedValue = base.Request["ct"].ToString(); } if (base.DealType == OpType.Add) { if (this.NodeCode.Length != 3 && this.NodeCode.Length != 6) { this.DDLCostType.Enabled = true; } string text = this.theCBS.InitCBSCode(this.NodeCode); this.TxtCBSCode.Text = text; } if (base.DealType == OpType.Upd) { if (!this.IsHaveChild && this.NodeCode.Length == 3) { this.DDLCostType.Enabled = true; } CBSFeeNodeInfo cBSNodeByCode = this.theCBS.GetCBSNodeByCode(this.NodeCode); this.TxtCBSCode.Text = cBSNodeByCode.NodeCode; this.TxtCostName.Text = cBSNodeByCode.NodeName; this.TxtRemark.Text = cBSNodeByCode.Remark; try { this.DDLCostType.SelectedValue = cBSNodeByCode.CostType.ToString(); } catch { } } } }
public int AddCBSNodeInfo(CBSFeeNodeInfo CBSNode) { object obj2 = (("" + " insert into EPM_CostApprove_CBS_Analyze(NodeCode,NodeName,NodeLayer,CostType,IsValid,Remark) " + " values( ") + " '" + CBSNode.NodeCode + "', ") + " '" + CBSNode.NodeName + "', "; object obj3 = string.Concat(new object[] { obj2, " '", CBSNode.NodeLayer, "', " }) + " '" + CBSNode.CostType + "', "; string sqlString = (string.Concat(new object[] { obj3, " '", CBSNode.IsValid, "', " }) + " '" + CBSNode.Remark + "' ") + " ) "; try { publicDbOpClass.ExecSqlString(sqlString); return(1); } catch { return(0); } }
private void DgCostCbs_ItemDataBound(object sender, DataGridItemEventArgs e) { if (e.Item.ItemIndex != -1) { CBSFeeNodeInfo cBSFeeNodeInfo = (CBSFeeNodeInfo)e.Item.DataItem; TextBox textBox = (TextBox)e.Item.Cells[2].Controls[1]; if (cBSFeeNodeInfo.IsHaveChild) { textBox.Enabled = false; textBox.Attributes.CssStyle["background-color"] = "#FFFFC0"; } e.Item.Attributes["onclick"] = "doClick(this,'" + this.DgCostCbs.ClientID + "');"; e.Item.Attributes["onmouseover"] = "doMouseOver(this);"; e.Item.Attributes["onmouseout"] = "doMouseOut(this);"; } }
private CBSFeeNodeInfo GetCBSFeeNodeFromDataRow(DataRow dr) { CBSFeeNodeInfo info = new CBSFeeNodeInfo { NodeCode = dr["NodeCode"].ToString(), NodeName = dr["NodeName"].ToString(), NodeLayer = (dr["NodeLayer"].ToString() == "") ? -2147483648 : ((int)dr["NodeLayer"]), IsValid = (dr["IsValid"].ToString() == "") ? -2147483648 : ((int)dr["IsValid"]), PNode = dr["PNode"].ToString(), CostType = dr["CostType"].ToString() }; try { info.Money = (dr["Money"].ToString() == "") ? 0M : ((decimal)dr["Money"]); info.StartDate = (dr["StartDate"].ToString() == "") ? DateTime.Now : ((DateTime)dr["StartDate"]); } catch { } try { info.IsHaveChild = int.Parse(dr["IsHaveChild"].ToString()) >= 1; } catch { } try { info.TargetMoney = (dr["TargetMoney"].ToString() == "") ? 0M : ((decimal)dr["TargetMoney"]); } catch { } try { info.PlanMoney = (dr["PlanMoney"].ToString() == "") ? 0M : ((decimal)dr["PlanMoney"]); } catch { } info.Remark = dr["Remark"].ToString(); return(info); }
private void Init_theWork() { this.dtWork.Columns.Add(new DataColumn("ParentWorkCode", typeof(string))); this.dtWork.Columns.Add(new DataColumn("WorkCode", typeof(string))); this.dtWork.Columns.Add(new DataColumn("WorkName", typeof(string))); this.dtWork.Columns.Add(new DataColumn("WorkType", typeof(string))); this.dtWork.Columns.Add(new DataColumn("WorkRemark", typeof(string))); this.dtWork.Columns.Add(new DataColumn("IsHaveChild", typeof(string))); ArrayList allCBSApproveList = this.theCBS.GetAllCBSApproveList2(); for (int i = 0; i < allCBSApproveList.Count; i++) { DataRow dataRow = this.dtWork.NewRow(); CBSFeeNodeInfo cBSFeeNodeInfo = (CBSFeeNodeInfo)allCBSApproveList[i]; dataRow["ParentWorkCode"] = cBSFeeNodeInfo.PNode; dataRow["WorkCode"] = cBSFeeNodeInfo.NodeCode; dataRow["WorkName"] = cBSFeeNodeInfo.NodeName; dataRow["WorkType"] = ((cBSFeeNodeInfo.CostType == "1") ? "成本核算" : ((cBSFeeNodeInfo.CostType == "2") ? "其它成本" : "")); dataRow["WorkRemark"] = cBSFeeNodeInfo.Remark; this.dtWork.Rows.Add(dataRow); } }