using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace FirstFace
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void Form2_Closing(object sender, e)
{
//System.Environment.Exit(0);
Application.Exit();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Form4 form4 = new Form4();
form4.Show();
}
private void button2_Click(object sender, EventArgs e)
{
if (Form1.type.Equals("总经理") || Form1.type.Equals("部门经理"))
//权限控制
{
Form5 form5 = new Form5();
form5.Show();
SqlConnection con = new SqlConnection("server=.\\sqlexpress;Integrated Security=SSPI;DataBase=MyDB");
con.Open();
SqlCommand cmd = new SqlCommand("select
DeclarerID
from
Declaration where flow=0", con);
//查找状态为等待审批的DeclarerID
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
(reader[0].ToString());
}
}
else
{
MessageBox.Show("对不起你没有权限访问!");
}
}
private void button3_Click(object sender, EventArgs e)
{
if (Form1.type.Equals("出纳员") || Form1.type.Equals("总经理") || Form1.type.Equals("部门经理"))
//权限控制
{
Form6 form6 = new Form6();
form6.Show();
SqlConnection con = new SqlConnection("server=.\\sqlexpress;Integrated Security=SSPI;DataBase=MyDB");
con.Open();
SqlCommand cmd = new SqlCommand("select
DeclarerID
from
Declaration where flow=1", con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
(reader[0].ToString());
}
}
else
{
MessageBox.Show("对不起你没有权限访问!");
}
}
private void button4_Click(object sender, EventArgs e)
{
if (Form1.type.Equals("会计员") || Form1.type.Equals("总经理") || Form1.type.Equals("部门经理"))
//权限控制
{
Form7 form7 = new Form7();
form7.Show();
SqlConnection con = new SqlConnection("server=.\\sqlexpress;Integrated Security=SSPI;DataBase=MyDB");
con.Open();
SqlCommand cmd = new SqlCommand("select
DeclarerID
from
Declaration where flow=2", con);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
(reader[0].ToString());
}
}
else
{
MessageBox.Show("对不起你没有权限访问!");
}
}
private void 密码修改ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form8 form8 = new Form8();
form8.Show();
}
private void 系统注销ToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dr = MessageBox.Show("您确定要注销登录吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
{
Application.ExitThread();
System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);
}
else
{
}
}
private void 系统退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult dr = MessageBox.Show("您确定要退出登录吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (dr == DialogResult.Yes)
System.Environment.Exit(0);
else
{
}
}
private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("谢谢!","提示");
}
}
}