Beispiel #1
0
    protected void btn_Delete_Click(object sender, EventArgs e)
    {
        StdInfoBLL                 sib   = new StdInfoBLL();
        List <StdInfoModel>        lSib  = sib.GetAllInformation();
        SuperAdminInfoBLL          saib  = new SuperAdminInfoBLL();
        List <SuperAdminInfoModel> lSaim = saib.GetSuperAdminInfo();
        bool isSAdminExit = false;

        if (tb_StdNum.Text != "" && tb_SAdminName.Text != "" && tb_SPassword.Text != "")//信息完整
        {
            for (int i = 0; i < lSaim.Count; i++)
            {
                if (tb_SAdminName.Text == lSaim[i].SAdminName && tb_SPassword.Text == lSaim[i].SPassword)
                {
                    isSAdminExit = true;
                }
            }
            if (isSAdminExit)
            {
                sib.DeleteInfoByNum(tb_StdNum.Text);
                Response.Write(@"<script>alert('删除成功');</script>");
                Response.Write(@"<script>location.href='Handler_ShowStdInfo.ashx';</script>");
            }
            else
            {
                Response.Write(@"<script>alert('超级管理员用户或密码错误');</script>");
            }
        }
        else//信息不完整
        {
            Response.Write(@"<script>alert('请输入信息');</script>");
        }
    }
Beispiel #2
0
    protected void btn_Register_Click(object sender, EventArgs e)
    {
        AdminInfoBLL               aib   = new AdminInfoBLL();
        SuperAdminInfoBLL          saib  = new SuperAdminInfoBLL();
        List <AdminInfoModel>      lAim  = aib.GetAdminInfon();
        List <SuperAdminInfoModel> lSaim = saib.GetSuperAdminInfo();
        //用于判断用户是否存在
        bool isRegistered = false;

        //信息不为空
        if (tb_AdminName.Text != "" && tb_Password.Text != "" && tb_Confirm.Text != "" && tb_SAdminName.Text != "" && tb_SPassword.Text != "")
        {
            //判断用户名是否存在
            for (int i = 0; i < lAim.Count; i++)
            {
                if (tb_AdminName.Text == lAim[i].AdminName)
                {
                    isRegistered = true;
                }
            }
            //用户不存在
            if (!isRegistered)
            {
                //两次密码一致
                if (tb_Password.Text == tb_Confirm.Text)
                {
                    for (int j = 0; j < lSaim.Count; j++)
                    {
                        //超级管理员用户和密码正确
                        if (tb_SAdminName.Text == lSaim[j].SAdminName && tb_SPassword.Text == lSaim[j].SPassword)
                        {
                            aib.AddAdmin(tb_AdminName.Text, tb_Password.Text);
                            Response.Write(@"<script>alert('注册成功');</script>");
                            Response.Write(@"<script>location.href='Login.aspx';</script>");
                        }
                        //超级管理员用户和密码错误
                        else
                        {
                            Response.Write(@"<script>alert('超级管理员用户或密码错误');</script>");
                        }
                    }
                }
                //两次密码不一致
                else
                {
                    Response.Write(@"<script>alert('两次输入的密码不一致');</script>");
                }
            }
            //用户存在
            else
            {
                Response.Write(@"<script>alert('该用户已存在');</script>");
            }
        }
        //信息为空
        else
        {
            Response.Write(@"<script>alert('请将输入完整信息');</script>");
        }
    }
Beispiel #3
0
        private void btn_Register_Click(object sender, EventArgs e)
        {
            AdminInfoBLL               aib   = new AdminInfoBLL();
            SuperAdminInfoBLL          saib  = new SuperAdminInfoBLL();
            List <AdminInfoModel>      lAim  = aib.GetAdminInfon();
            List <SuperAdminInfoModel> lSaim = saib.GetSuperAdminInfo();
            //用于判断用户是否存在
            bool isRegistered = false;

            //信息不为空
            if (tb_AdminName.Text != "" && tb_Password.Text != "" && tb_Confirm.Text != "" && tb_SAdminName.Text != "" && tb_SPassword.Text != "")
            {
                //判断用户名是否存在
                for (int i = 0; i < lAim.Count; i++)
                {
                    if (tb_AdminName.Text == lAim[i].AdminName)
                    {
                        isRegistered = true;
                    }
                }
                //用户不存在
                if (!isRegistered)
                {
                    //两次密码一致
                    if (tb_Password.Text == tb_Confirm.Text)
                    {
                        for (int j = 0; j < lSaim.Count; j++)
                        {
                            //超级管理员用户和密码正确
                            if (tb_SAdminName.Text == lSaim[j].SAdminName && tb_SPassword.Text == lSaim[j].SPassword)
                            {
                                aib.AddAdmin(tb_AdminName.Text, tb_Password.Text);
                                MessageBox.Show("注册成功");
                                this.Hide();
                                new Form_Login().ShowDialog();
                                Application.ExitThread();
                            }
                            //超级管理员用户和密码错误
                            else
                            {
                                MessageBox.Show("超级管理员用户或密码错误");
                            }
                        }
                    }
                    //两次密码不一致
                    else
                    {
                        MessageBox.Show("两次输入的密码不一致");
                    }
                }
                //用户存在
                else
                {
                    MessageBox.Show("该用户已存在");
                }
            }
            //信息为空
            else
            {
                MessageBox.Show("请将输入完整信息");
            }
        }