⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 librarymanager.cs

📁 图书馆信息管理系统 Library Information Management System
💻 CS
📖 第 1 页 / 共 4 页
字号:
#region Using
using System;
using System.Drawing;
//using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.IO;
using Library.Class;
using DataBaseOperation;
#endregion

namespace Library
{
	/// <summary>
	/// Global 的摘要说明。
	/// </summary>
	public class Global : System.Windows.Forms.Form
	{
		#region 控件变量
		private System.Windows.Forms.MainMenu mnuMain;
		private System.Windows.Forms.MenuItem menuItem3;
		private System.Windows.Forms.MenuItem mnuBuyBooks;
		private System.Windows.Forms.MenuItem menuItem10;
		private System.Windows.Forms.MenuItem menuItem11;
		private System.Windows.Forms.MenuItem mnuAddNewCard;
		private System.Windows.Forms.MenuItem menuItem19;
		private System.Windows.Forms.MenuItem menuItem20;
		private System.Windows.Forms.MenuItem mnuSystem;
		private System.Windows.Forms.MenuItem mnuExitSystem;
		private System.Windows.Forms.MenuItem mnuHelp;
		private System.Windows.Forms.MenuItem mnuWindows;
		private System.Windows.Forms.ImageList iltToolBar;
		private System.Windows.Forms.ToolBar tbMain;
		private System.Windows.Forms.ToolBarButton toolBarButton1;
		private System.Windows.Forms.ToolBarButton toolBarButton2;
		private System.Windows.Forms.ToolBarButton toolBarButton6;
		private System.Windows.Forms.MenuItem mnuAboutLibraryManageSystem;
		private System.Windows.Forms.MenuItem mnuReturnBooks;
		private System.Windows.Forms.MenuItem mnuCancelReader;
		private System.Windows.Forms.MenuItem mnuProvisionalLeave;
		private System.Windows.Forms.MenuItem mnuStatistics;
		private System.Windows.Forms.MenuItem mnuBooksStatistics;
		private System.Windows.Forms.MenuItem mnuReaderStatistics;
		private System.Windows.Forms.MenuItem mnuRegisterLoss;
		private System.Windows.Forms.MenuItem mnuLiftLossRegister;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem mnuBooksSetting;
		private System.Windows.Forms.MenuItem mnuBooksManage;
		private System.Windows.Forms.MenuItem mnuReaderManage;
		private System.Windows.Forms.MenuItem mnuSystemSearch;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.MenuItem menuItem6;
		private System.Windows.Forms.MenuItem menuItem18;
		private System.Windows.Forms.MenuItem menuItem21;
		private System.Windows.Forms.MenuItem menuItem22;
		private System.Windows.Forms.MenuItem menuItem23;
		private System.Windows.Forms.MenuItem menuItem25;
		private System.Windows.Forms.MenuItem menuItem27;
		private System.Windows.Forms.MenuItem menuItem32;
		private System.Windows.Forms.MenuItem menuItem33;
		private System.Windows.Forms.MenuItem menuItem34;
		private System.Windows.Forms.MenuItem menuItem35;
		private System.Windows.Forms.MenuItem menuItem36;
		private System.Windows.Forms.MenuItem menuItem37;
		private System.Windows.Forms.MenuItem menuItem38;
		private System.Windows.Forms.MenuItem menuItem39;
		private System.Windows.Forms.MenuItem menuItem40;
		private System.Windows.Forms.MenuItem menuItem41;
		private System.Windows.Forms.MenuItem menuItem42;
		private System.Windows.Forms.MenuItem menuItem43;
		private System.Windows.Forms.MenuItem menuItem44;
		private System.Windows.Forms.ToolBarButton toolBarButton3;
		private System.Windows.Forms.ToolBarButton toolBarButton4;
		private System.Windows.Forms.ToolBarButton toolBarButton5;
		private System.Windows.Forms.ToolBarButton toolBarButton7;
		private System.Windows.Forms.MenuItem menuItem48;
		private System.Drawing.Printing.PrintDocument prtDocument;
		private System.Windows.Forms.PageSetupDialog dlgPageSetup;
		private System.Windows.Forms.PrintDialog dlgPrint;
		private System.Windows.Forms.MenuItem mnuPressSetting;
		private System.Windows.Forms.MenuItem mnuUserSetting;
		private System.Windows.Forms.MenuItem mnuLibraryInfo;
		private System.Windows.Forms.MenuItem mnuBorrowBooks;
		private System.Windows.Forms.MenuItem mnuBooksInfo;
		private System.ComponentModel.IContainer components;
		#endregion

