private void ShowInfo(int _id) { Cms.BLL.C_admin_role bll = new Cms.BLL.C_admin_role(); Cms.Model.C_admin_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //管理权限 for (int i = 0; i < rptList.Items.Count; i++) { string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value; // CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox1"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox2"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox3"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox4"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox5"); // for (int n = 0; n < cblActionType.Items.Count; n++) { Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); DataSet ds = bllrole_value.GetList("nav_name='" + navName + "' and role_id=" + _id); if (ds != null && ds.Tables[0].Rows.Count > 0) { string[] actionTypeArr = ds.Tables[0].Rows[0]["action_type"].ToString().Split(','); for (int j = 0; j < actionTypeArr.Length; j++) { if (j == 0) { checkbox1.Checked = true; } if (j == 1) { checkbox2.Checked = true; } if (j == 2) { checkbox3.Checked = true; } if (j == 3) { checkbox4.Checked = true; } if (j == 4) { checkbox5.Checked = true; } } //cblActionType.Items[n].Selected = true; } } } }
protected void btnDelete_Click(object sender, EventArgs e) { string strparentId = this.Request.QueryString["parentId"] ?? "";//上级栏目ID foreach (RepeaterItem item in rptList.Items) { //获取选择框 CheckBox check = item.FindControl("Check_Select") as CheckBox; if (check.Checked) { HiddenField field = item.FindControl("Fielddocid") as HiddenField; int id = int.Parse(field.Value); //删除文档的同时删除静态文档 blladmin_role.Delete(id); adminUser.AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), blladmin_role.GetModel(id).role_name); //记录日志 } } JscriptMsg("删除信息成功!", "role_list.aspx", "Success"); }
private bool DoEdit(int _id) { bool result = false; Cms.BLL.C_admin_role bll = new Cms.BLL.C_admin_role(); Cms.Model.C_admin_role model = bll.GetModel(_id); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); //管理权限 Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); Cms.Model.C_admin_role_value modelrole_value = new Cms.Model.C_admin_role_value(); bllrole_value.DeleteList("role_id=" + _id); for (int i = 0; i < rptList.Items.Count; i++) { string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value; //CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType"); //for (int n = 0; n < cblActionType.Items.Count; n++) //{ // if (cblActionType.Items[n].Selected == true) // { // modelrole_value.role_id = _id; // modelrole_value.nav_name = navName; // modelrole_value.action_type = cblActionType.Items[n].Value; // bllrole_value.Add(modelrole_value); // } //} System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox1"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox2"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox3"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox4"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox5"); string[] actionTypeArr = ((HiddenField)rptList.Items[i].FindControl("hidActionType")).Value.Split(','); string str = ""; if (checkbox1.Checked == true) { str += actionTypeArr[0] + ","; } if (checkbox2.Checked == true) { str += actionTypeArr[1] + ","; } if (checkbox3.Checked == true) { str += actionTypeArr[2] + ","; } if (checkbox4.Checked == true) { str += actionTypeArr[3] + ","; } if (checkbox5.Checked == true) { str += actionTypeArr[4] + ","; } if (str.Length > 0) { str = str.Substring(0, str.Length - 1); modelrole_value.role_id = _id; modelrole_value.nav_name = navName; modelrole_value.action_type = str; bllrole_value.Add(modelrole_value); } } if (bll.Update(model)) { adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.role_name); //记录日志 result = true; } return(result); }