예제 #1
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;                //
            }
            healthCheckDetail = HealthCheckDetails[e.RowIndex];

            DataGridViewColumn column = dataGridView2.Columns[e.ColumnIndex];

            if (column is DataGridViewCheckBoxColumn)
            {
                DataGridViewDisableCheckBoxCell cell = dataGridView2.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewDisableCheckBoxCell;
                if (!cell.Enabled)
                {
                    return;
                }
                if ((SelectedStatus)cell.Value == SelectedStatus.NoSelected)
                {
                    cell.Value = SelectedStatus.Selected;
                    SetRadioButtonValue(cell);
                }
                else
                {
                    cell.Value = SelectedStatus.NoSelected;
                }
            }
        }
예제 #2
0
        private void AddBtn_Click(object sender, EventArgs e)
        {
            this.refreshBtn.Enabled    = false;
            this.searchBtn.Enabled     = false;
            this.SaveBtn.Enabled       = true;
            this.CancelBtn.Enabled     = true;
            this.pagerControl1.Visible = false;
            this.pagerControl2.Visible = false;
            AddorEditFlag = 1;
            search();

            if (this.tabControlHealthDocManage.SelectedIndex == 0)
            {
                foreach (var c in this.EditGroup.Controls)
                {
                    if (c.GetType().Name == "TextBox")
                    {
                        ((TextBox)c).Text = "";
                    }
                }
                this.textBoxPersonNumber.Text         = "0";
                this.textBoxPassNumber.Text           = "0";
                this.EditGroup.Visible                = true;
                this.SearchGroup.Visible              = false;
                this.splitContainer1.SplitterDistance = 155;
                healthCheckDocument = new HealthCheckDocument();
            }
            if (this.tabControlHealthDocManage.SelectedIndex == 1)
            {
                foreach (var c in this.groupBox1.Controls)
                {
                    if (c.GetType().Name == "TextBox")
                    {
                        ((TextBox)c).Text = "";
                    }
                }

                this.groupBox1.Visible = true;
                this.groupBox2.Visible = false;
                this.splitContainer2.SplitterDistance = 199;

                this.comboBoxDocName.DataSource = HealthCheckDocuments;
                comboBoxDocName.DisplayMember   = "DocumentName";
                comboBoxDocName.ValueMember     = "ID";
                if (comboBoxDocName.Items.Count > 0)
                {
                    comboBoxDocName.SelectedIndex = 0;
                }
                this.cmbEployeeName.DataSource = Employees;
                cmbEployeeName.DisplayMember   = "Name";
                cmbEployeeName.ValueMember     = "ID";
                if (this.cmbEployeeName.Items.Count > 0)
                {
                    cmbEployeeName.SelectedIndex = 0;
                }
                healthCheckDetail = new HealthCheckDetail();
            }
        }
예제 #3
0
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定要删除吗?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (this.tabControlHealthDocManage.SelectedIndex == 0)
                    {
                        if (dataGridView1.CurrentRow != null)
                        {
                            //执行删除操作
                            int currRowIndex = dataGridView1.CurrentRow.Cells[0].RowIndex;
                            healthCheckDocument = HealthCheckDocuments[currRowIndex];

                            string msg = string.Empty;
                            PharmacyDatabaseService.DeleteHealthCheckDocument(healthCheckDocument.Id, out msg);

                            refreshBtn_Click(this, null);
                        }
                        else
                        {
                            MessageBox.Show("没有选择要删除的记录!");
                        }
                    }
                    if (this.tabControlHealthDocManage.SelectedIndex == 1)
                    {
                        if (dataGridView2.CurrentRow != null)
                        {
                            //执行删除操作
                            int currRowIndex = dataGridView2.CurrentRow.Cells[0].RowIndex;
                            healthCheckDetail = HealthCheckDetails[currRowIndex];

                            string msg = string.Empty;
                            PharmacyDatabaseService.DeleteHealthCheckDetail(healthCheckDetail.Id, out msg);

                            refreshBtn_Click(this, null);
                        }
                        else
                        {
                            MessageBox.Show("没有选择要删除的记录!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.Error(ex);
            }
        }