private void tbtn_college_Click(object sender, EventArgs e) { Log.log.user_college = true; //判断是用户窗体处单击的 admin_Type admin_Type = new admin_Type(); //实例化admin_Type admin_Type.ShowDialog(); //显示 }
//添加用户按钮的显示事件 private void tsbtn_add_Click(object sender, EventArgs e) { string sql = "select c_id from college"; //查询语句 con = dButil.SqlOpen(); //打开数据库 cmd = new SqlCommand(sql, con); //储存语句 string id = Convert.ToString(cmd.ExecuteScalar()); //执行sql语句,获得返回值进行判断 con.Close(); //关闭数据库 if (id.Equals("")) //如果为空跳转到添加学院界面 { DialogResult dialog = MessageBox.Show("数据库中无学院请先添加学院,点击确认跳转!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialog == DialogResult.OK) { Log.log.user_college = true; //判断是用户窗体处单击的 admin_Type admin_BookType = new admin_Type(); //实例化admin_BookType窗体 admin_BookType.ShowDialog(); //以对话框模式显示 } } else//否则显示添加图书界面 { admin_userAdd userAdd = new admin_userAdd(); userAdd.ShowDialog(); //查询全部的sql语句,实现刷新 sql = "select * from V_Listuser"; databind(sql);//传递sql然后查询填充 } }
//添加新类别按钮事件 private void tsbtn_type_Click(object sender, EventArgs e) { Log.log.user_college = false; //说明是图书窗体单击的 admin_Type admin_Type = new admin_Type(); //实例化admin_Type窗体 admin_Type.ShowDialog(); //以对话框模式显示 }
//添加图书按钮事件 private void tsbtn_bookadd_Click(object sender, EventArgs e) { string sql = "select t_id from type"; //查询语句 con = dButil.SqlOpen(); //打开数据库 cmd = new SqlCommand(sql, con); //储存语句 string id = Convert.ToString(cmd.ExecuteScalar()); //执行sql语句,获得返回值进行判断 con.Close(); //关闭数据库 if (id.Equals("")) //如果为空跳转到添加图书类别界面 { DialogResult dialog = MessageBox.Show("数据库中无图书类别请先添加图书类别,点击确认跳转!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialog == DialogResult.OK) { admin_Type admin_BookType = new admin_Type(); //实例化admin_BookType窗体 admin_BookType.ShowDialog(); //以对话框模式显示 } } else//否则显示添加图书界面 { admin_BookAdd admin_BookAdd = new admin_BookAdd();//实例化admin_BookAdd窗体 admin_BookAdd.ShowDialog();//以对话框模式显示 //关闭添加图书窗体后,刷新界面数据 sql = "select * from V_bookPage"; databind(sql);//传递sql然后查询填充 } }
//跳转到添加学院窗体 private void link_college_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Log.log.user_college = true; //判断是用户窗体处单击的 admin_Type admin_Type = new admin_Type(); //实例化admin_Type admin_Type.ShowDialog(); //显示 BookType(); //刷新学院下拉框 }
//添加新类别的按钮 private void lkl_type_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Log.log.user_college = false; admin_Type bookType = new admin_Type(); bookType.ShowDialog(); BookType(); }