/// <summary> /// 保存当前成套医嘱的明细数据 /// </summary> public void SaveSuiteDetailData() { //先清除老的数据 DataRow[] delRows = SuiteDetailTable.Select(ConstSchemaNames.SuiteDetailColSuiteSerialNo + " = " + CurrentSuiteNo); foreach (DataRow row in delRows) { SuiteDetailTable.Rows.Remove(row); } // 将医嘱表数据合并到成套明细表(因为需要将合并后的行状态都为新行,所以采用AddRow的方式) foreach (DataRow row in TempOrderTable.Rows) { AddNewRowToDetailTable(row, true); } foreach (DataRow row in LongOrderTable.Rows) { AddNewRowToDetailTable(row, false); } // 删除数据库中此序号对应的明细记录 m_SqlExecutor.ExecuteNoneQuery(String.Format(ConstSqlSentences.FormatDeleteSuiteDetail, ConstSchemaNames.SuiteDetailTableName, CurrentSuiteNo)); // 保存 m_SqlExecutor.UpdateTable(SuiteDetailTable, ConstSchemaNames.SuiteDetailTableName, false); //SuiteDetailTable.AcceptChanges(); }
/// <summary> /// 删除指定的成套医嘱 /// </summary> /// <param name="serialNo"></param> public void DeleteMasterRecord(decimal serialNo) { if ((serialNo > 0) && (m_MessageBox.MessageShow("确定要删除当前记录吗?", CustomMessageBoxKind.QuestionYesNo) == DialogResult.Yes)) { // 删除对应明细, 删除主记录 string delCmd = String.Format(CultureInfo.CurrentCulture , ConstSqlSentences.FormatDeleteSuiteData , ConstSchemaNames.SuiteDetailTableName , ConstSchemaNames.SuiteTableName , serialNo); try { m_SqlExecutor.ExecuteNoneQuery(delCmd); // 从DataTable中移除 DataRow[] matchRows = SuiteMasterTable.Select(ConstSchemaNames.SuiteDetailColSuiteSerialNo + " = " + serialNo); foreach (DataRow row in matchRows) { row.Delete(); } matchRows = SuiteDetailTable.Select(ConstSchemaNames.SuiteDetailColSuiteSerialNo + " = " + serialNo); foreach (DataRow row in matchRows) { row.Delete(); } } catch { m_MessageBox.MessageShow("删除记录出错,请重试!", CustomMessageBoxKind.ErrorYes); } } }