private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; // } //if (dataGridView1.Columns[e.ColumnIndex].Name == "ColCheck") //{ healthCheckDocument = HealthCheckDocuments[e.RowIndex]; // //this.btnDetails.Enabled = true; //} DataGridViewColumn column = dataGridView1.Columns[e.ColumnIndex]; if (column is DataGridViewCheckBoxColumn) { DataGridViewDisableCheckBoxCell cell = dataGridView1.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; } } }
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(); } }
private void BindingDataToControls() { try { if (tabControlHealthDocManage.SelectedIndex == 0) { if (healthCheckDocument != null) { this.textBoxDocNumber.Text = this.healthCheckDocument.DocumentNumber; this.textBoxDocName.Text = this.healthCheckDocument.DocumentName; this.dateTimePickerCheck.Value = this.healthCheckDocument.CheckTime; this.textBoxCheckContext.Text = this.healthCheckDocument.CheckContext; this.textBoxCheckOrgnize.Text = this.healthCheckDocument.CheckOrganize; this.textBoxAddress.Text = this.healthCheckDocument.CheckAdress; this.textBoxCheckContext.Text = this.healthCheckDocument.CheckContext; this.textBoxHepatitisDoctor.Text = this.healthCheckDocument.HepatitisDoctor; this.textBoxIssuanceOrg.Text = this.healthCheckDocument.IssuanceOrg; this.textBoxMedicineDoctor.Text = this.healthCheckDocument.MedicineDoctor; this.textBoxOptometryDoctor.Text = this.healthCheckDocument.OptometryDoctor; this.textBoxSkinDoctor.Text = this.healthCheckDocument.SkinDoctor; this.textBoxXCheckDoctor.Text = this.healthCheckDocument.XCheckDoctor; this.textBoxPersonNumber.Text = this.healthCheckDocument.CheckEployeesSum.ToString("0"); this.textBoxPersonNumber.Text = this.healthCheckDocument.CheckPassNumber.ToString("0"); } } if (tabControlHealthDocManage.SelectedIndex == 1) { if (healthCheckDetail != null) { Employee listitem = Employees.Where(d => d.Id == healthCheckDetail.EmployeeId).First(); this.cmbEployeeName.SelectedItem = listitem; HealthCheckDocument listitem1 = HealthCheckDocuments.Where(d => d.Id == healthCheckDetail.DocumentId).First(); this.comboBoxDocName.SelectedItem = listitem1; this.txtMResult.Text = healthCheckDetail.Medicine; this.txtSResult.Text = healthCheckDetail.Skin; this.txtHResult.Text = healthCheckDetail.Hepatitis; this.txtOResult.Text = healthCheckDetail.Optometry; this.txtXResult.Text = healthCheckDetail.XCheck; this.textBoxConclution.Text = healthCheckDetail.CheckResult; this.checkBoxPass.Checked = healthCheckDetail.IsCheckPass; this.textBoxMemo.Text = healthCheckDetail.Memo; this.txtCheckYear.Text = healthCheckDetail.CheckYear; } } } catch (Exception ex) { MessageBox.Show("控件绑定数据出错!"); } }
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); } }
private void comboBoxDocName_SelectionChangeCommitted(object sender, EventArgs e) { if (this.comboBoxDocName.SelectedIndex >= 0) { HealthCheckDocument healthDocument = HealthCheckDocuments.Where(d => d.Id == (Guid)(this.comboBoxDocName.SelectedValue)).First(); this.textBoxDocNumberD.Text = healthDocument.DocumentNumber; this.dateTimePicker1.Value = healthDocument.CheckTime.Date; this.textBoxOrgnize.Text = healthDocument.CheckOrganize; this.textBoxMDoctor.Text = healthDocument.MedicineDoctor; this.textBoxSDoctor.Text = healthDocument.SkinDoctor; this.textBoxXDoctor.Text = healthDocument.XCheckDoctor; this.textBoxHDoctor.Text = healthDocument.HepatitisDoctor; this.textBoxOpDoctor.Text = healthDocument.OptometryDoctor; this.textBoxCharger.Text = healthDocument.ChargeDoctor; this.textBoxCheckAdress.Text = healthDocument.CheckAdress; } }
private void initDataGridView2() { _source2.DataSource = HealthCheckDetails; dataGridView2.RowCount = HealthCheckDetails.Count; for (int i = 0; i < HealthCheckDetails.Count; i++) { if (i == 0) { dataGridView2.Rows[i].Cells["columnCheck"].Value = SelectedStatus.Selected; } else { dataGridView2.Rows[i].Cells["columnCheck"].Value = SelectedStatus.NoSelected; } Employee emp = Employees.Where(d => d.Id == (Guid)(HealthCheckDetails[i].EmployeeId)).FirstOrDefault(); if (emp == null) { return; } dataGridView2.Rows[i].Cells["colEployee"].Value = emp.Name; HealthCheckDocument hDoc = HealthCheckDocuments.Where(d => d.Id == (Guid)(HealthCheckDetails[i].DocumentId)).FirstOrDefault(); if (hDoc == null) { return; } dataGridView2.Rows[i].Cells["colDocId"].Value = hDoc.DocumentName; dataGridView2.Rows[i].Cells["colCheckYear"].Value = HealthCheckDetails[i].CheckYear; dataGridView2.Rows[i].Cells["colMedicine"].Value = HealthCheckDetails[i].Medicine; dataGridView2.Rows[i].Cells["colSkin"].Value = HealthCheckDetails[i].Skin; dataGridView2.Rows[i].Cells["colXCheck"].Value = HealthCheckDetails[i].XCheck; dataGridView2.Rows[i].Cells["colHepatitis"].Value = HealthCheckDetails[i].Hepatitis; dataGridView2.Rows[i].Cells["colOptometry"].Value = HealthCheckDetails[i].Optometry; dataGridView2.Rows[i].Cells["colCheckResult"].Value = HealthCheckDetails[i].CheckResult; } }
public CosmosClientReadWriteTestProvider() { _document = new HealthCheckDocument(); _partitionKey = new PartitionKey(_document.PartitionKey); }