protected void Page_Load(object sender, EventArgs e) { if (function.isAjax()) { string action = Request.Form["action"]; string result = ""; switch (action) { case "modelname": result = SeeModelName(); break; default: break; } Response.Write(result); Response.Flush(); Response.End(); return; } if (!IsPostBack) { ModelList_DP.DataSource = pubBll.Sel(); ModelList_DP.DataBind(); string bread = "<li class='active'>{0}</li>"; //------------------------------------------------------------- if (Mid > 0) { M_Pub pubMod = pubBll.SelReturnModel(Mid); M_AdminInfo adminMod = B_Admin.GetLogin(); string prowinfo = B_Role.GetPowerInfoByIDs(adminMod.RoleList); if (!adminMod.IsSuperAdmin() && !prowinfo.Contains("," + pubMod.PubTableName + ",")) { function.WriteErrMsg("无权限管理该互动模型!!"); } ModelList_DP.SelectedValue = pubMod.PubTableName; PubTableName.Enabled = false; PubLogin.Checked = pubMod.PubLogin == 1; PubLoginUrls.Visible = PubLogin.Checked; PubLoginUrl.Text = pubMod.PubLoginUrl; bread = string.Format(bread, "修改[" + pubMod.PubName + "]"); #region Menu操作 switch (Menu) { case "edit": { PubType.Enabled = false; Lbtitle.Text = "修改模块信息"; PubName.Text = pubMod.PubName; PubClass.SelectedValue = pubMod.PubClass.ToString(); PubType.SelectedValue = pubMod.PubType.ToString(); if (pubMod.PubOneOrMore == 2) { PubOneOrMore.SelectedValue = "2"; PubOneOrMorenum.Visible = true; PubOneOrMorenum.Text = pubMod.PubOneOrMore.ToString(); } else { PubIPOneOrMorenum.Visible = false; PubOneOrMore.SelectedValue = pubMod.PubOneOrMore.ToString(); } if (pubMod.PubIPOneOrMore < 2) { PubIPOneOrMorenum.Visible = false; PubIPOneOrMore.SelectedValue = pubMod.PubIPOneOrMore.ToString(); } else { PubIPOneOrMore.SelectedValue = "2"; PubIPOneOrMorenum.Visible = true; PubIPOneOrMorenum.Text = pubMod.PubIPOneOrMore.ToString(); } Interval_T.Text = pubMod.Interval.ToString(); if (!string.IsNullOrEmpty(pubMod.PubTableName)) { PubTableName.Text = pubMod.PubTableName.Replace("ZL_Pub_", ""); } PubTemplate_hid.Value = pubMod.PubTemplate; PubLoadstr.Text = pubMod.PubLoadstr; PubIsTrue.Checked = pubMod.PubIsTrue == 1 ? true : false; PubCode.Checked = pubMod.PubCode == 1 ? true : false; PubOpenComment.Checked = pubMod.PubOpenComment == 1 ? true : false; //CookieNum_Rad.SelectedValue = (pubinfo.PubTimeSlot < 1 ? 0 : 1).ToString(); //CookieNum_T.Text = pubinfo.PubTimeSlot < 1 ? "1" : pubinfo.PubTimeSlot.ToString(); RaPublic.Checked = pubMod.Pubid == 1 ? true : false; Pubkeep.Text = pubMod.Pubkeep.ToString(); Puberrmsg.Text = pubMod.Puberrmsg.ToString(); if (pubMod.PubEndTime.ToString() == "9999-12-31 23:59:59") { PubEndTime.Text = ""; } else { PubEndTime.Text = pubMod.PubEndTime.ToString().Replace("/", "-"); } PubInputTM_hid.Value = pubMod.PubInputTM; PubInputLoadStr.Text = pubMod.PubInputLoadStr; Pubinfo.Text = pubMod.Pubinfo; PubGourl.Text = pubMod.PubGourl; pubflag.Checked = pubMod.PubFlag == 1; if (!string.IsNullOrEmpty(pubMod.PubPermissions)) { CheckBox1.Checked = pubMod.PubPermissions.Contains("Look"); CheckBox2.Checked = pubMod.PubPermissions.Contains("Edit"); CheckBox3.Checked = pubMod.PubPermissions.Contains("Del"); CheckBox4.Checked = pubMod.PubPermissions.Contains("Sen"); } } break; case "copy": { PubTableName.Enabled = true; PubName.Attributes.Add("onkeyup", "Getpy('PubName','PubTableName','PubLoadstr','PubInputLoadStr')"); Lbtitle.Text = "复制模块信息"; PubName.Text = "新建" + pubMod.PubName; PubClass.SelectedValue = pubMod.PubClass.ToString(); PubType.SelectedValue = pubMod.PubType.ToString(); PubOneOrMore.SelectedValue = pubMod.PubOneOrMore.ToString(); PubIPOneOrMore.SelectedValue = pubMod.PubIPOneOrMore.ToString(); if (!string.IsNullOrEmpty(pubMod.PubTableName)) { PubTableName.Text = pubMod.PubTableName.Replace("ZL_Pub_", ""); } PubTemplate_hid.Value = pubMod.PubTemplate; PubLoadstr.Text = "XJ" + pubMod.PubLoadstr; PubIsTrue.Checked = pubMod.PubIsTrue == 1 ? true : false; PubCode.Checked = pubMod.PubCode == 1 ? true : false; PubOpenComment.Checked = pubMod.PubOpenComment == 1 ? true : false; Pubkeep.Text = pubMod.Pubkeep.ToString(); Puberrmsg.Text = pubMod.Puberrmsg.ToString(); if (pubMod.PubEndTime.ToString() == "9999-12-31 23:59:59") { PubEndTime.Text = ""; } else { PubEndTime.Text = pubMod.PubEndTime.ToString().Replace("/", "-"); } PubInputTM_hid.Value = pubMod.PubInputTM; PubInputLoadStr.Text = "XJ" + pubMod.PubInputLoadStr; Pubinfo.Text = pubMod.Pubinfo; PubGourl.Text = pubMod.PubGourl; if (!string.IsNullOrEmpty(pubMod.PubPermissions)) { CheckBox1.Checked = pubMod.PubPermissions.Contains("Look"); CheckBox2.Checked = pubMod.PubPermissions.Contains("Edit"); CheckBox3.Checked = pubMod.PubPermissions.Contains("Del"); CheckBox4.Checked = pubMod.PubPermissions.Contains("Sen"); } } break; case "delete": { pubMod.PubIsDel = 1; pubBll.GetUpdate(pubMod); function.WriteErrMsg("存档成功", "PubManage.aspx"); } break; case "truedelete": { pubBll.GetDelete(Mid); B_Role.DelPower(pubMod.PubTableName); function.WriteSuccessMsg("删除成功", "PubRecycler.aspx"); } break; case "revert": { pubMod.PubIsDel = 0; pubBll.InsertUpdate(pubMod); function.WriteSuccessMsg("还原成功", "PubRecycler.aspx"); } break; } #endregion } else { PubName.Attributes.Add("onkeyup", "Getpy('PubName','PubTableName','PubLoadstr','PubInputLoadStr')"); ModelList_DP.Items.Insert(0, new ListItem("请选择模型", "")); bread = string.Format(bread, "添加互动"); } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Content/ContentManage.aspx'>内容管理</a></li><li><a href='PubManage.aspx'>互动模块</a></li>" + bread); } }
//保存权限设置 #region protected void btnSave_Click(object sender, EventArgs e) { string power; int RoleID = DataConverter.CLng(ViewState["roleid"]); //内容管理 for (int m = 0; m < this.CheckBoxList1.Items.Count; m++) { power = this.CheckBoxList1.Items[m].Value; if (this.CheckBoxList1.Items[m].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int t = 0; t < this.CheckBoxList2.Items.Count; t++) { power = this.CheckBoxList2.Items[t].Value; if (this.CheckBoxList2.Items[t].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int y = 0; y < this.CheckBoxList3.Items.Count; y++) { power = this.CheckBoxList3.Items[y].Value; if (this.CheckBoxList3.Items[y].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int v = 0; v < this.CheckBoxList4.Items.Count; v++) { power = this.CheckBoxList4.Items[v].Value; if (this.CheckBoxList4.Items[v].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } Response.Redirect("RoleManage.aspx"); }
//保存权限设置 protected void btnSave_Click(object sender, EventArgs e) { string power; int RoleID = DataConverter.CLng(ViewState["roleid"]); //内容管理 for (int m = 0; m < this.CheckBoxList1.Items.Count; m++) { power = this.CheckBoxList1.Items[m].Value; if (this.CheckBoxList1.Items[m].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int t = 0; t < this.CheckBoxList2.Items.Count; t++) { power = this.CheckBoxList2.Items[t].Value; if (this.CheckBoxList2.Items[t].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int y = 0; y < this.CheckBoxList3.Items.Count; y++) { power = this.CheckBoxList3.Items[y].Value; if (this.CheckBoxList3.Items[y].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int v = 0; v < this.CheckBoxList4.Items.Count; v++) { power = this.CheckBoxList4.Items[v].Value; if (this.CheckBoxList4.Items[v].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int v = 0; v < this.CheckBoxList5.Items.Count; v++) { power = this.CheckBoxList5.Items[v].Value; if (this.CheckBoxList5.Items[v].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int v = 0; v < this.CheckBoxList6.Items.Count; v++) { power = this.CheckBoxList6.Items[v].Value; if (this.CheckBoxList6.Items[v].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int v = 0; v < this.CheckBoxList7.Items.Count; v++) { power = this.CheckBoxList7.Items[v].Value; if (this.CheckBoxList7.Items[v].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int v = 0; v < this.CheckBoxList8.Items.Count; v++) { power = this.CheckBoxList8.Items[v].Value; if (this.CheckBoxList8.Items[v].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } for (int v = 0; v < this.CheckBoxList9.Items.Count; v++) { power = this.CheckBoxList9.Items[v].Value; if (this.CheckBoxList9.Items[v].Selected) { if (!B_Role.IsExistPower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } //互动权限 for (int i = 0; i < this.PubManage.Items.Count; i++) { power = this.PubManage.Items[i].Value; if (this.PubManage.Items[i].Selected) { if (!B_Role.SavePower(RoleID, power)) { B_Role.SavePower(RoleID, power); } } else { if (B_Role.IsExistPower(RoleID, power)) { B_Role.DelPower(RoleID, power); } } } //Crm权限 crmModel.RoleID = RoleID; crmModel.Add_Date = DateTime.Now; crmModel.Add_Man = badmin.GetAdminLogin().AdminId.ToString(); crmModel.AllowOption = crmAuthChk.Items[0].Selected ? "1" : "0"; crmModel.AllowOptionValue = crmAuthChk.Items[1].Selected ? "1" : "0"; crmModel.AllowExcel = crmAuthChk.Items[2].Selected ? "1" : "0"; crmModel.AllowAddClient = crmAuthChk.Items[3].Selected ? "1" : "0"; crmModel.AllCustomer = crmAuthChk.Items[4].Selected ? "1" : "0"; crmModel.AssignFPMan = crmAuthChk.Items[5].Selected ? "1" : "0"; crmModel.AllowFPAll = crmAuthChk.Items[6].Selected ? "1" : "0"; crmModel.IsSalesMan = crmAuthChk.Items[7].Selected ? "1" : "0"; if (crmBll.IsExist(RoleID)) { crmBll.UpdateModel(crmModel); } else { crmBll.insert(crmModel); } function.WriteSuccessMsg("操作成功", "RoleManage.aspx"); //Response.Redirect("RoleManage.aspx"); }