当前位置: 首页>>代码示例>>C#>>正文


C# Security.getUserCode方法代码示例

本文整理汇总了C#中Security.getUserCode方法的典型用法代码示例。如果您正苦于以下问题:C# Security.getUserCode方法的具体用法?C# Security.getUserCode怎么用?C# Security.getUserCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Security的用法示例。


在下文中一共展示了Security.getUserCode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: loginButton_Click

    protected void loginButton_Click( object sender , EventArgs e )
    {
        dbModule dm = new dbModule();
        pbModule pm = new pbModule();
        string uCode = ucodeTextbox.Text.Trim();
        string uPass = upassTextbox.Text.Trim();
        if ( !pm.isValidString( uCode) || !pm.isValidString( uPass ) )
        {
            errors.Text = Resources.Resource.strNotValidString;
            return;
        }
        int result = dm.adminLogin( uCode , uPass );
        switch ( result )
        {
            case -1 :
                errors.Text = Resources.Resource.strWrongPasswordString;
                break;
            case 0:
                errors.Text = Resources.Resource.strWrongUsernameString;
                break;
            case 1:

                Security s = new Security();
                s.setSecurity( priCode.xtgly );
                s.setUserCode(ucodeTextbox.Text.Trim());
                s.setUserName( dm.getUnameByUcode(uCode, priCode.xtgly ) );
                Session["sec"] = s;
                Session["usercode"] = s.getUserCode();
                Response.Redirect( "adminDefault.aspx" );
                break;
            default:
                errors.Text = Resources.Resource.strDuplicateUserNameString;
                break;
        }
    }
开发者ID:zhouxin262,项目名称:SyxkWebSource,代码行数:35,代码来源:adminlogin.aspx.cs

示例2: loginButton_Click

    protected void loginButton_Click( object sender , EventArgs e )
    {
        dbModule dm = new dbModule();
        pbModule pm = new pbModule();
        string uCode = ucodeTextbox.Text.Trim();
        string uPass = upassTextbox.Text.Trim();
        if ( !pm.isValidString( uCode) || !pm.isValidString( uPass ) )
        {
            errors.Text = Resources.Resource.strNotValidString;
            return;
        }
        int result = 0;
        Security s = new Security();
        string url = "";
        switch (Convert.ToInt32(lb_DropList.SelectedValue))
        {
            case 0://学生
                result = dm.xsLogin(uCode, uPass);
                url = "stuDefault.aspx";
                s.setSecurity(priCode.xs);
                s.setUserName(dm.getUnameByUcode(uCode, priCode.xs));
                s.setUserXy(dm.getUxyByUcode(uCode, priCode.xs));
                break;
            case 1://任课教师
                result = dm.jsLogin(uCode, uPass);
                url = "teaDefault.aspx";
                s.setUserName(dm.getUnameByUcode(uCode, priCode.js));
                s.setUserXy(dm.getUxyByUcode(uCode, priCode.js));
                s.setSecurity(priCode.js);
                break;
            case 2://实验教师
                result = dm.eadmLogin(uCode, uPass);
                url = "eadmDefault.aspx";
                s.setSecurity(priCode.sygly);
                s.setUserName(dm.getUnameByUcode(uCode, priCode.sygly));
                s.setUserXy(dm.getUxyByUcode(uCode, priCode.sygly));
                break;
            case 3://管理员
                result = dm.adminLogin(uCode, uPass);
                url = "adminDefault.aspx";
                s.setSecurity(priCode.xtgly);
                s.setUserName(dm.getUnameByUcode(uCode, priCode.xtgly));
                s.setUserXy(dm.getUxyByUcode(uCode, priCode.xtgly));
                break;
            case 4://教务管理员
                result = dm.aadmLogin(uCode, uPass);
                url = "aadmDefault.aspx";
                s.setSecurity(priCode.jwgly);
                s.setUserName(dm.getUnameByUcode(uCode, priCode.jwgly));
                s.setUserXy(dm.getUxyByUcode(uCode, priCode.jwgly));
                break;

        }
        switch ( result )
        {
            case -1 :
                errors.Text = Resources.Resource.strWrongPasswordString;
                break;
            case 0:
                errors.Text = Resources.Resource.strWrongUsernameString;
                break;
            case 1:
                s.setUserCode(ucodeTextbox.Text.Trim());

                Session["sec"] = s;
                Session["usercode"] = s.getUserCode();
                Response.Redirect(url);
                break;
            default:
                errors.Text = Resources.Resource.strDuplicateUserNameString;
                break;
        }
    }
开发者ID:zhouxin262,项目名称:SyxkWebSource,代码行数:73,代码来源:login.aspx.cs


注:本文中的Security.getUserCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。