public void AssingDataUrlString(string fieldName, FieldClass <byte[]> dataField, StringField contentTypeField, string stringValue, bool required) { if (!string.IsNullOrEmpty(stringValue)) { var parts = stringValue.Split(new string[] { "data:", ";base64," }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length == 2) { try { if (!ReferenceEquals(contentTypeField, null)) { contentTypeField.Value = parts[0]; } dataField.Value = Convert.FromBase64String(parts[1]); } catch { Add(fieldName, "Validation.Upload.Failed", "Validation message on upload failed", "File upload failed"); IsSuccess = false; } } else { Add(fieldName, "Validation.Upload.Failed", "Validation message on upload failed", "File upload failed"); IsSuccess = false; } } else if (required) { Add(fieldName, "Validation.Upload.Required", "Validation message on upload required", "File upload required"); IsSuccess = false; } }
public SystemWideSettings(Guid id) : base(id) { Currency = new StringField(this, "currency", 256); }