		#region 静态变量
		/// <summary>
		/// 状态栏sbrGlobal
		/// </summary>
		public static System.Windows.Forms.StatusBar sbrGlobal;
		/// <summary>
		/// 状态栏Panel sbpGlobal
		/// </summary>
		public static System.Windows.Forms.StatusBarPanel sbpGlobal;
		/// <summary>
		/// 状态栏Panel sbpOther
		/// </summary>
		public static System.Windows.Forms.StatusBarPanel sbpOther;
		/// <summary>
		/// SqlConnection
		/// </summary>
		public static SqlConnection conn;
		/// <summary>
		/// SqlConnection.ConnectionString
		/// </summary>
		public static string ConnectionString = @"data source = localhost;
												initial catalog = Library;
												integrated security = SSPI;
												persist security info = False;
												packet size= 4096";
		/// <summary>
		/// 激活状态的子窗体
		/// </summary>
		public static string ActiveChild = "null";
		/// <summary>
		/// BooksInfo窗口打开标志
		/// </summary>
		public static bool BooksInfo = false;
		/// <summary>
		/// BorrowBooks窗口打开标志
		/// </summary>
		public static bool BorrowBooks = false;
		/// <summary>
		/// 续借图书窗口打开标志
		/// </summary>
		public static bool ReborrowBooks = false;
		/// <summary>
		/// 归还图书窗口打开标志
		/// </summary>
		public static bool ReturnBooks = false;
		/// <summary>
		/// 图书借阅排名窗口打开标志
		/// </summary>
		public static bool BooksStatistics = false;
		/// <summary>
		/// 读者借阅排名窗口打开标志
		/// </summary>
		public static bool ReaderStatistics = false;
		/// <summary>
		/// 登陆的用户名
		/// </summary>
		public static string UserName;
		/// <summary>
		/// 登陆窗体
		/// </summary>
		public static Library.LoginSystem m_LoginSystem ;
		/// <summary>
		/// 权限设置_ 系统设置
		/// </summary>
		public static bool b_SystemSetting = false;
		/// <summary>
		/// 权限设置_图书设置
		/// </summary>
		public static bool b_BooksSetting = false;
		/// <summary>
		/// 权限设置_图书管理
		/// </summary>
		public static bool b_BooksManage = false;
		/// <summary>
		/// 权限设置_读者管理
		/// </summary>
		public static bool b_ReaderManage = false;
		/// <summary>
		/// 权限设置_系统查询
		/// </summary>
		public static bool b_SystemSearch = false;
		/// <summary>
		/// 权限设置_统计排名
		/// </summary>
		public static bool b_Statistics = false;
		#endregion

		#region 其他变量
		/// <summary>
		/// MDI窗体中的客户区,获取此客户区可以实现MDI窗体中显示图形等
		/// </summary>
		private System.Windows.Forms.MdiClient mdiClient;
		private System.Windows.Forms.MenuItem mnuReaderManager;
		private System.Windows.Forms.MenuItem menuItem2;
		/// <summary>
		/// 配置
		/// </summary>
		public static DBConfig db = new DBConfig();
		#endregion

