private void buttonSave_Click(object sender, EventArgs e) { try { if (this._instCategory.ListCategory.Count(r => r.IsChecked) <= 0) { MessageBox.Show("您没有选择任何器械分类代码,请设置!"); return; } this._gspLiscence.GMSPLicenseBusinessScopes = null; IList <GMSPLicenseBusinessScope> newlist = new List <GMSPLicenseBusinessScope>(); foreach (var row in this._instCategory.ListCategory) { if (!row.IsChecked) { continue; } GMSPLicenseBusinessScope gmsp = new GMSPLicenseBusinessScope { BusinessScopeCode = row.StandardCode, BusinessScopeCodeMemo = row.Description, GSPLicenseId = this._gspLiscence.Id, Id = Guid.NewGuid(), }; newlist.Add(gmsp); } this._gspLiscence.GMSPLicenseBusinessScopes = newlist; bool result = false; if (this._fs.FStatus == FormStatusEnum.New) { result = PharmacyDatabaseService.AddGSPLicense(out msg, this._gspLiscence); } else { result = PharmacyDatabaseService.EditGSPLiscence(this._gspLiscence, out msg); } if (result && string.IsNullOrWhiteSpace(msg)) { MessageBox.Show(this.Text + "证书保证成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = System.Windows.Forms.DialogResult.OK; this._gspLiscenceId = this._gspLiscence.Id; } else { MessageBox.Show(this.Text + "证书保存失败" + msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { MessageBox.Show(this.Text + "证书保存失败" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }
private void buttonSave_Click(object sender, EventArgs e) { try { string msg = String.Empty; if (!ValidateControls(out msg)) { MessageBox.Show(msg); return; } if (GetGMSPLicense()) { //string msg; bool result = false; if (EditMode) { result = PharmacyDatabaseService.AddGSPLicense(out msg, this.GSPLicense); } else { result = PharmacyDatabaseService.AddGSPLicense(out msg, this.GSPLicense); } if (result && string.IsNullOrWhiteSpace(msg)) { //MessageBox.Show("证书保证成功", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(this.Text + "证书保证成功", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { //MessageBox.Show("证书保存失败" + msg, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(this.Text + "证书保存失败" + msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); } } catch (Exception ex) { //MessageBox.Show("证书保存失败" + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop); MessageBox.Show(this.Text + "证书保存失败" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } }