📄 lazymaninventory.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;
namespace LazyManInventory
{
/// <summary>
/// Global Class
/// </summary>
public class Global : System.Windows.Forms.Form
{
#region Instance Fields
private System.Windows.Forms.PictureBox pbxSplash;
private System.Windows.Forms.MainMenu mmuMain;
private System.Windows.Forms.MenuItem mnuFileSeparator1;
private System.Windows.Forms.MenuItem mnuFileSeparator2;
private System.Windows.Forms.MenuItem mnuFileSeparator3;
private System.Windows.Forms.MenuItem mnuHelpSeparator1;
private System.Windows.Forms.MenuItem mnuFile;
private System.Windows.Forms.MenuItem mnuOpen;
private System.Windows.Forms.MenuItem mnuPageSetup;
private System.Windows.Forms.MenuItem mnuPrint;
private System.Windows.Forms.MenuItem mnuSetup;
private System.Windows.Forms.MenuItem mnuInventoryPriceListDisclosure;
private System.Windows.Forms.MenuItem mnuPurchaseOrderDisclosure;
private System.Windows.Forms.MenuItem mnuInventoryPriceOptions;
private System.Windows.Forms.MenuItem mnuPrintWithPicture;
private System.Windows.Forms.MenuItem mnuPrintWithoutPicture;
private System.Windows.Forms.MenuItem mnuMixed;
private System.Windows.Forms.MenuItem mnuExit;
private System.Windows.Forms.MenuItem mnuDataEntry;
private System.Windows.Forms.MenuItem mnuInventoryInfomation;
private System.Windows.Forms.MenuItem mnuSalesInvoice;
private System.Windows.Forms.MenuItem mnuPurchaseOrder;
private System.Windows.Forms.MenuItem mnuReports;
private System.Windows.Forms.MenuItem mnuInventoryPriceList;
private System.Windows.Forms.MenuItem mnuInventoryOutOfStock;
private System.Windows.Forms.MenuItem mnuInventoryOnOrder;
private System.Windows.Forms.MenuItem mnuInventoryBelowMinimum;
private System.Windows.Forms.MenuItem mnuInventoryByVendor;
private System.Windows.Forms.MenuItem mnuCompleteInventory;
private System.Windows.Forms.MenuItem mnuUtilities;
private System.Windows.Forms.MenuItem mnuClearSalesTotals;
private System.Windows.Forms.MenuItem mnuWindow;
private System.Windows.Forms.MenuItem mnuHelp;
private System.Windows.Forms.MenuItem mnuLazyManInventoryHelp;
private System.Windows.Forms.MenuItem mnuAboutLazyManInventory;
private System.Windows.Forms.ToolBar tbrMain;
private System.Windows.Forms.ImageList iltToolBar;
private System.Windows.Forms.ToolBarButton tbnOpen;
private System.Windows.Forms.ToolBarButton tbnSeparator1;
private System.Windows.Forms.ToolBarButton tbnPrint;
private System.Windows.Forms.ToolBarButton tbnMagnify;
private System.Windows.Forms.ToolBarButton tbnFont;
private System.Windows.Forms.ToolBarButton tbnSeparator2;
private System.Windows.Forms.ToolBarButton tbnHelp;
private System.ComponentModel.IContainer components;
#endregion
#region Static Fields
/// <summary>
/// SQL Connection
/// </summary>
public static SqlConnection cnn;
/// <summary>
/// DataAdapter
/// </summary>
public static SqlDataAdapter daInventory;
/// <summary>
/// Command parameter
/// </summary>
public static SqlParameter param;
/// <summary>
/// DataSet
/// </summary>
public static DataSet dsInventory = new DataSet();
/// <summary>
/// DataView
/// </summary>
public static DataView dvInventory = new DataView();
/// <summary>
/// DataView Sort String
/// </summary>
public static string InventorySort;
/// <summary>
/// Print Price List Options: with pictures, without pictures or mixed
/// </summary>
public static string PrintPictures;
/// <summary>
/// Integrated Security connection string
/// </summary>
public const string ConnectionString = @"data source = localhost;
initial catalog=LazyManInventory; integrated security = SSPI;
persist security info = False; packet size=4096";
/// <summary>
/// SQL Security connection string
/// </summary>
public const string ConnectionString2 = @"data source = localhost;
initial catalog = LazyManInventory;persist security info = False; user id=sa; packet size=4096";
#endregion
#region Constructors
/// <summary>
/// Global Class Constructor
/// </summary>
public Global()
{
InitializeComponent();
cnn = new SqlConnection();
dvInventory.AllowNew = true;
dvInventory.AllowEdit = true;
dvInventory.AllowDelete = true;
}
#endregion
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Global));
this.pbxSplash = new System.Windows.Forms.PictureBox();
this.mmuMain = new System.Windows.Forms.MainMenu();
this.mnuFile = new System.Windows.Forms.MenuItem();
this.mnuOpen = new System.Windows.Forms.MenuItem();
this.mnuFileSeparator1 = new System.Windows.Forms.MenuItem();
this.mnuPageSetup = new System.Windows.Forms.MenuItem();
this.mnuPrint = new System.Windows.Forms.MenuItem();
this.mnuFileSeparator2 = new System.Windows.Forms.MenuItem();
this.mnuSetup = new System.Windows.Forms.MenuItem();
this.mnuInventoryPriceListDisclosure = new System.Windows.Forms.MenuItem();
this.mnuPurchaseOrderDisclosure = new System.Windows.Forms.MenuItem();
this.mnuInventoryPriceOptions = new System.Windows.Forms.MenuItem();
this.mnuPrintWithPicture = new System.Windows.Forms.MenuItem();
this.mnuPrintWithoutPicture = new System.Windows.Forms.MenuItem();
this.mnuMixed = new System.Windows.Forms.MenuItem();
this.mnuFileSeparator3 = new System.Windows.Forms.MenuItem();
this.mnuExit = new System.Windows.Forms.MenuItem();
this.mnuDataEntry = new System.Windows.Forms.MenuItem();
this.mnuInventoryInfomation = new System.Windows.Forms.MenuItem();
this.mnuSalesInvoice = new System.Windows.Forms.MenuItem();
this.mnuPurchaseOrder = new System.Windows.Forms.MenuItem();
this.mnuReports = new System.Windows.Forms.MenuItem();
this.mnuInventoryPriceList = new System.Windows.Forms.MenuItem();
this.mnuInventoryOutOfStock = new System.Windows.Forms.MenuItem();
this.mnuInventoryOnOrder = new System.Windows.Forms.MenuItem();
this.mnuInventoryBelowMinimum = new System.Windows.Forms.MenuItem();
this.mnuInventoryByVendor = new System.Windows.Forms.MenuItem();
this.mnuCompleteInventory = new System.Windows.Forms.MenuItem();
this.mnuUtilities = new System.Windows.Forms.MenuItem();
this.mnuClearSalesTotals = new System.Windows.Forms.MenuItem();
this.mnuWindow = new System.Windows.Forms.MenuItem();
this.mnuHelp = new System.Windows.Forms.MenuItem();
this.mnuLazyManInventoryHelp = new System.Windows.Forms.MenuItem();
this.mnuHelpSeparator1 = new System.Windows.Forms.MenuItem();
this.mnuAboutLazyManInventory = new System.Windows.Forms.MenuItem();
this.tbrMain = new System.Windows.Forms.ToolBar();
this.tbnOpen = new System.Windows.Forms.ToolBarButton();
this.tbnSeparator1 = new System.Windows.Forms.ToolBarButton();
this.tbnPrint = new System.Windows.Forms.ToolBarButton();
this.tbnMagnify = new System.Windows.Forms.ToolBarButton();
this.tbnFont = new System.Windows.Forms.ToolBarButton();
this.tbnSeparator2 = new System.Windows.Forms.ToolBarButton();
this.tbnHelp = new System.Windows.Forms.ToolBarButton();
this.iltToolBar = new System.Windows.Forms.ImageList(this.components);
this.SuspendLayout();
//
// pbxSplash
//
this.pbxSplash.Image = ((System.Drawing.Image)(resources.GetObject("pbxSplash.Image")));
this.pbxSplash.Location = new System.Drawing.Point(184, 144);
this.pbxSplash.Name = "pbxSplash";
this.pbxSplash.Size = new System.Drawing.Size(400, 300);
this.pbxSplash.TabIndex = 1;
this.pbxSplash.TabStop = false;
this.pbxSplash.Click += new System.EventHandler(this.pbxSplash_Click);
//
// mmuMain
//
this.mmuMain.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuFile,
this.mnuDataEntry,
this.mnuReports,
this.mnuUtilities,
this.mnuWindow,
this.mnuHelp});
//
// mnuFile
//
this.mnuFile.Index = 0;
this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuOpen,
this.mnuFileSeparator1,
this.mnuPageSetup,
this.mnuPrint,
this.mnuFileSeparator2,
this.mnuSetup,
this.mnuFileSeparator3,
this.mnuExit});
this.mnuFile.Text = "&File";
//
// mnuOpen
//
this.mnuOpen.Index = 0;
this.mnuOpen.Text = "&Open";
//
// mnuFileSeparator1
//
this.mnuFileSeparator1.Index = 1;
this.mnuFileSeparator1.Text = "-";
//
// mnuPageSetup
//
this.mnuPageSetup.Index = 2;
this.mnuPageSetup.Text = "Page Set&up";
//
// mnuPrint
//
this.mnuPrint.Index = 3;
this.mnuPrint.Text = "&Print";
//
// mnuFileSeparator2
//
this.mnuFileSeparator2.Index = 4;
this.mnuFileSeparator2.Text = "-";
//
// mnuSetup
//
this.mnuSetup.Index = 5;
this.mnuSetup.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuInventoryPriceListDisclosure,
this.mnuPurchaseOrderDisclosure,
this.mnuInventoryPriceOptions});
this.mnuSetup.Text = "&Setup";
//
// mnuInventoryPriceListDisclosure
//
this.mnuInventoryPriceListDisclosure.Index = 0;
this.mnuInventoryPriceListDisclosure.Text = "Inventory &Price List Disclosure";
//
// mnuPurchaseOrderDisclosure
//
this.mnuPurchaseOrderDisclosure.Index = 1;
this.mnuPurchaseOrderDisclosure.Text = "Purchase &Order Disclosure";
//
// mnuInventoryPriceOptions
//
this.mnuInventoryPriceOptions.Index = 2;
this.mnuInventoryPriceOptions.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuPrintWithPicture,
this.mnuPrintWithoutPicture,
this.mnuMixed});
this.mnuInventoryPriceOptions.Text = "Inventory Price &List Options";
//
// mnuPrintWithPicture
//
this.mnuPrintWithPicture.Index = 0;
this.mnuPrintWithPicture.Text = "Print With &Picture";
//
// mnuPrintWithoutPicture
//
this.mnuPrintWithoutPicture.Index = 1;
this.mnuPrintWithoutPicture.Text = "Print &Without Picture";
//
// mnuMixed
//
this.mnuMixed.Index = 2;
this.mnuMixed.Text = "Print &Mixed";
//
// mnuFileSeparator3
//
this.mnuFileSeparator3.Index = 6;
this.mnuFileSeparator3.Text = "-";
//
// mnuExit
//
this.mnuExit.Index = 7;
this.mnuExit.Text = "E&xit";
//
// mnuDataEntry
//
this.mnuDataEntry.Index = 1;
this.mnuDataEntry.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuInventoryInfomation,
this.mnuSalesInvoice,
this.mnuPurchaseOrder});
this.mnuDataEntry.Text = "&Data Entry";
//
// mnuInventoryInfomation
//
this.mnuInventoryInfomation.Index = 0;
this.mnuInventoryInfomation.Text = "Inventory &Infomation";
//
// mnuSalesInvoice
//
this.mnuSalesInvoice.Index = 1;
this.mnuSalesInvoice.Text = "Sales &Invoice";
//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -