예제 #1
0
 private void initPage()
 {
     modeladmin = blladmin.GetModel(Convert.ToInt32(editUserId));
     if (modeladmin != null)
     {
         this.txtUserName.Text = modeladmin.dbo_UserName;
     }
     this.txtUserName.Enabled = false;
     this.btnAdd.Text         = "保存修改";
 }
예제 #2
0
        protected void ShowInfo()
        {
            if (Request.QueryString["id"] != null)
            {
                modelAdmin = bllAdmin.GetModel(int.Parse(Request.QueryString["id"]));

                txtUserName.Text = modelAdmin.UserName;
                txtPwd.Attributes.Add("value", "重新设置密码");
                txtRePwd.Attributes.Add("value", "重新设置密码");
                chbIsEnabled.Checked      = modelAdmin.Enabled.Value;
                ddlUserType.SelectedValue = modelAdmin.UserType;
                txtRemark.Text            = modelAdmin.Remark;
                ddlAccount.SelectedValue  = modelAdmin.TbAccount;

                this.BtnSubmit.Visible = false;
                this.BtnUpdate.Visible = true;
            }
        }
예제 #3
0
        protected void BtnSubmit_Click(object sender, EventArgs e)
        {
            var loginModel = Session[sessionAdminModel] as Model.AdminInfo;

            modelAdmin         = bllAdmin.GetModel(loginModel.ID);
            modelAdmin.UserPwd = PageFunc.Encrypt(txtPwd.Text, 1);

            bllAdmin.Update(modelAdmin);
            Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "ChangePwd.aspx"));
        }
예제 #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string UserID = context.Request.Form["UserID"];

            BLL.Admin bll = new BLL.Admin();
            // Model.Admin前必须加 [Serializable]
            Model.Admin model = bll.GetModel(int.Parse(UserID));
            //返回一个类的对象
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string jsonString = serializer.Serialize(model);

            context.Response.Write(jsonString);
        }
예제 #5
0
        public void showPowerSelect()
        {
            string adminPower = string.Empty;
            string adminName  = string.Empty;

            model = blladmin.GetModel(Convert.ToInt32(Request.QueryString["id"]));
            if (model != null)
            {
                adminName  = model.dbo_UserName;
                adminPower = model.dbo_Power;
            }
            else
            {
                return;
            }
            if (!Page.IsPostBack)
            {
                this.litName.Text = adminName;
                if (adminPower == "super")
                {
                    this.rbtnSuper.Checked  = true;
                    this.rbtnCommon.Checked = false;
                }
                else
                {
                    this.rbtnSuper.Checked  = false;
                    this.rbtnCommon.Checked = true;
                }
            }

            DataTable dtSpc = bllspeciality.GetList("1=1 order by id asc").Tables[0];
            DataRow   dr    = dtSpc.NewRow();

            dr["id"]          = "0";
            dr["dbo_name"]    = "默认频道";
            dr["dbo_htmlDir"] = "";
            dtSpc.Rows.InsertAt(dr, 0);


            for (int i = 0; i < dtSpc.Rows.Count; i++)
            {
                #region 显示频道权限设置的内容

                string channelId   = dtSpc.Rows[i]["id"].ToString();
                string channelName = dtSpc.Rows[i]["dbo_name"].ToString();

                HtmlGenericControl fieldset = new HtmlGenericControl("fieldset");
                fieldset.ID = "fieldset" + channelId;

                HtmlGenericControl legend = new HtmlGenericControl("legend");
                legend.ID = "legend" + channelId;
                pla1.Controls.Add(fieldset);
                fieldset.Controls.Add(legend);

                legend.InnerText = "此管理员在【" + channelName + "】的管理权限";

                Panel p1 = new Panel();
                fieldset.Controls.Add(p1);
                Panel p2 = new Panel();
                fieldset.Controls.Add(p2);
                Panel pTypes = new Panel();
                pTypes.ID = "ChannelTypes" + channelId;
                fieldset.Controls.Add(pTypes);
                Panel p3 = new Panel();
                fieldset.Controls.Add(p3);

                RadioButton rbtn1 = new RadioButton();
                p1.Controls.Add(rbtn1);
                rbtn1.Text      = "频道管理员:拥有该频道的所有权限(内容管理,类别管理,静态生成,模板管理)";
                rbtn1.ID        = "ChannelAdmin" + channelId;
                rbtn1.GroupName = "ChannelAdmin" + channelId;
                rbtn1.Attributes.Add("onclick", "javascript:showTypes(false,'ChannelTypes" + channelId + "');");

                RadioButton rbtn2 = new RadioButton();
                p2.Controls.Add(rbtn2);
                rbtn2.Text      = "频道编辑:仅拥有相对应内容类别的管理权限";
                rbtn2.ID        = "ChannelEditor" + channelId;
                rbtn2.GroupName = "ChannelAdmin" + channelId;
                rbtn2.Attributes.Add("onclick", "javascript:showTypes(true,'ChannelTypes" + channelId + "');");


                CheckBoxList chkList = new CheckBoxList();
                chkList.ID = "chkList" + channelId;
                pTypes.Controls.Add(chkList);
                chkList.RepeatDirection = RepeatDirection.Horizontal;

                RadioButton rbtn3 = new RadioButton();
                p3.Controls.Add(rbtn3);
                rbtn3.Text      = "在此频道无任何管理权限";
                rbtn3.ID        = "Nopower" + channelId;
                rbtn3.GroupName = "ChannelAdmin" + channelId;
                rbtn3.Attributes.Add("onclick", "javascript:showTypes(false,'ChannelTypes" + channelId + "');");

                #endregion

                if (!Page.IsPostBack)
                {
                    #region 添加该频道下的文章类别

                    DataTable dtTypes = bllarticletype.GetList("dbo_fatherid=0 and dbo_specialityId = " + channelId + " order by id asc").Tables[0];
                    for (int j = 0; j < dtTypes.Rows.Count; j++)
                    {
                        chkList.Items.Add(new ListItem(dtTypes.Rows[j]["dbo_typename"].ToString(), dtTypes.Rows[j]["id"].ToString()));
                    }
                    #endregion

                    #region 填充已经有的权限
                    bool IsEditor = false;

                    string power = adminOpers.getChannelPower(channelId, adminOpers.getChannels(adminPower));

                    switch (power)
                    {
                    case "0": rbtn1.Checked = true; break;

                    case "-1": rbtn3.Checked = true; break;

                    default: rbtn2.Checked = true; IsEditor = true; break;
                    }

                    if (IsEditor && power != "-2")
                    {
                        string[] powers = power.Split(',');

                        for (int j = 0; j < chkList.Items.Count; j++)
                        {
                            for (int k = 0; k < powers.Length; k++)
                            {
                                if (chkList.Items[j].Value == powers[k])
                                {
                                    chkList.Items[j].Selected = true;
                                    break;
                                }
                            }
                        }
                    }
                    if (!IsEditor)
                    {
                        pTypes.Style.Add("display", "none");
                    }

                    #endregion
                }
            }
        }