📄 appmain.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using GoodsReportManage.ItemClass;
using GoodsReportManage.Goods;
using System.Collections;
namespace GoodsReportManage
{
public partial class AppMain : Form
{
public AppMain()
{
InitializeComponent();
}
SqlBaseClass G_SqlClass = new SqlBaseClass();
/// <summary>
/// 根据用户权限分配显示菜单
/// </summary>
public void MenuIsVisible()
{
ArrayList arylst = new ArrayList();
ToolStripMenuItem[] menu = new ToolStripMenuItem[] {
this.menuEmployee,this.menuCompany,this.menuCustomer,this.menuGoodsIn,this.menuGoodsOut,this.menuSellGoods,
this.menuGoodsBack,this.menuDepotChange,this.menuDepotAlarm,this.menuSysUser,this.menuPopedomSet,this.menuDatabak,this.menuReBakData
};
DataSet P_ds = G_SqlClass.GetDs("SELECT * FROM v_UserView WHERE SysLoginName = '"+ PropertyClass.SendNameValue+"'");
for (int i = 0; i < 13; i++)
{
arylst.Add(P_ds.Tables[0].Rows[0][14+i].ToString());
}
for (int j = 0; j < arylst.Count; j++)
{
if (arylst[j].ToString() == "False")
{
menu[j].Visible = false;
}
else
{
menu[j].Visible = true;
}
}
this.menuEmployee.Visible = false;
this.menuCompany.Visible = false;
this.menuCustomer.Visible = false;
this.menuGoodsOut.Visible = false;
this.menuGoodsBack.Visible = false;
this.menuDepotChange.Visible = false;
this.menuDepotAlarm.Visible = false;
this.menuSysUser.Visible = false;
this.menuPopedomSet.Visible = false;
}
private void timer1_Tick(object sender, EventArgs e)
{
this.statusTime.Text = "当前时间:" + DateTime.Now.ToString();
}
private void AppMain_Load(object sender, EventArgs e)
{
this.timer1.Start();
this.statusUser.Text = "系统操作员:"+PropertyClass.SendNameValue;
MenuIsVisible();
}
private void AppMain_FormClosing(object sender, FormClosingEventArgs e)
{
}
private void Menu_Click(object sender, EventArgs e)
{
WinOperationClass P_Menu = new WinOperationClass(); //声明对WinForm窗体进行操作的类对象
P_Menu.ShowForm((ToolStripMenuItem)sender, this); //调用类中的方法,完成对窗体中ToolStripMenuItem控件相应项的操作
}
private void AppMain_FormClosed_1(object sender, FormClosedEventArgs e)
{
if (MessageBox.Show("确定要退出吗?", "提示对话框", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
{
Application.Exit();
this.Dispose();
}
else
{
AppMain app = new AppMain();
app.Show();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -