private void ShowInfo(int _id) { BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //管理菜单 if (model.manager_role_values != null) { 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++) { Model.manager_role_value modelt = model.manager_role_values.Find(p => p.nav_name == navName && p.action_type == cblActionType.Items[n].Value); if (modelt != null) { cblActionType.Items[n].Selected = true; } } } } //管理权限 if (model.RolePemissionList != null) { hCodeStr.Value = "," + string.Join(",", model.RolePemissionList.ConvertAll(u => u.urp_code).ToArray()) + ","; rptPermission.DataSource = model.RolePemissionList; rptPermission.DataBind(); } }
private void ShowInfo(int _id) { BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //基本设置 for (int i = 0; i < rptList1.Items.Count; i++) { string navName = ((HiddenField)rptList1.Items[i].FindControl("hidName")).Value; string navValue = ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Value; if (model.manager_role_values != null) { Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue); if (modelt != null) { ((HiddenField)rptList1.Items[i].FindControl("hidId")).Value = modelt.id.ToString(); ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Checked = true; } } } //频道设置 for (int i = 0; i < rptList3.Items.Count; i++) { int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value); if (model.manager_role_values != null) { Model.manager_role_value modelt1 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.View.ToString()); if (modelt1 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value = modelt1.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbView")).Checked = true; } Model.manager_role_value modelt2 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.Add.ToString()); if (modelt2 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value = modelt2.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbAdd")).Checked = true; } Model.manager_role_value modelt3 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.Edit.ToString()); if (modelt3 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value = modelt3.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbEdit")).Checked = true; } Model.manager_role_value modelt4 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == ActionEnum.Delete.ToString()); if (modelt4 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value = modelt4.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbDelete")).Checked = true; } } } }
private string DoEdit(int _id) { BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); //管理权限 string[] codelist = hCodeStr.Value.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); List <Model.userRolePemission> ps = new List <Model.userRolePemission>(); foreach (string item in codelist) { ps.Add(new Model.userRolePemission() { urp_type = 2, urp_code = item }); } model.RolePemissionList = ps; if (model.RolePemissionList.FindAll(p => p.urp_code == "0603" || p.urp_code == "0402" || p.urp_code == "0601").Count > 1) { return("同一个角色不能同时开通区域审批权(0603)、财务部审批(0402)、总经理审批(0601)中的两个权限"); } //管理菜单 List <Model.manager_role_value> ls = new List <Model.manager_role_value>(); 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) { ls.Add(new Model.manager_role_value { role_id = _id, nav_name = navName, action_type = cblActionType.Items[n].Value }); } } } model.manager_role_values = ls; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理角色:" + model.role_name); //记录日志 return(""); } return("编辑失败"); }
private void ShowInfo(int _id) { BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //管理权限 if (model.manager_role_values != null) { 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++) { Model.manager_role_value modelt = model.manager_role_values.Find(p => p.nav_name == navName && p.action_type == cblActionType.Items[n].Value); if (modelt != null) { cblActionType.Items[n].Selected = true; } } } } }
private bool DoEdit(int _id) { bool result = false; BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); //管理权限 List <Model.manager_role_value> ls = new List <Model.manager_role_value>(); 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) { ls.Add(new Model.manager_role_value { role_id = _id, nav_name = navName, action_type = cblActionType.Items[n].Value }); } } } model.manager_role_values = ls; if (bll.Update(model)) { AddAdminLog(AXEnums.ActionEnum.Edit.ToString(), "修改管理角色:" + model.role_name); //记录日志 result = true; } return(result); }
private void ShowInfo(int _id) { BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //管理权限 if (model.manager_role_values != null) { 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++) { Model.manager_role_value modelt = model.manager_role_values.Find(p => p.nav_name == navName && p.action_type == cblActionType.Items[n].Value); if (modelt != null) { cblActionType.Items[n].Selected = true; } } } } }
private void ShowInfo(int _id) { BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //基本设置 for (int i = 0; i < rptList1.Items.Count; i++) { string navName = ((HiddenField)rptList1.Items[i].FindControl("hidName")).Value; string navValue = ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Value; if (model.manager_role_values != null) { Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue); if (modelt != null) { ((HiddenField)rptList1.Items[i].FindControl("hidId")).Value = modelt.id.ToString(); ((HtmlInputCheckBox)rptList1.Items[i].FindControl("cblNavName")).Checked = true; } } } //会员设置 for (int i = 0; i < rptList2.Items.Count; i++) { string navName = ((HiddenField)rptList2.Items[i].FindControl("hidName")).Value; string navValue = ((HtmlInputCheckBox)rptList2.Items[i].FindControl("cblNavName")).Value; if (model.manager_role_values != null) { Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue); if (modelt != null) { ((HiddenField)rptList2.Items[i].FindControl("hidId")).Value = modelt.id.ToString(); ((HtmlInputCheckBox)rptList2.Items[i].FindControl("cblNavName")).Checked = true; } } } //销售设置 for (int i = 0; i < rptList21.Items.Count; i++) { string navName = ((HiddenField)rptList21.Items[i].FindControl("hidName")).Value; string navValue = ((HtmlInputCheckBox)rptList21.Items[i].FindControl("cblNavName")).Value; if (model.manager_role_values != null) { Model.manager_role_value modelt = model.manager_role_values.Find(p => p.channel_name == navName && p.action_type == navValue); if (modelt != null) { ((HiddenField)rptList21.Items[i].FindControl("hidId")).Value = modelt.id.ToString(); ((HtmlInputCheckBox)rptList21.Items[i].FindControl("cblNavName")).Checked = true; } } } //频道设置 for (int i = 0; i < rptList3.Items.Count; i++) { int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value); if (model.manager_role_values != null) { Model.manager_role_value modelt1 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.View.ToString()); if (modelt1 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value = modelt1.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbView")).Checked = true; } Model.manager_role_value modelt2 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.Add.ToString()); if (modelt2 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value = modelt2.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbAdd")).Checked = true; } Model.manager_role_value modelt3 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.Edit.ToString()); if (modelt3 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value = modelt3.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbEdit")).Checked = true; } Model.manager_role_value modelt4 = model.manager_role_values.Find(p => p.channel_id == channelId && p.action_type == DTEnums.ActionEnum.Delete.ToString()); if (modelt4 != null) { ((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value = modelt4.id.ToString(); ((HtmlInputCheckBox)rptList3.Items[i].FindControl("cbDelete")).Checked = true; } } } }
private bool DoEdit(int _id) { bool result = true; BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); List<Model.manager_role_value> ls = new List<Model.manager_role_value>(); //基本设置 for (int i = 0; i < rptList1.Items.Count; i++) { int hidId = Convert.ToInt32(((HiddenField)rptList1.Items[i].FindControl("hidId")).Value); HiddenField hidNavName = rptList1.Items[i].FindControl("hidName") as HiddenField; HtmlInputCheckBox hcbNavValue = rptList1.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; if (hidNavName != null && hcbNavValue != null) { if (hcbNavValue.Checked == true) { ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); } } } //会员设置 for (int i = 0; i < rptList2.Items.Count; i++) { int hidId = Convert.ToInt32(((HiddenField)rptList2.Items[i].FindControl("hidId")).Value); HiddenField hidNavName = rptList2.Items[i].FindControl("hidName") as HiddenField; HtmlInputCheckBox hcbNavValue = rptList2.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; if (hidNavName != null && hcbNavValue != null) { if (hcbNavValue.Checked == true) { ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); } } } //销售设置 for (int i = 0; i < rptList21.Items.Count; i++) { int hidId = Convert.ToInt32(((HiddenField)rptList21.Items[i].FindControl("hidId")).Value); HiddenField hidNavName = rptList21.Items[i].FindControl("hidName") as HiddenField; HtmlInputCheckBox hcbNavValue = rptList21.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; if (hidNavName != null && hcbNavValue != null) { if (hcbNavValue.Checked == true) { ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); } } } //频道设置 for (int i = 0; i < rptList3.Items.Count; i++) { int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value); HtmlInputCheckBox hcbView = rptList3.Items[i].FindControl("cbView") as HtmlInputCheckBox; HtmlInputCheckBox hcbAdd = rptList3.Items[i].FindControl("cbAdd") as HtmlInputCheckBox; HtmlInputCheckBox hcbEdit = rptList3.Items[i].FindControl("cbEdit") as HtmlInputCheckBox; HtmlInputCheckBox hcbDelete = rptList3.Items[i].FindControl("cbDelete") as HtmlInputCheckBox; int hidViewId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value); int hidAddId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value); int hidEditId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value); int hidDeleteId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value); if (hcbView != null && hcbView.Checked == true) { ls.Add(new Model.manager_role_value { id = hidViewId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.View.ToString() }); } if (hcbAdd != null && hcbAdd.Checked == true) { ls.Add(new Model.manager_role_value { id = hidAddId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Add.ToString() }); } if (hcbEdit != null && hcbEdit.Checked == true) { ls.Add(new Model.manager_role_value { id = hidEditId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Edit.ToString() }); } if (hcbDelete != null && hcbDelete.Checked == true) { ls.Add(new Model.manager_role_value { id = hidDeleteId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Delete.ToString() }); } } model.manager_role_values = ls; if (!bll.Update(model)) { result = false; } return result; }
private bool DoEdit(int _id) { bool result = true; BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); model.role_value = int.Parse(txtRoleValue.Text.Trim()); List <Model.manager_role_value> ls = new List <Model.manager_role_value>(); //系统设置 for (int i = 0; i < rptList1.Items.Count; i++) { int hidId = Convert.ToInt32(((HiddenField)rptList1.Items[i].FindControl("hidId")).Value); HiddenField hidNavName = rptList1.Items[i].FindControl("hidName") as HiddenField; HtmlInputCheckBox hcbNavValue = rptList1.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; if (hidNavName != null && hcbNavValue != null) { if (hcbNavValue.Checked == true) { ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); } } } //工时设置 for (int i = 0; i < rptList2.Items.Count; i++) { HiddenField hidNavName = rptList2.Items[i].FindControl("hidName") as HiddenField; HtmlInputCheckBox hcbNavValue = rptList2.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; if (hidNavName != null && hcbNavValue != null) { if (hcbNavValue.Checked == true) { ls.Add(new Model.manager_role_value { channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); } } } //工单设置 for (int i = 0; i < rptList3.Items.Count; i++) { HiddenField hidNavName = rptList3.Items[i].FindControl("hidName") as HiddenField; HtmlInputCheckBox hcbNavValue = rptList3.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; if (hidNavName != null && hcbNavValue != null) { if (hcbNavValue.Checked == true) { ls.Add(new Model.manager_role_value { channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); } } } //客户设置 for (int i = 0; i < rptList4.Items.Count; i++) { HiddenField hidNavName = rptList4.Items[i].FindControl("hidName") as HiddenField; HtmlInputCheckBox hcbNavValue = rptList4.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; if (hidNavName != null && hcbNavValue != null) { if (hcbNavValue.Checked == true) { ls.Add(new Model.manager_role_value { channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); } } } ////会员设置 //for (int i = 0; i < rptList2.Items.Count; i++) //{ // int hidId = Convert.ToInt32(((HiddenField)rptList2.Items[i].FindControl("hidId")).Value); // HiddenField hidNavName = rptList2.Items[i].FindControl("hidName") as HiddenField; // HtmlInputCheckBox hcbNavValue = rptList2.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; // if (hidNavName != null && hcbNavValue != null) // { // if (hcbNavValue.Checked == true) // { // ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); // } // } //} ////销售设置 //for (int i = 0; i < rptList21.Items.Count; i++) //{ // int hidId = Convert.ToInt32(((HiddenField)rptList21.Items[i].FindControl("hidId")).Value); // HiddenField hidNavName = rptList21.Items[i].FindControl("hidName") as HiddenField; // HtmlInputCheckBox hcbNavValue = rptList21.Items[i].FindControl("cblNavName") as HtmlInputCheckBox; // if (hidNavName != null && hcbNavValue != null) // { // if (hcbNavValue.Checked == true) // { // ls.Add(new Model.manager_role_value { id = hidId, role_id = _id, channel_id = 0, channel_name = hidNavName.Value, action_type = hcbNavValue.Value }); // } // } //} ////频道设置 //for (int i = 0; i < rptList3.Items.Count; i++) //{ // int channelId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidChannelId")).Value); // HtmlInputCheckBox hcbView = rptList3.Items[i].FindControl("cbView") as HtmlInputCheckBox; // HtmlInputCheckBox hcbAdd = rptList3.Items[i].FindControl("cbAdd") as HtmlInputCheckBox; // HtmlInputCheckBox hcbEdit = rptList3.Items[i].FindControl("cbEdit") as HtmlInputCheckBox; // HtmlInputCheckBox hcbDelete = rptList3.Items[i].FindControl("cbDelete") as HtmlInputCheckBox; // int hidViewId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidViewId")).Value); // int hidAddId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidAddId")).Value); // int hidEditId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidEditId")).Value); // int hidDeleteId = Convert.ToInt32(((HiddenField)rptList3.Items[i].FindControl("hidDeleteId")).Value); // if (hcbView != null && hcbView.Checked == true) // { // ls.Add(new Model.manager_role_value { id = hidViewId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.View.ToString() }); // } // if (hcbAdd != null && hcbAdd.Checked == true) // { // ls.Add(new Model.manager_role_value { id = hidAddId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Add.ToString() }); // } // if (hcbEdit != null && hcbEdit.Checked == true) // { // ls.Add(new Model.manager_role_value { id = hidEditId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Edit.ToString() }); // } // if (hcbDelete != null && hcbDelete.Checked == true) // { // ls.Add(new Model.manager_role_value { id = hidDeleteId, role_id = _id, channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Delete.ToString() }); // } //} model.manager_role_values = ls; if (!bll.Update(model)) { result = false; } return(result); }
private bool DoEdit(int _id) { bool result = false; BLL.manager_role bll = new BLL.manager_role(); Model.manager_role model = bll.GetModel(_id); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); //管理权限 List<Model.manager_role_value> ls = new List<Model.manager_role_value>(); 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) { ls.Add(new Model.manager_role_value { role_id = _id, nav_name = navName, action_type = cblActionType.Items[n].Value }); } } } model.manager_role_values = ls; if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理角色:" + model.role_name); //记录日志 result = true; } return result; }