newrole.aspx.cs

来自「这是一个自动排课软件(包含源码,需求分析,详细设计).希望对你有所帮助.」· CS 代码 · 共 70 行

CS
70
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Web.Services;

public partial class UserManage_NewRole : System.Web.UI.Page
{HtmlLink link = new HtmlLink();
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (Request.Cookies["ThemeCss"] == null)
            link.Href = "../styles/VistaBlue.css";
        else
            link.Href = "../styles/" + Request.Cookies["ThemeCss"].Value;
        link.Attributes["rel"] = "stylesheet";
        link.Attributes["type"] = "text/css";
        Page.Header.Controls.Add(link);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            if (labError.Text.ToString() == "")
            {
                BLL.BCropRole bCropRole = new BLL.BCropRole();
                Entities.CorpRole corpRole = new Entities.CorpRole();
                corpRole.RoleName = this.txtname.Text.ToString().Trim();
                corpRole.IsValid = cbkIsValid.Checked;
                if (bCropRole.Insert(corpRole) > -1)
                {
                    this.labError.Text = "添加成功";
                }
                
                Response.Write("<script>window.returnValue='';window.close();</script>");
            }
        }
    }

    [WebMethod]
    public static bool VerifyUser(string userName)
    {
        if (userName != null || userName != string.Empty)
        {
            Search.CorpRoleSearcher search = new Search.CorpRoleSearcher();
            search.RoleName = userName;
            search.RoleNameIsValid = true;

            ArrayList list = new BLL.BCropRole().Select(search);
            if (list != null && list.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        else
            return false;
    }
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?