📄 lazymaninventory.cs
字号:
// mnuPurchaseOrder
//
this.mnuPurchaseOrder.Index = 2;
this.mnuPurchaseOrder.Text = "&Purchase Order";
//
// mnuReports
//
this.mnuReports.Index = 2;
this.mnuReports.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuInventoryPriceList,
this.mnuInventoryOutOfStock,
this.mnuInventoryOnOrder,
this.mnuInventoryBelowMinimum,
this.mnuInventoryByVendor,
this.mnuCompleteInventory});
this.mnuReports.Text = "&Reports";
//
// mnuInventoryPriceList
//
this.mnuInventoryPriceList.Index = 0;
this.mnuInventoryPriceList.Text = "Inventory Price &List";
//
// mnuInventoryOutOfStock
//
this.mnuInventoryOutOfStock.Index = 1;
this.mnuInventoryOutOfStock.Text = "Inventory Out of &Stock";
//
// mnuInventoryOnOrder
//
this.mnuInventoryOnOrder.Index = 2;
this.mnuInventoryOnOrder.Text = "Inventory On &Order";
//
// mnuInventoryBelowMinimum
//
this.mnuInventoryBelowMinimum.Index = 3;
this.mnuInventoryBelowMinimum.Text = "Inventory Below &Minimum";
//
// mnuInventoryByVendor
//
this.mnuInventoryByVendor.Index = 4;
this.mnuInventoryByVendor.Text = "Inventory By &Vendor";
//
// mnuCompleteInventory
//
this.mnuCompleteInventory.Index = 5;
this.mnuCompleteInventory.Text = "&Complete Inventory";
//
// mnuUtilities
//
this.mnuUtilities.Index = 3;
this.mnuUtilities.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuClearSalesTotals});
this.mnuUtilities.Text = "&Utilities";
//
// mnuClearSalesTotals
//
this.mnuClearSalesTotals.Index = 0;
this.mnuClearSalesTotals.Text = "&Clear Sales Totals";
//
// mnuWindow
//
this.mnuWindow.Index = 4;
this.mnuWindow.Text = "&Window";
//
// mnuHelp
//
this.mnuHelp.Index = 5;
this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.mnuLazyManInventoryHelp,
this.mnuHelpSeparator1,
this.mnuAboutLazyManInventory});
this.mnuHelp.Text = "&Help";
//
// mnuLazyManInventoryHelp
//
this.mnuLazyManInventoryHelp.Index = 0;
this.mnuLazyManInventoryHelp.Text = "Lazy &Man Inventory Help\t F1";
//
// mnuHelpSeparator1
//
this.mnuHelpSeparator1.Index = 1;
this.mnuHelpSeparator1.Text = "-";
//
// mnuAboutLazyManInventory
//
this.mnuAboutLazyManInventory.Index = 2;
this.mnuAboutLazyManInventory.Text = "&About Lazy Man Inventory";
this.mnuAboutLazyManInventory.Click += new System.EventHandler(this.mnuAboutLazyManInventory_Click);
//
// tbrMain
//
this.tbrMain.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
this.tbrMain.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.tbnOpen,
this.tbnSeparator1,
this.tbnPrint,
this.tbnMagnify,
this.tbnFont,
this.tbnSeparator2,
this.tbnHelp});
this.tbrMain.DropDownArrows = true;
this.tbrMain.ImageList = this.iltToolBar;
this.tbrMain.Location = new System.Drawing.Point(0, 0);
this.tbrMain.Name = "tbrMain";
this.tbrMain.ShowToolTips = true;
this.tbrMain.Size = new System.Drawing.Size(706, 28);
this.tbrMain.TabIndex = 3;
this.tbrMain.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbrMain_ButtonClick);
//
// tbnOpen
//
this.tbnOpen.ImageIndex = 0;
//
// tbnSeparator1
//
this.tbnSeparator1.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// tbnPrint
//
this.tbnPrint.ImageIndex = 1;
//
// tbnMagnify
//
this.tbnMagnify.ImageIndex = 2;
//
// tbnFont
//
this.tbnFont.ImageIndex = 3;
//
// tbnSeparator2
//
this.tbnSeparator2.Style = System.Windows.Forms.ToolBarButtonStyle.Separator;
//
// tbnHelp
//
this.tbnHelp.ImageIndex = 4;
//
// iltToolBar
//
this.iltToolBar.ImageSize = new System.Drawing.Size(16, 16);
this.iltToolBar.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("iltToolBar.ImageStream")));
this.iltToolBar.TransparentColor = System.Drawing.Color.Transparent;
//
// Global
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.Gainsboro;
this.ClientSize = new System.Drawing.Size(706, 521);
this.Controls.Add(this.tbrMain);
this.Controls.Add(this.pbxSplash);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsMdiContainer = true;
this.MaximizeBox = false;
this.Menu = this.mmuMain;
this.Name = "Global";
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "LazyMan Inventory";
this.Load += new System.EventHandler(this.Global_Load);
this.ResumeLayout(false);
}
#endregion
#region Instance Methods
/// <summary>
/// Load Form
/// </summary>
private void Global_Load(object sender, System.EventArgs e)
{
int i;
// Connection to database
try{
cnn.ConnectionString = ConnectionString;
cnn.Open();
}catch{
try{
cnn.ConnectionString = ConnectionString2;
cnn.Open();
}catch(Exception ex){
MessageBox.Show(ex.Message);
}
}
// Create SqlCommand
SqlCommand cmd = cnn.CreateCommand();
// Query MSDE Data
cmd.CommandText="SELECT * FROM tblInventory";
daInventory = new SqlDataAdapter(cmd);
daInventory.FillSchema(dsInventory,SchemaType.Source);
daInventory.AcceptChangesDuringFill = true;
daInventory.Fill(dsInventory,"tblInventory");
dvInventory.Table = dsInventory.Tables["tblInventory"];
// Read Sort String
string[] sortValue = new String[2];
string[] sortOrder = new String[2];
cmd.CommandText ="SELECT * FROM tblInventorySort";
SqlDataReader drInventorySort = cmd.ExecuteReader();
i=0;
while(drInventorySort.Read())
{
sortValue[i] = drInventorySort.GetString(2);
sortOrder[i] = drInventorySort.GetString(3);
++i;
}
drInventorySort.Close();
Array.Sort(sortOrder,sortValue);
InventorySort = "";
for (i=0; i<2; i++)
{
switch(sortOrder[i].ToString())
{
case "0":
break;
default:
InventorySort += sortValue[i];
InventorySort +=",";
break;
}
}
InventorySort += "InventoryKey";
dvInventory.Sort = InventorySort;
// Read Option File
cmd.CommandText = "SELECT * FROM tblOption";
SqlDataReader drOption = cmd.ExecuteReader();
while(drOption.Read())
{
switch(drOption.GetString(1)) {
case "PrintPictures":
PrintPictures = drOption.GetString(2);
switch(PrintPictures) {
case "Yes":
mnuPrintWithPicture.Checked = true;
break;
case "No":
mnuPrintWithoutPicture.Checked = true;
break;
}
break;
}
}
drOption.Close();
cnn.Close();
}
/// <summary>
/// Splash Click : Exit Splash
/// </summary>
private void pbxSplash_Click(object sender, System.EventArgs e)
{
pbxSplash.Visible = false;
}
/// <summary>
/// Display and hide Splash Screen
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void mnuAboutLazyManInventory_Click(object sender, System.EventArgs e)
{
pbxSplash.Visible = !pbxSplash.Visible;
}
/// <summary>
/// Process Toolbar Buttons
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tbrMain_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
pbxSplash.Visible = false;
}
#endregion
#region Static Methods
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Global());
}
#endregion
#region Method Overrides
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -