Ejemplo n.º 1
0
    protected void btn_Click(object sender, EventArgs eventArgs)
    {
        string js = "alert('操作失败!');";
        if (string.IsNullOrEmpty(txtRoleName.Value.Trim()))
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('角色名称不能为空!');", true);
            return;
        }
        T_Role role = new T_Role();
        role.RoleName = Util.querySQL(txtRoleName.Value.Trim());
        role.RoleDescription = Util.querySQL(txtRoleDescription.Value.Trim());
        if (Mode == "add")
        {
            //新增
            if (BLLFactory<T_RoleManager>.Instance.Insert(role))
            {
                js = "window.opener.select();window.close();";
            }

        }
        else
        {
            //修改
            if (BLLFactory<T_RoleManager>.Instance.Update(role, ViewState["ID"].ToString()))
            {
                js = "window.opener.select();window.close();";
            }
        }
        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", js, true);
    }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Mode = Request.QueryString["action"];
         string id = Request.QueryString["id"] as string;
         if (!string.IsNullOrEmpty(id))
         {
             T_Role roleInfo = new T_Role();
             roleInfo = BLLFactory<T_RoleManager>.Instance.FindByID(id);
             BindPage(roleInfo);
             ViewState["ID"] = id;
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 将数据填充到页面显示
 /// </summary>
 /// <param name="info">实体类数据</param>
 protected void BindPage(T_Role info)
 {
     txtRoleName.Value = info.RoleName;
     txtRoleDescription.Value = info.RoleDescription;
   
 }