//登录按键响应事件 private void ButtonLogin_Click(object sender, EventArgs e) { //新建ClassSqlConnect类,调用重构的ViewCount方法返回从数据库中查询的结果 ClassSqlConnect log = new ClassSqlConnect(); SqlDataReader reader = log.ViewCount(ComboxUserName.Text.ToString(),TxtPassword.Text.ToString()); if (reader.Read())//判断有数据,说明登录成功 { /*保存账号信息,将这部分信息保存在数据库(XML)中更好*/ ComboxUserName.Items.Add(ComboxUserName.Text.ToString()); Form nfm; //提取用户名信息 string UName = reader[1].ToString(); MessageBox.Show("欢迎你,"+ UName); //提取权限信息并选择应打开的界面 switch((int)reader[2]) { case 0: nfm = new Form2();//系统管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 1: nfm = new Form7();//人事经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 2: nfm = new Form3();//人事员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 3: nfm = new Form8();//财务经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 4: nfm = new Form4();//财务员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 5: nfm = new Form9();//销售经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 6: nfm = new Form6();//销售员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 7: nfm = new Form10();//仓库经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 8: nfm = new Form5();//仓库员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; default: MessageBox.Show("你没有登录权限," + UName,"没有权限"); ComboxUserName.Text = ""; TxtPassword.Text = ""; break; } } else { MessageBox.Show("用户名或密码错误!","错误"); TxtPassword.Text = ""; } //调用自定义的Close方法关闭sql连接 log.Close(); }
// V Header Links private void dataGridView7_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView7.CurrentCellAddress.X == 4) { tabControl1.SelectedIndex = 1; comboBox6.SelectedIndex = Convert.ToInt32(dataGridView7.CurrentCell.Value); return; } if (dataGridView7.CurrentCellAddress.X == 5 || dataGridView7.CurrentCellAddress.X == 6) { tabControl1.SelectedIndex = 4; comboBox5.SelectedIndex = Convert.ToInt32(dataGridView7.CurrentCell.Value); return; } if (dataGridView7.CurrentCellAddress.X == 7) { tabControl1.SelectedIndex = 3; radioButton15.Checked = true; comboBox3.SelectedIndex = Convert.ToInt32(dataGridView7.CurrentCell.Value); return; } if (dataGridView7.CurrentCellAddress.X == 16) { wildIndex = nameText.IndexOf(dataGridView7.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString()); Form4_2 nameEditor = new Form4_2(); nameEditor.ShowDialog(this); dataGridView7.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = nameText[wildIndex]; return; } if (dataGridView7.CurrentCellAddress.X == 21) { mapFlags = Convert.ToInt32(dataGridView7.CurrentCell.Value); Form4 flagEditor = new Form4(); flagEditor.ShowDialog(this); dataGridView7.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = mapFlags; return; } if (dataGridView7.CurrentCellAddress.X == 12) { wildIndex = Convert.ToInt32(dataGridView7.CurrentCell.Value); Form9 wildEditor = new Form9(); wildEditor.ShowDialog(this); } }
// Load Wild Editor private void button19_Click(object sender, EventArgs e) { wildIndex = 0; Form9 wildEditor = new Form9(); wildEditor.ShowDialog(this); }
// Header Links private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { // DPPt Links if (dataGridView1.CurrentCellAddress.X == 2 && Convert.ToInt32(dataGridView1.CurrentCell.Value) < comboBox12.Items.Count) { comboBox12.SelectedIndex = Convert.ToInt32(dataGridView1.CurrentCell.Value); return; } if (dataGridView1.CurrentCellAddress.X == 4) { tabControl1.SelectedIndex = 1; comboBox1.SelectedIndex = Convert.ToInt32(dataGridView1.CurrentCell.Value); return; } if (dataGridView1.CurrentCellAddress.X == 5 || dataGridView1.CurrentCellAddress.X == 6) { tabControl1.SelectedIndex = 4; comboBox5.SelectedIndex = Convert.ToInt32(dataGridView1.CurrentCell.Value); return; } if (dataGridView1.CurrentCellAddress.X == 7) { tabControl1.SelectedIndex = 3; comboBox3.SelectedIndex = Convert.ToInt32(dataGridView1.CurrentCell.Value); return; } if (dataGridView1.CurrentCellAddress.X == 10 && (gameID == 0x45414441 || gameID == 0x45415041 || gameID == 0x53414441 || gameID == 0x53415041 || gameID == 0x46414441 || gameID == 0x46415041 || gameID == 0x49414441 || gameID == 0x49415041 || gameID == 0x44414441 || gameID == 0x44415041 || gameID == 0x4A414441 || gameID == 0x4A415041 || gameID == 0x4B414441 || gameID == 0x4B415041 || gameID == 0x45555043 || gameID == 0x53555043 || gameID == 0x46555043 || gameID == 0x49555043 || gameID == 0x44555043 || gameID == 0x4A555043 || gameID == 0x4B555043)) { wildIndex = (int)Convert.ToUInt32(dataGridView1.CurrentCell.Value); Form9 wildEditor = new Form9(); wildEditor.ShowDialog(this); return; } if (dataGridView1.CurrentCellAddress.X == 11 && (gameID == 0x45414441 || gameID == 0x45415041 || gameID == 0x53414441 || gameID == 0x53415041 || gameID == 0x46414441 || gameID == 0x46415041 || gameID == 0x49414441 || gameID == 0x49415041 || gameID == 0x44414441 || gameID == 0x44415041 || gameID == 0x4A414441 || gameID == 0x4A415041 || gameID == 0x4B414441 || gameID == 0x4B415041 || gameID == 0x45555043 || gameID == 0x53555043 || gameID == 0x46555043 || gameID == 0x49555043 || gameID == 0x44555043 || gameID == 0x4A555043 || gameID == 0x4B555043)) { tabControl1.SelectedIndex = 5; comboBox10.SelectedIndex = Convert.ToInt32(dataGridView1.CurrentCell.Value); return; } if (dataGridView1.CurrentCellAddress.X == 12 && (gameID == 0x45414441 || gameID == 0x45415041 || gameID == 0x53414441 || gameID == 0x53415041 || gameID == 0x46414441 || gameID == 0x46415041 || gameID == 0x49414441 || gameID == 0x49415041 || gameID == 0x44414441 || gameID == 0x44415041 || gameID == 0x4A414441 || gameID == 0x4A415041 || gameID == 0x4B414441 || gameID == 0x4B415041 || gameID == 0x45555043 || gameID == 0x53555043 || gameID == 0x46555043 || gameID == 0x49555043 || gameID == 0x44555043 || gameID == 0x4A555043 || gameID == 0x4B555043)) { wildIndex = nameText.IndexOf(dataGridView1.CurrentCell.Value.ToString()); Form4_2 nameEditor = new Form4_2(); nameEditor.ShowDialog(this); dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = nameText[wildIndex]; return; } if (dataGridView1.CurrentCellAddress.X == 16 && (gameID == 0x45414441 || gameID == 0x45415041 || gameID == 0x53414441 || gameID == 0x53415041 || gameID == 0x46414441 || gameID == 0x46415041 || gameID == 0x49414441 || gameID == 0x49415041 || gameID == 0x44414441 || gameID == 0x44415041 || gameID == 0x4A414441 || gameID == 0x4A415041 || gameID == 0x4B414441 || gameID == 0x4B415041)) { mapFlags = Convert.ToUInt16(dataGridView1.CurrentCell.Value); Form4 flagEditor = new Form4(); flagEditor.ShowDialog(this); dataGridView1.CurrentCell.Value = mapFlags; return; } // Platinum Links if (dataGridView1.CurrentCellAddress.X == 17 && (gameID == 0x45555043 || gameID == 0x53555043 || gameID == 0x46555043 || gameID == 0x49555043 || gameID == 0x44555043 || gameID == 0x4A555043 || gameID == 0x4B555043)) { mapFlags = Convert.ToUInt16(dataGridView1.CurrentCell.Value); Form4 flagEditor = new Form4(); flagEditor.ShowDialog(this); dataGridView1.CurrentCell.Value = mapFlags; return; } // HGSS Links if (dataGridView13.CurrentCellAddress.X == 6) { tabControl1.SelectedIndex = 1; comboBox1.SelectedIndex = Convert.ToInt32(dataGridView13.CurrentCell.Value); return; } if (dataGridView13.CurrentCellAddress.X == 7 || dataGridView13.CurrentCellAddress.X == 8) { tabControl1.SelectedIndex = 4; comboBox5.SelectedIndex = Convert.ToInt32(dataGridView13.CurrentCell.Value); return; } if (dataGridView13.CurrentCellAddress.X == 9) { tabControl1.SelectedIndex = 3; comboBox3.SelectedIndex = Convert.ToInt32(dataGridView13.CurrentCell.Value); return; } if (dataGridView13.CurrentCellAddress.X == 12 && (gameID == 0x454B5049 || gameID == 0x45475049 || gameID == 0x534B5049 || gameID == 0x53475049 || gameID == 0x464B5049 || gameID == 0x46475049 || gameID == 0x494B5049 || gameID == 0x49475049 || gameID == 0x444B5049 || gameID == 0x44475049 || gameID == 0x4A4B5049 || gameID == 0x4A475049 || gameID == 0x4B4B5049 || gameID == 0x4B475049)) { tabControl1.SelectedIndex = 5; comboBox10.SelectedIndex = Convert.ToInt32(dataGridView13.CurrentCell.Value); return; } if (dataGridView13.CurrentCellAddress.X == 13 && (gameID == 0x454B5049 || gameID == 0x45475049 || gameID == 0x534B5049 || gameID == 0x53475049 || gameID == 0x464B5049 || gameID == 0x46475049 || gameID == 0x494B5049 || gameID == 0x49475049 || gameID == 0x444B5049 || gameID == 0x44475049 || gameID == 0x4A4B5049 || gameID == 0x4A475049 || gameID == 0x4B4B5049 || gameID == 0x4B475049)) { wildIndex = nameText.IndexOf(dataGridView13.CurrentCell.Value.ToString()); Form4_2 nameEditor = new Form4_2(); nameEditor.ShowDialog(this); dataGridView13.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = nameText[wildIndex]; return; } if (dataGridView13.CurrentCellAddress.X == 2 && (gameID == 0x454B5049 || gameID == 0x45475049 || gameID == 0x534B5049 || gameID == 0x53475049 || gameID == 0x464B5049 || gameID == 0x46475049 || gameID == 0x494B5049 || gameID == 0x49475049 || gameID == 0x444B5049 || gameID == 0x44475049 || gameID == 0x4A4B5049 || gameID == 0x4A475049 || gameID == 0x4B4B5049 || gameID == 0x4B475049)) { wildIndex = (int)Convert.ToUInt32(dataGridView13.CurrentCell.Value); Form9 wildEditor = new Form9(); wildEditor.ShowDialog(this); return; } if (dataGridView13.CurrentCellAddress.X == 18 && (gameID == 0x454B5049 || gameID == 0x45475049 || gameID == 0x534B5049 || gameID == 0x53475049 || gameID == 0x464B5049 || gameID == 0x46475049 || gameID == 0x494B5049 || gameID == 0x49475049 || gameID == 0x444B5049 || gameID == 0x44475049 || gameID == 0x4A4B5049 || gameID == 0x4A475049 || gameID == 0x4B4B5049 || gameID == 0x4B475049)) { mapFlags = Convert.ToUInt16(dataGridView13.CurrentCell.Value); Form4 flagEditor = new Form4(); flagEditor.ShowDialog(this); dataGridView13.CurrentCell.Value = mapFlags; return; } }
private void btnView_Click(object sender, EventArgs e) { var views = new Form9(); views.ShowDialog(); }