/// <summary>コンストラクタ</summary> /// <param name="front">区切り文字(先頭)</param> /// <param name="back">区切り文字(後尾)</param> /// <param name="fieldType">項目種別</param> /// <param name="value">値</param> public FileNameModel(string front, string back, FieldType?fieldType, string value) { this.Back = back; this.Front = front; this.FieldType = fieldType; this.Value = value; }
public void CopyFrom(Field field) { _name = field.Name; if (field.FieldType == FieldType.CheckBox) { // Try method won't throw exception on failure. bool.TryParse(field.Default, out _defaultBoolean); } else { _defaultString = field.Default; } _prompt = field.Prompt; _description = field.Description; if (field.Choices == null) { ChoicesSource = new ObservableCollection <StringViewModel>(); } else { ChoicesSource = new ObservableCollection <StringViewModel>(field.Choices.Select(s => StringViewModel.CreateFromString(Container, s))); } _choices = new ListCollectionView(_choicesSource); _selectedFieldType = field.FieldType; }
public void ConvertsNullFieldToDefaultValueToSupportImplicitTypeConversionRules() { Field <FieldType>? @null = null; FieldType? value = @null; Assert.Null(value); }
/// <summary> /// Initializes a new instance of the Field /// </summary> /// <param name="x">Coordinate of X</param> /// <param name="y">Coordinate of Y</param> /// <param name="name">Name of the field</param> /// <param name="fieldType">Type of the field</param> public Field(int x, int y, string name, FieldType fieldType) { X = x; Y = y; Name = name; FieldType = fieldType; }
/// <summary> /// Initializes a new instance of the Field /// </summary> /// <param name="x">Coordinate of X</param> /// <param name="y">Coordinate of Y</param> /// <param name="fieldType">Type of the field</param> public Field(int x, int y, FieldType fieldType) { X = x; Y = y; Name = string.Empty; FieldType = fieldType; }
private QueryArgument[] CreateQueryArguments(Type entityType, bool onlyStructural) { PropertyInfo[] properties = entityType.GetProperties(); if (onlyStructural) { properties = properties.Where(p => p.PropertyType.IsValueType || p.PropertyType == typeof(String)).ToArray(); } var queryArguments = new List <QueryArgument>(properties.Length); for (int i = 0; i < properties.Length; i++) { QueryArgument queryArgument; var entityGraphType = (IObjectGraphType)_clrTypeToObjectGraphType[entityType]; FieldType? fieldType = entityGraphType.Fields.SingleOrDefault(f => f.Name == properties[i].Name); if (fieldType != null) { if (fieldType.Type == null) { String name; IGraphType resolvedType = fieldType.ResolvedType; if (resolvedType is NonNullGraphType nonNullGraphType) { resolvedType = nonNullGraphType.ResolvedType; name = resolvedType.Name; } else if (resolvedType is ListGraphType listGraphType) { name = listGraphType.ResolvedType.Name; } else { name = resolvedType.Name; } Type inputObjectGraphType = typeof(InputObjectGraphType <>).MakeGenericType(resolvedType.GetType()); var inputObjectGraph = (IInputObjectGraphType)Activator.CreateInstance(inputObjectGraphType) !; queryArgument = new QueryArgument(inputObjectGraphType) { Name = name, ResolvedType = inputObjectGraph }; } else { if (fieldType.Type.IsGenericType && typeof(NonNullGraphType).IsAssignableFrom(fieldType.Type)) { queryArgument = new QueryArgument(fieldType.Type.GetGenericArguments()[0]); } else { queryArgument = new QueryArgument(fieldType.Type); } } queryArgument.Name = NameFirstCharLower(properties[i].Name); queryArguments.Add(queryArgument); } } return(queryArguments.ToArray()); }
/// <summary> /// Initializes a new instance with the specified parameters. /// </summary> public ArgumentInformation(ParameterInfo parameterInfo, Type?sourceType, FieldType?fieldType, TypeInformation typeInformation, LambdaExpression?expression) { ParameterInfo = parameterInfo ?? throw new ArgumentNullException(nameof(parameterInfo)); FieldType = fieldType; // ?? throw new ArgumentNullException(nameof(fieldType)); SourceType = sourceType; // ?? throw new ArgumentNullException(nameof(sourceType)); TypeInformation = typeInformation ?? throw new ArgumentNullException(nameof(typeInformation)); Expression = expression; }
/// <summary> /// Initializes an instance of <see cref="ExecutionNode"/> with the specified values /// </summary> /// <param name="parent">The parent node, or <see langword="null"/> if this is the root node</param> /// <param name="graphType">The graph type of this node, unwrapped if it is a <see cref="NonNullGraphType"/>. Array nodes will be a <see cref="ListGraphType"/> instance.</param> /// <param name="field">The AST field of this node</param> /// <param name="fieldDefinition">The graph's field type of this node</param> /// <param name="indexInParentNode">For child array item nodes of a <see cref="ListGraphType"/>, the index of this array item within the field; otherwise, <see langword="null"/></param> protected ExecutionNode(ExecutionNode?parent, IGraphType?graphType, Field?field, FieldType?fieldDefinition, int?indexInParentNode) { Parent = parent; GraphType = graphType; Field = field; FieldDefinition = fieldDefinition; IndexInParentNode = indexInParentNode; }
private static void CollectFieldsAndFragmentNames( ValidationContext context, IGraphType?parentType, SelectionSet selectionSet, Dictionary <string, List <FieldDefPair> > nodeAndDefs, HashSet <string> fragments) { for (int i = 0; i < selectionSet.Selections.Count; i++) { var selection = selectionSet.Selections[i]; if (selection is Field field) { var fieldName = field.Name; FieldType?fieldDef = null; if (isObjectType(parentType) || isInterfaceType(parentType)) { fieldDef = (parentType as IComplexGraphType) !.GetField(fieldName); } var responseName = !string.IsNullOrWhiteSpace(field.Alias) ? field.Alias ! : fieldName; if (!nodeAndDefs.ContainsKey(responseName)) { nodeAndDefs[responseName] = new List <FieldDefPair>(); } nodeAndDefs[responseName].Add(new FieldDefPair { ParentType = parentType, Field = selection, FieldDef = fieldDef }); } else if (selection is FragmentSpread fragmentSpread) { fragments.Add(fragmentSpread.Name); } else if (selection is InlineFragment inlineFragment) { var typeCondition = inlineFragment.Type; var inlineFragmentType = typeCondition != null ? typeCondition.GraphTypeFromType(context.Schema) : parentType; CollectFieldsAndFragmentNames( context, inlineFragmentType, inlineFragment.SelectionSet, nodeAndDefs, fragments); } } }
/// <summary> /// Returns the name of the WeightFieldMember /// </summary> /// <param name="esField">IModelMemberElasticSearchField instance</param> /// <param name="value">FieldType value</param> public static void Set_FieldType(IModelMemberElasticSearchField esField, FieldType?value) { if (esField != null) { if (value.HasValue && esField.Parent is IModelMember member && string.IsNullOrEmpty(esField.FieldName)) { esField.FieldName = ElasticSearchClient.FieldName(member.Name); } ((ModelNode)esField).SetValue <FieldType?>(nameof(IModelMemberElasticSearchField.FieldType), value); } }
/// <summary> /// Get the Elastic Search Field Type Related. /// </summary> /// <param name="att">ElasticPropertyAttribute</param> /// <param name="p">Property Field</param> /// <returns>String with the type name or null if can not be inferres</returns> private static string GetElasticSearchType(ElasticsearchPropertyAttribute att, PropertyInfo p) { FieldType?fieldType = att.Type; if (fieldType == FieldType.None) { fieldType = GetFieldTypeFromType(p.PropertyType); } return(GetElasticSearchTypeFromFieldType(fieldType)); }
/// <summary> /// Get the Elastic Search Field from a FieldType. /// </summary> /// <param name="fieldType">FieldType</param> /// <returns>String with the type name or null if can not be inferres</returns> private string GetElasticSearchTypeFromFieldType(FieldType?fieldType) { switch (fieldType) { case FieldType.GeoPoint: return("geo_point"); case FieldType.GeoShape: return("geo_shape"); case FieldType.Attachment: return("attachment"); case FieldType.Ip: return("ip"); case FieldType.Binary: return("binary"); case FieldType.String: return("string"); case FieldType.Integer: return("integer"); case FieldType.Long: return("long"); case FieldType.Float: return("float"); case FieldType.Double: return("double"); case FieldType.Date: return("date"); case FieldType.Boolean: return("boolean"); case FieldType.Completion: return("completion"); case FieldType.Nested: return("nested"); case FieldType.Object: return("object"); default: return(null); } }
/// <summary> /// Initializes a new instance with the specified parameters. /// If the parameter type is <see cref="IResolveFieldContext"/> or <see cref="CancellationToken"/>, /// an expression is generated for the parameter and set within <see cref="Expression"/>; otherwise /// <see cref="Expression"/> is set to <see langword="null"/>. /// </summary> public ArgumentInformation(ParameterInfo parameterInfo, Type?sourceType, FieldType?fieldType, TypeInformation typeInformation) : this(parameterInfo, sourceType, fieldType, typeInformation, null) { if (parameterInfo.ParameterType == typeof(IResolveFieldContext)) { Expression = (IResolveFieldContext x) => x; } else if (parameterInfo.ParameterType == typeof(CancellationToken)) { Expression = (IResolveFieldContext x) => x.CancellationToken; } }
public virtual void CopyFrom(FieldDialogViewModel field) { _name = field.Name; _defaultString = field._defaultString; _defaultBoolean = field._defaultBoolean; _prompt = field.Prompt; _description = field.Description; ChoicesSource = field._choicesSource == null ? new ObservableCollection <StringViewModel>() : new ObservableCollection <StringViewModel>(field._choicesSource); _choices = new ListCollectionView(_choicesSource); _selectedFieldType = field.SelectedFieldType; }
public Field(string FieldName,FieldType type,bool Nullable,int fieldLength) { if (FieldName == null) throw new Exception("Cannot set Field with null name."); _fieldName=FieldName.ToUpper(); _fieldType=type; _nullable=Nullable; _fieldLength=fieldLength; if (_fieldType.Equals(FieldType.STRING) && (fieldLength==0)) { throw new Exception("Cannot set field type of string without setting the field length. Set -1 for very large strings."); } }
/// <summary> /// Get the Elastic Search Field from a FieldType. /// </summary> /// <param name="fieldType">FieldType</param> /// <returns>String with the type name or null if can not be inferres</returns> private string GetElasticSearchTypeFromFieldType(FieldType?fieldType) { switch (fieldType) { case FieldType.geo_point: return("geo_point"); case FieldType.attachment: return("attachment"); case FieldType.ip: return("ip"); case FieldType.binary: return("binary"); case FieldType.string_type: return("string"); case FieldType.integer_type: return("integer"); case FieldType.long_type: return("long"); case FieldType.float_type: return("float"); case FieldType.double_type: return("double"); case FieldType.date_type: return("date"); case FieldType.boolean_type: return("boolean"); case FieldType.nested: return("nested"); case FieldType.completion: return("completion"); case FieldType.@object: return("object"); default: return(null); } }
/// <summary> /// Get the Elastic Search Field Type Related. /// </summary> /// <param name="att">ElasticPropertyAttribute</param> /// <param name="p">Property Field</param> /// <returns>String with the type name or null if can not be inferres</returns> private string GetElasticSearchType(IElasticPropertyAttribute att, PropertyInfo p) { FieldType?fieldType = null; if (att != null) { fieldType = att.Type; } if (fieldType == null || fieldType == FieldType.none) { fieldType = this.GetFieldTypeFromType(p.PropertyType); } return(this.GetElasticSearchTypeFromFieldType(fieldType)); }
public Effect(FieldType?TargetCard, PlayerType?TargetPlayer, ViewType viewType, int effectCost, int pos, int id, int useAmount, int maxUseAmount, bool singleUse, string actionName, string effectString, int effectAmount) { this.TargetCard = TargetCard; this.TargetPlayer = TargetPlayer; this.viewType = viewType; this.effectCost = effectCost; this.pos = pos; this.id = id; this.useAmount = useAmount; this.maxUseAmount = maxUseAmount; this.singleUse = singleUse; this.actionName = actionName; this.effectString = effectString; this.effectAmount = effectAmount; this.action = GetEffect(actionName, effectAmount); effectText = HelperFunctions.NewText(this.effectString, 10, new Vector2f(10, 230 + 20 * pos), Color.Black); }
static bool TryGetRecognizedFieldType(AttributeMetadata attribute, out FieldType fieldType) { FieldType?_fieldType = attribute.AttributeType == AttributeTypeCode.Customer ? FieldType.EntityReference : attribute.AttributeType == AttributeTypeCode.EntityName ? FieldType.String : attribute.AttributeType == AttributeTypeCode.Memo ? FieldType.String : IsUnsupported(attribute) ? FieldType.Unsupported : Enum.IsDefined(typeof(FieldType), (FieldType)attribute.AttributeType) ? (FieldType)attribute.AttributeType : (FieldType?)null; fieldType = _fieldType ?? FieldType.Unsupported; return(_fieldType.HasValue); }
//todo //private Effect GetEffect(string effect) //{ // if (effect == "HealAllyCard") // { // return // } //} public Effect(int pos, Card card, FieldType?targetCard, PlayerType?targetPlayer, string text, CustomAction action, int effectCost = 1) { this.card = card; //if (card is SpellCard) //{ // hasCost = false; //} //else //{ // hasCost = true; //} this.action = action; this.TargetCard = targetCard; this.TargetPlayer = targetPlayer; this.pos = pos; id = random.Next(); this.effectCost = effectCost; effectString = text; effectText = HelperFunctions.NewText(text, 10, new Vector2f(10, 230 + 20 * pos), Color.Black); }
private QueryParameters AddOrdering(QueryParameters parameters, Order?order, FieldType?field) { if (field.HasValue) { parameters.Add("orderBy", field.Value); } else { parameters.Add("orderBy", "id"); } if (order.HasValue) { parameters.Add("order", order.Value); } else { parameters.Add("order", Order.Ascending); } return(parameters); }
/// <summary> /// Returns a page of mailings in the account that match the given schedule time /// </summary> /// <param name="scheduleTime"></param> /// <param name="beforeSchedulingTime"></param> /// <param name="fields"></param> /// <param name="order"></param> /// <param name="orderBy"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public Page <Mailing> GetMailingsBySchedulingTime(Timestamp scheduleTime, bool beforeSchedulingTime, List <FieldType> fields, Order?order, FieldType?orderBy, int pageIndex, int pageSize) { ValidatePaginationParameters(pageIndex, pageSize); QueryParameters parameters = new QueryParameters(); parameters.Add("page_index", pageIndex); parameters.Add("page_size", pageSize); parameters.Add("scheduleTime", scheduleTime.ToString()); parameters.Add("beforeSchedulingTime", beforeSchedulingTime); parameters.AddList("fields", fields); parameters = AddOrdering(parameters, order, orderBy); ResponseWrapper response = Get("mailings/filter/scheduletime", parameters); Page <Mailing> page = new Page <Mailing>(pageIndex, pageSize, response); page.Items = SerializationUtils <MailingCollection> .FromXmlString(response.Body); return(page); }
public bool InitField(TagHelperContext context, TagHelperOutput output) { var isSuccess = true; #region << Init >> if (FieldId == null) { FieldId = Guid.NewGuid(); } if (String.IsNullOrWhiteSpace(ApiUrl) && Mode == FieldRenderMode.InlineEdit && (RecordId == null || String.IsNullOrWhiteSpace(EntityName))) { InitErrors.Add("In 'inlineEdit' when 'api-url' is not defined, entityName and recordId are required!"); } if (LabelMode == LabelRenderMode.Undefined) { //Check if it is defined in form group if (context.Items.ContainsKey(typeof(LabelRenderMode))) { LabelMode = (LabelRenderMode)context.Items[typeof(LabelRenderMode)]; } else { LabelMode = LabelRenderMode.Stacked; } } if (Mode == FieldRenderMode.Undefined) { //Check if it is defined in form group if (context.Items.ContainsKey(typeof(FieldRenderMode))) { Mode = (FieldRenderMode)context.Items[typeof(FieldRenderMode)]; } else { Mode = FieldRenderMode.Form; } } if (!String.IsNullOrWhiteSpace(Locale)) { Culture = new CultureInfo(Locale); } if (String.IsNullOrWhiteSpace(Name) && (Mode == FieldRenderMode.Form || Mode == FieldRenderMode.InlineEdit) && context.TagName != "wv-field-plaintext") { InitErrors.Add("In InlineEdit or Form the attribute 'name' is required"); } if (ValidationErrors.Count > 0) { ValidationErrors = ValidationErrors.FindAll(x => x.PropertyName == Name.ToLowerInvariant()).ToList(); } if (ValidationErrors.Count == 0) { //Check if it is defined in form group if (context.Items.ContainsKey(typeof(ValidationException))) { var validation = (ValidationException)context.Items[typeof(ValidationException)]; if (validation != null & validation.Errors.Count > 0) { ValidationErrors = validation.Errors.FindAll(x => x.PropertyName == Name.ToLowerInvariant()); } } } if (AutoComplete == null) { if (context.Items.ContainsKey("FromAutocomplete")) { AutoComplete = (bool)context.Items["FromAutocomplete"]; } } #region << Init Value >> var tagName = context.TagName; var errorList = new List <string>(); FieldType?fieldType = FieldType.TextField; switch (context.TagName) { case "wv-field-autonumber": fieldType = FieldType.AutoNumberField; break; case "wv-field-checkbox": fieldType = FieldType.CheckboxField; break; case "wv-field-checkbox-grid": { fieldType = FieldType.TextField; } break; case "wv-field-currency": fieldType = FieldType.CurrencyField; break; case "wv-field-date": fieldType = FieldType.DateField; break; case "wv-field-datetime": case "wv-field-time": fieldType = FieldType.DateTimeField; break; case "wv-field-email": fieldType = FieldType.EmailField; break; case "wv-field-file": fieldType = FieldType.FileField; break; case "wv-field-html": fieldType = FieldType.HtmlField; break; case "wv-field-image": fieldType = FieldType.ImageField; break; case "wv-field-textarea": fieldType = FieldType.MultiLineTextField; break; case "wv-field-multiselect": case "wv-field-checkbox-list": fieldType = FieldType.MultiSelectField; if (Value is List <string> ) { } else if (Value is List <SelectOption> ) { var newListString = new List <string>(); foreach (var option in (List <SelectOption>)Value) { newListString.Add(option.Value); } Value = newListString; } else { throw new Exception("Expected multiselect value is List<string> or List<SelectOption>"); } break; case "wv-field-number": fieldType = FieldType.NumberField; break; case "wv-field-password": fieldType = FieldType.PasswordField; break; case "wv-field-percent": fieldType = FieldType.PercentField; break; case "wv-field-phone": fieldType = FieldType.PhoneField; break; case "wv-field-guid": fieldType = FieldType.GuidField; break; case "wv-field-select": fieldType = FieldType.SelectField; break; case "wv-field-text": fieldType = FieldType.TextField; break; case "wv-field-url": fieldType = FieldType.UrlField; break; default: fieldType = null; break; } dynamic valueResult = null; DataUtils.ValidateValueToFieldType(fieldType, Value, out valueResult, out errorList); Value = valueResult; dynamic defaultValueResult = null; DataUtils.ValidateValueToFieldType(fieldType, DefaultValue, out defaultValueResult, out errorList); DefaultValue = defaultValueResult; if (errorList.Count > 0) { foreach (var error in errorList) { InitErrors.Add(error); } } #endregion #endregion #region << Render Field Group / Output tag >> output.TagName = "div"; if (!String.IsNullOrWhiteSpace(Class)) { CssClassList.Add(Class); } CssClassList.Add("form-group"); CssClassList.Add("erp-field"); if (LabelMode == LabelRenderMode.Horizontal) { CssClassList.Add("label-horizontal"); } if (!String.IsNullOrWhiteSpace(Id)) { output.Attributes.Add("id", Id); } switch (LabelMode) { case LabelRenderMode.Hidden: CssClassList.Add("label-hidden"); break; case LabelRenderMode.Horizontal: CssClassList.Add("row no-gutters"); break; } switch (Mode) { case FieldRenderMode.Display: CssClassList.Add("display"); break; case FieldRenderMode.Form: CssClassList.Add("form"); break; case FieldRenderMode.InlineEdit: CssClassList.Add("inline-edit"); break; case FieldRenderMode.Simple: CssClassList.Add("list"); break; } output.Attributes.SetAttribute("class", String.Join(' ', CssClassList)); #endregion #region << Render Label >> if (LabelMode != LabelRenderMode.Hidden) { var labelEl = new TagBuilder("label"); //Set label attributes if (FieldId != null) { labelEl.Attributes.Add("for", "input-" + FieldId); } if (LabelMode == LabelRenderMode.Horizontal) { labelEl.Attributes.Add("class", "col-12 col-sm-auto col-form-label label-horizontal pr-0 pr-sm-2"); } else { labelEl.Attributes.Add("class", "control-label label-stacked"); } //Set Required if (Required && Mode == FieldRenderMode.Form) { var requiredEl = new TagBuilder("abbr"); requiredEl.MergeAttribute("class", "go-red"); requiredEl.MergeAttribute("title", "required"); requiredEl.InnerHtml.Append("*"); labelEl.InnerHtml.AppendHtml(requiredEl); } //Set Label text if (LabelMode != LabelRenderMode.Horizontal) { labelEl.InnerHtml.AppendHtml(LabelText); } else { labelEl.InnerHtml.AppendHtml(LabelText + ":"); } //Set Help if (!String.IsNullOrWhiteSpace(LabelHelpText)) { var helpEl = new TagBuilder("i"); helpEl.MergeAttribute("class", "fa fa-fw fa-question-circle field-help"); helpEl.MergeAttribute("data-toggle", "tooltip"); helpEl.MergeAttribute("data-placement", "top"); helpEl.MergeAttribute("data-html", "true"); helpEl.MergeAttribute("id", "help-message-" + FieldId); helpEl.MergeAttribute("title", LabelHelpText); labelEl.InnerHtml.AppendHtml(helpEl); var scriptEl = new TagBuilder("script"); var script = $"$(function () {{$('#help-message-{FieldId}').tooltip();}})"; scriptEl.InnerHtml.AppendHtml(script); labelEl.InnerHtml.AppendHtml(scriptEl); } ; //Set Warning if (!String.IsNullOrWhiteSpace(LabelWarningText)) { var helpEl = new TagBuilder("i"); helpEl.MergeAttribute("class", "fa fa-fw fa-exclamation-triangle field-warning-message"); helpEl.MergeAttribute("data-toggle", "tooltip"); helpEl.MergeAttribute("data-placement", "top"); helpEl.MergeAttribute("data-html", "true"); helpEl.MergeAttribute("id", "warning-message-" + FieldId); helpEl.MergeAttribute("data-delay", "{ \"show\": 100, \"hide\": 3000 }"); helpEl.MergeAttribute("title", LabelWarningText); labelEl.InnerHtml.AppendHtml(helpEl); var scriptEl = new TagBuilder("script"); var script = $"$(function () {{$('#warning-message-{FieldId}').tooltip();}})"; scriptEl.InnerHtml.AppendHtml(script); labelEl.InnerHtml.AppendHtml(scriptEl); } ; //Set Error if (!String.IsNullOrWhiteSpace(LabelErrorText)) { var helpEl = new TagBuilder("i"); helpEl.MergeAttribute("class", "fa fa-fw fa-exclamation-circle field-error-message"); helpEl.MergeAttribute("data-toggle", "tooltip"); helpEl.MergeAttribute("data-placement", "top"); helpEl.MergeAttribute("data-html", "true"); helpEl.MergeAttribute("id", "error-message-" + FieldId); helpEl.MergeAttribute("data-delay", "{ \"show\": 100, \"hide\": 3000 }"); helpEl.MergeAttribute("title", LabelErrorText); labelEl.InnerHtml.AppendHtml(helpEl); var scriptEl = new TagBuilder("script"); var script = $"$(function () {{$('#error-message-{FieldId}').tooltip();}})"; scriptEl.InnerHtml.AppendHtml(script); labelEl.InnerHtml.AppendHtml(scriptEl); } ; output.PreContent.AppendHtml(labelEl); } #endregion #region << Field Outer Wrapper tag - StartTag >> var fieldWrapper = new TagBuilder("div"); fieldWrapper.AddCssClass("col"); if (LabelMode == LabelRenderMode.Horizontal) { output.PreContent.AppendHtml(fieldWrapper.RenderStartTag()); } #endregion #region << if Init Errors >> if (InitErrors.Count > 0) { var errorListEl = new TagBuilder("ul"); errorListEl.AddCssClass("erp-error-list list-unstyled"); foreach (var error in InitErrors) { var errorEl = new TagBuilder("li"); errorEl.AddCssClass("go-red"); var iconEl = new TagBuilder("span"); iconEl.AddCssClass("fa fa-fw fa-exclamation"); errorEl.InnerHtml.AppendHtml(iconEl); errorEl.InnerHtml.Append($"Error: {error}"); errorListEl.InnerHtml.AppendHtml(errorEl); } output.PostContent.AppendHtml(errorListEl); return(false); } #endregion #region << if Forbidden >> if (Access == FieldAccess.Forbidden) { if (Mode != FieldRenderMode.Simple) { var forbiddenEl = new TagBuilder("div"); forbiddenEl.AddCssClass("form-control-plaintext"); var innerSpan = new TagBuilder("span"); innerSpan.AddCssClass("go-gray"); var innerIcon = new TagBuilder("span"); innerIcon.AddCssClass("fa fa-lock mr-1"); var innerEm = new TagBuilder("em"); innerEm.InnerHtml.Append(AccessDeniedMessage); innerSpan.InnerHtml.AppendHtml(innerIcon); innerSpan.InnerHtml.AppendHtml(innerEm); forbiddenEl.InnerHtml.AppendHtml(innerSpan); output.PostContent.AppendHtml(forbiddenEl); return(false); } else { var innerSpan = new TagBuilder("span"); innerSpan.AddCssClass("go-gray"); var innerIcon = new TagBuilder("span"); innerIcon.AddCssClass("fa fa-lock mr-1"); var innerEm = new TagBuilder("em"); innerEm.InnerHtml.Append(AccessDeniedMessage); innerSpan.InnerHtml.AppendHtml(innerIcon); innerSpan.InnerHtml.AppendHtml(innerEm); output.SuppressOutput(); output.PostContent.AppendHtml(innerSpan); return(false); } } #endregion #region << Field Outer Wrapper tag - End Tag >> if (LabelMode == LabelRenderMode.Horizontal) { output.PostContent.AppendHtml(fieldWrapper.RenderEndTag()); } #endregion #region << Init SubInputEl >> if (ValidationErrors.Count == 1) { SubInputEl = new TagBuilder("div"); SubInputEl.AddCssClass("invalid-feedback d-block"); SubInputEl.InnerHtml.AppendHtml(ValidationErrors.First().Message); } else if (ValidationErrors.Count > 1) { SubInputEl = new TagBuilder("div"); SubInputEl.AddCssClass("invalid-feedback d-block"); var errorListEl = new TagBuilder("ul"); foreach (var error in ValidationErrors) { var errorEl = new TagBuilder("li"); errorEl.InnerHtml.AppendHtml(error.Message); errorListEl.InnerHtml.AppendHtml(errorEl); } SubInputEl.InnerHtml.AppendHtml(errorListEl); } else if (!String.IsNullOrWhiteSpace(Description)) { SubInputEl = new TagBuilder("div"); SubInputEl.AddCssClass("field-description form-text text-muted"); SubInputEl.InnerHtml.AppendHtml(Description); } #endregion #region << Init EmptyValEl>> { EmptyValEl = new TagBuilder("div"); EmptyValEl.AddCssClass("form-control-plaintext"); var innerSpan = new TagBuilder("span"); innerSpan.AddCssClass("go-gray"); var innerEm = new TagBuilder("em"); innerEm.InnerHtml.Append(EmptyValueMessage); innerSpan.InnerHtml.AppendHtml(innerEm); EmptyValEl.InnerHtml.AppendHtml(innerSpan); } #endregion return(isSuccess); }
public MapInfo(WzImage image, string strMapName, string strStreetName) { int? startHour; int? endHour; this.strMapName = strMapName; this.strStreetName = strStreetName; foreach (IWzImageProperty prop in image["info"].WzProperties) switch (prop.Name) { case "bgm": bgm = InfoTool.GetString(prop); break; case "cloud": cloud = InfoTool.GetBool(prop); break; case "swim": swim = InfoTool.GetBool(prop); break; case "forcedReturn": forcedReturn = InfoTool.GetInt(prop); break; case "hideMinimap": hideMinimap = InfoTool.GetBool(prop); break; case "mapDesc": mapDesc = InfoTool.GetString(prop); break; case "mapMark": MapMark = InfoTool.GetString(prop); break; case "mobRate": mobRate = InfoTool.GetFloat(prop); break; case "moveLimit": moveLimit = InfoTool.GetInt(prop); break; case "returnMap": returnMap = InfoTool.GetInt(prop); break; case "town": town = InfoTool.GetBool(prop); break; case "version": version = InfoTool.GetInt(prop); break; case "fieldLimit": int fl = InfoTool.GetInt(prop); if (fl >= (int)Math.Pow(2, 23)) fl = fl & ((int)Math.Pow(2, 23) - 1); fieldLimit = (FieldLimit)fl; break; case "VRTop": case "VRBottom": case "VRLeft": case "VRRight": break; case "link": //link = InfoTool.GetInt(prop); break; case "timeLimit": timeLimit = InfoTool.GetInt(prop); break; case "lvLimit": lvLimit = InfoTool.GetInt(prop); break; case "onFirstUserEnter": onFirstUserEnter = InfoTool.GetString(prop); break; case "onUserEnter": onUserEnter = InfoTool.GetString(prop); break; case "fly": fly = InfoTool.GetBool(prop); break; case "noMapCmd": noMapCmd = InfoTool.GetBool(prop); break; case "partyOnly": partyOnly = InfoTool.GetBool(prop); break; case "fieldType": int ft = InfoTool.GetInt(prop); if (!Enum.IsDefined(typeof(FieldType), ft)) ft = 0; fieldType = (FieldType)ft; break; case "miniMapOnOff": miniMapOnOff = InfoTool.GetBool(prop); break; case "reactorShuffle": reactorShuffle = InfoTool.GetBool(prop); break; case "reactorShuffleName": reactorShuffleName = InfoTool.GetString(prop); break; case "personalShop": personalShop = InfoTool.GetBool(prop); break; case "entrustedShop": entrustedShop = InfoTool.GetBool(prop); break; case "effect": effect = InfoTool.GetString(prop); break; case "lvForceMove": lvForceMove = InfoTool.GetInt(prop); break; case "timeMob": startHour = InfoTool.GetOptionalInt(prop["startHour"]); endHour = InfoTool.GetOptionalInt(prop["endHour"]); int? id = InfoTool.GetOptionalInt(prop["id"]); string message = InfoTool.GetOptionalString(prop["message"]); if (id == null || message == null || (startHour == null ^ endHour == null)) { //System.Windows.Forms.MessageBox.Show("Warning", "Warning - incorrect timeMob structure in map data. Skipped and error log was saved."); WzFile file = (WzFile)image.WzFileParent; if (file != null) ErrorLogger.Log(ErrorLevel.IncorrectStructure, "timeMob, map " + image.Name + " of version " + Enum.GetName(typeof(WzMapleVersion), file.MapleVersion) + ", v" + file.Version.ToString()); } else timeMob = new TimeMob((int?)startHour, (int?)endHour, (int)id, message); break; case "help": help = InfoTool.GetString(prop); break; case "snow": snow = InfoTool.GetBool(prop); break; case "rain": rain = InfoTool.GetBool(prop); break; case "dropExpire": dropExpire = InfoTool.GetInt(prop); break; case "decHP": decHP = InfoTool.GetInt(prop); break; case "decInterval": decInterval = InfoTool.GetInt(prop); break; case "autoLieDetector": startHour = InfoTool.GetOptionalInt(prop["startHour"]); endHour = InfoTool.GetOptionalInt(prop["endHour"]); int? interval = InfoTool.GetOptionalInt(prop["interval"]); int? propInt = InfoTool.GetOptionalInt(prop["prop"]); if (startHour == null || endHour == null || interval == null || propInt == null) { //System.Windows.Forms.MessageBox.Show("Warning", "Warning - incorrect autoLieDetector structure in map data. Skipped and error log was saved."); WzFile file = (WzFile)image.WzFileParent; if (file != null) ErrorLogger.Log(ErrorLevel.IncorrectStructure, "autoLieDetector, map " + image.Name + " of version " + Enum.GetName(typeof(WzMapleVersion), file.MapleVersion) + ", v" + file.Version.ToString()); } else autoLieDetector = new AutoLieDetector((int)startHour, (int)endHour, (int)interval, (int)propInt); break; case "expeditionOnly": expeditionOnly = InfoTool.GetBool(prop); break; case "fs": fs = InfoTool.GetFloat(prop); break; case "protectItem": protectItem = InfoTool.GetInt(prop); break; case "createMobInterval": createMobInterval = InfoTool.GetInt(prop); break; case "fixedMobCapacity": fixedMobCapacity = InfoTool.GetInt(prop); break; case "streetName": streetName = InfoTool.GetString(prop); break; case "noRegenMap": noRegenMap = InfoTool.GetBool(prop); break; case "allowedItems": allowedItems = new List<int>(); if (prop.WzProperties != null && prop.WzProperties.Count > 0) foreach (IWzImageProperty item in prop.WzProperties) allowedItems.Add((int)item); break; case "recovery": recovery = InfoTool.GetFloat(prop); break; case "blockPBossChange": blockPBossChange = InfoTool.GetBool(prop); break; case "everlast": everlast = InfoTool.GetBool(prop); break; case "damageCheckFree": damageCheckFree = InfoTool.GetBool(prop); break; case "dropRate": dropRate = InfoTool.GetFloat(prop); break; case "scrollDisable": scrollDisable = InfoTool.GetBool(prop); break; case "needSkillForFly": needSkillForFly = InfoTool.GetBool(prop); break; case "zakum2Hack": zakum2Hack = InfoTool.GetBool(prop); break; case "allMoveCheck": allMoveCheck = InfoTool.GetBool(prop); break; case "VRLimit": VRLimit = InfoTool.GetBool(prop); break; case "consumeItemCoolTime": consumeItemCoolTime = InfoTool.GetBool(prop); break; default: additionalProps.Add(prop); break; } if (image["info"]["VRLeft"] != null) { IWzImageProperty info = image["info"]; int left = InfoTool.GetInt(info["VRLeft"]); int right = InfoTool.GetInt(info["VRRight"]); int top = InfoTool.GetInt(info["VRTop"]); int bottom = InfoTool.GetInt(info["VRBottom"]); VR = new Rectangle(left, top, right - left, bottom - top); } }
private static IList <LambdaExpression> BuildFieldResolver_BuildMethodArguments(MethodInfo methodInfo, Type?sourceType, FieldType?fieldType) { List <LambdaExpression> expressions = new(); foreach (var parameterInfo in methodInfo.GetParameters()) { var typeInformation = new TypeInformation(parameterInfo); typeInformation.ApplyAttributes(); // typically this is unnecessary, since this is primarily used to control the graph type of generated query arguments var argumentInfo = new ArgumentInformation(parameterInfo, sourceType, fieldType, typeInformation); argumentInfo.ApplyAttributes(); // necessary to allow [FromSource], [FromServices] and similar attributes to work var(queryArgument, expression) = argumentInfo.ConstructQueryArgument(); if (queryArgument != null) { // even though the query argument is not used, it is necessary to apply attributes to the generated argument in case the name is overridden, // as the generated query argument's name is used within the expression for the call to GetArgument var attributes = parameterInfo.GetCustomAttributes <GraphQLAttribute>(); foreach (var attr in attributes) { attr.Modify(queryArgument); } } expression ??= GetParameterExpression( parameterInfo.ParameterType, queryArgument ?? throw new InvalidOperationException("Invalid response from ConstructQueryArgument: queryArgument and expression cannot both be null")); expressions.Add(expression); } return(expressions); }
/// <summary> /// Constructor for Fielddto /// </summary> /// <param name="id"> ///<summary> /// TBD ///</summary> /// </param> /// <param name="name"> ///<summary> /// TBD ///</summary> /// </param> /// <param name="fieldType"> ///<summary> /// TBD ///</summary> /// </param> public Fielddto(long?id, string name, FieldType?fieldType) { this.Id = id; this.Name = name; this.FieldType = fieldType; }
/// <summary> /// Constructs an event stream resolver for the specified method with the specified instance expression. /// Does not build accompanying query arguments for detected method parameters. /// Does not allow overriding build behavior. /// <br/><br/> /// An example of an instance expression would be as follows: /// <code>context => (TSourceType)context.Source</code> /// </summary> public static ISourceStreamResolver BuildSourceStreamResolver(MethodInfo methodInfo, Type?sourceType, FieldType?fieldType, LambdaExpression instanceExpression) { var arguments = BuildFieldResolver_BuildMethodArguments(methodInfo, sourceType, fieldType); return(new SourceStreamMethodResolver(methodInfo, instanceExpression, arguments)); }
/// <summary> /// Constructs a field resolver for the specified field, property or method with the specified instance expression. /// Does not build accompanying query arguments for detected method parameters. /// Does not allow overriding build behavior. /// <br/><br/> /// An example of an instance expression would be as follows: /// <code>context => (TSourceType)context.Source</code> /// </summary> public static IFieldResolver BuildFieldResolver(MemberInfo memberInfo, Type?sourceType, FieldType?fieldType, LambdaExpression instanceExpression) { // this entire method is a simplification of AutoRegisteringObjectGraphType.BuildFieldType // but it does not provide the ability to override any behavior, and it does not return or // build query arguments if (memberInfo is FieldInfo fieldInfo) { return(new MemberResolver(fieldInfo, instanceExpression)); } else if (memberInfo is PropertyInfo propertyInfo) { return(new MemberResolver(propertyInfo, instanceExpression)); } else if (memberInfo is MethodInfo methodInfo) { var arguments = BuildFieldResolver_BuildMethodArguments(methodInfo, sourceType, fieldType); return(new MemberResolver(methodInfo, instanceExpression, arguments)); } throw new ArgumentOutOfRangeException(nameof(memberInfo), "Member must be a field, property or method."); }
public ObjectExecutionNode(ExecutionNode?parent, IGraphType?graphType, Field?field, FieldType?fieldDefinition, int?indexInParentNode) : base(parent, graphType, field, fieldDefinition, indexInParentNode) { }
internal void InitFieldName(PropertyInfo p) { if (_fieldName == null) { _fieldName = ""; if (p.Name.ToUpper() != p.Name) { foreach (char c in p.Name.ToCharArray()) { if (c.ToString().ToUpper() == c.ToString()) { _fieldName += "_" + c.ToString().ToUpper(); } else { _fieldName += c.ToString().ToUpper(); } } }else{ _fieldName=p.Name; } if (_fieldName[0] == '_') { _fieldName =_fieldName[1].ToString().ToUpper()+ _fieldName.Substring(2).ToUpper(); } if (_fieldName[_fieldName.Length-1]=='_') _fieldName=_fieldName.Substring(0,_fieldName.Length-1); if (!_fieldType.HasValue) _fieldType = GetFieldType(p.PropertyType); if ((_fieldLength==int.MinValue)&&((_fieldType == FieldType.STRING) || (_fieldType == FieldType.BYTE))) { if ((_fieldType== FieldType.BYTE)&&(!p.PropertyType.IsArray)) _fieldLength=1; else _fieldLength = -1; } if ((_fieldType == FieldType.STRING) && (this is PrimaryKeyField)) { if (((PrimaryKeyField)this).AutoGen) { _fieldLength = 38; } } Logger.LogLine("Located Field Name: "+_fieldName); } }
public Field(FieldType type) { _fieldType=type; }
public virtual SortFieldDescriptor <T> UnmappedType(FieldType?type) => Assign(a => a.UnmappedType = type);
/// <summary> /// Returns a page of mailings in the account that match the given creator name /// </summary> /// <param name="creatorName"></param> /// <param name="creatorNameOp"></param> /// <param name="fields"></param> /// <param name="order"></param> /// <param name="orderBy"></param> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public Page <Mailing> GetMailingsByCreatorName(string creatorName, StringOperation creatorNameOp, List <FieldType> fields, Order?order, FieldType?orderBy, int pageIndex, int pageSize) { ValidatePaginationParameters(pageIndex, pageSize); QueryParameters parameters = new QueryParameters(); parameters.Add("page_index", pageIndex); parameters.Add("page_size", pageSize); parameters.AddList("fields", fields); parameters.Add("creatorName", creatorName); parameters.Add("creatorNameOp", creatorNameOp); parameters = AddOrdering(parameters, order, orderBy); ResponseWrapper response = Get("mailings/filter/creatorname", parameters); Page <Mailing> page = new Page <Mailing>(pageIndex, pageSize, response); page.Items = SerializationUtils <MailingCollection> .FromXmlString(response.Body); return(page); }
public virtual SortFieldDescriptor <T> UnmappedType(FieldType?type) => Assign(type, (a, v) => a.UnmappedType = v);
public MapInfo(WzImage image, string strMapName, string strStreetName, string strCategoryName) { this.image = image; int? startHour; int? endHour; this.strMapName = strMapName; this.strStreetName = strStreetName; this.strCategoryName = strCategoryName; WzFile file = (WzFile)image.WzFileParent; string loggerSuffix = ", map " + image.Name + ((file != null) ? (" of version " + Enum.GetName(typeof(WzMapleVersion), file.MapleVersion) + ", v" + file.Version.ToString()) : ""); foreach (WzImageProperty prop in image["info"].WzProperties) { switch (prop.Name) { case "bgm": bgm = InfoTool.GetString(prop); break; case "cloud": cloud = InfoTool.GetBool(prop); break; case "swim": swim = InfoTool.GetBool(prop); break; case "forcedReturn": forcedReturn = InfoTool.GetInt(prop); break; case "hideMinimap": hideMinimap = InfoTool.GetBool(prop); break; case "mapDesc": mapDesc = InfoTool.GetString(prop); break; case "mapName": mapName = InfoTool.GetString(prop); break; case "mapMark": mapMark = InfoTool.GetString(prop); break; case "mobRate": mobRate = InfoTool.GetFloat(prop); break; case "moveLimit": moveLimit = InfoTool.GetInt(prop); break; case "returnMap": returnMap = InfoTool.GetInt(prop); break; case "town": town = InfoTool.GetBool(prop); break; case "version": version = InfoTool.GetInt(prop); break; case "fieldLimit": int fl = InfoTool.GetInt(prop); if (fl >= (int)Math.Pow(2, 23)) { ErrorLogger.Log(ErrorLevel.IncorrectStructure, "Invalid fieldlimit " + fl.ToString() + loggerSuffix); fl = fl & ((int)Math.Pow(2, 23) - 1); } fieldLimit = (FieldLimit)fl; break; case "VRTop": case "VRBottom": case "VRLeft": case "VRRight": break; case "link": //link = InfoTool.GetInt(prop); break; case "timeLimit": timeLimit = InfoTool.GetInt(prop); break; case "lvLimit": lvLimit = InfoTool.GetInt(prop); break; case "onFirstUserEnter": onFirstUserEnter = InfoTool.GetString(prop); break; case "onUserEnter": onUserEnter = InfoTool.GetString(prop); break; case "fly": fly = InfoTool.GetBool(prop); break; case "noMapCmd": noMapCmd = InfoTool.GetBool(prop); break; case "partyOnly": partyOnly = InfoTool.GetBool(prop); break; case "fieldType": int ft = InfoTool.GetInt(prop); if (!Enum.IsDefined(typeof(FieldType), ft)) { ErrorLogger.Log(ErrorLevel.IncorrectStructure, "Invalid fieldType " + ft.ToString() + loggerSuffix); ft = 0; } fieldType = (FieldType)ft; break; case "miniMapOnOff": miniMapOnOff = InfoTool.GetBool(prop); break; case "reactorShuffle": reactorShuffle = InfoTool.GetBool(prop); break; case "reactorShuffleName": reactorShuffleName = InfoTool.GetString(prop); break; case "personalShop": personalShop = InfoTool.GetBool(prop); break; case "entrustedShop": entrustedShop = InfoTool.GetBool(prop); break; case "effect": effect = InfoTool.GetString(prop); break; case "lvForceMove": lvForceMove = InfoTool.GetInt(prop); break; case "timeMob": startHour = InfoTool.GetOptionalInt(prop["startHour"]); endHour = InfoTool.GetOptionalInt(prop["endHour"]); int? id = InfoTool.GetOptionalInt(prop["id"]); string message = InfoTool.GetOptionalString(prop["message"]); if (id == null || message == null || (startHour == null ^ endHour == null)) { ErrorLogger.Log(ErrorLevel.IncorrectStructure, "timeMob" + loggerSuffix); } else timeMob = new TimeMob((int?)startHour, (int?)endHour, (int)id, message); break; case "help": help = InfoTool.GetString(prop); break; case "snow": snow = InfoTool.GetBool(prop); break; case "rain": rain = InfoTool.GetBool(prop); break; case "dropExpire": dropExpire = InfoTool.GetInt(prop); break; case "decHP": decHP = InfoTool.GetInt(prop); break; case "decInterval": decInterval = InfoTool.GetInt(prop); break; case "autoLieDetector": startHour = InfoTool.GetOptionalInt(prop["startHour"]); endHour = InfoTool.GetOptionalInt(prop["endHour"]); int? interval = InfoTool.GetOptionalInt(prop["interval"]); int? propInt = InfoTool.GetOptionalInt(prop["prop"]); if (startHour == null || endHour == null || interval == null || propInt == null) { ErrorLogger.Log(ErrorLevel.IncorrectStructure, "autoLieDetector" + loggerSuffix); } else autoLieDetector = new AutoLieDetector((int)startHour, (int)endHour, (int)interval, (int)propInt); break; case "expeditionOnly": expeditionOnly = InfoTool.GetBool(prop); break; case "fs": fs = InfoTool.GetFloat(prop); break; case "protectItem": protectItem = InfoTool.GetInt(prop); break; case "createMobInterval": createMobInterval = InfoTool.GetInt(prop); break; case "fixedMobCapacity": fixedMobCapacity = InfoTool.GetInt(prop); break; case "streetName": streetName = InfoTool.GetString(prop); break; case "noRegenMap": noRegenMap = InfoTool.GetBool(prop); break; case "allowedItem": allowedItem = new List<int>(); if (prop.WzProperties != null && prop.WzProperties.Count > 0) foreach (WzImageProperty item in prop.WzProperties) allowedItem.Add(item.GetInt()); break; case "recovery": recovery = InfoTool.GetFloat(prop); break; case "blockPBossChange": blockPBossChange = InfoTool.GetBool(prop); break; case "everlast": everlast = InfoTool.GetBool(prop); break; case "damageCheckFree": damageCheckFree = InfoTool.GetBool(prop); break; case "dropRate": dropRate = InfoTool.GetFloat(prop); break; case "scrollDisable": scrollDisable = InfoTool.GetBool(prop); break; case "needSkillForFly": needSkillForFly = InfoTool.GetBool(prop); break; case "zakum2Hack": zakum2Hack = InfoTool.GetBool(prop); break; case "allMoveCheck": allMoveCheck = InfoTool.GetBool(prop); break; case "VRLimit": VRLimit = InfoTool.GetBool(prop); break; case "consumeItemCoolTime": consumeItemCoolTime = InfoTool.GetBool(prop); break; default: ErrorLogger.Log(ErrorLevel.MissingFeature, "Unknown Prop: " + prop.Name + loggerSuffix); additionalProps.Add(prop.DeepClone()); break; } } }