Пример #1
0
 private void BindRole(string RoleId)
 {
     if (!string.IsNullOrEmpty(RoleId))
     {
         Model.AccountsRoles model = rolebll.GetModel(RoleId);
         if (model != null)
         {
             this.rolename.Text = model.Title;
             this.descript.Text = model.Description;
         }
     }
 }
Пример #2
0
 protected void btnEdit_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(Request.QueryString["roleid"]))
     {
         Model.AccountsRoles model = new Model.AccountsRoles();
         int roleid = Convert.ToInt32(Request.QueryString["roleid"].ToString());
         model.RoleID      = roleid.ToString();
         model.Title       = this.rolename.Text.Trim();
         model.Description = this.descript.Text.Trim();
         rolebll.Update(model);
         ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('编辑成功');parent.Window_Close();</script>");
     }
 }
Пример #3
0
        //获取角色
        public string GetRole(string id)
        {
            string rolename = "";

            try
            {
                Model.AccountsUserRoles urmodel   = aurbll.GetModel(id, hotelID);
                Model.AccountsRoles     rolemodel = rolebll.GetModel(urmodel.RoleID);
                rolename = rolemodel.Title;
            }
            catch
            {
            }
            return(rolename);
        }
Пример #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Model.AccountsRoles model = new Model.AccountsRoles();
                int count = rolebll.GetListByTitle(this.txtrolename.Text.Trim()).Tables[0].Rows.Count;
                if (count > 0)
                {
                    this.labname.Text = "该角色名已存在!";
                    return;
                }
                model.RoleID      = rolebll.GetMaxId().ToString();
                model.Title       = this.txtrolename.Text.Trim();
                model.Description = this.txtdescript.Text.Trim();
                rolebll.Add(model);
                ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript' defer>alert('提交成功');parent.Window_Close();</script>");

                //Response.Write("<script> function CloseDiv() {Window_Close();}</script>");
            }
            catch
            {
            }
        }