📄 frmmain.cs
字号:
this.销货单查询ToolStripMenuItem.Click += new System.EventHandler(this.销货单查询ToolStripMenuItem_Click);
//
// 采购单查询ToolStripMenuItem
//
this.采购单查询ToolStripMenuItem.Name = "采购单查询ToolStripMenuItem";
this.采购单查询ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.采购单查询ToolStripMenuItem.Text = "采购单查询";
//
// 销售退货ToolStripMenuItem
//
this.销售退货ToolStripMenuItem.Name = "销售退货ToolStripMenuItem";
this.销售退货ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.销售退货ToolStripMenuItem.Text = "销售退货";
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = global::BookStore.Properties.Resources._244755;
this.ClientSize = new System.Drawing.Size(931, 541);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.mnuMain);
this.IsMdiContainer = true;
this.MainMenuStrip = this.mnuMain;
this.Name = "FrmMain";
this.Text = "打开书店管理";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.mnuMain.ResumeLayout(false);
this.mnuMain.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
//如果无版本信息在注册表中写入版本信息
private void WriteRegistryInfo()
{
RegistryKey SoftWareKey = Registry.LocalMachine.OpenSubKey("Software", true);
if (SoftWareKey.OpenSubKey("BookStore") == null)
{
RegistryKey BookStore = SoftWareKey.CreateSubKey("BookStore");
BookStore.SetValue("版本信息", "V 1.00");
this.Vision = "V 1.00";
}
else
{
RegistryKey BookStore = SoftWareKey.OpenSubKey("BookStore");
this.Vision = BookStore.GetValue("版本信息").ToString().Trim();
}
}
private void 采购ToolStripMenuItem_Click(object sender, EventArgs e)
{
}
private void 打开ToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog aa = new OpenFileDialog();
aa.ShowDialog();
}
private void 采购进货ToolStripMenuItem_Click(object sender, EventArgs e)
{
StockTable AddBook = new StockTable();
AddBook.MdiParent= this;
AddBook.Show();
}
private void 库存查看ToolStripMenuItem_Click(object sender, EventArgs e)
{
ProductsInfo newFrm = new ProductsInfo(false);
newFrm.MdiParent = this;
newFrm.Show();
}
private void 关于书店管理ToolStripMenuItem_Click(object sender, EventArgs e)
{
FrmAbout newFrm = new FrmAbout();
newFrm.MdiParent = this;
newFrm.Show();
}
private void 退出ToolStripMenuItem1_Click(object sender, EventArgs e)
{
this.Close();
}
private void FrmMain_Load(object sender, EventArgs e)
{
string SelDep = "select Department from users where UserID=" + Login.UserID;
string strDep = DataAccess.Narnu.GetObjectBySqlString(SelDep).ToString();
string SelPopeDom = "select 权限名称 from 权限清单 where 用户编号=" + Login.UserID;
DataTable dt = DataAccess.Narnu.GetDataTableBySql(SelPopeDom);
if (strDep == "系统管理")
{
this.采购管理ToolStripMenuItem.Enabled = true;
this.库存管理ToolStripMenuItem.Enabled = true;
this.商品利润ToolStripMenuItem.Enabled = true;
this.人员管理ToolStripMenuItem.Enabled = true;
this.销售统计ToolStripMenuItem.Enabled = true;
this.数据管理ToolStripMenuItem.Enabled = true;
this.在线升级ToolStripMenuItem.Enabled = true;
}
for (int i = 0; i < dt.Rows.Count; i++)
{
if (dt.Rows[i][0].ToString().Trim() == "采购管理")
{
this.采购管理ToolStripMenuItem.Enabled = true;
continue;
}
if (dt.Rows[i][0].ToString().Trim() == "库存管理")
{
this.库存管理ToolStripMenuItem.Enabled = true;
continue;
}
if (dt.Rows[i][0].ToString().Trim() == "采购管理")
{
this.商品利润ToolStripMenuItem.Enabled = true;
continue;
}
if (dt.Rows[i][0].ToString().Trim() == "库存管理")
{
this.人员管理ToolStripMenuItem.Enabled = true;
continue;
}
if (dt.Rows[i][0].ToString().Trim() == "采购管理")
{
this.销售统计ToolStripMenuItem.Enabled = true;
continue;
}
if (dt.Rows[i][0].ToString().Trim() == "库存管理")
{
this.数据管理ToolStripMenuItem.Enabled = true;
continue;
}
if (dt.Rows[i][0].ToString().Trim() == "库存管理")
{
this.在线升级ToolStripMenuItem.Enabled = true;
continue;
}
}
WriteRegistryInfo();
SetStatus();
}
private void 用户权限管理ToolStripMenuItem_Click(object sender, EventArgs e)
{
PopeDom newFrm = new PopeDom();
newFrm.MdiParent = this;
newFrm.Show();
}
private void 销售ToolStripMenuItem_Click(object sender, EventArgs e)
{
Sell newFrm = new Sell();
newFrm.MdiParent = this;
newFrm.Show();
}
private void 检查更新ToolStripMenuItem_Click(object sender, EventArgs e)
{
string select = "select 版本号 from 版本";
DataTable myDT = DataAccess.Narnu.GetDataTableBySql(select);
string newVision = myDT.Rows[0][0].ToString().Trim();
if (newVision == this.Vision)
{
MessageBox.Show("未发现新版本!");
}
else
{
//下载程序
DialogResult Res = MessageBox.Show("发现新版本,是否更新!","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
if (Res == DialogResult.OK)
{
try
{
FileStream fs1 = new FileStream(Application.StartupPath + "\\UpLoad\\书店管理.EXE", FileMode.OpenOrCreate);
byte[] arry = new byte[fs1.Length];
fs1.Read(arry, 0, arry.Length - 1);
FileStream fs2 = new FileStream(Application.StartupPath + "\\DownLoad\\书店管理.EXE", FileMode.OpenOrCreate);
fs2.Write(arry, 0, arry.Length - 1);
MessageBox.Show("更新成功,请到DownLoad中查看!", "提示");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
else
{
}
//更新注册表
RegistryKey SoftWareKey = Registry.LocalMachine.OpenSubKey("SoftWare", true);
RegistryKey BookStore = SoftWareKey.OpenSubKey("BookStore",true);
BookStore.SetValue("版本信息", newVision);
this.Vision = newVision;
SetStatus();
}
}
//状态栏显示
private void SetStatus()
{
string select = "select * from users where UserID=" + Login.UserID;
DataTable dt = DataAccess.Narnu.GetDataTableBySql(select);
this.StatusLabelUserName.Text = "用户名:" + dt.Rows[0][1].ToString();
this.StatusVision.Text = "版本信息:" + this.Vision.ToString();
}
private void 销货单查询ToolStripMenuItem_Click(object sender, EventArgs e)
{
SellListFrm newFrm = new SellListFrm();
newFrm.MdiParent = this;
newFrm.Show();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -