public async Task <dynamic> CreateBucket([FromBody] BucketModel bucket) { dynamic NewBucket = null; BucketsApi buckets = new BucketsApi(); dynamic token = await OAuthController.GetInternalAsync(); buckets.Configuration.AccessToken = token.access_token; PostBucketsPayload bucketPayload = new PostBucketsPayload(string.Format("{0}-{1}", ClientId, bucket.bucketKey.ToLower()), null, PostBucketsPayload.PolicyKeyEnum.Transient); try { NewBucket = await buckets.CreateBucketAsync(bucketPayload, bucketRegion); } catch (Exception e) { if (e.Message == "Error calling CreateBucket: {\"reason\":\"Bucket already exists\"}") { dynamic allBuckets = await buckets.GetBucketsAsync("US", 100); foreach (KeyValuePair <string, dynamic> actualBucket in new DynamicDictionaryItems(allBuckets.items)) { string bucketName = actualBucket.Value.bucketKey; if (bucketName.Contains(BucketName)) //kitchenconfig designautomation { NewBucket = actualBucket; } } } } return(NewBucket); }
public async Task <List <ItemModel> > AddItemsListAsync(string inventoryType, Item[] items, MemberModel member, ItemsManifestService manifest, APIAccessor accessor) { var itemList = new List <ItemModel>(); foreach (var item in items) { try { ItemManifestModel info = manifest.GetManifestItemData(item); BucketModel type = info != null?manifest.GetManifestBucketData(info, item) : null; PrimaryStat instance = item.ItemInstanceId != null && type != null ? await GetInstanceAsync(item, member, accessor) : null; //DamageModel damage = new DamageModel(); //if (info != null && type.DisplayProperties.Name == "Energy Weapons") //{ // damage = manifest.GetDamageTypeData(info); //} //DamageModel damage = info != null && type.DisplayProperties.Name == "Energy Weapons" ? manifest.GetDamageTypeData(info) : null; if (info != null && type != null) { itemList.Add(AddModelItem(inventoryType, item, type, info, instance)); } } catch (Exception e) { } } return(itemList); }
public virtual IActionResult Delete(int id, BucketModel bucket) { Bucket Bucket = _BucketService.GetBucketById(id); Bucket.BucketDeleted = true; _BucketService.UpdateBucket(Bucket); return(RedirectToAction("Index")); }
public IActionResult addBucket(BucketModel newBucket) { _context.Add(newBucket); _context.SaveChanges(); // return Content($"Added Bucket {newBucket.id}"); // sanity check return(RedirectToAction("listAllBuckets")); }
public int BucketModify(BucketModel bucket) { return(SqlHelper.ExecuteNonQuery(" UPDATE SJPackageBucketInfo SET FName=@FName,FWeight=@FWeight,FOffset=@FOffset,FKeyword=@FKeyword WHERE FBucketID=@FBucketID" , new SqlParameter[] { new SqlParameter("@FName", SqlHelper.SqlNull(bucket.FName)) , new SqlParameter("@FWeight", SqlHelper.SqlNull(bucket.FWeight)) , new SqlParameter("@FOffset", SqlHelper.SqlNull(bucket.FOffset)) , new SqlParameter("@FBucketID", bucket.FBucketID) , new SqlParameter("@FKeyword", SqlHelper.SqlNull(bucket.FKeyword)) })); }
public bool BucketModify(BucketModel model) { string sql = @" UPDATE SJPackageBucketInfo SET FName=@FName,FWeight=@FWeight,FOffset=@FOffset,FKeyword=@FKeyword WHERE FBucketID=@FBucketID"; using (var connection = SqlDb.UpdateConnection) { return(connection.Execute(sql, model) > 0); } }
public static BucketModel GenerateBucket() { BucketModel bucket = new BucketModel(); bucket.id = Guid.NewGuid().ToString(); bucket.MaxCapacity = 12; bucket.CurrentContentValue = 12; return(bucket); }
public void GenerateItemWithValuesLargeBarrel(int content, int maxvalue) { BucketModel item = new BucketModel() { id = Guid.NewGuid().ToString(), CurrentContentValue = content, MaxCapacity = maxvalue }; }
public WaveViewModel(int bucketId, SuggestedNextActionType actions = SuggestedNextActionType.NotSet, BucketActivityType?activityTypeFilter = null) { Bucket = new BucketModel { BucketId = bucketId }; this.HighlightedActions = actions; ActivityTypeFilter = activityTypeFilter; }
public async Task <dynamic> CreateBucketAsync([FromBody] BucketModel bucket) { BucketsApi buckets = new BucketsApi(); dynamic token = await OAuthController.GetInternalAsync(); buckets.Configuration.AccessToken = token.access_token; PostBucketsPayload bucketPayload = new PostBucketsPayload(bucket.bucketKey, null, bucket.policyKey); return(await buckets.CreateBucketAsync(bucketPayload, "US")); }
public async Task <IActionResult> DeleteBucketAsync([FromBody] BucketModel bucket) { BucketsApi buckets = new BucketsApi(); dynamic token = await OAuthController.GetInternalAsync(); buckets.Configuration.AccessToken = token.access_token; await buckets.DeleteBucketAsync(bucket.bucketKey); return(Ok()); }
public virtual IActionResult Edit(int id, BucketModel bucket) { Bucket Bucket = _BucketService.GetBucketById(id); Bucket.BucketDesc = bucket.BucketDesc; Bucket.BucketTitle = bucket.BucketTitle; Bucket.BucketTypeId = bucket.BucketTypeId; Bucket.DueDate = bucket.DueDate; Bucket.IsActive = bucket.IsActive; _BucketService.UpdateBucket(Bucket); return(RedirectToAction("Index")); }
public string Write(List <Flower> flowers, string filePath) { BucketModel model = new BucketModel(); model.Flowers = flowers; using (StreamWriter file = System.IO.File.CreateText(filePath)) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(file, model); } return(filePath); }
public virtual IActionResult Create() { BucketModel bucket = new BucketModel(); bucket.DueDate = DateTime.Now; bucket.IsActive = true; var buckettypes = _BucketTypeService.GetAllBucketTypes(); bucket.bucketTypes = buckettypes.Select(s => new SelectListItem { Value = s.Id.ToString(), Text = s.Type }).ToList(); bucket.BucketTypeId = buckettypes.Select(s => s.Id).FirstOrDefault(); return(View(bucket)); }
public ActionResult Create(BucketModel model) { try { PutBucketRequest bucketRequest = new PutBucketRequest(); bucketRequest.BucketName = model.BucketName; this._awsService.Client.PutBucket(bucketRequest); } catch (Exception ex) { TempData["Error"] = ex.Message; } return(RedirectToAction("Index")); }
public async Task <IActionResult> CreateBucket(BucketModel model) { var service = new AmazonS3Service(); await service.CreateBucketToS3(model.Name); var response = new GenericResponse <string>() { IsSuccess = true, Message = "Bucket created successfully.", ResponseCode = 200, Result = "Success" }; return(Ok(response)); }
public List <Flower> Read(string filePath) { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentOutOfRangeException("File path must be specified"); } XmlSerializer deserializer = new XmlSerializer(typeof(BucketModel)); TextReader reader = new StreamReader(filePath); object obj = deserializer.Deserialize(reader); BucketModel bucketModel = (BucketModel)obj; reader.Close(); return(bucketModel.Flowers); }
public bool AddBucketToContainer(BucketModel bucket) { bool found = false; if (!_containers.Any()) { var item = new ContainerModel { id = Guid.NewGuid().ToString(), CurrentContentValue = bucket.MaxCapacity, BucketsStoredInsideThisContainer = new List <BucketModel> { bucket } }; StaticResources.CurrentStaticContainer.currentContainer = item; _containers.Add(item); Console.WriteLine("Bucket and container added"); } foreach (var item in _containers) { if (found == false) { if (item.MaxCapacity > item.CurrentContentValue) { item.BucketsStoredInsideThisContainer.Add(bucket); item.CurrentContentValue = bucket.MaxCapacity; found = true; Console.WriteLine("Bucket added"); } } } if (found == false) { ContainerModel item = new ContainerModel(); ContainerAbstractionStructure.containers = new List <ContainerModel>(); ContainerAbstractionStructure.containers.Add(item); item.id = Guid.NewGuid().ToString(); item.BucketsStoredInsideThisContainer = new List <BucketModel>(); item.BucketsStoredInsideThisContainer.Add(bucket); item.CurrentContentValue = bucket.MaxCapacity; _containers.Add(item); Console.WriteLine("Bucket and container added"); } return(true); }
public string Write(List <Flower> flowers, string filePath) { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentOutOfRangeException("File path must be specified"); } BucketModel bucketModel = new BucketModel(); bucketModel.Flowers = flowers; XmlSerializer writer = new XmlSerializer(typeof(BucketModel)); FileStream file = System.IO.File.Create(filePath); writer.Serialize(file, bucketModel); file.Close(); return(filePath); }
public virtual IActionResult Edit(int id) { Bucket Bucket = _BucketService.GetBucketById(id); BucketModel bucket = new BucketModel() { BucketDesc = Bucket.BucketDesc, BucketTitle = Bucket.BucketTitle, DueDate = Bucket.DueDate, IsActive = Bucket.IsActive, BucketTypeId = Bucket.BucketTypeId }; var buckettypes = _BucketTypeService.GetAllBucketTypes(); bucket.bucketTypes = buckettypes.Select(s => new SelectListItem { Value = s.Id.ToString(), Text = s.Type }).ToList(); return(View(bucket)); }
public async Task UpdateTasksAsync() { // Get a group plan. var plans = await _graphService.GetGroupPlansAsync(Group); var plan = plans.FirstOrDefault(); // If a group plan doesn't exist, create it. if (plan == null) { plan = await _graphService.AddGroupPlanAsync(Group, new PlanModel { Title = Group.DisplayName, Owner = Group.Id }); } // Get the task bucket. var buckets = await _graphService.GetPlanBucketsAsync(plan); var taskBucket = buckets.FirstOrDefault(b => b.Name.Equals(Constants.TaskBucketName)); // If the task bucket doesn't exist, create it. if (taskBucket == null) { taskBucket = await _graphService.AddBucketAsync(new BucketModel { Name = Constants.TaskBucketName, PlanId = plan.Id }); } // Get the tasks and add the ones that aren't completed. var tasks = await _graphService.GetBucketTasksAsync(taskBucket); Tasks.AddRange(tasks.Where(t => t.PercentComplete < 100)); OnTasksChanged(); // Store values. _groupPlan = plan; _taskBucket = taskBucket; }
public async Task <ResultModel> Shopping(BucketModel model) { HttpResponseMessage req = await client.PostAsync("/adverts/sold/", new FormUrlEncodedContent( new Dictionary <string, string>() { { "BakkalId", model.BakkalId }, //{ "products", model.products.ToString() }, { "TotalAmount", model.TotalAmount }, })); if (req != null && req.IsSuccessStatusCode) { var data = await req.Content.ReadAsStringAsync(); return(JsonConvert.DeserializeObject <ResultModel>(data)); } return(null); }
public virtual IActionResult Create(BucketModel model) { // if (!_permissionService.Authorize(StandardPermissionProvider.AllowCustomerImpersonation)) // return AccessDeniedView(); Bucket bucket = new Bucket(); bucket.CustomerId = 189458; bucket.BucketDeleted = false; bucket.BucketDesc = model.BucketDesc; bucket.BucketTitle = model.BucketTitle; bucket.BucketTypeId = model.BucketTypeId; bucket.CreateDate = DateTime.Now; bucket.DueDate = model.DueDate; bucket.IsActive = model.IsActive; bucket.StatusId = 1; if (ModelState.IsValid) { } _BucketService.InsertBucket(bucket); return(RedirectToAction("create")); }
public ItemModel AddModelItem(string inventoryType, Item item, BucketModel type, ItemManifestModel info, PrimaryStat instancePath) { ItemModel Item = new ItemModel { ItemHashId = item.ItemHash, BucketHash = item.BucketHash, BucketType = type.DisplayProperties.Name, ItemDesc = info.DisplayProperties.Description, ItemIcon = "https://www.bungie.net" + info.DisplayProperties.Icon, ItemName = info.DisplayProperties.Name, ItemType = info.ItemTypeDisplayName, IconWM = "https://www.bungie.net", TierType = info.Inventory.TierTypeName, ScreenShot = "https://www.bungie.net" + info.Screenshot, InventoryType = inventoryType }; //Item.DamageType = damage != null ? "https://www.bungie.net" + damage.DisplayProperties.Icon : ""; Item.IconWM += info.IconWatermark == null ? info.IconWatermarkShelved : info.IconWatermark; Item.ItemLight = instancePath != null && instancePath.Value > 200 ? instancePath.Value.ToString() : ""; Item.ItemInstance = item.ItemInstanceId != null?Convert.ToInt64(item.ItemInstanceId) : 0; return(Item); }
public int BucketModify(BucketModel sJBucket) { return(sJBucketDal.BucketModify(sJBucket)); }
public void generateBucket() { BucketModel bucket = new BucketModel(); }
public FileModel(BucketModel bucket, string key, int size, ObjectModel parent = null) : base(bucket, key, parent) { Size = size; }
public FolderModel(BucketModel bucket, string key, ObjectModel parent = null) : base(bucket, key, parent) { }
public Task <BucketModel> AddBucketAsync(BucketModel bucket) { return(PostAsync("planner/buckets", bucket)); }
public Task <TaskModel[]> GetBucketTasksAsync(BucketModel bucket) { return(GetManyAsync <TaskModel>($"planner/buckets/{bucket.Id}/tasks")); }