毕业论文论文范文课程设计实践报告法律论文英语论文教学论文医学论文农学论文艺术论文行政论文管理论文计算机安全
您现在的位置: 毕业论文 >> 论文 >> 正文

C#图书管理系统设计 第6页

更新时间:2010-2-28:  来源:毕业论文
C#图书管理系统设计 第6页登录代码(Login)
namespace BookInfoM
{
    public partial class Login : Form
    {
        public static string[] LuserID;
        private int Logintimes=0;
        public Login()
        {
            InitializeComponent();
        }
        private void Login_Load(object sender, EventArgs e)
        {
            combUserID.Text = "";
            txtPassWord.Text = "";
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (this.Text.Trim() != "")
            {
                if (txtPassWord.Text != "")
                {
                  SqlCommand command = CustomDataProvide.GetCommand(
"select * from UserInfo where UserID='" + combUserID.Text.Trim() +
"'and Password='" + txtPassWord.Text.Trim() + "'");
                    SqlDataReader dr;
                    try
                    {
                        command.Connection.Open();
                        dr = command.ExecuteReader();
                        dr.Read();
                        if (dr.HasRows)
                        {
                            Logintimes = 0;
                            Main main = new Main();
                            Main.LoginUser.UserID = dr.GetString(0);
                            Main.LoginUser .UserName  = dr.GetString(1);
                            Main.LoginUser .Password = dr.GetString(2);
                            Main.LoginUser .Isadmin = dr.GetBoolean(3);
                            Main.LoginUser.Day = (Week )dr.GetInt32(4);
                            this.Hide();
                            main.Show();
                            dr.Close();
                            command.Connection.Close();
                            command.Dispose();  }
                        else
                        {   Logintimes++;
                            if (Logintimes == 3)
                            {  MessageBox.Show("对不起,你登录的次数
已经超过三次!", "警告!");
                                Application.Exit();
                            }
                     if (BookInfoM.ClassCodes.DataValidate.IDExist("select
 UserID from UserInfo where UserID='" + combUserID.Text.Trim().ToString()
+ "'") == true)
                         {   MessageBox.Show("密码不正确", "警告!");
                                txtPassWord.Text = "";   }
                            else
                          {  MessageBox.Show("此用户ID不存在,请查
证后登录", "提示");
                                combUserID.Text = "";
                                txtPassWord.Text = "";
                            }   }   }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                    }    }
                else
                {  MessageBox.Show("密码不能为空", "提示");  }   }
            else
            {   MessageBox.Show("用户ID不能为空", "提示");  }   }
        private void btnExit_Click(object sender, EventArgs e)
        {
                if (MessageBox.Show("你确认要退出该程序吗?",
"提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
 == DialogResult.Yes)
                Application.Exit();
        }    }   

上一页  [1] [2] [3] [4] [5] [6] [7] [8] 下一页

C#图书管理系统设计 第6页下载如图片无法显示或论文不完整,请联系qq752018766
设为首页 | 联系站长 | 友情链接 | 网站地图 |

copyright©751com.cn 辣文论文网 严禁转载
如果本毕业论文网损害了您的利益或者侵犯了您的权利,请及时联系,我们一定会及时改正。