Example #1
0
        private void txButton1_Click(object sender, EventArgs e)
        {
            try
            {
                OsZbPurchaseProjectInfo projectInfo = FormHelp.GetEntityByControls <OsZbPurchaseProjectInfo>(this.groupBox2);
                osZbPurchaseProjectInfo = osZbPurchaseProjectInfo ?? new OsZbPurchaseProjectInfo();

                ObjectUtil.CopyPop(projectInfo, ref osZbPurchaseProjectInfo, "Id");

                VerifyMessage verifyMessage = VerifyUtil.Verify(osZbPurchaseProjectInfo);

                if (!string.IsNullOrWhiteSpace(verifyMessage.ErrorInfo))
                {
                    MessageBox.Show(verifyMessage.ErrorInfo,
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                    return;
                }
                else if (!string.IsNullOrWhiteSpace(verifyMessage.PromptInfo))
                {
                    MessageBox.Show(verifyMessage.PromptInfo,
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }


                R result = osZbPurchaseProjectInfoBLL.SaveOrUpdate(osZbPurchaseProjectInfo, null, true, null);

                if (!result.Successful)
                {
                    MessageBox.Show(result.ResultHint,
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                    return;
                }
                else
                {
                    MessageBox.Show("操作成功",
                                    "提示",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                    if (RefeshParentWindow != null)
                    {
                        RefeshParentWindow.Invoke();
                    }
                    this.Hide();
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                log.AddLog(ex.Message, null);

                MessageBox.Show(ex.Message,
                                "提示",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }
        }