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); }
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; }