コード例 #1
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     try
     {
         CellectInfo();
         if (DataReady)
         {
             string msg    = string.Empty;
             bool   result = false;
             if ((!this.OrganizationCodeLicense.Id.Equals(Guid.Empty)) && this.OrganizationCodeLicense.Id != null)
             {
                 result = PharmacyDatabaseService.SaveOrganizationCodeLicense(out msg, this.OrganizationCodeLicense);
             }
             else
             {
                 this.OrganizationCodeLicense.Id = Guid.NewGuid();
                 result = PharmacyDatabaseService.AddOrganizationCodeLicense(out msg, this.OrganizationCodeLicense);
             }
             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(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Log.Error(ex);
     }
 }