예제 #1
0
 public Form9__修改密码(Form4__用户登录 f4, Form5__管理员登入 f5)
 {
     InitializeComponent();
     //user=a;
     lastform = f4;
     last     = f5;
     init_user();
 }
예제 #2
0
        private void 修改密码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form5__管理员登入 f5 = null;
            Form9__修改密码  f9 = new Form9__修改密码(this, f5);

            f9.Show();
            this.Hide();
            //  MessageBox.Show("修改密码");
        }
예제 #3
0
 // int flag = 0;
 public Form10_修改信息(Form4__用户登录 f4, Form5__管理员登入 f5)
 {
     InitializeComponent();
     //user = a;
     if (f4 != null)
     {
         lastform = f4;
     }
     else
     {
         last = f5;
     }
 }
 public Form12__修改图书信息(Form5__管理员登入 f)
 {
     InitializeComponent();
     lastform = f;
     init();
 }
예제 #5
0
 public Form13__新增图书(Form5__管理员登入 f)
 {
     InitializeComponent();
     lastform = f;
 }
예제 #6
0
        private void 登录_Click(object sender, EventArgs e)
        {
            ID   = textBox1.Text.ToString();
            str2 = textBox2.Text.ToString();
            //数据库连接字符串(引号中的字符串为之前复制的那段字符)
            //Data source=服务器名,Initial catalog=数据库名,User Id=sqlserver连接名,
            //Password=数据库连接密码,integrated Security=True
            string        str  = @"Data Source=(local)\SQLEXPRESS;Initial Catalog=zpjsb;Integrated Security=True";
            SqlConnection conn = new SqlConnection(str);


            SqlCommand     MyCommand     = new SqlCommand("SELECT 密码,类型 FROM Users WHERE 账号='" + ID + "'", conn); //定义一个数据库操作指令
            SqlDataAdapter SelectAdapter = new SqlDataAdapter();                                                  //定义一个数据适配器

            SelectAdapter.SelectCommand = MyCommand;                                                              //定义数据适配器的操作指令
            DataSet MyDataSet = new DataSet();                                                                    //定义一个数据集

            conn.Open();                                                                                          //打开数据库连接
            SelectAdapter.SelectCommand.ExecuteNonQuery();                                                        //执行数据库查询指令
            conn.Close();                                                                                         //关闭数据库
            SelectAdapter.Fill(MyDataSet);                                                                        //填充数据集
            //DataGrid DataGird1 = new DataGrid();



            DataTable table = MyDataSet.Tables[0]; //查询第一张表
            int       flag  = 0;

            //  MessageBox.Show(table.Rows.Count + "AAAAA" + table.Columns.Count);
            for (int i = 0; i < table.Rows.Count; i++) //遍历每一行,DataTable包含若干个行
            {
                DataRow row = table.Rows[i];           //遍历每一行,得到每一行的内容
                //  MessageBox.Show(table.Columns.Count.ToString());

                flag = 1;
                for (int j = 0; j < table.Columns.Count; j++)  //遍历row的列
                // MessageBox.Show(row[j].ToString().Trim());
                {
                    if (j == 0)
                    {
                        if (!(row[j].ToString().Trim() == str2.Trim()))
                        {
                            flag = 2;
                        }
                    }
                    if (j == 1)
                    {
                        if (!(row[j].ToString().Trim() == user_flag.ToString()))
                        {
                            flag = 3;
                        }
                    }
                }
                //if (j != 2 && flag != 3)
                //    flag = 1;
            }
            // MessageBox.Show(flag.ToString());


            // flag = 1;

            if (flag == 1)
            {
                if (user_flag == 1)
                {
                    Form4__用户登录 f4 = new Form4__用户登录(ID, this);
                    f4.Show();
                }
                else if (user_flag == 2)
                {
                    Form5__管理员登入 f5 = new Form5__管理员登入(ID, this);
                    f5.Show();
                }
                this.Hide();
            }
            else if (flag == 2)
            {
                MessageBox.Show("密码错误,请重新输入!");
            }
            else if (flag == 0)
            {
                MessageBox.Show("账号不存在,请重新输入!");
            }
            else if (flag == 3)
            {
                MessageBox.Show("类型错误,请重新选择!");
            }
        }
예제 #7
0
 public Form14__删除图书(Form5__管理员登入 f)
 {
     InitializeComponent();
     init();
     lastform = f;
 }
 public Form11__管理员修改学生密码(Form5__管理员登入 f)
 {
     InitializeComponent();
     lastform = f;
 }