www.pudn.com > MainPrj_CarShop.rar > MdiFrm_Main.cs
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using MainPrj_CarShop;
using car;
using Indispost;
using CarStorehouse;
using SALE;
using frmCarInfo = car.frmCarInfo;
using Client;
namespace MainPrj_CarShop
{
///
/// Form1 的摘要说明。
///
public class MdiFrm_Main : System.Windows.Forms.Form
{
#region 控件变量定义
private System.Windows.Forms.ContextMenu contextMenu1;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem mnuSysMag;
private System.Windows.Forms.MenuItem mnuRLog;
private System.Windows.Forms.MenuItem mnuPwd;
private System.Windows.Forms.MenuItem mnuDataBack;
private System.Windows.Forms.MenuItem mnuDataRestore;
private System.Windows.Forms.MenuItem mnuSysIni;
private System.Windows.Forms.MenuItem mnuSysOpt;
private System.Windows.Forms.MenuItem mnuExit;
private System.Windows.Forms.MenuItem mnuCar;
private System.Windows.Forms.MenuItem menuItem14;
private System.Windows.Forms.MenuItem menuItem17;
private System.Windows.Forms.MenuItem mnuBase;
private System.Windows.Forms.MenuItem mnuFac;
private System.Windows.Forms.MenuItem mnuBuyer;
private System.Windows.Forms.MenuItem menuItem42;
private System.Windows.Forms.MenuItem mnuDepInfo;
private System.Windows.Forms.MenuItem mnuMoneyQ;
private System.Windows.Forms.MenuItem mnuBuy;
private System.Windows.Forms.MenuItem mnuBook;
private System.Windows.Forms.MenuItem mnuInDep;
private System.Windows.Forms.MenuItem mnuBuyPay;
private System.Windows.Forms.MenuItem mnuSell;
private System.Windows.Forms.MenuItem mnuReady;
private System.Windows.Forms.MenuItem mnuSelling;
private System.Windows.Forms.MenuItem mnuSellTake;
private System.Windows.Forms.MenuItem menuItem23;
private System.Windows.Forms.MenuItem menuItem30;
private System.Windows.Forms.MenuItem menuItem35;
private System.Windows.Forms.MenuItem mnuDepot;
private System.Windows.Forms.MenuItem mnuDepCar;
private System.Windows.Forms.MenuItem mnuMoveCar;
private System.Windows.Forms.MenuItem mnuReport;
private System.Windows.Forms.MenuItem menuItem11;
private System.Windows.Forms.MenuItem mnuHelp;
private System.Windows.Forms.MenuItem mnuDirHelp;
private System.Windows.Forms.MenuItem mnuAbout;
private System.Windows.Forms.ToolBar toolBar1;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.ToolBarButton toolBarButton1;
private System.Windows.Forms.ToolBarButton tbn;
private System.Windows.Forms.ToolBarButton tbnStock_m;
private System.Windows.Forms.ToolBarButton tbnInDep_m;
private System.Windows.Forms.ToolBarButton tbnPay_m;
private System.Windows.Forms.ToolBarButton toolBarButton7;
private System.Windows.Forms.ToolBarButton tbnSell_m;
private System.Windows.Forms.ToolBarButton tbnSellMon_m;
private System.Windows.Forms.ToolBarButton tb;
private System.Windows.Forms.ToolBarButton tbnExit_m;
private System.Windows.Forms.StatusBarPanel sbplabel;
private System.Windows.Forms.StatusBarPanel tbpUserName_m;
private System.Windows.Forms.StatusBarPanel tbpLabel2;
private System.Windows.Forms.StatusBarPanel sbpNowTime_m;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.Button Dir;
private System.Windows.Forms.Panel pnlLeft;
#endregion
public static string UserID;
public static string UserName;
public static string UserJob;
private System.Windows.Forms.StatusBar _stuBar;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.ToolBarButton tbnSelPre;
private System.Windows.Forms.MenuItem mnuVerti;
private System.Windows.Forms.MenuItem mnuHort;
private System.Windows.Forms.MenuItem mnuCascade;
private System.Windows.Forms.MenuItem mnuMaxChd;
private System.Windows.Forms.MenuItem mnuMinChd;
private System.Windows.Forms.MenuItem mnuLayout;
private System.Windows.Forms.MenuItem menuItem4;
private System.Timers.Timer _timer;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.FontDialog fontDialog1;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.MenuItem mnuContextDep;
private System.Windows.Forms.MenuItem mnuContextCar;
private System.Windows.Forms.MenuItem mnuContextFac;
private System.Windows.Forms.MenuItem mnuContextBuy;
private System.Windows.Forms.StatusBarPanel sbpCompany;
private System.Windows.Forms.StatusBarPanel sbpCompany_m;
private System.Windows.Forms.MenuItem mnuEmployee;
private System.Windows.Forms.MenuItem mmuComm;
private bool isLogExit;
public MdiFrm_Main()
{
//
// Windows 窗体设计器支持所必需的
//
try
{
InitializeComponent();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
//log.Close();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
///
/// 清理所有正在使用的资源。
///
protected override void Dispose( bool disposing )
{
try
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
#region Windows 窗体设计器生成的代码
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.contextMenu1 = new System.Windows.Forms.ContextMenu();
this.mnuContextCar = new System.Windows.Forms.MenuItem();
this.mnuContextBuy = new System.Windows.Forms.MenuItem();
this.mnuContextFac = new System.Windows.Forms.MenuItem();
this.mnuContextDep = new System.Windows.Forms.MenuItem();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.mnuSysMag = new System.Windows.Forms.MenuItem();
this.mnuRLog = new System.Windows.Forms.MenuItem();
this.mnuPwd = new System.Windows.Forms.MenuItem();
this.mnuEmployee = new System.Windows.Forms.MenuItem();
this.menuItem14 = new System.Windows.Forms.MenuItem();
this.mnuLayout = new System.Windows.Forms.MenuItem();
this.mnuVerti = new System.Windows.Forms.MenuItem();
this.mnuHort = new System.Windows.Forms.MenuItem();
this.mnuCascade = new System.Windows.Forms.MenuItem();
this.mnuMaxChd = new System.Windows.Forms.MenuItem();
this.mnuMinChd = new System.Windows.Forms.MenuItem();
this.menuItem11 = new System.Windows.Forms.MenuItem();
this.mnuDataBack = new System.Windows.Forms.MenuItem();
this.mnuDataRestore = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.mnuSysIni = new System.Windows.Forms.MenuItem();
this.mnuSysOpt = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem17 = new System.Windows.Forms.MenuItem();
this.mnuExit = new System.Windows.Forms.MenuItem();
this.mnuBase = new System.Windows.Forms.MenuItem();
this.mnuFac = new System.Windows.Forms.MenuItem();
this.mnuBuyer = new System.Windows.Forms.MenuItem();
this.mnuCar = new System.Windows.Forms.MenuItem();
this.mnuDepInfo = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem23 = new System.Windows.Forms.MenuItem();
this.mnuMoneyQ = new System.Windows.Forms.MenuItem();
this.mnuBuy = new System.Windows.Forms.MenuItem();
this.mnuBook = new System.Windows.Forms.MenuItem();
this.mnuInDep = new System.Windows.Forms.MenuItem();
this.menuItem30 = new System.Windows.Forms.MenuItem();
this.mnuBuyPay = new System.Windows.Forms.MenuItem();
this.mnuSell = new System.Windows.Forms.MenuItem();
this.mnuReady = new System.Windows.Forms.MenuItem();
this.mnuSelling = new System.Windows.Forms.MenuItem();
this.menuItem35 = new System.Windows.Forms.MenuItem();
this.mnuSellTake = new System.Windows.Forms.MenuItem();
this.mnuDepot = new System.Windows.Forms.MenuItem();
this.mnuDepCar = new System.Windows.Forms.MenuItem();
this.mnuMoveCar = new System.Windows.Forms.MenuItem();
this.mnuReport = new System.Windows.Forms.MenuItem();
this.mnuHelp = new System.Windows.Forms.MenuItem();
this.mnuDirHelp = new System.Windows.Forms.MenuItem();
this.menuItem42 = new System.Windows.Forms.MenuItem();
this.mnuAbout = new System.Windows.Forms.MenuItem();
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
this.tbn = new System.Windows.Forms.ToolBarButton();
this.tbnStock_m = new System.Windows.Forms.ToolBarButton();
this.tbnInDep_m = new System.Windows.Forms.ToolBarButton();
this.tbnPay_m = new System.Windows.Forms.ToolBarButton();
this.toolBarButton7 = new System.Windows.Forms.ToolBarButton();
this.tbnSelPre = new System.Windows.Forms.ToolBarButton();
this.tbnSell_m = new System.Windows.Forms.ToolBarButton();
this.tbnSellMon_m = new System.Windows.Forms.ToolBarButton();
this.tb = new System.Windows.Forms.ToolBarButton();
this.tbnExit_m = new System.Windows.Forms.ToolBarButton();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this._stuBar = new System.Windows.Forms.StatusBar();
this.sbplabel = new System.Windows.Forms.StatusBarPanel();
this.tbpUserName_m = new System.Windows.Forms.StatusBarPanel();
this.tbpLabel2 = new System.Windows.Forms.StatusBarPanel();
this.sbpNowTime_m = new System.Windows.Forms.StatusBarPanel();
this.sbpCompany = new System.Windows.Forms.StatusBarPanel();
this.sbpCompany_m = new System.Windows.Forms.StatusBarPanel();
this.pnlLeft = new System.Windows.Forms.Panel();
this.Dir = new System.Windows.Forms.Button();
this._timer = new System.Timers.Timer();
this.fontDialog1 = new System.Windows.Forms.FontDialog();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.mmuComm = new System.Windows.Forms.MenuItem();
((System.ComponentModel.ISupportInitialize)(this.sbplabel)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tbpUserName_m)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tbpLabel2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sbpNowTime_m)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sbpCompany)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.sbpCompany_m)).BeginInit();
this.pnlLeft.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this._timer)).BeginInit();
this.SuspendLayout();
//
// contextMenu1
//
this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuContextCar,
this.mnuContextBuy,
this.mnuContextFac,
this.mnuContextDep});
//
// mnuContextCar
//
this.mnuContextCar.Index = 0;
this.mnuContextCar.Text = "车型信息";
this.mnuContextCar.Click += new System.EventHandler(this.ContextMenu_Click);
//
// mnuContextBuy
//
this.mnuContextBuy.Index = 1;
this.mnuContextBuy.Text = "客户信息";
this.mnuContextBuy.Click += new System.EventHandler(this.ContextMenu_Click);
//
// mnuContextFac
//
this.mnuContextFac.Index = 2;
this.mnuContextFac.Text = "厂商信息";
this.mnuContextFac.Click += new System.EventHandler(this.ContextMenu_Click);
//
// mnuContextDep
//
this.mnuContextDep.Index = 3;
this.mnuContextDep.Text = "仓库信息";
this.mnuContextDep.Click += new System.EventHandler(this.ContextMenu_Click);
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuSysMag,
this.mnuBase,
this.mnuBuy,
this.mnuSell,
this.mnuDepot,
this.mnuReport,
this.mnuHelp});
//
// mnuSysMag
//
this.mnuSysMag.Index = 0;
this.mnuSysMag.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuRLog,
this.mnuPwd,
this.mnuEmployee,
this.menuItem14,
this.mnuLayout,
this.menuItem11,
this.mnuDataBack,
this.mnuDataRestore,
this.menuItem4,
this.mnuSysIni,
this.mnuSysOpt,
this.menuItem17,
this.mnuExit});
this.mnuSysMag.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
this.mnuSysMag.Text = "系统管理(&S)";
//
// mnuRLog
//
this.mnuRLog.Index = 0;
this.mnuRLog.Text = "重新登陆";
this.mnuRLog.Click += new System.EventHandler(this.mnuRLog_Click);
//
// mnuPwd
//
this.mnuPwd.Index = 1;
this.mnuPwd.Text = "更改密码";
this.mnuPwd.Click += new System.EventHandler(this.mnuPwd_Click);
//
// mnuEmployee
//
this.mnuEmployee.Index = 2;
this.mnuEmployee.Text = "添加员工";
//
// menuItem14
//
this.menuItem14.Index = 3;
this.menuItem14.Text = "-";
//
// mnuLayout
//
this.mnuLayout.Index = 4;
this.mnuLayout.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuVerti,
this.mnuHort,
this.mnuCascade,
this.mnuMaxChd,
this.mnuMinChd});
this.mnuLayout.Text = "窗体布局";
//
// mnuVerti
//
this.mnuVerti.Index = 0;
this.mnuVerti.Text = "垂直";
this.mnuVerti.Click += new System.EventHandler(this.mnuLayoutForms_Click);
//
// mnuHort
//
this.mnuHort.Index = 1;
this.mnuHort.Text = "水平";
this.mnuHort.Click += new System.EventHandler(this.mnuLayoutForms_Click);
//
// mnuCascade
//
this.mnuCascade.Index = 2;
this.mnuCascade.Text = "层叠";
this.mnuCascade.Click += new System.EventHandler(this.mnuLayoutForms_Click);
//
// mnuMaxChd
//
this.mnuMaxChd.Checked = true;
this.mnuMaxChd.Index = 3;
this.mnuMaxChd.Text = "最大化";
this.mnuMaxChd.Click += new System.EventHandler(this.mnuLayoutForms_Click);
//
// mnuMinChd
//
this.mnuMinChd.Index = 4;
this.mnuMinChd.Text = "最小化";
this.mnuMinChd.Click += new System.EventHandler(this.mnuLayoutForms_Click);
//
// menuItem11
//
this.menuItem11.Index = 5;
this.menuItem11.Text = "-";
//
// mnuDataBack
//
this.mnuDataBack.Index = 6;
this.mnuDataBack.Text = "数据备份";
this.mnuDataBack.Click += new System.EventHandler(this.mnuDataBack_Click);
//
// mnuDataRestore
//
this.mnuDataRestore.Index = 7;
this.mnuDataRestore.Text = "数据恢复";
this.mnuDataRestore.Click += new System.EventHandler(this.mnuDataRestore_Click);
//
// menuItem4
//
this.menuItem4.Index = 8;
this.menuItem4.Text = "-";
//
// mnuSysIni
//
this.mnuSysIni.Index = 9;
this.mnuSysIni.Text = "系统初始化";
this.mnuSysIni.Click += new System.EventHandler(this.mnuSysIni_Click);
//
// mnuSysOpt
//
this.mnuSysOpt.Index = 10;
this.mnuSysOpt.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem5,
this.menuItem6,
this.menuItem7});
this.mnuSysOpt.Text = "系统设置(&O)";
//
// menuItem5
//
this.menuItem5.Index = 0;
this.menuItem5.Text = "字体";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// menuItem6
//
this.menuItem6.Index = 1;
this.menuItem6.Text = "背景";
this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
//
// menuItem7
//
this.menuItem7.Index = 2;
this.menuItem7.Text = "恢复默认";
this.menuItem7.Click += new System.EventHandler(this.menuItem7_Click);
//
// menuItem17
//
this.menuItem17.Index = 11;
this.menuItem17.Text = "-";
//
// mnuExit
//
this.mnuExit.Index = 12;
this.mnuExit.Text = "退出(&E)";
this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);
//
// mnuBase
//
this.mnuBase.Index = 1;
this.mnuBase.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuFac,
this.mnuBuyer,
this.mnuCar,
this.mnuDepInfo,
this.mmuComm,
this.menuItem3,
this.menuItem2,
this.menuItem1,
this.menuItem23,
this.mnuMoneyQ});
this.mnuBase.Text = "基本数据(&B)";
//
// mnuFac
//
this.mnuFac.Index = 0;
this.mnuFac.Shortcut = System.Windows.Forms.Shortcut.F6;
this.mnuFac.Text = "厂商资料";
this.mnuFac.Click += new System.EventHandler(this.mnuFac_Click);
//
// mnuBuyer
//
this.mnuBuyer.Index = 1;
this.mnuBuyer.Shortcut = System.Windows.Forms.Shortcut.F8;
this.mnuBuyer.Text = "客户资料";
this.mnuBuyer.Click += new System.EventHandler(this.mnuBuyer_Click);
//
// mnuCar
//
this.mnuCar.Index = 2;
this.mnuCar.Shortcut = System.Windows.Forms.Shortcut.F7;
this.mnuCar.Text = "车型资料";
this.mnuCar.Click += new System.EventHandler(this.mnuCar_Click);
//
// mnuDepInfo
//
this.mnuDepInfo.Index = 3;
this.mnuDepInfo.Text = "仓库信息";
this.mnuDepInfo.Click += new System.EventHandler(this.mnuDepInfo_Click);
//
// menuItem3
//
this.menuItem3.Index = 5;
this.menuItem3.Text = "-";
//
// menuItem2
//
this.menuItem2.Index = 6;
this.menuItem2.Text = "客户回访";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem1
//
this.menuItem1.Index = 7;
this.menuItem1.Text = "客户跟踪";
this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
//
// menuItem23
//
this.menuItem23.Index = 8;
this.menuItem23.Text = "-";
//
// mnuMoneyQ
//
this.mnuMoneyQ.Index = 9;
this.mnuMoneyQ.Text = "收付款摘要";
//
// mnuBuy
//
this.mnuBuy.Index = 2;
this.mnuBuy.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuBook,
this.mnuInDep,
this.menuItem30,
this.mnuBuyPay});
this.mnuBuy.Shortcut = System.Windows.Forms.Shortcut.F3;
this.mnuBuy.Text = "进货管理(&I)";
//
// mnuBook
//
this.mnuBook.Index = 0;
this.mnuBook.Shortcut = System.Windows.Forms.Shortcut.F3;
this.mnuBook.Text = "采购订单";
this.mnuBook.Click += new System.EventHandler(this.mnuBook_Click);
//
// mnuInDep
//
this.mnuInDep.Index = 1;
this.mnuInDep.Shortcut = System.Windows.Forms.Shortcut.F4;
this.mnuInDep.Text = "车辆入库";
this.mnuInDep.Click += new System.EventHandler(this.mnuInDep_Click);
//
// menuItem30
//
this.menuItem30.Index = 2;
this.menuItem30.Text = "-";
//
// mnuBuyPay
//
this.mnuBuyPay.Index = 3;
this.mnuBuyPay.Text = "采购付款";
//
// mnuSell
//
this.mnuSell.Index = 3;
this.mnuSell.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuReady,
this.mnuSelling,
this.menuItem35,
this.mnuSellTake});
this.mnuSell.Text = "销售管理(&L)";
//
// mnuReady
//
this.mnuReady.Index = 0;
this.mnuReady.Shortcut = System.Windows.Forms.Shortcut.F2;
this.mnuReady.Text = "车辆预售";
this.mnuReady.Click += new System.EventHandler(this.mnuReady_Click);
//
// mnuSelling
//
this.mnuSelling.Index = 1;
this.mnuSelling.Shortcut = System.Windows.Forms.Shortcut.F1;
this.mnuSelling.Text = "车辆销售";
this.mnuSelling.Click += new System.EventHandler(this.mnuSelling_Click);
//
// menuItem35
//
this.menuItem35.Index = 2;
this.menuItem35.Text = "-";
//
// mnuSellTake
//
this.mnuSellTake.Index = 3;
this.mnuSellTake.Shortcut = System.Windows.Forms.Shortcut.F5;
this.mnuSellTake.Text = "销售收款";
//
// mnuDepot
//
this.mnuDepot.Index = 4;
this.mnuDepot.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuDepCar,
this.mnuMoveCar});
this.mnuDepot.Text = "库存管理(&D)";
//
// mnuDepCar
//
this.mnuDepCar.Index = 0;
this.mnuDepCar.Shortcut = System.Windows.Forms.Shortcut.F9;
this.mnuDepCar.Text = "库存车辆";
this.mnuDepCar.Click += new System.EventHandler(this.mnuDepCar_Click);
//
// mnuMoveCar
//
this.mnuMoveCar.Index = 1;
this.mnuMoveCar.Text = "车辆移库";
this.mnuMoveCar.Click += new System.EventHandler(this.mnuMoveCar_Click);
//
// mnuReport
//
this.mnuReport.Index = 5;
this.mnuReport.Shortcut = System.Windows.Forms.Shortcut.F10;
this.mnuReport.Text = "查询报表(&Q)";
//
// mnuHelp
//
this.mnuHelp.Index = 6;
this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuDirHelp,
this.menuItem42,
this.mnuAbout});
this.mnuHelp.Text = "帮助(&H)";
//
// mnuDirHelp
//
this.mnuDirHelp.Index = 0;
this.mnuDirHelp.Shortcut = System.Windows.Forms.Shortcut.F11;
this.mnuDirHelp.Text = "目录";
//
// menuItem42
//
this.menuItem42.Index = 1;
this.menuItem42.Text = "-";
//
// mnuAbout
//
this.mnuAbout.Index = 2;
this.mnuAbout.Text = "关于(&A)";
this.mnuAbout.Click += new System.EventHandler(this.mnuAbout_Click);
//
// toolBar1
//
this.toolBar1.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarButton1,
this.tbn,
this.tbnStock_m,
this.tbnInDep_m,
this.tbnPay_m,
this.toolBarButton7,
this.tbnSelPre,
this.tbnSell_m,
this.tbnSellMon_m,
this.tb,
this.tbnExit_m});
this.toolBar1.DropDownArrows = true;
this.toolBar1.ImageList = this.imageList1;
this.toolBar1.Location = new System.Drawing.Point(0, 0);
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(692, 41);
this.toolBar1.TabIndex = 1;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// toolBarButton1
//
this.toolBarButton1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// tbn
//
this.tbn.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// tbnStock_m
//
this.tbnStock_m.Text = "采购订单";
//
// tbnInDep_m
//
this.tbnInDep_m.Text = "车辆入库";
//
// tbnPay_m
//
this.tbnPay_m.Text = "采购付款";
//
// toolBarButton7
//
this.toolBarButton7.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// tbnSelPre
//
this.tbnSelPre.Text = "车辆预售";
//
// tbnSell_m
//
this.tbnSell_m.Text = "车辆销售";
//
// tbnSellMon_m
//
this.tbnSellMon_m.Text = "销售收款";
//
// tb
//
this.tb.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// tbnExit_m
//
this.tbnExit_m.Text = "退出";
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// _stuBar
//
this._stuBar.Location = new System.Drawing.Point(0, 301);
this._stuBar.Name = "_stuBar";
this._stuBar.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
this.sbplabel,
this.tbpUserName_m,
this.tbpLabel2,
this.sbpNowTime_m,
this.sbpCompany,
this.sbpCompany_m});
this._stuBar.ShowPanels = true;
this._stuBar.Size = new System.Drawing.Size(692, 24);
this._stuBar.TabIndex = 2;
//
// sbplabel
//
this.sbplabel.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.sbplabel.MinWidth = 62;
this.sbplabel.Text = " 用户名称";
this.sbplabel.Width = 62;
//
// tbpUserName_m
//
this.tbpUserName_m.ToolTipText = "用户姓名";
//
// tbpLabel2
//
this.tbpLabel2.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.tbpLabel2.MinWidth = 40;
this.tbpLabel2.Text = "时间";
this.tbpLabel2.Width = 40;
//
// sbpNowTime_m
//
this.sbpNowTime_m.MinWidth = 130;
this.sbpNowTime_m.ToolTipText = "当前时间";
this.sbpNowTime_m.Width = 130;
//
// sbpCompany
//
this.sbpCompany.Alignment = System.Windows.Forms.HorizontalAlignment.Center;
this.sbpCompany.MinWidth = 62;
this.sbpCompany.Text = "单位名称";
this.sbpCompany.Width = 62;
//
// sbpCompany_m
//
this.sbpCompany_m.Text = "厦门T77汽车销售公司";
this.sbpCompany_m.ToolTipText = "厦门T77汽车销售公司";
this.sbpCompany_m.Width = 800;
//
// pnlLeft
//
this.pnlLeft.BackColor = System.Drawing.SystemColors.Control;
this.pnlLeft.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pnlLeft.Controls.Add(this.Dir);
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlLeft.Location = new System.Drawing.Point(0, 41);
this.pnlLeft.Name = "pnlLeft";
this.pnlLeft.Size = new System.Drawing.Size(203, 260);
this.pnlLeft.TabIndex = 4;
//
// Dir
//
this.Dir.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.Dir.Location = new System.Drawing.Point(184, 120);
this.Dir.Name = "Dir";
this.Dir.Size = new System.Drawing.Size(16, 48);
this.Dir.TabIndex = 1;
this.Dir.Text = "<<";
this.Dir.Click += new System.EventHandler(this.Dir_Click);
//
// _timer
//
this._timer.Enabled = true;
this._timer.Interval = 999;
this._timer.SynchronizingObject = this;
this._timer.Elapsed += new System.Timers.ElapsedEventHandler(this._timer_Elapsed);
//
// fontDialog1
//
this.fontDialog1.MaxSize = 20;
this.fontDialog1.MinSize = 5;
this.fontDialog1.ShowApply = true;
this.fontDialog1.ShowColor = true;
//
// colorDialog1
//
this.colorDialog1.AnyColor = true;
//
// mmuComm
//
this.mmuComm.Index = 4;
this.mmuComm.Text = "代办管理";
this.mmuComm.Click += new System.EventHandler(this.mmuComm_Click);
//
// MdiFrm_Main
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.WhiteSmoke;
this.ClientSize = new System.Drawing.Size(692, 325);
this.ContextMenu = this.contextMenu1;
this.Controls.Add(this.pnlLeft);
this.Controls.Add(this._stuBar);
this.Controls.Add(this.toolBar1);
this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.ForeColor = System.Drawing.Color.Black;
this.IsMdiContainer = true;
this.Menu = this.mainMenu1;
this.Name = "MdiFrm_Main";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "汽车销售进存销系统";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Resize += new System.EventHandler(this.MdiFrm_Main_Resize);
this.Closing += new System.ComponentModel.CancelEventHandler(this.MdiFrm_Main_Closing);
this.Load += new System.EventHandler(this.MdiFrm_Main_Load);
this.Closed += new System.EventHandler(this.MdiFrm_Main_Closed);
this.Activated += new System.EventHandler(this.MdiFrm_Main_Activated);
((System.ComponentModel.ISupportInitialize)(this.sbplabel)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tbpUserName_m)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tbpLabel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sbpNowTime_m)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sbpCompany)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.sbpCompany_m)).EndInit();
this.pnlLeft.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this._timer)).EndInit();
this.ResumeLayout(false);
}
#endregion
[DllImport("user32.dll")]
public static extern bool FlashWindow(IntPtr hWnd,bool bInvert);
private void MdiFrm_Main_Load(object sender, System.EventArgs e)
{
try
{
bool i=FlashWindow(this.Handle,true);
// this.Login(0);
this.Visible=false;
//if(this.sbpNowTime_m!=null)
// this.sbpNowTime_m.Text=DateTime.Now.ToLocalTime().ToLongDateString();
frmLogin log=new frmLogin();
if(log.ShowDialog()!=DialogResult.Cancel)
{
this.isLogExit=false;
this.Visible=true;
}
else
{
this.isLogExit=true;
this.Close();
}
if(UserJob.IndexOf("管理员")==-1)
{
this.mnuDataRestore.Enabled=false;
}
else
this.mnuDataRestore.Enabled=true;
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
// if(log!=null)
// log.Hide();
// else
// Application.Exit();
}
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
try
{
if(e.Button==this.tbnExit_m)
this.mnuExit.PerformClick();
else if(e.Button==this.tbnInDep_m)
this.mnuInDep.PerformClick();
else if(e.Button==this.tbnPay_m)
this.mnuBuyPay.PerformClick();
else if(e.Button==this.tbnSell_m)
this.mnuSelling.PerformClick();
else if(e.Button==this.tbnSellMon_m)
this.mnuSellTake.PerformClick();
else if(e.Button==this.tbnStock_m)
this.mnuBook.PerformClick();
else if(e.Button==this.tbnSelPre)
this.mnuReady.PerformClick();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
public static bool islog=false;
private void mnuExit_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void MdiFrm_Main_Resize(object sender, System.EventArgs e)
{
try
{
this.Dir.Top=this.pnlLeft.Height/2-this.Dir.Height/2;
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private bool outer=true;
private void Dir_Click(object sender, System.EventArgs e)
{
try
{
if(outer)
{
this.pnlLeft.Width=this.Dir.Width;
this.Dir.Text=">>";
outer=false;
}
else
{
this.pnlLeft.Width=203;
this.Dir.Text="<<";
outer=true;
}
this.Dir.Left=this.pnlLeft.Width-this.Dir.Width;
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void MdiFrm_Main_Activated(object sender, System.EventArgs e)
{
// if(this.tbpUserName_m.Text=="")
try
{
this.tbpUserName_m.Text=UserName;
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void MdiFrm_Main_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
try
{
if(this.isLogExit)
{
foreach(Form form in this.MdiChildren)
{
form.Close();
}
}
else
if(MessageBox.Show("确实要退出系统?","确认退出",MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)==DialogResult.Cancel)
e.Cancel=true;
else
{
foreach(Form form in this.MdiChildren)
{
form.Close();
}
}
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void MdiFrm_Main_Closed(object sender, System.EventArgs e)
{
try
{
Application.Exit();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 重新登陆
///
///
///
private void mnuRLog_Click(object sender, System.EventArgs e)
{
try
{
this.Visible=false;
foreach(Form chd in this.MdiChildren)
chd.Close();
frmLogin log=new frmLogin();
if(log.ShowDialog()!=DialogResult.Cancel)
{
this.isLogExit=false;
this.Visible=true;
}
else
{
this.isLogExit=true;
this.Close();
}
if(UserJob.IndexOf("管理员")==-1)
{
this.mnuDataRestore.Enabled=false;
}
else
this.mnuDataRestore.Enabled=true;
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private frmStock carBuy;
///
/// 菜单弹出采购窗体
///
///
///
private void mnuBook_Click(object sender, System.EventArgs e)
{
try
{
if(carBuy==null||carBuy.Disposing||carBuy.IsDisposed)
{
carBuy=null;
carBuy=new frmStock(UserID);
carBuy.MdiParent=this;
}
carBuy.Show();
carBuy.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private frmInDepot inDepot;
///
/// 弹出入库窗体
///
///
///
private void mnuInDep_Click(object sender, System.EventArgs e)
{
try
{
if(inDepot==null||inDepot.Disposing||inDepot.IsDisposed)
{
inDepot=null;
inDepot=new frmInDepot(UserID);
inDepot.MdiParent=this;
}
inDepot.Show();
inDepot.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 库存信息
///
private frmKunCun cun;
private void mnuDepCar_Click(object sender, System.EventArgs e)
{
try
{
if(cun==null||cun.Disposing||cun.IsDisposed)
{
cun=null;
cun=new frmKunCun();
cun.MdiParent=this;
}
cun.Show();
cun.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 仓库信息
///
private CarStorehouse.frmStorageInfo store;
private void mnuDepInfo_Click(object sender, System.EventArgs e)
{
try
{
if(store==null||store.Disposing||store.IsDisposed)
{
store=null;
store=new frmStorageInfo(0,UserID);
store.MdiParent=this;
}
store.Show();
store.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 移库操作
///
private CarStorehouse.frmShift shift;
private void mnuMoveCar_Click(object sender, System.EventArgs e)
{
try
{
if(shift==null||shift.Disposing||shift.IsDisposed)
{
shift=null;
shift=new frmShift(UserID);
shift.MdiParent=this;
}
shift.Show();
shift.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 系统初始化
///
private frmInitial ini;
private void mnuSysIni_Click(object sender, System.EventArgs e)
{
try
{
if(ini==null||ini.Disposing||ini.IsDisposed)
{
ini=null;
ini=new frmInitial(UserID);
ini.MdiParent=this;
}
ini.Show();
ini.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 更改密码
///
private frmRePwd repwd;
private void mnuPwd_Click(object sender, System.EventArgs e)
{
try
{
if(repwd==null||repwd.Disposing||repwd.IsDisposed)
{
repwd=null;
repwd=new frmRePwd(UserID,UserName);
repwd.MdiParent=this;
}
repwd.Show();
repwd.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
/*预售管理*/
private SALE.frmPreSaleManager fpsm;
private void mnuReady_Click(object sender, System.EventArgs e)
{
try
{
if(UserJob.Equals("预售员") || UserJob.Equals("管理员") || UserJob.Equals("预售经理"))
{
}
else
{
MessageBox.Show("您没有此权限的操作","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return;
}
if(fpsm==null||fpsm.Disposing||fpsm.IsDisposed)
{
fpsm=null;
fpsm=new SALE.frmPreSaleManager(UserID,UserJob);
fpsm.MdiParent=this;
}
fpsm.Show();
fpsm.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
fpsm.Close();
}
}
/*销售管理*/
private SALE.frmSaleManager fsm;
private void mnuSelling_Click(object sender, System.EventArgs e)
{
try
{
if(UserJob.Equals("销售员") || UserJob.Equals("管理员") || UserJob.Equals("销售经理"))
{
}
else
{
MessageBox.Show("您没有此权限的操作","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return;
}
if(fsm==null||fsm.Disposing||fsm.IsDisposed)
{
fsm=null;
fsm=new SALE.frmSaleManager(UserID,UserJob);
fsm.MdiParent=this;
}
fsm.Show();
fsm.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
fsm.Close();
}
}
/*客户回访*/
private SALE.frmVisitManager fvm;
private void menuItem2_Click(object sender, System.EventArgs e)
{
try
{
if(UserJob.Equals("客户员") || UserJob.Equals("管理员") || UserJob.Equals("客户经理"))
{
}
else
{
MessageBox.Show("您没有此权限的操作","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return;
}
if(fvm==null||fvm.Disposing||fvm.IsDisposed)
{
fvm=null;
fvm=new SALE.frmVisitManager(UserID,UserJob);
fvm.MdiParent=this;
}
fvm.Show();
fvm.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
fvm.Close();
}
}
/*客户跟踪*/
private SALE.frmSlotManager fsMgr;
private void menuItem1_Click(object sender, System.EventArgs e)
{
try
{
if(UserJob.Equals("客户员") || UserJob.Equals("管理员") || UserJob.Equals("客户经理"))
{
}
else
{
MessageBox.Show("您没有此权限的操作","警告",MessageBoxButtons.OK,MessageBoxIcon.Warning);
return;
}
if(fsMgr==null||fsMgr.Disposing||fsMgr.IsDisposed)
{
fsMgr=null;
fsMgr=new SALE.frmSlotManager(UserID,UserJob);
fsMgr.MdiParent=this;
}
fsMgr.Show();
fsMgr.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private car.frmFactoryInfo fac;
///
/// 厂商资料
///
///
///
private void mnuFac_Click(object sender, System.EventArgs e)
{
try
{
if(fac==null||fac.Disposing||fac.IsDisposed)
{
fac=null;
fac=new frmFactoryInfo();
fac.MdiParent=this;
}
fac.Show();
fac.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private car.frmCarInfo cari;
///
/// 车型资料
///
///
///
///
private void mnuCar_Click(object sender, System.EventArgs e)
{
try
{
if(cari==null||cari.Disposing||cari.IsDisposed)
{
cari=null;
cari=new frmCarInfo("","");
cari.MdiParent=this;
}
cari.Show();
cari.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private Client.Form1 client;
///
/// 客户资料
///
///
///
private void mnuBuyer_Click(object sender, System.EventArgs e)
{
try
{
if(client==null||client.Disposing||client.IsDisposed)
{
client=null;
client=new Form1();
client.MdiParent=this;
}
client.Show();
client.Activate();
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private frmMdiAbout about;
///
/// 关于
///
///
///
private void mnuAbout_Click(object sender, System.EventArgs e)
{
try
{
if(about==null||about.Disposing||about.IsDisposed)
{
about=null;
about=new frmMdiAbout();
about.ShowDialog(this);
about.Dispose();
}
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 窗体布局
///
///
///
private void mnuLayoutForms_Click(object sender, System.EventArgs e)
{
try
{
MenuItem item=(MenuItem)sender;
if(item==this.mnuVerti)
{
foreach(Form chd in this.MdiChildren)
chd.WindowState=FormWindowState.Normal;
this.LayoutMdi(MdiLayout.TileVertical);
}
else if(item==this.mnuHort)
{
foreach(Form chd in this.MdiChildren)
chd.WindowState=FormWindowState.Normal;
this.LayoutMdi(MdiLayout.TileHorizontal);
}
else if(item==this.mnuCascade)
{
foreach(Form chd in this.MdiChildren)
chd.WindowState=FormWindowState.Normal;
this.LayoutMdi(MdiLayout.Cascade);
}
else if(item==this.mnuMaxChd)
{
foreach(Form chd in this.MdiChildren)
chd.WindowState=FormWindowState.Maximized;
}
else if(item==this.mnuMinChd)
{
foreach(Form chd in this.MdiChildren)
chd.WindowState=FormWindowState.Minimized;
this.LayoutMdi(MdiLayout.ArrangeIcons);
}
foreach(MenuItem it in this.mnuLayout.MenuItems)
if(it.Checked)
{
it.Checked=false;
break;
}
item.Checked=true;
}catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
this.sbpNowTime_m.Text=DateTime.Now.ToLocalTime().ToString();
}
///
/// 系统设置--字体
///
///
///
private void menuItem5_Click(object sender, System.EventArgs e)
{
try
{
this.fontDialog1.Font=this.Font;
this.fontDialog1.Color=this.ForeColor;
if(this.fontDialog1.ShowDialog(this)==DialogResult.OK)
{
this.Font=this.fontDialog1.Font;
this.ForeColor=this.fontDialog1.Color;
}
}catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 系统设置--恢复默认
///
///
///
private void menuItem7_Click(object sender, System.EventArgs e)
{
this.Font=new Font("宋体",9,FontStyle.Regular);
this.ForeColor=Color.Black;
this.BackColor=Color.WhiteSmoke;
}
///
/// 系统设置--背景
///
///
///
private void menuItem6_Click(object sender, System.EventArgs e)
{
try
{
this.colorDialog1.Color=this.BackColor;
if(this.colorDialog1.ShowDialog(this)==DialogResult.OK)
{
this.BackColor=this.colorDialog1.Color;
}
}
catch(Exception ex)
{
MessageBox.Show("系统发生一个异常的错误!请与管理员联系。\n"+ex.Message,"系统错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 右键菜单
///
///
///
private void ContextMenu_Click(object sender, System.EventArgs e)
{
MenuItem item=(MenuItem)sender;
if(item==this.mnuContextCar)
this.mnuCar.PerformClick();
else if(item==this.mnuContextFac)
this.mnuFac.PerformClick();
else if(item==this.mnuContextBuy)
this.mnuBuyer.PerformClick();
else if(item==this.mnuContextDep)
this.mnuDepInfo.PerformClick();
}
///
/// 数据备份
///
///
///
private void mnuDataBack_Click(object sender, System.EventArgs e)
{
BackupDataAndStore back=new BackupDataAndStore();
try
{
back.BackUpDataBase("dbCarsys",Environment.CurrentDirectory+@"\dbCarsys");
MessageBox.Show("数据库已成功备份!","数据备份",MessageBoxButtons.OK,MessageBoxIcon.Information);
}catch(Exception ex)
{
MessageBox.Show("数据库备份发生错误!请与管理员联系。","数据备份错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
///
/// 数据恢复
///
///
///
private void mnuDataRestore_Click(object sender, System.EventArgs e)
{
if(UserJob.IndexOf("管理员")!=-1)
{
try
{
if(MessageBox.Show("请确认您要恢复数据库,这将导致部分或全部数据丢失!","确认操作",MessageBoxButtons.OKCancel,MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)==DialogResult.OK)
{
if(MessageBox.Show("请先重启Sql服务代理,以便关闭所有数据连接!\n重启后按“确定”开始恢复数据库。按“取消”退出操作。","确认操作",MessageBoxButtons.OKCancel,MessageBoxIcon.Information,MessageBoxDefaultButton.Button2)==DialogResult.OK)
{
if(!File.Exists(Environment.CurrentDirectory+@"\dbCarsys.bak"))
{
MessageBox.Show("备份文件不存在!","数据恢复错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
BackupDataAndStore store=new BackupDataAndStore();
store.RestoreDataBase("dbCarsys",Environment.CurrentDirectory+@"\dbCarsys.bak");
MessageBox.Show("数据库已恢复至:"+File.GetLastWriteTime(Environment.CurrentDirectory+@"\dbCarsys.bak"),"数据恢复",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
}
catch(Exception ex)
{
MessageBox.Show("数据库恢复发生错误!请重试或与管理员联系。\n"+ex.Message,"数据恢复错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
}
/*显示代办管理*/
private void mmuComm_Click(object sender, System.EventArgs e)
{
SALE.frmCommItems fci=new frmCommItems();
fci.MdiParent=this;
fci.Show();
}
}
}