/// <summary> /// Used for injection of pre-parsed value list /// </summary> public FieldAttribute( JSONDataMap valueList, string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string backendType = null, string description = null, string metadata = null, bool nonUI = false, string formatRegExp = null, string formatDescr = null, string displayFormat = null ) : base(targetName, metadata) { if (valueList == null) { throw new DataException("FieldAttribute(JSONDataMap valueList==null)"); } StoreFlag = storeFlag; BackendName = backendName; BackendType = backendType; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; Description = description; NonUI = nonUI; FormatRegExp = formatRegExp; FormatDescription = formatDescr; DisplayFormat = displayFormat; m_CacheValueListPresetInCtor = true; m_CacheValueList_Insensitive = valueList; m_CacheValueList_Sensitive = valueList; ValueList = null; }
// Create a Flag reminder to follow up with a store public async Task <IActionResult> AddFlag(int?id) { var store = await _context.Store.SingleOrDefaultAsync(m => m.StoreId == id); var FollowUpFlag = await _context.Flag.Where(f => f.Name == "Follow Up").SingleOrDefaultAsync(); var StoreFollowUp = new StoreFlag(); StoreFollowUp.StoreId = store.StoreId; StoreFollowUp.FlagId = FollowUpFlag.FlagId; _context.Add(StoreFollowUp); await _context.SaveChangesAsync(); return(RedirectToAction("Details", new { id = id })); }
public FieldAttribute( string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, string valueList = null, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string backendType = null, string description = null, string metadata = null, bool nonUI = false, string formatRegExp = null, string formatDescr = null, string displayFormat = null, bool isArow = false ) : base(targetName, metadata) { StoreFlag = storeFlag; BackendName = backendName; BackendType = backendType; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; ValueList = valueList; Description = description; NonUI = nonUI; FormatRegExp = formatRegExp; FormatDescription = formatDescr; DisplayFormat = displayFormat; IsArow = isArow; }
public FieldAttribute( string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, string valueList = null, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string description = null, string metadata = null, bool nonUI = false ) : base(targetName, metadata) { StoreFlag = storeFlag; BackendName = backendName; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; ValueList = valueList; Description = description; NonUI = nonUI; }
public FieldAttribute( Type protoType, string protoFieldName, //Schema:Field string targetName = ANY_TARGET, object storeFlag = null, object key = null, object kind = null, object required = null, object visible = null, string valueList = null, object dflt = null, object min = null, object max = null, object minLength = null, object maxLength = null, object charCase = null, string backendName = null, string backendType = null, string description = null, string metadata = null, object nonUI = null, string formatRegExp = null, string formatDescr = null, string displayFormat = null ) : base(targetName, null) { if (protoType==null || protoFieldName.IsNullOrWhiteSpace()) throw new CRUDException(StringConsts.ARGUMENT_ERROR+"FieldAttr.ctor(protoType|protoFieldName=null|empty)"); try { var schema = Schema.GetForTypedRow(protoType); var protoTargetName = targetName; var segs = protoFieldName.Split(':'); if (segs.Length>1) { protoTargetName = segs[0].Trim(); protoFieldName = segs[1].Trim(); } if (protoTargetName.IsNullOrWhiteSpace()) throw new Exception("Wrong target syntax"); if (protoFieldName.IsNullOrWhiteSpace()) throw new Exception("Wrong field syntax"); var protoFieldDef = schema[protoFieldName]; if (protoFieldDef==null) throw new Exception("Prototype '{0}' field '{1}' not found".Args(protoType.FullName, protoFieldName)); var protoAttr = protoFieldDef[protoTargetName]; try { StoreFlag = storeFlag == null? protoAttr.StoreFlag : (StoreFlag)storeFlag; BackendName = backendName == null? protoAttr.BackendName : backendName; BackendType = backendType == null? protoAttr.BackendType : backendType; Key = key == null? protoAttr.Key : (bool)key; Kind = kind == null? protoAttr.Kind : (DataKind)kind; Required = required == null? protoAttr.Required : (bool)required; Visible = visible == null? protoAttr.Visible : (bool)visible; Min = min == null? protoAttr.Min : min; Max = max == null? protoAttr.Max : max; Default = dflt == null? protoAttr.Default : dflt; MinLength = minLength == null? protoAttr.MinLength : (int)minLength; MaxLength = maxLength == null? protoAttr.MaxLength : (int)maxLength; CharCase = charCase == null? protoAttr.CharCase : (CharCase)charCase; ValueList = valueList == null? protoAttr.ValueList : valueList; Description = description == null? protoAttr.Description : description; NonUI = nonUI == null? protoAttr.NonUI : (bool)nonUI; FormatRegExp = formatRegExp == null? protoAttr.FormatRegExp: formatRegExp; FormatDescription= formatDescr == null? protoAttr.FormatDescription: formatDescr; DisplayFormat = displayFormat== null? protoAttr.DisplayFormat : displayFormat; if (metadata.IsNullOrWhiteSpace()) m_MetadataContent = protoAttr.m_MetadataContent; else if (protoAttr.m_MetadataContent.IsNullOrWhiteSpace()) m_MetadataContent = metadata; else { var conf1 = ParseMetadataContent(protoAttr.m_MetadataContent); var conf2 = ParseMetadataContent(metadata); var merged = new LaconicConfiguration(); merged.CreateFromMerge(conf1, conf2); m_MetadataContent = merged.SaveToString(); } } catch(Exception err) { throw new Exception("Invalid assignment of prototype override value: " + err.ToMessageWithType()); } } catch(Exception error) { throw new CRUDException(StringConsts.CRUD_FIELD_ATTR_PROTOTYPE_CTOR_ERROR.Args(error.Message)); } }
/// <summary> /// Used for injection of pre-parsed value list /// </summary> public FieldAttribute( JSONDataMap valueList, string targetName = ANY_TARGET, StoreFlag storeFlag = StoreFlag.LoadAndStore, bool key = false, DataKind kind = DataKind.Text, bool required = false, bool visible = true, object dflt = null, object min = null, object max = null, int minLength = 0, int maxLength = 0, CharCase charCase = CharCase.AsIs, string backendName = null, string backendType = null, string description = null, string metadata = null, bool nonUI = false, string formatRegExp = null, string formatDescr = null, string displayFormat = null ) : base(targetName, metadata) { if (valueList == null) throw new CRUDException("FieldAttribute(JSONDataMap valueList==null)"); StoreFlag = storeFlag; BackendName = backendName; BackendType = backendType; Key = key; Kind = kind; Required = required; Visible = visible; Min = min; Max = max; Default = dflt; MinLength = minLength; MaxLength = maxLength; CharCase = charCase; Description = description; NonUI = nonUI; FormatRegExp = formatRegExp; FormatDescription = formatDescr; DisplayFormat = displayFormat; m_CacheValueListPresetInCtor = true; m_CacheValueList_Insensitive = valueList; m_CacheValueList_Sensitive = valueList; ValueList = null; }
internal ColumnDef(string name) { m_Name = name; //Defaults m_StoreFlag = StoreFlag.LoadAndStore; m_Visible = true; }