/////////////////////////////////////////////////////////////////////// public bool AddUsage( UsageType type, long value ) { return((lambda != null) ? lambda.AddUsage(type, value) : false); }
private void btnAdd_Click(object sender, EventArgs e) { if (!ValidateMandatoryFields()) { return; } var existingUsage = uowUsage.Repository.GetAll().Where(u => u.UsageTypeCode == txtUsageTypeCode.Text.Trim()).FirstOrDefault(); if (existingUsage != null) { CommonMessageHelper.DataAlreadyExist(txtUsageDesc.Text.Trim()); } else { var usageToAdd = new UsageType { UsageTypeCode = txtUsageTypeCode.Text.Trim(), Description = txtUsageDesc.Text.Trim(), // Audit Fields CreatedBy = Properties.Settings.Default.CurrentUserId, CreatedAt = DateTime.Now, ModifiedBy = Properties.Settings.Default.CurrentUserId, ModifiedAt = DateTime.Now }; uowUsage.Repository.Add(usageToAdd); uowUsage.Commit(); btnReload.PerformClick(); CommonMessageHelper.DataSavedSuccessfully(); } }
/////////////////////////////////////////////////////////////////////// public bool SetUsage( UsageType type, ref long value ) { return((lambda != null) ? lambda.SetUsage(type, ref value) : false); }
/////////////////////////////////////////////////////////////////////// public bool AddUsage( UsageType type, long value ) { return((command != null) ? command.AddUsage(type, value) : false); }
private async Task <EditContext> GetRootEditContextAsync(UsageType usageType, string collectionAlias, string?parentId) { var collection = _collectionProvider.GetCollection(collectionAlias); var newEntity = await collection.Repository.InternalNewAsync(parentId, collection.EntityVariant.Type); return(new EditContext(newEntity, usageType | UsageType.List, _serviceProvider)); }
public Part GetNextSmaller(Part currentPart, UsageType necessaryUsageType) { return(GetByModulaton(currentPart.Modulation) .WhereType(necessaryUsageType) .OrderByDescending(p => p.Width) .FirstOrDefault(p => p.Width < currentPart.Width)); }
public Shampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) : base(name, brand, price, gender) { this.Milliliters = milliliters; this.Usage = usage; this.Price *= this.Milliliters; }
public async Task EnsureAuthorizedUserAsync(UsageType usageType, IEntity entity) { if (!await IsUserAuthorizedAsync(usageType, entity)) { throw new UnauthorizedAccessException(); } }
public async Task <ViewCommand> ProcessRelationActionAsync(UsageType usageType, string collectionAlias, IEntity relatedEntity, IEnumerable <EditContext> editContexts, string actionId, object?customData) { var collection = _collectionProvider.GetCollection(collectionAlias); var button = collection.FindButton(actionId); if (button == null) { throw new Exception($"Cannot determine which button triggered action for collection {collectionAlias}"); } var rootEditContext = await GetRootEditContextAsync(usageType, collectionAlias, null); var newEntity = await EnsureCorrectConcurrencyAsync(() => collection.Repository.NewAsync(null, collection.EntityVariant.Type)); await EnsureAuthorizedUserAsync(rootEditContext, button); ViewCommand viewCommand; var context = new ButtonContext(null, customData); switch (await button.ButtonClickBeforeRepositoryActionAsync(rootEditContext, context)) { case CrudType.Create: if (button.EntityVariant == null) { throw new InvalidOperationException(); } if (usageType.HasFlag(UsageType.List)) { viewCommand = new NavigateCommand { Uri = UriHelper.Node(Constants.New, collectionAlias, button.EntityVariant, default, null) }; }
private List <EditContext> ConvertEditContexts(UsageType usageType, string collectionAlias, EditContext rootEditContext, IEnumerable <IEntity> existingEntities) { if (usageType == UsageType.List) { return(existingEntities .Select(ent => new EditContext(ent, UsageType.Node | UsageType.Edit, _serviceProvider)) .ToList()); } else if (usageType.HasFlag(UsageType.Add)) { return(existingEntities .Select(ent => new EditContext(ent, UsageType.Node | UsageType.Pick, _serviceProvider)) .ToList()); } else if (usageType.HasFlag(UsageType.Edit) || usageType.HasFlag(UsageType.New)) { var entities = existingEntities .Select(ent => new EditContext(ent, UsageType.Node | UsageType.Edit, _serviceProvider)) .ToList(); if (usageType.HasFlag(UsageType.New)) { entities.Insert(0, new EditContext(rootEditContext.Entity, UsageType.Node | UsageType.New, _serviceProvider)); } return(entities); } else { throw new NotImplementedException($"Failed to process {usageType} for collection {collectionAlias}"); } }
public Shampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) : base(name, brand, price, gender) { this.Milliliters = milliliters; base.Price = price * this.Milliliters; this.Usage = usage; }
public override JToken ToJToken(ApiVersion version, ResultFormat format) { var obj = new JObject(); obj["usageType"] = UsageType.ToString(); if (Display != null) { obj["dispay"] = Display.ToJToken(version, format); } if (Description != null) { obj["description"] = Description.ToJToken(version, format); } obj["contentType"] = ContentType; obj["length"] = Length; obj["sha2"] = SHA2; if (FileUrl != null) { obj["fileUrl"] = FileUrl.ToString(); } return(obj); }
public async Task UnauthorisedUsageAsyncTest(UsageType type) { var response = await sandBoxClient.Account.UsageAsync(type); // This is due to a key on the Start plan and lack of documentation on https://iexcloud.io/docs/api/#usage around these. Assert.AreEqual("Forbidden - The API key provided is not valid.", response.ErrorMessage); }
protected override void Execute(List <GameEntity> entities) { var currentWeapon = _contexts.game.playerEntity.weapon.WeaponType; UsageType usage = UsageType.None; switch (currentWeapon) { case WeaponType.ConstantPower: usage = UsageType.Craft; break; case WeaponType.Slingshot: usage = UsageType.Weapon; break; } if (!_contexts.game.playerEntity.hasCurrentProjectile || _contexts.game.playerEntity.currentProjectile.value == null || !_contexts.game.playerEntity.currentProjectile.value.isInsideInventory) { var availableItems = _inventory.GetEntities().Where(x => x.usage.value == usage); if (availableItems.Any()) { _contexts.game.playerEntity.ReplaceCurrentProjectile(availableItems.First()); } } }
public async Task UsageAsyncTest(UsageType type) { var response = await sandBoxClient.Account.UsageAsync(type); Assert.IsNull(response.ErrorMessage); Assert.IsNotNull(response.Data); }
/////////////////////////////////////////////////////////////////////// public bool AddUsage( UsageType type, long value ) { return((@operator != null) ? @operator.AddUsage(type, value) : false); }
/// <summary> /// Initializes a new instance of the <see cref="CreateIPFencingViewModel" /> class. /// </summary> /// <param name="usage">usage (required).</param> /// <param name="rule">rule (required).</param> /// <param name="ipAddress">ipAddress.</param> /// <param name="ipRange">ipRange.</param> /// <param name="headerName">headerName.</param> /// <param name="headerValue">headerValue.</param> public CreateIPFencingViewModel(UsageType usage = default(UsageType), RuleType rule = default(RuleType), string ipAddress = default(string), string ipRange = default(string), string headerName = default(string), string headerValue = default(string)) { // to ensure "usage" is required (not null) if (usage == null) { throw new InvalidDataException("usage is a required property for CreateIPFencingViewModel and cannot be null"); } else { this.Usage = usage; } // to ensure "rule" is required (not null) if (rule == null) { throw new InvalidDataException("rule is a required property for CreateIPFencingViewModel and cannot be null"); } else { this.Rule = rule; } this.IpAddress = ipAddress; this.IpRange = ipRange; this.HeaderName = headerName; this.HeaderValue = headerValue; }
public static string ToNameString(this UsageType usage) { switch (usage) { case UsageType.Form: return("Forma"); case UsageType.Box: return("Caixa"); case UsageType.Lp: return("LP"); case UsageType.StartLp: return("LP de Partida"); case UsageType.EndLp: return("LP Final"); case UsageType.Ld: return("LD"); case UsageType.Lds: return("LDS"); case UsageType.Head: return("Cabeça"); default: throw new ArgumentOutOfRangeException(nameof(usage), usage, null); } }
public static Color ToColor(this UsageType usage) { switch (usage) { case UsageType.Form: return(Color.FromRgb(255, 255, 255)); case UsageType.Box: return(Color.FromRgb(255, 255, 255)); case UsageType.Lp: return(Color.FromRgb(25, 25, 200)); case UsageType.StartLp: return(Color.FromRgb(116, 88, 173)); case UsageType.EndLp: return(Color.FromRgb(200, 191, 231)); case UsageType.Ld: return(Color.FromRgb(38, 240, 120)); case UsageType.Lds: return(Color.FromRgb(255, 244, 40)); case UsageType.Head: return(Color.FromRgb(200, 0, 100)); default: throw new ArgumentOutOfRangeException(nameof(usage), usage, null); } }
public AssemblyReference(string projectName, string projectFile, UsageType usage, string refPath) { ProjectName = projectName; ProjecFile = projectFile; Usage = usage; ReferencePath = refPath; }
public ObjectUsage <T> Get(UsageType usage) { switch (usage) { case UsageType.Write: lock (buffers) { while (buffers[write].usage == UsageType.Read || write == lastWrite) { write = (write + 1) % 3; } } buffers[write].usage = UsageType.Write; buffers[write].frameId = Interlocked.Increment(ref currentFrame); return(buffers[write]); case UsageType.Read: if (lastWrite < 0) { return(null); } lock (buffers) { read = lastWrite; buffers[read].usage = UsageType.Read; } return(buffers[read]); } return(null); }
public IEditContext GetEditContextWrapper( UsageType usageType, EntityState entityState, IEntity updatedEntity, IEntity referenceEntity, IParent?parent, IEnumerable <(string propertyName, string typeName, IEnumerable <object> elements)> relations)
/////////////////////////////////////////////////////////////////////// public bool AddUsage( UsageType type, long value ) { return((function != null) ? function.AddUsage(type, value) : false); }
protected override void Load() { DataTable dt = new DataTable(); dt = datacomponentAttribute.GetComponentAttribute(this.ComponentKey, this.AttributeID); var cat = dt.AsEnumerable().Select(g => new ComponentAttribute { InstanceID = g.IsNull("FieldInstanceID") ? 0 : g.Field <int>("FieldInstanceID"), Type = g.IsNull("Attributetype") ? AttributeType._None : g.Field <AttributeType>("FieldInstanceID"), ComponentKey = g.IsNull("componentKey") ? "" : g.Field <string>("componentKey"), Cryptography = g.IsNull("cryptography") ? 0 : g.Field <int>("cryptography"), RegExpression = g.IsNull("regExpression") ? "" : g.Field <string>("regExpression"), ParentComponentKey = g.IsNull("parentComponent") ? "" : g.Field <string>("parentComponent"), ParentAttribute = g.IsNull("parentAttribute") ? "" : g.Field <string>("parentAttribute"), UsageFieldType = g.IsNull("UsageFieldType") ? UsageType._InputField : g.Field <UsageType>("UsageFieldType"), }).FirstOrDefault(); this.InstanceID = cat.InstanceID; this.Type = cat.Type; this.ComponentKey = cat.ComponentKey; this.Cryptography = cat.Cryptography; this.RegExpression = cat.RegExpression; this.ParentAttribute = cat.ParentAttribute; this.ParentComponentKey = cat.ParentComponentKey; this.UsageFieldType = cat.UsageFieldType; base.Load(); }
internal EditContext(string collectionAlias, IEntity entity, IParent?parent, UsageType usageType, IServiceProvider serviceProvider) { CollectionAlias = collectionAlias; Entity = entity ?? throw new ArgumentNullException(nameof(entity)); Parent = parent; UsageType = usageType; _serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); }
public async Task <EditContext> GetRootAsync(UsageType usageType, string collectionAlias, string?parentId) { var context = await GetRootEditContextAsync(usageType, collectionAlias, parentId); await EnsureAuthorizedUserAsync(usageType, context.Entity); return(context); }
public Task <IEditContext> GetEditContextWrapperAsync( UsageType usageType, EntityState entityState, Type repositoryEntityType, IEntity updatedEntity, IEntity referenceEntity, IParent?parent, IEnumerable <(string propertyName, string typeName, IEnumerable <object> elements)> relations)
private void SetDefault() { this.UsageFieldType = UsageType._InputField; this.ComponentKey = this.ComponentKey == null ? "" : this.ComponentKey; this.RegExpression = this.RegExpression == null ? "" : RegExpression; this.ParentComponentKey = this.ParentComponentKey == null ? "" : ParentComponentKey; this.ParentAttribute = this.ParentAttribute == null ? "" : ParentAttribute; }
private WrappedTexture(Device device, int width, int height, UsageType usageType, FormatType formatType) { _width = width; _height = height; _usageType = usageType; _formatType = formatType; CreateTexture(device); }
/////////////////////////////////////////////////////////////////////// public bool SetUsage( UsageType type, ref long value ) { return((@operator != null) ? @operator.SetUsage(type, ref value) : false); }
/////////////////////////////////////////////////////////////////////// public bool SetUsage( UsageType type, ref long value ) { return((function != null) ? function.SetUsage(type, ref value) : false); }
private static UsageMessage CreateUsageMessage(UsageType type) { var msg = UsageUtilities.GetUsageMessage(); msg.Certified = ManifestVerification.Valid; msg.MessageType = type; return(msg); }
private UsageMessage CreateUsageMessage(UsageType type) { UsageMessage theMessage = UsageUtilities.GetUsageMessage(); theMessage.MessageType = type; theMessage.Certified = ManifestVerification.Valid; AppendUsageData(theMessage); return theMessage; }
public Shampoo(string name, string brand, decimal price, uint mililiters, GenderType gender, UsageType usageType) : base(name, brand, price, gender) { Validator.CheckIfNull(mililiters, string.Format(GlobalErrorMessages.ObjectCannotBeNull, "Mililiters")); Validator.CheckIfNull(usageType, string.Format(GlobalErrorMessages.ObjectCannotBeNull, "UsageType")); this.Usage = usageType; this.Milliliters = mililiters; }
public Shampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) : base(name, brand, price, gender) { this.Milliliters = milliliters; this.Usage = usage; // TODO: Refactor price calculation ??? this.Price = price * this.Milliliters; }
public Shampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) { this.Name = name; this.Brand = brand; this.Price = price; this.Gender = gender; this.Milliliters = milliliters; this.Usage = usage; }
public static WrappedCubeTexture Create(Device device, int edgeSize, UsageType usageType, FormatType formatType) { var usage = DirectXGraphicsContext.MapUsage(usageType); var format = DirectXGraphicsContext.MapFormat(formatType); var wrappedCubeTexture = new WrappedCubeTexture(device, edgeSize, usage, format, Pool.Default); return wrappedCubeTexture; }
public IShampoo CreateShampoo( string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) { return new Shampoo(name, brand, price, gender, milliliters, usage); }
public IShampoo CreateShampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) { // TODO: create shampoo }
public WatermarkType() { this.usageField = UsageType.All; }
public static WrappedTexture Create(Device device, int width, int height, UsageType usageType, FormatType formatType) { return new WrappedTexture(device, width, height, usageType, formatType); }
public Shampoo(string name, string brand, decimal price, GenderType gender, uint quantity, UsageType usage) : base(name, brand, price, gender) { this.Milliliters = quantity; this.Usage = usage; }
private void SingleUsageTypeCriteriaToString(StringBuilder stringBuilder, UsageType usageType, string searchTerm) { switch (usageType) { case UsageType.Bodies: stringBuilder.Append(SandoField.Body.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.Body.ToString()); break; case UsageType.Definitions: stringBuilder.Append(SandoField.Name.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.Name.ToString()); break; case UsageType.ExtendedClasses: stringBuilder.Append(SandoField.ExtendedClasses.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.ExtendedClasses.ToString()); break; case UsageType.ImplementedInterfaces: stringBuilder.Append(SandoField.ImplementedInterfaces.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.ImplementedInterfaces.ToString()); break; case UsageType.MethodArguments: stringBuilder.Append(SandoField.Arguments.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.Arguments.ToString()); break; case UsageType.MethodReturnTypes: stringBuilder.Append(SandoField.ReturnType.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.ReturnType.ToString()); break; case UsageType.NamespaceNames: stringBuilder.Append(SandoField.Namespace.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.Namespace.ToString()); break; case UsageType.PropertyOrFieldTypes: stringBuilder.Append(SandoField.DataType.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.DataType.ToString()); break; case UsageType.RawSourceCode: stringBuilder.Append(SandoField.Source.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.Source.ToString()); break; case UsageType.ClassName: stringBuilder.Append(SandoField.ClassName.ToString() + ":"); stringBuilder.Append(searchTerm); AppendBoostFactor(stringBuilder, SandoField.ClassName.ToString()); break; default: throw new IndexerException(TranslationCode.Exception_General_UnrecognizedEnumValue, null, "UsageType"); } }
private string CreateShampoo(string shampooName, string shampooBrand, decimal shampooPrice, GenderType shampooGender, uint shampooMilliliters, UsageType shampooUsage) { if (this.products.ContainsKey(shampooName)) { return string.Format(ShampooAlreadyExist, shampooName); } var shampoo = this.factory.CreateShampoo(shampooName, shampooBrand, shampooPrice, shampooGender, shampooMilliliters, shampooUsage); this.products.Add(shampooName, shampoo); return string.Format(ShampooCreated, shampooName); }
public Shampoo CreateShampoo(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) { // TODO: create shampoo Shampoo newShampoo= new Shampoo(name,brand,price,gender,milliliters,usage); return newShampoo; }
internal void SingleUsageTypeCriteriaToString(StringBuilder stringBuilder, UsageType usageType) { int collectionSize = SearchTerms.Count; foreach (string searchTerm in SearchTerms) { switch (usageType) { case UsageType.Bodies: stringBuilder.Append(SandoField.Body.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.Definitions: stringBuilder.Append(SandoField.Name.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.EnumValues: stringBuilder.Append(SandoField.Values.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.ExtendedClasses: stringBuilder.Append(SandoField.ExtendedClasses.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.ImplementedInterfaces: stringBuilder.Append(SandoField.ImplementedInterfaces.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.MethodArguments: stringBuilder.Append(SandoField.Arguments.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.MethodReturnTypes: stringBuilder.Append(SandoField.ReturnType.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.NamespaceNames: stringBuilder.Append(SandoField.Namespace.ToString() + ":"); stringBuilder.Append(searchTerm); break; case UsageType.PropertyOrFieldTypes: stringBuilder.Append(SandoField.DataType.ToString() + ":"); stringBuilder.Append(searchTerm); break; default: throw new IndexerException(TranslationCode.Exception_General_UnrecognizedEnumValue, null, "UsageType"); } if (collectionSize > 1) { stringBuilder.Append(" AND "); //every term must be present in the results } --collectionSize; } }
private static UsageApplicationData GetApplicationData(IUsageApplicationDataProvider provider, UsageType type) { try { return provider.GetData(type); } catch (Exception) { return null; } }
public Usage(UsageType usageType) { Type = usageType; }
public static IEnumerable<UsageApplicationData> GetApplicationData(UsageType type) { return new UsageApplicationDataProviderExtensionPoint().CreateExtensions().Select(p => GetApplicationData(p, type)).Where(d => d != null); }
private static UsageMessage CreateUsageMessage(UsageType type) { var msg = UsageUtilities.GetUsageMessage(); msg.Certified = ManifestVerification.Valid; msg.MessageType = type; return msg; }
public Category(string name, string brand, decimal price, GenderType gender, uint milliliters, UsageType usage) { this.Name = name; this.Brand = brand; this.cosmetics = new List<IProduct>(); }