Beispiel #1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        AdminMgr sMgr  = new AdminMgr();
        Admin    admin = new Admin();

        if (this.txtAdminID.ReadOnly == false)
        {
            if (sMgr.ExistsAdmin(this.txtAdminID.Text))
            {
                this.SendMessage("该登录名称已经存在");
                return;
            }
            admin.Password = "******";
        }
        else
        {
            admin = sMgr.GetAdmin(this.txtAdminID.Text);
        }

        admin.AdminID   = this.txtAdminID.Text.Trim();
        admin.AdminName = this.txtAdminName.Text.Trim();
        if (this.txtPassword.Text != "")
        {
            admin.Password = this.txtPassword.Text;
        }



        sMgr.UpdateAdmin(admin);
        this.SendMessage("信息编辑成功");
        if (!this.txtAdminID.ReadOnly)
        {
            this.ClearTextData(this);
        }
    }
Beispiel #2
0
 /// <summary>
 /// 初始化窗体信息
 /// </summary>
 private void initForm()
 {
     if (this.txtAdminID.Text != "")
     {
         this.txtAdminID.ReadOnly = true;
         AdminMgr pMgr  = new AdminMgr();
         Admin    admin = pMgr.GetAdmin(this.txtAdminID.Text);
         if (admin.AdminID != "")
         {
             this.txtAdminName.Text = admin.AdminName;
         }
         else
         {
             this.btnOK.Enabled = false;
             this.SendMessage("没有找到该人员信息");
         }
     }
 }
Beispiel #3
0
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        switch (this.lstLoginType.SelectedValue)
        {
        case "管理员":
            AdminMgr aMgr  = new AdminMgr();
            Admin    admin = aMgr.GetAdmin(this.txtLoginName.Text);
            if (admin.AdminID != "")
            {
                if (this.txtPassword.Text == admin.Password)
                {
                    this.eUserID   = admin.AdminID;
                    this.eUserName = admin.AdminName;
                    this.eUserType = "管理员";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该教师");
            }
            break;

        case "教师":
            ClientMgr pMgr   = new ClientMgr();
            Client    client = pMgr.GetClient(this.txtLoginName.Text);
            if (client.ClientID != "")
            {
                if (this.txtPassword.Text == client.Password)
                {
                    this.eUserID   = client.ClientID;
                    this.eUserName = client.ClientName;
                    this.eUserType = "教师";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该教师");
            }
            break;

        case "学生":
            PersonMgr cMgr   = new PersonMgr();
            Person    person = cMgr.GetPerson(this.txtLoginName.Text);
            if (person.PersonID != "")
            {
                if (this.txtPassword.Text == person.Password)
                {
                    this.eUserID   = person.PersonID;
                    this.eUserName = person.PersonName;
                    this.eUserType = "学生";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该学生");
            }
            break;
        }
    }