private string DoAdd() { Model.manager_role model = new Model.manager_role(); BLL.manager_role bll = new BLL.manager_role(); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); //管理权限 if (!string.IsNullOrEmpty(hCodeStr.Value)) { 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 { nav_name = navName, action_type = cblActionType.Items[n].Value }); } } } model.manager_role_values = ls; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理角色:" + model.role_name); //记录日志 return(""); } return("添加失败"); }
private bool DoAdd() { Model.manager adminEntity = GetAdminInfo(); bool result = false; Model.manager_role model = new Model.manager_role(); model.agentId = adminEntity.id; model.role_name = txtRoleName.Text.Trim(); //model.role_type = int.Parse(ddlRoleType.SelectedValue); model.role_type = 2; //管理权限 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 { nav_name = navName, action_type = cblActionType.Items[n].Value }); } } } model.manager_role_values = ls; if (rBll.Add(model) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加角色:" + model.role_name); //记录日志 result = true; } return(result); }
private bool DoAdd() { bool result = true; Model.manager_role model = new Model.manager_role(); BLL.manager_role bll = new BLL.manager_role(); 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++) { 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 { 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 < rptList21.Items.Count; i++) { 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 { 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; if (hcbView != null && hcbView.Checked == true) { ls.Add(new Model.manager_role_value { 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 { 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 { 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 { channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Delete.ToString() }); } } model.manager_role_values = ls; if (bll.Add(model) < 1) { result = false; } return result; }
private bool DoAdd() { bool result = true; Model.manager_role model = new Model.manager_role(); BLL.manager_role bll = new BLL.manager_role(); 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++) { 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 { 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++) //{ // 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 < rptList21.Items.Count; i++) //{ // 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 { 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; // if (hcbView != null && hcbView.Checked == true) // { // ls.Add(new Model.manager_role_value { 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 { 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 { 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 { channel_id = channelId, channel_name = "channel", action_type = DTEnums.ActionEnum.Delete.ToString() }); // } //} model.manager_role_values = ls; if (bll.Add(model) < 1) { result = false; } return(result); }
private bool DoAdd() { bool result = false; Model.manager_role model = new Model.manager_role(); BLL.manager_role bll = new BLL.manager_role(); 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 { nav_name = navName, action_type = cblActionType.Items[n].Value }); } } } model.manager_role_values = ls; if (bll.Add(model) > 0) { AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理角色:" + model.role_name); //记录日志 result = true; } return result; }