main.cs
来自「第三方物流信息管理平台 1、数据库配置: 需要打开MS SQL SERVE」· CS 代码 · 共 647 行 · 第 1/2 页
CS
647 行
"Original_所属部门 IS NULL AND 所属部门 IS NULL) AND (权限名称 = @Original_权限名称) AND (管理员帐号 =" +
" @Original_管理员帐号)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_权限序号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "权限序号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_所属部门", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "所属部门", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_权限名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "权限名称", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_管理员帐号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "管理员帐号", System.Data.DataRowVersion.Original, null));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "initial catalog=logistics;integrated security=SSPI;persist security info=False;wo" +
"rkstation id=SOFT54;packet size=4096";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO popedom(管理员帐号, 所属部门, 权限名称) VALUES (@管理员帐号, @所属部门, @权限名称); SELECT 权限序号" +
", 管理员帐号, 所属部门, 权限名称 FROM popedom WHERE (权限序号 = @@IDENTITY)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@管理员帐号", System.Data.SqlDbType.VarChar, 10, "管理员帐号"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@所属部门", System.Data.SqlDbType.VarChar, 10, "所属部门"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@权限名称", System.Data.SqlDbType.VarChar, 10, "权限名称"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 权限序号, 管理员帐号, 所属部门, 权限名称 FROM popedom";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE popedom SET 管理员帐号 = @管理员帐号, 所属部门 = @所属部门, 权限名称 = @权限名称 WHERE (权限序号 = @Original_权限序号) AND (所属部门 = @Original_所属部门 OR @Original_所属部门 IS NULL AND 所属部门 IS NULL) AND (权限名称 = @Original_权限名称) AND (管理员帐号 = @Original_管理员帐号); SELECT 权限序号, 管理员帐号, 所属部门, 权限名称 FROM popedom WHERE (权限序号 = @权限序号)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@管理员帐号", System.Data.SqlDbType.VarChar, 10, "管理员帐号"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@所属部门", System.Data.SqlDbType.VarChar, 10, "所属部门"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@权限名称", System.Data.SqlDbType.VarChar, 10, "权限名称"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_权限序号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "权限序号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_所属部门", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "所属部门", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_权限名称", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "权限名称", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_管理员帐号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "管理员帐号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@权限序号", System.Data.SqlDbType.Int, 4, "权限序号"));
//
// popedomDataset1
//
this.popedomDataset1.DataSetName = "popedomDataset";
this.popedomDataset1.Locale = new System.Globalization.CultureInfo("zh-CN");
this.popedomDataset1.Namespace = "http://www.tempuri.org/popedomDataset.xsd";
//
// main
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.BackgroundImage = ((System.Drawing.Bitmap)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(972, 633);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.statusBar1});
this.IsMdiContainer = true;
this.Location = new System.Drawing.Point(10, 50);
this.Menu = this.mainMenu1;
this.Name = "main";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "main";
this.Load += new System.EventHandler(this.main_Load);
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.popedomDataset1)).EndInit();
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Form1 login=new Form1();
login.ShowDialog();
if (Form1.blCanLogin==true)
Application.Run(new main());
}
private void main_Load(object sender, System.EventArgs e)
{
this.statusBarPanel2.Text = " 当前用户: " + Form1.strUser + " 所属部门为: "+ Form1.strDepartment;
this.sendStrSQL = "SELECT * from popedom where 管理员帐号 = '" + Form1.strUser +"'";
this.ds = this.link.SelectDataBase(sendStrSQL,sendTableName);
popedomDataset1.Clear();
sqlDataAdapter1.Fill(popedomDataset1);
if (Form1.strDepartment == "IT信息部")
{
this.menuItem2.Enabled = true;
this.menuItem3.Enabled = true;
this.menuItem4.Enabled = true;
this.menuItem20.Enabled = true;
this.menuItem11.Enabled = true;
this.menuItem12.Enabled = true;
this.menuItem14.Enabled = true;
this.menuItem16.Enabled = true;
this.menuItem7.Enabled = true;
this.menuItem8.Enabled = true;
this.menuItem9.Enabled = true;
this.menuItem10.Enabled = true;
this.menuItem13.Enabled = true;
//this.menuItem18.Enabled = true;
this.menuItem21.Enabled = true;
this.menuItem23.Enabled = true;
}
else//根据从数据库中检索到的用户的权限来设置其有权使用的菜单
{
for (int intCounter=0;intCounter<this.popedomDataset1.Tables[0].Rows.Count;intCounter++)
{
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "客户管理")
{
this.menuItem2.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "配送员管理")
{
this.menuItem3.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "管理员维护")
{
this.menuItem4.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "权限管理")
{
this.menuItem20.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "订单总汇")
{
this.menuItem11.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "待处理订单")
{
this.menuItem12.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "未完成订单")
{
this.menuItem14.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "已完成订单")
{
this.menuItem16.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "运输路线设计")
{
this.menuItem7.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "运输路线管理")
{
this.menuItem8.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "未实施订单")
{
this.menuItem13.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "货物跟踪")
{
this.menuItem23.Enabled = true;
continue;
}
/*if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "车辆跟踪")
{
this.menuItem24.Enabled = true;
continue;
}*/
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "回执单维护")
{
this.menuItem21.Enabled = true;
continue;
}
/*if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "回执单查询")
{
this.menuItem22.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "运输网络维护")
{
this.menuItem17.Enabled = true;
continue;
}
if (this.popedomDataset1.Tables[0].Rows[intCounter][3].ToString().Trim() == "车辆信息维护")
{
this.menuItem18.Enabled = true;
continue;
}*/
}
}
}
private void menuItem2_Click(object sender, System.EventArgs e)
{
customerForm cf=new customerForm();
cf.Show();
}
private void menuItem15_Click(object sender, System.EventArgs e)
{
if (MessageBox.Show("确实要退出系统吗?","询问",MessageBoxButtons.YesNo) == DialogResult.Yes)
{
this.Close();
}
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
peisong_Form pm=new peisong_Form();
pm.Show();
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
manage_Form em=new manage_Form();
em.Show();
}
private void menuItem20_Click(object sender, System.EventArgs e)
{
popedom pm=new popedom();
pm.Show();
}
private void menuItem11_Click(object sender, System.EventArgs e)
{
orderform_Form orf=new orderform_Form();
orf.Show();
}
private void menuItem12_Click(object sender, System.EventArgs e)
{
waitdeal_orderForm wm=new waitdeal_orderForm();
wm.Show();
}
private void menuItem7_Click(object sender, System.EventArgs e)
{
transign_Form tsf=new transign_Form();
tsf.Show();
}
private void menuItem21_Click(object sender, System.EventArgs e)
{
return_Form rm=new return_Form();
rm.Show();
}
private void menuItem17_Click(object sender, System.EventArgs e)
{
trans_net_Form tnm=new trans_net_Form();
tnm.Show();
}
private void menuItem23_Click(object sender, System.EventArgs e)
{
goodsgz_Form gm=new goodsgz_Form();
gm.Show();
}
private void menuItem14_Click(object sender, System.EventArgs e)
{
notfinish_orderForm nfom=new notfinish_orderForm();
nfom.Show();
}
private void menuItem22_Click(object sender, System.EventArgs e)
{
returnfind_Form fm=new returnfind_Form();
fm.Show();
}
private void menuItem16_Click(object sender, System.EventArgs e)
{
finish_orderForm fom=new finish_orderForm();
fom.Show();
}
private void menuItem8_Click(object sender, System.EventArgs e)
{
trans_manageForm tmm=new trans_manageForm();
tmm.Show();
}
private void menuItem13_Click(object sender, System.EventArgs e)
{
cus_checkForm cmm=new cus_checkForm();
cmm.Show();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?