protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int intAdminId = HelperUtility.hasPurviewPage("HOME"); ModelAdmin model = BllAdmin.getById(intAdminId); lblAdminName.Text = model.real_name; } }
protected void gvShow_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#e1f2e9'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); // 将销售公司id转换成名称,将adminid转换成管理员姓名,显示缩略图 Label lblAdminId = (Label)e.Row.FindControl("lblAdminId"); int intAdminId = Convert.ToInt32(lblAdminId.Text); lblAdminId.Text = (BllAdmin.getById(intAdminId)).real_name; } }
protected void gvShow_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#e1f2e9'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); Label lblAdminInfo = ((Label)e.Row.FindControl("lblAdminId")); int intAdminId = Convert.ToInt32(lblAdminInfo.Text); ModelAdmin admin = BllAdmin.getById(intAdminId); lblAdminInfo.Text = admin.real_name; } }
protected void gvShow_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#e1f2e9'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); Label lblAdminId = (Label)e.Row.FindControl("lblAdminId"); int intAdminId = Convert.ToInt32(lblAdminId.Text); lblAdminId.Text = (BllAdmin.getById(intAdminId)).real_name; Label lblId = (Label)e.Row.FindControl("lblId"); HyperLink hlShow = (HyperLink)e.Row.FindControl("hlShow"); hlShow.NavigateUrl = "show.aspx?id=" + lblId.Text; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HelperUtility.hasPurviewPage("SysAdmin_update"); // 本页只能从list.aspx的编辑页转过来 // 因此要得到要修改的id值和页面的page值用于修改成功后返回 int intId = HelperUtility.getQueryInt("id"); ViewState["id"] = intId; int intPage = HelperUtility.getQueryInt("page"); ViewState["page"] = intPage; // 更新表单数据 ModelAdmin model = BllAdmin.getById(intId); tbUsername.Value = model.username; tbRealName.Value = model.real_name; tbMobilePhone.Value = model.mobile_phone; setPurviewCheckBox(model.purviews); } }
protected void btnEdit_Click(object sender, EventArgs e) { if (!HelperUtility.hasPurviewOP("SysAdmin_update")) { string strUrl = "edit.aspx?id=" + ViewState["id"] + "&page=" + ViewState["page"]; HelperUtility.showAlert("没有操作权限", strUrl); } int intId = Convert.ToInt32(ViewState["id"]); int intPage = Convert.ToInt32(ViewState["page"]); string strMsgError = ""; string strPassword = tbPassword.Value.ToString(); if (!"".Equals(strPassword)) { if (strPassword.Length < 4 || strPassword.Length > 12) { strMsgError += "密码长度必须在4 ~ 12之间!\n"; } string strPassword2 = tbPassword2.Value.ToString(); if ("".Equals(strPassword2)) { strMsgError += "确认密码不能为空!\n"; } if (!strPassword.Equals(strPassword2)) { strMsgError += "两次输入的密码必须相同!\n"; } strPassword = HelperCrypto.encode(strPassword, "DES"); } string strRealName = tbRealName.Value.ToString().Trim(); if (strRealName.Length > 6) { strMsgError += "真实姓名长度不能大于6个字符!\n"; } string strMobilePhone = tbMobilePhone.Value.ToString().Trim(); if (!HelperUtility.isMobilePhone(strMobilePhone)) { strMsgError += "手机号码格式不正确!\n"; } if (!"".Equals(strMsgError)) { HelperUtility.showAlert(strMsgError, "edit.aspx?id=" + intId + "&page=" + intPage); } // 开始更新 ModelAdmin model = BllAdmin.getById(intId); if (!"".Equals(strPassword)) { model.password = strPassword; } model.real_name = strRealName; model.mobile_phone = strMobilePhone; if (!(model.username == "rush" || model.username == "wumin")) { model.purviews = getSelectedCheckBox(); } BllAdmin.update(model); Response.Redirect("/BackManager/admin/list.aspx?page=" + intPage); }