Пример #1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            string str = "";

            foreach (Control c in this.groupBox2.Controls)
            {
                if (c is CheckBox)
                {
                    if (((CheckBox)c).Checked)
                    {
                        str += ((CheckBox)c).Text + ",";
                    }
                }
            }
            this.textBoxBusinessScope.Text += str;
            try
            {
                CellectInfo();
                if (DataReady)
                {
                    string msg    = string.Empty;
                    bool   result = false;
                    if (this.TaxRegisterLicense.Id != null && (!this.TaxRegisterLicense.Id.Equals(Guid.Empty)))
                    {
                        result = PharmacyDatabaseService.SaveTaxRegisterLicense(out msg, this.TaxRegisterLicense);
                    }
                    else
                    {
                        this.TaxRegisterLicense.Id = Guid.NewGuid();
                        result = PharmacyDatabaseService.AddTaxRegisterLicense(out msg, this.TaxRegisterLicense);
                    }
                    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();
                }
                //else
                //{
                //    MessageBox.Show("从控件获取证书信息失败", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                //}
            }
            catch (Exception ex)
            {
                //MessageBox.Show("证书保存失败" + ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                MessageBox.Show(this.Text + "证书保存失败" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }