Beispiel #1
0
        //private void txtPass_Validated(object sender, EventArgs e)
        //{
        //    if (txtPass.Text.Length < 5 || txtPass.Text.Length >12 || txtPass.Text.Length == 0)
        //    {
        //        MessageBox.Show("密码长度不符合规定,请重新输入!","提示");
        //        txtPass.Focus ();
        //        txtPass.SelectAll();
        //    }
        //}

        //private void txtRepass_Validated(object sender, EventArgs e)
        //{
        //    if (xtPass.Text.Length < 5 || txtPass.Text.Length >12 || txtPass.Text.Length == 0||txtRepass.Text.Length < 5 || txtRepass.Text.Length > 12 || txtRepass.Text.Length == 0)
        //    {
        //        MessageBox.Show("密码长度不符合规定,请重新输入!", "提示");
        //        txtRepass.Focus();
        //        txtRepass.SelectAll();
        //    }
        //    else
        //    {
        //        if (txtPass.Text != txtRepass.Text)
        //        {
        //            MessageBox.Show("两次输入的密码不一致,请重新输入!", "提示");
        //            txtPass.Focus();
        //            txtPass.SelectAll();
        //        }
        //        else
        //        {
        //            butOk.Enabled = true;
        //        }
        //    }
        //}
        #endregion

        private void butOk_Click(object sender, EventArgs e)
        {
            if (txtPass.Text.Length < 5 || txtPass.Text.Length > 12 || txtPass.Text.Length == 0 || txtRepass.Text.Length < 5 || txtRepass.Text.Length > 12 || txtRepass.Text.Length == 0)
            {
                MessageBox.Show("密码长度不符合规定,请重新输入!", "提示");
                txtRepass.Focus();
                txtRepass.SelectAll();
            }
            else
            {
                if (txtPass.Text != txtRepass.Text)
                {
                    MessageBox.Show("两次输入的密码不一致,请重新输入!", "提示");
                    txtPass.Focus();
                    txtPass.SelectAll();
                }
                else
                {
                    try
                    {
                        SqlConnection Strconn1 = Dbconnection.Dblink();; //调用Dbconnection类中的连接
                        Strconn1.Open();                                 //打开连接
                        string     sqlName1 = "insert into Users values ('" + txtUsername.Text + "','" + txtPass.Text + "','" + comboxtype.Text + "','" + "否" + "')";
                        SqlCommand scomd1   = new SqlCommand(sqlName1, Strconn1);
                        scomd1.ExecuteNonQuery();
                        //实现实时更新
                        frmUsercontrol fuc = new frmUsercontrol();
                        fuc.Reflesh();
                        Strconn1.Close();
                        this.Dispose();
                        MessageBox.Show("用户添加成功!", "提示");
                    }

                    catch (Exception c)
                    {
                        Console.WriteLine(c.Message);
                    }
                }
            }
        }
Beispiel #2
0
        private void 用户管理UToolStripMenuItem_Click(object sender, EventArgs e)
        {
            frmUsercontrol fuc = new frmUsercontrol();

            fuc.ShowDialog();
        }
Beispiel #3
0
        private void listView1_DoubleClick(object sender, EventArgs e)
        {
            if (frmlogin.type == "超级用户")
            {
                if (listView1.SelectedItems[0].Text == "  用户管理")
                {
                    frmUsercontrol fuc = new frmUsercontrol();
                    fuc.Owner = this;
                    fuc.ShowDialog();
                }
            }
            else
            {
                ;
            }
            if (listView1.SelectedItems[0].Text == "  切换用户")
            {
                切换用户LToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  修改密码")
            {
                修改密码MToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  备份管理")
            {
                备份管理BToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  读者管理")
            {
                读者资料管理PToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  操作流水")
            {
                操作流水HToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  借阅查询")
            {
                借阅查询BToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  系统初始化")
            {
                系统初始化IToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  借阅管理")
            {
                toolStripButton2_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  预借详情")
            {
                预借查询PToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  书籍管理")
            {
                if (!OnlyOpen("frmBookManage", "  书籍管理"))
                {
                    frmBookManage fbm = new frmBookManage();
                    fbm.MdiParent = this;
                    fbm.Show();
                }
                //读者资料管理PToolStripMenuItem_Click(sender, e);
            }
            if (listView1.SelectedItems[0].Text == "  暂时离开")
            {
                暂时离开OToolStripMenuItem_Click(sender, e);
            }

            if (listView1.SelectedItems[0].Text == "  备忘管理")
            {
                备忘管理RToolStripMenuItem_Click(sender, e);
            }

            if (listView1.SelectedItems[0].Text == "  系统参数")
            {
                if (!OnlyOpen("frmSystemSet", "  系统参数"))
                {
                    frmSystemSet fss = new frmSystemSet();
                    fss.ShowDialog();
                }
            }
        }