예제 #1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                int      id       = Int32.Parse(senderGrid.Rows[e.RowIndex].Cells["Id"].Value.ToString());
                ViewCase viewCase = new ViewCase(id, this);
                this.Hide();
                viewCase.Show();
            }
        }
예제 #2
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                if (e.ColumnIndex == 0) // Edit / View Case
                {
                    if (Global.Type == UserType.DOCTOR)
                    {
                        EditCase editCase = new EditCase(prevForm, Int32.Parse(senderGrid.Rows[e.RowIndex].Cells["Id"].Value.ToString()));
                        this.Hide();
                        editCase.Show();
                    }
                    else if (Global.Type == UserType.PATIENT)
                    {
                        ViewCase viewCase = new ViewCase(Int32.Parse(senderGrid.Rows[e.RowIndex].Cells["Id"].Value.ToString()), this);
                        this.Hide();
                        viewCase.Show();
                    }
                }
                else
                {
                    ViewHistory viewHistory = null;
                    if (Global.Type == UserType.DOCTOR)
                    {
                        viewHistory = new ViewHistory(Int32.Parse(senderGrid.Rows[e.RowIndex].Cells["PatientId"].Value.ToString()), this);
                    }
                    else if (Global.Type == UserType.PATIENT)
                    {
                        viewHistory = new ViewHistory((int)Global.Id, this);
                    }
                    this.Hide();
                    viewHistory.Show();
                }
            }
        }