protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { Label lab1 = e.Row.FindControl("bname") as Label; if (lab1 != null) { if (lab1.Text == "合计") { Label lab2 = e.Row.FindControl("Liulan") as Label; if (lab2 != null) { lab2.Text = ""; } } } LinkButton link1 = e.Row.FindControl("dellinBtn") as LinkButton; if (link1 != null) { if (PubComm.IsRole("系统管理员") == false || (lab1 != null && lab1.Text == "合计")) { link1.Visible = false; } } }
//控制链接的显示 protected void Repeater_DataBound(object sernder, RepeaterItemEventArgs e) { if (e.Item.FindControl("butDel") != null) { LinkButton but1 = e.Item.FindControl("butDel") as LinkButton; LinkButton but2 = e.Item.FindControl("butEdit") as LinkButton; Label lab1 = e.Item.FindControl("status") as Label; if (this.owner == false) { but1.Visible = false; but2.Visible = false; } if (PubComm.IsRole(User.Identity.Name, "系统管理员")) { but1.Visible = true; } else { but1.Visible = false; } string user1 = this.zeren.Text; if ((PubComm.IsRole(User.Identity.Name, "系统管理员") || user1 == User.Identity.Name) && lab1.Text == "") { but2.Visible = true; } else { but2.Visible = false; } } }
//控制-资产处置中按钮的权限 protected void Repeater6_ItemDataBound(object sender, RepeaterItemEventArgs e) { int status1 = 0; if (this.status.Text != "") { status1 = Int32.Parse(this.status.Text); } bool zcstatus = false; if (status1 == (int)SP.开始审批) { zcstatus = true; } string[] ArrCon = new string[] { "AddZcczfs", "butDel", "butEdit" }; for (int i = 0; i < ArrCon.Length; i++) { if (e.Item.FindControl(ArrCon[i]) != null) { e.Item.FindControl(ArrCon[i]).Visible = (this.owner && zcstatus); } } if (PubComm.IsRole("系统管理员")) { for (int i = 0; i < ArrCon.Length; i++) { if (e.Item.FindControl(ArrCon[i]) != null) { e.Item.FindControl(ArrCon[i]).Visible = true; } } } }
//设置按钮的显示权限 private void SetButton() { if (owner) { string status = this.status.Text; if (status == "") { status = "00"; } int Max1 = Int32.Parse(status) + 1; string[] arr1 = new string[] { "01", "02", "03", "04" }; for (int i = 0; i < arr1.Length; i++) { HtmlGenericControl but1 = this.Button01.Parent.FindControl("but" + arr1[i]) as HtmlGenericControl; if (int.Parse(arr1[i]) <= Max1) { but1.Visible = true; } else { but1.Visible = true; } } } if (PubComm.IsRole("系统管理员")) { this.Button5.Visible = true; } else { this.Button5.Visible = false; } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.FindControl("dellinBtn") != null) { LinkButton link1 = (LinkButton)e.Row.FindControl("dellinBtn"); if (PubComm.IsRole("会计") == false) { link1.Visible = false; } } }
//资产审批的删除和批阅 protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.Item.FindControl("seldoc") != null) { string id = (e.Item.FindControl("seldoc") as Label).Text.Trim(); if (e.CommandName == "delete") { U_ZCSPBU sp1 = new U_ZCSPBU(); sp1.DelSp(id); this.BindSP(sp1); sp1.Close(); } else { Context.Items["zcid"] = Request.QueryString["id"]; Context.Items["id"] = id; Context.Items["kind"] = (e.Item.FindControl("kind") as Label).Text.Trim(); Context.Items["czid"] = this.zcczid.Text; //检测【审核委员会主席】和【决策委员会主席】能否审批 U_ZCSPBU sp2 = new U_ZCSPBU(); int nospcount = sp2.GetNoEndSPCount(Request.QueryString["id"]); sp2.Close(); bool check1 = false; string rolename = ""; if (this.status.Text == (int)SP.审核委员会审批 + "") { rolename = "审核委员会主席"; } if (this.status.Text == (int)SP.决策委员会审批 + "") { rolename = "决策委员会主席"; } if (rolename != "") { check1 = PubComm.IsRole(rolename); } if (check1 && nospcount > 1) { Util.alert(this.Page, "抱歉,您是【" + rolename + "】,请等其他委员审批结束后,才能审批"); } else { if (check1) { Context.Items["zhuxi"] = "1"; } Server.Transfer("PiYue" + (e.Item.FindControl("kind") as Label).Text.Trim() + ".aspx?bkind=0", false); } } } }
protected void Page_Load(object sender, EventArgs e) { this.isOwner = PubComm.IsRole("系统管理员"); if (!Page.IsPostBack) { this.BindData(); if (isOwner == false) { this.Tab1.Visible = false; } } }
protected void Repeater2_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.FindControl("butDel") != null) { LinkButton link1 = e.Item.FindControl("butDel") as LinkButton; if (PubComm.IsRole(User.Identity.Name, "系统管理员")) { link1.Visible = true; } else { link1.Visible = false; } } }
//设置页面信息 private void BindData() { if (Request["id"] != null) { string zcid = Request["id"].ToString(); U_ZCBU zc1 = new U_ZCBU(); DataSet ds = zc1.GetZCSSInfo(zcid); string user1 = zc1.GetZerenByZCID(zcid); zc1.Close(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < arr1.Length; i++) { Util.SetControlValue(this.sszt.Parent.FindControl(arr1[i]), ds.Tables[0].Rows[0][arr1[i]]); Util.SetControlValue(this.sszt.Parent.FindControl(arr1[i] + "_1"), ds.Tables[0].Rows[0][arr1[i]]); } } ds.Dispose(); //设置按钮的权限 if (user1 == User.Identity.Name || (user1.Trim() == "" && PubComm.IsRole("系统管理员"))) { this.Button1.Visible = true; for (int i = 0; i < arr1.Length; i++) { if (this.sszl.Parent.FindControl(arr1[i] + "_1") != null) { this.sszl.Parent.FindControl(arr1[i] + "_1").Visible = false; } } } else { this.Button1.Visible = false; for (int i = 0; i < arr1.Length; i++) { if (this.sszl.Parent.FindControl(arr1[i]) != null) { this.sszl.Parent.FindControl(arr1[i]).Visible = false; } } } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Page.DataBind(); this.BindList(); if (PubComm.IsRole("系统管理员")) { this.Button2.Visible = true; } else { this.Button2.Visible = false; } } }
//设置按钮的权限控制 private void SetButton() { string status = this.status.Text; if (status != "") { int status1 = Int32.Parse(status); //if (owner && (status1 >= 16 || status1 == 14)) //{ // this.MyButtonGroup.Visible = true; //} //else //{ // this.MyButtonGroup.Visible = false; //} if (owner || PubComm.IsRole("系统管理员")) { this.MyButtonGroup.Visible = true; } else { this.MyButtonGroup.Visible = false; } } if (owner) { this.Button1.Visible = true; } else { this.Button1.Visible = false; } if (PubComm.IsRole("系统管理员")) { this.Button5.Visible = true; } else { this.Button5.Visible = false; } }
//设置按钮的权限 private void SetButton() { //设置送部门审批的按钮权限 int status1 = 0; if (this.status.Text != "") { status1 = Int32.Parse(this.status.Text); } if (status1 == (int)(SP.开始审批) && this.owner) { this.butSendToDepartLeader.Visible = true; this.butSaveData.Visible = true; //保存按钮的权限控制 } else { this.butSendToDepartLeader.Visible = false; this.butSaveData.Visible = false; //保存按钮的权限控制 } if ((status1 == (int)(SP.决策委员会同意) || status1 == (int)(SP.审核委员会同意)) && this.owner) { this.butNewData.Visible = true; } else { this.butNewData.Visible = false; } if (PubComm.IsRole("系统管理员") || User.Identity.Name == this.zeren.Text) { this.Button1.Visible = true; this.Button3.Visible = true; this.butSaveData.Visible = true; } else { this.Button1.Visible = false; this.Button3.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { zcMng = PubComm.IsZcMng(Request["id"], User.Identity.Name); //得到权限 if (!Page.IsPostBack) { this.BindData(); //控制时效的增加权限 if (this.zcMng == false) { this.butAdd.Visible = false; } if (PubComm.IsRole("系统管理员")) { this.Button2.Visible = true; } else { this.Button2.Visible = false; } } }
private void BindData() { if (Request["id"] != null) { string id = Request["id"]; U_ZCBU zc1 = new U_ZCBU(); string fs = "danwei,depart,zeren,bj,lx,pbj,plx,fee1,fee2,fee3,fee4,fee5,fee6,fee7,fee8,fee9,fee10,fee11,fee12,bjye,lxye,hbxh,bxhjye,fyhj"; DataSet ds = zc1.GetDetailByID(id, "danwei,depart,zeren,bj,pbj,plx,fee1,fee2,fee3,fee4,fee5,fee6,fee7,fee8,fee9,fee10,fee11,fee12,isnull(bj,0)-isnull(pbj,0) as bjye ,isnull(lx1,0)+isnull(lx2,0)+isnull(lx3,0)-plx as lxye,isnull(pbj,0)+isnull(plx,0) as hbxh,isnull(bj,0)+isnull(lx1,0)+isnull(lx2,0)+isnull(lx3,0)-isnull(pbj,0)-isnull(plx,0) as bxhjye,isnull(fee1,0)+isnull(fee2,0)+isnull(fee3,0)+isnull(fee4,0)+isnull(fee5,0)+isnull(fee6,0)+isnull(fee7,0)+isnull(fee8,0)+isnull(fee9,0)+isnull(fee10,0)+isnull(fee11,0)+isnull(fee12,0)+isnull(fee13,0)+isnull(fee14,0)+isnull(fee15,0)+isnull(fee16,0)+isnull(fee17,0)+isnull(fee18,0)+isnull(fee19,0)+isnull(fee20,0) as fyhj,isnull(lx1,0)+isnull(lx2,0)+isnull(lx3,0) as lx"); zc1.Close(); string[] AF = fs.Split(','); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < AF.Length; i++) { Util.SetControlValue(this.pbj.Parent.FindControl(AF[i]), ds.Tables[0].Rows[0][AF[i]]); } } //设置数字金额的显示 string[] num1 = new string[] { "pbj", "plx", "fee1", "fee2", "fee3", "fee4", "fee5", "fee6", "fee7", "fee8", "fee9", "fee10", "fee11", "fee12", "bjye", "lxye", "hbxh", "bxhjye", "fyhj" }; for (int i = 0; i < num1.Length; i++) { Label l1 = this.pbj.Parent.FindControl(num1[i]) as Label; if (l1 != null) { l1.Text = PubComm.GetNumberFormat(l1.Text); } } ds.Dispose(); if (PubComm.IsRole("系统管理员")) { this.Button2.Visible = true; } else { this.Button2.Visible = false; } } }
//设置页面控件的值 private void SetPageData1() { string id = Request["id"]; U_ZCBU zc1 = new U_ZCBU(); DataSet ds = zc1.GetDetailByID(id); zc1.Close(); if (ds.Tables[0].Rows.Count > 0) { //设置管理员字段 //for (int i = 0; i < arr1.Length; i++) //{ // Util.SetControlValue(this.zcbao.Parent.FindControl(arr1[i]), ds.Tables[0].Rows[0][arr1[i]]); // if (this.zcbao.Parent.FindControl(arr1[i] + "_1") != null) // { // //设置对应的标签提示信息 // Util.SetControlValue(this.zcbao.Parent.FindControl(arr1[i] + "_1"), ds.Tables[0].Rows[0][arr1[i]]); // } //} if (ds.Tables[0].Rows[0]["time0"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["time0"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("time0"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("time0_1"), dt); } if (ds.Tables[0].Rows[0]["status"] != DBNull.Value) { string st = ds.Tables[0].Rows[0]["statusText"].ToString(); Util.SetControlValue(this.zcbao.Parent.FindControl("status"), st); Util.SetControlValue(this.zcbao.Parent.FindControl("status_1"), st); } if (ds.Tables[0].Rows[0]["clsj"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["clsj"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("clsj"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("clsj_1"), dt); } if (ds.Tables[0].Rows[0]["xdri"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["xdri"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("xdri"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("xdri_1"), dt); } if (ds.Tables[0].Rows[0]["dkffrq1"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["dkffrq1"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("dkffrq1"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("dkffrq1_1"), dt); } if (ds.Tables[0].Rows[0]["xcyqrq"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["xcyqrq"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("xcyqrq"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("xcyqrq_1"), dt); } if (ds.Tables[0].Rows[0]["jrblsj"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["jrblsj"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("jrblsj"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("jrblsj_1"), dt); } } ds.Dispose(); this.bj.Text = PubComm.GetNumberFormat(this.bj.Text); //设置按钮的权限 string user1 = this.zeren.Text; if (user1 == User.Identity.Name || (user1.Trim() == "" && PubComm.IsRole("系统管理员"))) { this.but0.Visible = true; } else { this.but0.Visible = false; } //设置控件数据的显示 if (user1 == User.Identity.Name || (user1.Trim() == "" && PubComm.IsRole("系统管理员"))) { //for (int i = 0; i < arr1.Length; i++) //{ // if (this.zcbao.Parent.FindControl(arr1[i] + "_1") != null) // { // //设置对应的标签提示信息 // this.zcbao.Parent.FindControl(arr1[i] + "_1").Visible = false; // } //} //for (int i = 0; i < arr2.Length; i++) //{ // if (this.zcbao.Parent.FindControl(arr2[i] + "_1") != null) // { // //设置对应的标签提示信息 // this.zcbao.Parent.FindControl(arr2[i] + "_1").Visible = false; // } //} } else { //for (int i = 0; i < arr1.Length; i++) //{ // if (this.zcbao.Parent.FindControl(arr1[i]) != null) // { // //设置对应的标签提示信息 // this.zcbao.Parent.FindControl(arr1[i]).Visible = false; // } //} //for (int i = 0; i < arr2.Length; i++) //{ // if (this.zcbao.Parent.FindControl(arr2[i]) != null) // { // //设置对应的标签提示信息 // this.zcbao.Parent.FindControl(arr2[i]).Visible = false; // } //} } if (PubComm.IsRole("公司领导") || PubComm.IsRole("评审部角色")) { this.zcbao.Parent.FindControl("zhuang_1").Visible = true; } else { this.zcbao.Parent.FindControl("zhuang_1").Visible = false; } }
//绑定当前资产-处置申报情况(包括处置方式) private void BindData() { if (Request["id"] != null) { string id = Request["id"]; U_ZCBU zc1 = new U_ZCBU(); ////////////////////////////////////////// Hashtable ht = zc1.GetCurrentZcCZbyID(id); if (ht.Count > 0) { this.danwei.Text = ht["danwei"].ToString(); if (ht["depart"] != null) { this.depart.Text = ht["depart"].ToString(); } if (ht["zeren"] != null) { this.zeren.Text = ht["zeren"].ToString(); } if (ht["zcstatus"] != null) { this.status.Text = ht["zcstatus"].ToString(); } if (ht["statustext"] != null) { this.statusText.Text = ht["statustext"].ToString(); } if (this.statusText.Text == "") { this.statusText.Text = "阅卷"; } if (ht["xmsbh"] != null) { this.xmsbh.Text = ht["xmsbh"].ToString(); } //根据权限显示信息 int status1 = 0; if (this.status.Text != "") { status1 = Int32.Parse(this.status.Text); } string[] arr1 = new string[] { "zclx", "zcse", "xmbj", "fsxzly", "djyj", "zcczid" }; for (int i = 0; i < arr1.Length; i++) { if (ht[arr1[i]] != null) { Util.SetControlValue(this.zclx.Parent.FindControl(arr1[i]), ht[arr1[i]].ToString()); Util.SetControlValue(this.zclx.Parent.FindControl(arr1[i] + "_1"), Util.ChangeToShow(ht[arr1[i]].ToString())); } if (this.owner && status1 == (int)SP.开始审批) { this.zclx.Parent.FindControl(arr1[i] + "_1").Visible = false; } else { this.zclx.Parent.FindControl(arr1[i]).Visible = false; } if (PubComm.IsRole("系统管理员")) { this.zclx.Parent.FindControl(arr1[i]).Visible = true; this.zclx.Parent.FindControl(arr1[i] + "_1").Visible = false; } } //////////////////////////////////////////// this.zclx.Parent.FindControl("zcczid").Visible = true; this.BindZCCZDetail(zc1); } zc1.Close(); this.SetButton(); //设置按钮的权限 } }
//设置页面控制的值及显示格式等 private void SetPageData() { string id = Request["id"]; U_ZCBU zc1 = new U_ZCBU(); DataSet ds = zc1.GetDetailByID(id); zc1.Close(); //设置控件的值 bool owner = false; string user1 = ""; if (ds.Tables[0].Rows[0]["zeren"] != DBNull.Value) { user1 = ds.Tables[0].Rows[0]["zeren"].ToString(); } if (user1 == User.Identity.Name || (user1.Trim() == "" && PubComm.IsRole("系统管理员"))) { owner = true; } else { this.but0.Visible = false; } if (PubComm.IsRole("系统管理员")) { this.Button1.Visible = true; this.Button2.Visible = true; this.Button3.Visible = true; } else { this.Button1.Visible = false; this.Button2.Visible = false; this.Button3.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.zcbao.Parent.FindControl(colName) != null) { Util.SetControlValue(this.zcbao.Parent.FindControl(colName), ds.Tables[0].Rows[0][colName]); } if (this.zcbao.Parent.FindControl(colName + "_1") != null) { this.zcbao.Parent.FindControl(colName + "_1").Visible = false;; } } else { if (this.zcbao.Parent.FindControl(colName + "_1") != null) { Util.SetControlValue(this.zcbao.Parent.FindControl(colName + "_1"), ds.Tables[0].Rows[0][colName]); } if (this.zcbao.Parent.FindControl(colName) != null) { this.zcbao.Parent.FindControl(colName).Visible = false;; } } this.status.Text = ds.Tables[0].Rows[0]["statustext"].ToString(); this.status_1.Text = ds.Tables[0].Rows[0]["statustext"].ToString(); if (ds.Tables[0].Rows[0]["time0"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["time0"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("time0"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("time0_1"), dt); } if (ds.Tables[0].Rows[0]["status"] != DBNull.Value) { string st = ds.Tables[0].Rows[0]["statusText"].ToString(); Util.SetControlValue(this.zcbao.Parent.FindControl("status"), st); Util.SetControlValue(this.zcbao.Parent.FindControl("status_1"), st); } if (ds.Tables[0].Rows[0]["clsj"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["clsj"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("clsj"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("clsj_1"), dt); } if (ds.Tables[0].Rows[0]["xdri"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["xdri"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("xdri"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("xdri_1"), dt); } if (ds.Tables[0].Rows[0]["dkffrq1"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["dkffrq1"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("dkffrq1"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("dkffrq1_1"), dt); } if (ds.Tables[0].Rows[0]["xcyqrq"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["xcyqrq"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("xcyqrq"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("xcyqrq_1"), dt); } if (ds.Tables[0].Rows[0]["jrblsj"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["jrblsj"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.zcbao.Parent.FindControl("jrblsj"), dt); Util.SetControlValue(this.zcbao.Parent.FindControl("jrblsj_1"), dt); } } //设置转入价的显示 if (PubComm.IsRole("公司领导") || PubComm.IsRole("评审部角色")) { this.zcbao.Parent.FindControl("zhuang_1").Visible = true; } else { this.zcbao.Parent.FindControl("zhuang_1").Visible = false; } //设置数字金额的显示 string[] num1 = new string[] { "bj", "lx1", "lx2", "lx3", "zczb", "dkye", "zjycszje" }; for (int i = 0; i < num1.Length; i++) { TextBox t1 = this.bj.Parent.FindControl(num1[i]) as TextBox; Label l1 = this.bj.Parent.FindControl(num1[i] + "_1") as Label; if (t1 != null) { t1.Text = PubComm.GetNumberFormat(t1.Text); } if (l1 != null) { l1.Text = PubComm.GetNumberFormat(l1.Text); } } }
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() == "" && PubComm.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 = PubComm.GetNumberFormat(t1.Text); } if (l1 != null) { l1.Text = PubComm.GetNumberFormat(l1.Text); } } } }
private void BindData() { if (Request["id"] != null) { string zcid = Request["id"].ToString(); U_ZCBU zc1 = new U_ZCBU(); DataSet ds = zc1.GetZCDBInfoByID(zcid); string user1 = zc1.GetZerenByZCID(zcid); zc1.Close(); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < arr1.Length; i++) { Util.SetControlValue(this.bzyx.Parent.FindControl(arr1[i]), ds.Tables[0].Rows[0][arr1[i]]); Util.SetControlValue(this.bzyx.Parent.FindControl(arr1[i] + "_1"), ds.Tables[0].Rows[0][arr1[i]]); } if (ds.Tables[0].Rows[0]["hssj"] != DBNull.Value) { string dt = DateTime.Parse(ds.Tables[0].Rows[0]["hssj"].ToString()).ToString("yyyy-MM-dd"); Util.SetControlValue(this.bzyx.Parent.FindControl("hssj"), dt); Util.SetControlValue(this.bzyx.Parent.FindControl("hssj_1"), dt); } } ds.Dispose(); //设置按钮的权限 if (user1 == User.Identity.Name || (user1.Trim() == "" && PubComm.IsRole("系统管理员"))) { this.Button1.Visible = true; this.Adddyw.Visible = true; this.Addzyw.Visible = true; for (int i = 0; i < arr1.Length; i++) { if (this.bzyx.Parent.FindControl(arr1[i] + "_1") != null) { this.bzyx.Parent.FindControl(arr1[i] + "_1").Visible = false; } } } else { this.Button1.Visible = false; this.Adddyw.Visible = false; this.Addzyw.Visible = false; for (int i = 0; i < arr1.Length; i++) { if (this.bzyx.Parent.FindControl(arr1[i]) != null) { this.bzyx.Parent.FindControl(arr1[i]).Visible = false; } } } if (PubComm.IsRole("系统管理员")) { this.Button2.Visible = true; } else { this.Button2.Visible = false; } //设置数字金额的显示 string[] num1 = new string[] { "zwrhsgz", "bzrhsgz", "qthsgz", "bzje", "klazfy", "dyhsgz1", "dyhsgz2" }; for (int i = 0; i < num1.Length; i++) { TextBox t1 = this.zwrhsgz.Parent.FindControl(num1[i]) as TextBox; Label l1 = this.zwrhsgz.Parent.FindControl(num1[i] + "_1") as Label; if (t1 != null) { t1.Text = PubComm.GetNumberFormat(t1.Text); } if (l1 != null) { l1.Text = PubComm.GetNumberFormat(l1.Text); } } } }