Example #1
0
        private void dgvStudent_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgvStudent.Columns[e.ColumnIndex].Name == "StudentEdit" && e.RowIndex >= 0)
                {
                    try
                    {
                        var ID     = Convert.ToInt32(dgvStudent.CurrentRow.Cells[2].Value);
                        var frmAdd = new frmAdd();
                        frmAdd.StudentID   = ID;
                        frmAdd.IsEditModel = true;
                        frmAdd.Show();
                    }
                    finally {
                    }
                }

                if (dgvStudent.Columns[e.ColumnIndex].Name == "StudentDelete" && e.RowIndex >= 0)
                {
                    var StudentName = Convert.ToString(dgvStudent.CurrentRow.Cells[3].Value);
                    var ID          = int.Parse(dgvStudent.CurrentRow.Cells[2].Value.ToString());


                    if (MessageBox.Show(string.Concat("您确认删除 - ", StudentName, " - 吗?"), "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        try
                        {
                            if (GetStudentInstance().Delete(ID))
                            {
                                BindStudent(string.Empty, string.Empty);
                            }
                        }
                        catch
                        {
                        }
                        finally
                        {
                        }
                    }
                }
            }
            catch
            {
            }
            finally {
            }
        }
Example #2
0
        private void 采集ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var frmAdd = new frmAdd();

            frmAdd.Show();
        }