Exemple #1
0
        private async void btnFinish_Click(object sender, EventArgs e)
        {
            try
            {
                if (cls.Guid == Guid.Empty)
                {
                    cls.Guid = Guid.NewGuid();
                }

                if (string.IsNullOrEmpty(txtName.Text))
                {
                    frmNotification.PublicInfo.ShowMessage("عنوان گروه نمی تواند خالی باشد");
                    txtName.Focus();
                    return;
                }
                if (!await CustomerGroupBussines.CheckName(cls.Guid, txtName.Text.Trim()))
                {
                    frmNotification.PublicInfo.ShowMessage("عنوان وارد شده تکراری است");
                    txtName.Focus();
                    return;
                }

                cls.Name        = txtName.Text.Trim();
                cls.Description = txtDesc.Text;
                cls.ParentGuid  = (Guid)cmbParent.SelectedValue;
                var res = await cls.SaveAsync();

                if (res.HasError)
                {
                    frmNotification.PublicInfo.ShowMessage(res.ErrorMessage);
                    return;
                }
                DialogResult = DialogResult.OK;
                frmLoading.PublicInfo.ShowForm();
                Close();
            }
            catch (Exception exception)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(exception);
            }
        }