private void tsbReflesh_Click(object sender, EventArgs e) { string time = dbl.GetTime(9); if (cmbCheckList.Text.Trim() == "所有预借记录") { dbl.InfoShow("" + Sql + "", dgvReserBroInfo); } if (cmbCheckList.Text.Trim() == "今天预借记录") { dbl.InfoShow("" + Sql + " where r_ReadyTime like'%" + time + "%'", dgvReserBroInfo); } }
//当文本框中的文本变化时进行查询 private void txtBookNameorID_TextChanged(object sender, EventArgs e) { string time = db.GetTime(9); if (cmbCheckList.Text.Trim() == "今日操作记录") { db.InfoShow("" + Sql + " where ((BookName like'%" + txtBookNameorID.Text.Trim() + "%') or (BookStrichcode like'%" + txtBookNameorID.Text.Trim() + "%'))and HandleDate like'" + time + "%' order by HandleNumber", dgvNote); } else { db.InfoShow("" + Sql + " where (BookName like'%" + txtBookNameorID.Text.Trim() + "%') or (BookStrichcode like'%" + txtBookNameorID.Text.Trim() + "%') order by HandleNumber", dgvNote); } }
private void butSelect_Click(object sender, EventArgs e) { string time = dbl.GetTime(9); if (cmbTimelist.Text.Trim() == "所有借阅") { //利用今天的时间来查询符合条件的记录 Reflseh("select Number 借阅编号,CardID 借书证号,ReaderName 读者姓名,BookID 图书编号,BookName 图书名称,Author 图书作者,Publisher 出版社,Price 图书价格,BorrowDate 借书日期,BorrowNumber 借书数量,UserName 操作员,BroTieme 借阅时长,IsOverdue 是否超期 FROM Borrow WHERE (CardID LIKE '%" + textBox1.Text + "%') or(ReaderName LIKE '%" + textBox1.Text + "%')"); } else { //无条件,显示所有借阅记录 Reflseh("select Number 借阅编号,CardID 借书证号,ReaderName 读者姓名,BookID 图书编号,BookName 图书名称,Author 图书作者,Publisher 出版社,Price 图书价格,BorrowDate 借书日期,BorrowNumber 借书数量,UserName 操作员,BroTieme 借阅时长,IsOverdue 是否超期 FROM Borrow WHERE ((CardID LIKE '%" + textBox1.Text + "%') or(ReaderName LIKE '%" + textBox1.Text + "%')) and BorrowDate like '" + time + "%'"); } }
private void frmBookAbout_Load(object sender, EventArgs e) { cmbCheckList.SelectedIndex = 0; dupBookNumber.SelectedIndex = 0; dupBroTime.SelectedIndex = 2; //txtReader.ReadOnly = true; //txtBookName.ReadOnly = true; //获得屏幕的大小,并设置窗体初始化时的大小 Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen; this.Width = rect.Width - 120; this.Height = rect.Height - 157; string timeload = dbl.GetTime(9); dbl.InfoShow("" + Sql + " where HandleDate like '%" + timeload + "%'", dgvHandleInfo); }
private void frmMain_Load(object sender, EventArgs e) { if (frmlogin.type == "普通用户") { 用户管理UToolStripMenuItem.Enabled = false; } //设置时间和日期 tssl1.Text = "今天日期:" + System.DateTime.Now.ToLongDateString(); tssl2.Text = "登录时间:" + System.DateTime.Now.ToLongTimeString(); tsslLoginUser.Text = "当前用户:" + " " + frmlogin.userName; //系统启动时导航栏的状态 listView1.Clear(); listView1.LargeImageList = imageList1; listView1.Items.Add("借阅管理", " 借阅管理", 0); listView1.Items.Add("借阅查询", " 借阅查询", 1); listView1.Items.Add("操作流水", " 操作流水", 2); listView1.Items.Add("预借详情", " 预借详情", 3); listView1.Items.Add("帐务管理", " 帐务管理", 4); listView1.Items.Add("备忘管理", " 备忘管理", 5); //起始窗口布局 层叠窗口CToolStripMenuItem.Checked = true; this.LayoutMdi(MdiLayout.Cascade); 竖排窗口VToolStripMenuItem.Checked = false; 横排窗口HToolStripMenuItem.Checked = false; toolStrip1.AutoSize = false; this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); notifyIcon1.Visible = false; this.SizeChanged += new System.EventHandler(this.frmMain_SizeChanged); //Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen; //获得屏幕宽度 tssl1.Width = this.Width / 5; tssl2.Width = this.Width / 5; tssl3.Width = this.Width / 5; tsslLoginUser.Width = this.Width / 5; //插入登录记录 string time = dbl.GetTime(3); int Number = dbl.AutoNumber("select Max(Number) from Journal"); db.ExeInfochange("insert into Journal values (" + Number + ",'" + frmlogin.userName + "','" + frmlogin.type + "','" + time + "')"); }
private void butOk_Click(object sender, EventArgs e) { if (cmbDataType.Text == "数据库备份") { try { SqlConnection con = new SqlConnection(); con.ConnectionString = "server=.;database =51asp.net_Library;uid=sa;pwd=51asp.net"; con.Open(); SqlCommand com = new SqlCommand(); //实现数据库备份 com.CommandText = "BACKUP DATABASE " + "Library" + " TO DISK = '" + waybackup + "'"; com.Connection = con; int number = com.ExecuteNonQuery(); if (number == -1) { MessageBox.Show("数据库备份成功!", "提示"); string time = dbl.GetTime(3); int Number1 = dbl.AutoNumber("select Max(Number) from Backupinfo"); string strSql = "insert into Backupinfo values (" + Number1 + ",'" + frmlogin.userName + "','" + time + "','" + cmbDataType.Text + "','" + txtBackupWay.Text + "')"; InserInfo(strSql); } con.Close(); con.Dispose(); } catch (Exception) { MessageBox.Show("数据库备份失败!", "提示"); } } else { if (cmbDataType.Text == "数据库还原") { try { //实现数据库还原 string SqlStr1 = "server=.;database =51asp.net_Library;uid=sa;pwd=51asp.net"; SqlConnection con = new SqlConnection(SqlStr1); con.Open(); string SqlStr2 = "use master restore database " + "Library" + " from disk='" + txtBackupWay.Text + "'"; //string SqlStr2 = "insert into Backupinfo values ('123','2008-12-5','D:')"; SqlCommand cmd = new SqlCommand(SqlStr2, con); cmd.Connection = con; int number = cmd.ExecuteNonQuery(); if (number == -1) { MessageBox.Show("还原数据库成功!", "提示"); string time = dbl.GetTime(3); int Number2 = dbl.AutoNumber("select Max(Number) from Backupinfo"); string strSql1 = "insert into Backupinfo values (," + Number2 + "," + frmlogin.userName + "','" + time + "','" + cmbDataType.Text + "','" + txtBackupWay.Text + "')"; InserInfo(strSql1); } con.Close(); con.Dispose(); } catch (Exception) { //throw new Exception(ce.Message); MessageBox.Show("数据库还原失败!", "提示"); } } } }
private void butOk_Click(object sender, EventArgs e) { string time; time = dateTimePicker1.Text.ToString() + " " + dateTimePicker2.Text.ToString(); if (HandleType == "添加") { int Number = dbl.AutoNumber("select max(Number) from Remind"); if (checkBox2.Checked == true) { dbc.ExeInfochange("insert into Remind values(" + Number + ",'尚未提示','" + time + "','" + txtRemind.Text.Trim() + "','是','" + cmbRemindWay.Text + "','" + txtReaderName.Text.Trim() + "','" + dbl.GetTime(3) + "')"); } if (checkBox2.Checked == false) { dbc.ExeInfochange("insert into Remind values(" + Number + ",'尚未提示','" + time + "','" + txtRemind.Text.Trim() + "','否 ','" + cmbRemindWay.Text + "','" + txtReaderName.Text.Trim() + "','" + dbl.GetTime(3) + "')"); } MessageBox.Show("添加成功!", "提示"); butOk.Enabled = false; butExit.Enabled = false; tsbAdd.Enabled = true; tsbChange.Enabled = true; } if (HandleType == "修改") { if (checkBox2.Checked == true) { dbc.ExeInfochange("update Remind set Statue='尚未提示',RemindTime='" + time + "',Content='" + txtRemind.Text.Trim() + "',IsRemind='是',Type='" + cmbRemindWay.Text + "',IsToReader='" + txtReaderName.Text.Trim() + "'where Number='" + txtRemorandum.Text.Trim() + "'"); } if (checkBox2.Checked == false) { dbc.ExeInfochange("update Remind set Statue='尚未提示',RemindTime='" + time + "',Content='" + txtRemind.Text.Trim() + "',IsRemind='否',Type='" + cmbRemindWay.Text + "',IsToReader='" + txtReaderName.Text.Trim() + "' where Number='" + txtRemorandum.Text.Trim() + "'"); } MessageBox.Show("修改成功!", "提示"); butOk.Enabled = false; butExit.Enabled = false; tsbAdd.Enabled = true; tsbChange.Enabled = true; } txtRemorandum.Clear(); txtReaderName.Clear(); txtRemind.Clear(); Reflseh(); }