protected void SaveDataClick(object sender, EventArgs e) { Hashtable ht = new Hashtable(); ht["Bname"] = this.Bname.Text; ht["Bjsf"] = this.Bjsf.Text; ht["Bremark"] = this.Bremark.Text; ht["Bzeren"] = this.Bzeren.Text; U_ZCBAOBU zcb1 = new U_ZCBAOBU(); DataSet ds1 = zcb1.GetZCBAOInfo(this.Bname.Text); if (ds1.Tables[0].Rows.Count <= 0) { ht.Add("Bren", this.User.Identity.Name); zcb1.InsertData(ht); string url = Request.RawUrl; Comm.ShowInfo("增加资产包成功!", url, true); } else { Util.alert(this.Page, "该包名已经存在,请重新输入!"); } }
//绑定资产调查数据 private void BindData() { if (Request["id"] != null) { string id = Request["id"]; U_ZCBAOBU zcb1 = new U_ZCBAOBU(); DataSet ds = zcb1.GetDetailByID(id, "id,depart,bzeren,bstatus,statusText,bname"); zcb1.Close(); this.Bname.Text = ds.Tables[0].Rows[0]["bname"].ToString(); this.Bid.Text = ds.Tables[0].Rows[0]["id"].ToString(); this.depart.Text = ds.Tables[0].Rows[0]["depart"].ToString(); this.bzeren.Text = ds.Tables[0].Rows[0]["bzeren"].ToString(); this.status.Text = ds.Tables[0].Rows[0]["bstatus"].ToString(); this.statusText.Text = ds.Tables[0].Rows[0]["statusText"].ToString(); if (this.statusText.Text == "") { this.statusText.Text = "阅卷"; } ds.Dispose(); this.SetButton(); } }
protected void SaveDataClick(object sender, EventArgs e) { Hashtable ht = new Hashtable(); ht["Bname"] = this.Bname.Text; ht["Bjsf"] = this.Bjsf.Text; ht["Bremark"] = this.Bremark.Text; ht["Bzeren"] = this.Bzeren.Text; ht["Bzeren1"] = this.Bzeren1.Text; U_ZCBAOBU zcb1 = new U_ZCBAOBU(); if (Request["ID"] != null && ViewState["Bname"].ToString() == this.Bname.Text) { bool first = zcb1.UpdateZcBaoInfo(Request["ID"].ToString(), ht); if (first) { Util.alert(this.Page, "恭喜您,修改资产包成功!"); } else { Util.alert(this.Page, "很遗憾,修改资产包失败!"); } } else { bool first = zcb1.UpdateZcBaoInfoTrans(Request["ID"].ToString(), ht); if (first) { Util.alert(this.Page, "恭喜您,修改资产包成功!"); ViewState["Bname"] = this.Bname.Text; } else { Util.alert(this.Page, "很遗憾,修改资产包失败!"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.MenuKind1.EditMode = false; //隐藏编辑状态才有的菜单; if (Request["zcid"] != null && Request["zcid"].Trim() != String.Empty) { U_FASPBU bu1 = new U_FASPBU(); Hashtable ht = bu1.GetInfo1(Request["zcid"]); ht["bstatus"] = "0"; ht["status"] = "04"; //设置为部门审批 this.Info1.SetControlData(ht); this.Info1.NewMode = true; this.Info2.NewMode = true; this.Info2.EditMode = false; this.MenuKind1.ZcID = Request["zcid"]; } if (String.IsNullOrEmpty(Request["zcbid"]) == false) { this.Info1.NewMode = true; this.Info2.NewMode = true; this.Info2.EditMode = false; this.MenuKind1.ZcbID = Request["zcbid"]; U_ZCBAOBU bu1 = new U_ZCBAOBU(); DataSet ds = bu1.GetDetailByID(Request["zcbid"], "*"); if (ds != null && ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; Hashtable ht2 = new Hashtable(); foreach (DataColumn col in dr.Table.Columns) { String colName = col.ColumnName.ToLower().Trim(); if (ht2.ContainsKey(colName) == false) { ht2.Add(colName, dr[colName].ToString()); } } //调整部分数据 ht2["zeren"] = ht2["bzeren"]; ht2["xmmc"] = ht2["bname"]; ht2["status"] = ht2["bstatus"]; ht2["spkind"] = "1"; ht2["bstatus"] = "0"; ht2["status"] = "04"; //设置为部门审批 //根据资产包的信息计算资产的总金额 CommTable com1 = new CommTable(); com1.TabName = "U_ZCBaoInfo"; List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("bid", Request["zcbid"], SearchFieldType.数值型)); DataSet ds0 = com1.SearchData("zcid", condition); String zcid = ""; foreach (DataRow dr1 in ds0.Tables[0].Rows) { if (zcid == String.Empty) { zcid = dr1["zcid"].ToString(); } else { zcid = zcid + "," + dr1["zcid"].ToString(); } } com1.TabName = "U_ZC"; condition.Clear(); condition.Add(new SearchField("id", zcid, SearchOperator.集合, SearchFieldType.数值型)); DataSet ds1 = com1.SearchData("sum(cast(isnull(bj,0) as numeric(18,2))),sum(cast(isnull(lx1,0) as numeric(18,2))),sum(cast(isnull(lx2,0) as numeric(18,2))),sum(cast(isnull(lx3,0) as numeric(18,2)))", condition); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow dr2 = ds1.Tables[0].Rows[0]; ht2["benjin"] = dr2[0].ToString(); ht2["zqce"] = double.Parse(dr2[0].ToString()) + double.Parse(dr2[1].ToString()) + double.Parse(dr2[2].ToString()) + double.Parse(dr2[3].ToString()); ht2["lixi"] = double.Parse(dr2[1].ToString()) + double.Parse(dr2[2].ToString()) + double.Parse(dr2[3].ToString()); } com1.Close(); //////////////////////////////////////////////////////////////////////// this.Info1.SetControlData(ht2); } } } }
private void SetPageData() { if (Request["id"] != null) { string id = Request["id"]; U_ZCBAOBU zcb1 = new U_ZCBAOBU(); DataSet ds = zcb1.GetZCBAOInfoByID(id); zcb1.Close(); //设置控件的值 bool owner = false; string user1 = ""; if (ds.Tables[0].Rows[0]["bzeren"] != DBNull.Value) { user1 = ds.Tables[0].Rows[0]["bzeren"].ToString(); } if (user1 == User.Identity.Name || (user1.Trim() == "" && Comm.IsRole("系统管理员"))) { owner = true; } else { this.Button1.Visible = false; } //设置控件数据的显示 for (int i = 1; i < ds.Tables[0].Columns.Count; i++) { string colName = ds.Tables[0].Columns[i].ColumnName.ToLower(); if (owner) { if (this.Bname.Parent.FindControl(colName) != null) { Util.SetControlValue(this.Bname.Parent.FindControl(colName), ds.Tables[0].Rows[0][colName]); } if (this.Bname.Parent.FindControl(colName + "_1") != null) { this.Bname.Parent.FindControl(colName + "_1").Visible = false;; } } else { if (this.Bname.Parent.FindControl(colName + "_1") != null) { Util.SetControlValue(this.Bname.Parent.FindControl(colName + "_1"), ds.Tables[0].Rows[0][colName]); } if (this.Bname.Parent.FindControl(colName) != null) { this.Bname.Parent.FindControl(colName).Visible = false;; } } } //设置数字金额的显示 string[] num1 = new string[] { "Bljsk", "Bljzc" }; for (int i = 0; i < num1.Length; i++) { TextBox t1 = this.Bljsk.Parent.FindControl(num1[i]) as TextBox; Label l1 = this.Bljsk.Parent.FindControl(num1[i] + "_1") as Label; if (t1 != null) { t1.Text = Comm.GetNumberFormat(t1.Text); } if (l1 != null) { l1.Text = Comm.GetNumberFormat(l1.Text); } } } }