private void buttonOK_Click(object sender, EventArgs e) { try { CollectDrugInfos(); if (!DataToServerReady) { //MessageBox.Show("您的输入信息有错误!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop); MessageBox.Show(this.Text + "您的输入信息有错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } string message = string.Empty; bool result = false; switch (Mode) { case FormRunMode.Add: result = PharmacyDatabaseService.AddDoubtDrug(out message, CurrentDoubtDrug); //添加处理 //List<DrugInventoryRecord> DrugInventoryRecords = new List<DrugInventoryRecord>(); //DrugInventoryRecord DrugInventoryRecord = DrugInventoryRecords.Where(d => d.Id == currentDoubtDrug.DrugInventoryRecordId).First(); break; case FormRunMode.Edit: result = PharmacyDatabaseService.SaveDoubtDrug(out message, CurrentDoubtDrug); //编辑处理 break; } if (result && string.IsNullOrWhiteSpace(message)) { //MessageBox.Show("保存疑问成功", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(this.Text + "保存疑问成功", "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } else { //MessageBox.Show("保存疑问失败" + message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop); MessageBox.Show(this.Text + "保存疑问失败" + message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } } catch (Exception ex) { ex = new Exception("保存疑问失败" + ex.Message, ex); Log.Error(ex); } }