/// <summary> /// 显示文档类型设置对话框 /// </summary> /// <param name="row">指定行</param> private void ShowDocTypeSelectForm() { TempletSelectForm templetSelectForm = new TempletSelectForm(); templetSelectForm.DefaultDocTypeID = txtDocType.Tag as string; templetSelectForm.MultiSelect = true; templetSelectForm.Text = "选择病历类型"; templetSelectForm.Description = "请选择应书写的病历类型:"; if (templetSelectForm.ShowDialog() != DialogResult.OK) { return; } List <DocTypeInfo> lstDocTypeInfos = templetSelectForm.SelectedDocTypes; StringBuilder sbDocTypeIDList = new StringBuilder(); StringBuilder sbDocTypeNameList = new StringBuilder(); if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0) { txtDocType.Text = sbDocTypeNameList.ToString(); txtDocType.Tag = sbDocTypeIDList.ToString(); return; } for (int index = 0; index < lstDocTypeInfos.Count; index++) { DocTypeInfo docTypeInfo = lstDocTypeInfos[index]; if (docTypeInfo == null) { continue; } sbDocTypeIDList.Append(docTypeInfo.DocTypeID); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeIDList.Append(";"); } sbDocTypeNameList.Append(docTypeInfo.DocTypeName); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeNameList.Append(";"); } } txtDocType.Text = sbDocTypeNameList.ToString(); txtDocType.Tag = sbDocTypeIDList.ToString(); }
/// <summary> /// 显示文档类型设置对话框 /// </summary> /// <param name="row">指定行</param> private void ShowDocTypeSelectForm(DataTableViewRow row) { if (row == null || row.Index < 0 || this.dataGridView1.IsDeletedRow(row)) { return; } TempletSelectForm templetSelectForm = new TempletSelectForm(); DataGridViewCell cell = row.Cells[this.colDocType.Index]; if (cell.Tag != null) { templetSelectForm.DefaultDocTypeID = cell.Tag.ToString(); } templetSelectForm.MultiSelect = true; templetSelectForm.Text = "选择病历类型"; templetSelectForm.Description = "请选择应书写的病历类型:"; if (templetSelectForm.ShowDialog() != DialogResult.OK) { return; } List <DocTypeInfo> lstDocTypeInfos = templetSelectForm.SelectedDocTypes; if (lstDocTypeInfos == null || lstDocTypeInfos.Count <= 0) { row.Cells[this.colDocType.Index].Tag = null; row.Cells[this.colDocType.Index].Value = null; if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } return; } StringBuilder sbDocTypeIDList = new StringBuilder(); StringBuilder sbDocTypeNameList = new StringBuilder(); for (int index = 0; index < lstDocTypeInfos.Count; index++) { DocTypeInfo docTypeInfo = lstDocTypeInfos[index]; if (docTypeInfo == null) { continue; } sbDocTypeIDList.Append(docTypeInfo.DocTypeID); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeIDList.Append(";"); } sbDocTypeNameList.Append(docTypeInfo.DocTypeName); if (index < lstDocTypeInfos.Count - 1) { sbDocTypeNameList.Append(";"); } } row.Cells[this.colDocType.Index].Tag = sbDocTypeIDList.ToString(); row.Cells[this.colDocType.Index].Value = sbDocTypeNameList.ToString(); if (this.dataGridView1.IsNormalRowUndeleted(row)) { this.dataGridView1.SetRowState(row, RowState.Update); } }