Example #1
0
        public FrmEmployee(FormActionType ActionType, Employee employee) : this()
        {
            _actionType = ActionType;

            if (ActionType == FormActionType.Edit)
            {
                if (employee != null)
                {
                    SetEmployee(employee);
                }
                else
                {
                    throw new ArgumentNullException("Employee", "Can not be null");
                }
            }

            if (ActionType == FormActionType.Search)
            {
                txtId.ReadOnly = false;
            }
        }
Example #2
0
        protected virtual FormlyFormParams CommonConfig(FormActionType action)
        {
            var formParams = new FormlyFormParams
            {
                SchemaName       = SchemaName,
                Action           = action,
                OpenApiConfigUrl = GetOpenApiConfigUrl(UrlHelper, new { name = OpenApiConfigName }),
                FormInstanceId   = Utils.GenerateRandomHexString(),
                AdditionalFields = AdditionalData,
                Options          = Options
            };

            formParams.AddOption("basePath", UrlHelper.Content("~"));
            if (OpenApiConfigName != "admin-api")
            {
                formParams.AddOption("openApiConfigUrl", formParams.OpenApiConfigUrl);
            }

            formParams.UseFormSpinnerInside();

            return(formParams);
        }
Example #3
0
 protected virtual string GetSubmitActionName(FormActionType actionType)
 {
     return(SubmitActionName ?? (actionType == FormActionType.Create ? "Create" : "Patch"));
 }