public void GetName(MaintainManager MM, string whichScript, string whichScreen) { textBox1.Text = null; textBox2.Text = null; AD_MM = MM; WhichScript = whichScript; WhichScreen = whichScreen; }
//↓得到登录结果的返回值 public static void GetResult_MM(MaintainManager MM, string which) { MainSystem.IsAdmin = true; if (which == "change") { MM.change.Visible = true; MM.check.Hide(); } }
public static bool HasLogin_CM = false; //该次是否已有管理员登录 public CustomerManager() { InitializeComponent(); add.Hide(); change.Hide(); delete.Hide(); CM_DM = new DataManager(); CM_AL = new AdminLogin(); CM_IM = new InstallManager(); CM_MM = new MaintainManager(); CM_GM = new GoodsManager(); CM_AOA = new AllOfAll(); UpdateDataView_CM("SELECT * FROM Customer"); //进行显示界面的初始化 }
//↓显示窗口 MaintainManager(维修管理) private void button5_Click(object sender, EventArgs e) { CS_MM = new MaintainManager(); CS_MM.ShowDialog(); }
//↓点击登录,进行用户名和密码的判断 private void button1_Click(object sender, EventArgs e) { if (WhichScript == "ChooseSever") { string sql = "SELECT * FROM ExAdmin WHERE name = " + "'" + textBox1.Text + "'"; bool flag = AD_DM.RunSql(sql); if (flag) { string sql_01 = "SELECT * FROM ExAdmin WHERE name = " + "'" + textBox1.Text + "'AND key LIKE " + "'" + textBox2.Text + "'"; bool flag_01 = AD_DM.RunSql(sql_01); if (flag_01) { MessageBox.Show("登录成功!"); MainSystem.thisAdmin = textBox1.Text; this.Visible = false; ChooseSever.GetResult(AD_CS, WhichScreen); } else { MessageBox.Show("密码错误!"); } } else { MessageBox.Show("用户名错误!"); } } else { string sql = "SELECT * FROM Admin WHERE name = " + "'" + textBox1.Text + "'"; bool flag = AD_DM.RunSql(sql); if (flag) { string sql_01 = "SELECT * FROM Admin WHERE name = " + "'" + textBox1.Text + "'AND key LIKE " + "'" + textBox2.Text + "'"; bool flag_01 = AD_DM.RunSql(sql_01); if (flag_01) { MessageBox.Show("登录成功!"); MainSystem.thisAdmin = textBox1.Text; AD_AOA = new AllOfAll(); int num = AD_AOA.GetProductsNumber(); AD_DM.GetData_Operation(num, textBox1.Text, "管理员:" + textBox1.Text + "登录", DateTime.Now.ToString()); if (WhichScript == "ProductManager") { ProductManager.GetResult(AD_PM, WhichScreen); this.Visible = false; } if (WhichScript == "CustomerManager") { CustomerManager.GetResult_CM(AD_CM, WhichScreen); this.Visible = false; } if (WhichScript == "GoodsManager") { GoodsManager.GetResult_GM(AD_GM, WhichScreen); this.Visible = false; } if (WhichScript == "InstallManager") { InstallManager.GetResult_IM(AD_IM, WhichScreen); this.Visible = false; } if (WhichScript == "MaintainManager") { MaintainManager.GetResult_MM(AD_MM, WhichScreen); this.Visible = false; } } else { MessageBox.Show("密码错误!"); } } else { MessageBox.Show("用户名错误!"); } } }