		#region 程序初始化与关闭时销毁
		/// <summary>
		/// 生成字符串
		/// </summary>
		/// <returns></returns>
		public void createConnectionString()
		{
			if(db.Exists())
			{
				db = DBConfig.Load();
				ConnectionString = "server=" + db.DbSource + ";database=" + db.DbName + ";uid="+db.UID + ";pwd="+db.PWD;
				//数据库联接字符串
				conn.ConnectionString = ConnectionString;
				try
				{
					conn.Open();
				}
				catch(Exception ex)
				{
					conn.Close();
					MessageBox.Show("数据库连接错误!系统将转到数据库配置向导!\n错误信息:\n\t" + ex.ToString(),"错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
					Library.DataBaseSetting dbs = new DataBaseSetting();
					dbs.ShowDialog();
				}
			}
			else
			{
				Library.DataBaseSetting dbs = new DataBaseSetting();
				dbs.ShowDialog();
			}
		}
		public Global()
		{
			//Library.Class.HashMethod hm = new HashMethod();
			//Console.WriteLine(hm.Encrypto("admin"));
			Library.SplashForm sf = new SplashForm();
			sf.Show();
			//数据库联接
			conn = new SqlConnection();
			createConnectionString();
			sf.Close();
			//
			//登陆
			//
			m_LoginSystem = new LoginSystem(true);
			m_LoginSystem.ShowDialog();
			//
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//状态栏
			sbrGlobal = new System.Windows.Forms.StatusBar();
			sbpGlobal = new System.Windows.Forms.StatusBarPanel();
			sbpOther = new StatusBarPanel();
			((System.ComponentModel.ISupportInitialize)(sbpGlobal)).BeginInit();
			// 
			// sbrGlobal
			// 
			sbrGlobal.Location = new System.Drawing.Point(0, 548);
			sbrGlobal.Name = "sbrGlobal";
			sbrGlobal.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {sbpGlobal,sbpOther});
			sbrGlobal.ShowPanels = true;
			sbrGlobal.Size = new System.Drawing.Size(794, 20);
			sbrGlobal.SizingGrip = false;
			sbrGlobal.TabIndex = 0;
			//
			//sbpOther
			//
			sbpOther.Width = 200;
			sbpOther.Text = "当前登陆用户:" + UserName;
			// 
			// sbpGlobal
			// 
			sbpGlobal.Text = "就绪";
			sbpGlobal.Width = 594;
			this.Controls.Add(sbrGlobal);
			((System.ComponentModel.ISupportInitialize)(sbpGlobal)).EndInit();
			//
			//准备获取MdiClient
			//
			int iCnt=this.Controls.Count;
			for(int i=0;i<this.Controls.Count;i++)
			{
				if(this.Controls[i].GetType().ToString()=="System.Windows.Forms.MdiClient")
				{
					this.mdiClient=(System.Windows.Forms.MdiClient)this.Controls[i];
					break;
				}
			}
			string fbImage = Application.StartupPath + "\\Images\\backGround.jpg";
			if(File.Exists(fbImage))
			{
				Bitmap bm = new Bitmap(fbImage);
				this.mdiClient.BackgroundImage = bm;
			}
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>
		[STAThread]
		static void Main() 
		{
			//采用Windows XP界面
			Application.DoEvents();
			Application.EnableVisualStyles();
			Application.DoEvents();
			//系统运行
			Application.Run(new Global());
		}
		#endregion

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Global));
			this.mnuMain = new System.Windows.Forms.MainMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.mnuProvisionalLeave = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.mnuExitSystem = new System.Windows.Forms.MenuItem();
			this.mnuSystem = new System.Windows.Forms.MenuItem();
			this.mnuUserSetting = new System.Windows.Forms.MenuItem();
			this.mnuLibraryInfo = new System.Windows.Forms.MenuItem();
			this.mnuBooksSetting = new System.Windows.Forms.MenuItem();
			this.mnuPressSetting = new System.Windows.Forms.MenuItem();
			this.menuItem48 = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.mnuBooksManage = new System.Windows.Forms.MenuItem();
			this.mnuBuyBooks = new System.Windows.Forms.MenuItem();
			this.mnuBooksInfo = new System.Windows.Forms.MenuItem();
			this.menuItem6 = new System.Windows.Forms.MenuItem();
			this.mnuBorrowBooks = new System.Windows.Forms.MenuItem();
			this.menuItem10 = new System.Windows.Forms.MenuItem();
			this.menuItem11 = new System.Windows.Forms.MenuItem();
			this.mnuReturnBooks = new System.Windows.Forms.MenuItem();
			this.menuItem18 = new System.Windows.Forms.MenuItem();
			this.menuItem21 = new System.Windows.Forms.MenuItem();
			this.menuItem22 = new System.Windows.Forms.MenuItem();
			this.mnuReaderManage = new System.Windows.Forms.MenuItem();
			this.menuItem23 = new System.Windows.Forms.MenuItem();
			this.menuItem25 = new System.Windows.Forms.MenuItem();
			this.mnuAddNewCard = new System.Windows.Forms.MenuItem();
			this.mnuCancelReader = new System.Windows.Forms.MenuItem();
			this.mnuRegisterLoss = new System.Windows.Forms.MenuItem();
			this.mnuLiftLossRegister = new System.Windows.Forms.MenuItem();
			this.menuItem27 = new System.Windows.Forms.MenuItem();
			this.mnuReaderManager = new System.Windows.Forms.MenuItem();
			this.mnuSystemSearch = new System.Windows.Forms.MenuItem();
			this.menuItem32 = new System.Windows.Forms.MenuItem();
			this.menuItem33 = new System.Windows.Forms.MenuItem();
			this.menuItem34 = new System.Windows.Forms.MenuItem();
			this.menuItem35 = new System.Windows.Forms.MenuItem();
			this.menuItem36 = new System.Windows.Forms.MenuItem();
			this.menuItem37 = new System.Windows.Forms.MenuItem();
			this.menuItem38 = new System.Windows.Forms.MenuItem();
			this.menuItem39 = new System.Windows.Forms.MenuItem();
			this.menuItem40 = new System.Windows.Forms.MenuItem();
			this.menuItem41 = new System.Windows.Forms.MenuItem();
			this.menuItem42 = new System.Windows.Forms.MenuItem();
			this.menuItem43 = new System.Windows.Forms.MenuItem();
			this.menuItem44 = new System.Windows.Forms.MenuItem();
			this.mnuStatistics = new System.Windows.Forms.MenuItem();
			this.mnuBooksStatistics = new System.Windows.Forms.MenuItem();
			this.mnuReaderStatistics = new System.Windows.Forms.MenuItem();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -