private void AddAndDelGoods(ItemUpdate goods) { for (int i = 0; i < goods.items.get_Count(); i++) { BagType.BT bagType = goods.bagType; if (bagType == BagType.BT.Bag) { Goods goods2 = this.OnGetGood(goods.items.get_Item(i).baseInfo.id); if (goods2 != null) { if (goods.items.get_Item(i).baseInfo.count <= 0) { this.OnBagGroupAddAndDel(goods.items.get_Item(i).baseInfo.id, false); this.bag.Remove(goods2); } else { goods2.ServerItem.baseInfo.count = goods.items.get_Item(i).baseInfo.count; } } else { this.bag.Add(new Goods(goods.items.get_Item(i))); this.OnBagGroupAddAndDel(goods.items.get_Item(i).baseInfo.id, true); } } } }
void SubscriptionListener.onItemUpdate(ItemUpdate itemUpdate) { try { lock (chartForm.quotessource) { CultureInfo culture = new CultureInfo("en-US"); double tmp = Double.Parse(itemUpdate.getValue("last_price"), culture); if (chartForm.quotessource.Count > 5000) { chartForm.quotessource.RemoveAt(0); } chartForm.quotessource.Add(new Record(5, itemUpdate.getValue("time"), tmp)); if (tmp < chartForm.minvisual) { chartForm.minvisual = tmp; } } chartForm.Invoke(delegateChart, new Object[] { itemUpdate.ItemPos, itemUpdate }); } catch (Exception e) { Console.WriteLine("Message: " + e.Message); Console.WriteLine(e.StackTrace); } }
static public List <int> GetAvailibleNodeList(ItemUpdate source, bool ascend) { List <int> IDS = new List <int>(); IDS.AddRange(CommonID); switch (source.Get_ItemType) { case ItemType.Weapon: IDS.AddRange(WeaponID); switch (source.GetWeaponType) { case WeaponType.ExtendedMelee: case WeaponType.OtherMelee: case WeaponType.Stab: case WeaponType.Spear: case WeaponType.Swing: IDS.AddRange(MeleeID); break; case WeaponType.OtherRanged: case WeaponType.Gun: case WeaponType.Ranged: case WeaponType.Bow: IDS.AddRange(RangedID); break; case WeaponType.Summon: IDS = new List <int>(); IDS.AddRange(CommonID); IDS.AddRange(SummonID); break; case WeaponType.Magic: IDS.AddRange(MagicID); break; } break; case ItemType.Armor: IDS.AddRange(ArmorID); break; } List <int> IDR = new List <int>(); foreach (int n in IDS) { if (((ItemNode)GetCorrectNode(n)).IsAscend != ascend) { IDR.Add(n); } } foreach (int n in IDR) { IDS.Remove(n); } return(IDS); }
public ActionResult UpdateItem(int queueId, int itemId, ItemUpdate item) { if (!TryValidateModel(item)) { return(ValidationProblem(ModelState)); } var queueFromRepo = _repo.GetQueueById(queueId); if (queueFromRepo == null) { return(NotFound()); } var itemFromQueueRepo = _repo.GetItemFomQueueById(queueId, itemId); if (itemFromQueueRepo == null) { return(NotFound()); } _mapper.Map(item, itemFromQueueRepo); //source -> destination _repo.UpdateItemInQueue(queueId, itemFromQueueRepo); _repo.SaveChanges(); return(NoContent()); }
protected override ChartCandelData LoadUpdate(ItemUpdate update) { try { var updateData = new ChartCandelData { Bid = new HlocData { High = StringToNullableDecimal(update.getValue("BID_HIGH")), Low = StringToNullableDecimal(update.getValue("BID_LOW")), Open = StringToNullableDecimal(update.getValue("BID_OPEN")), Close = StringToNullableDecimal(update.getValue("BID_CLOSE")) }, Offer = new HlocData { High = StringToNullableDecimal(update.getValue("OFR_HIGH")), Low = StringToNullableDecimal(update.getValue("OFR_LOW")), Open = StringToNullableDecimal(update.getValue("OFR_OPEN")), Close = StringToNullableDecimal(update.getValue("OFR_CLOSE")) }, LastTradedPrice = new HlocData { High = StringToNullableDecimal(update.getValue("LTP_HIGH")), Low = StringToNullableDecimal(update.getValue("LTP_LOW")), Open = StringToNullableDecimal(update.getValue("LTP_OPEN")), Close = StringToNullableDecimal(update.getValue("LTP_CLOSE")) }, LastTradedVolume = StringToNullableDecimal(update.getValue("LTV")), IncrimetalTradingVolume = StringToNullableDecimal(update.getValue("TTV")), UpdateTime = EpocStringToNullableDateTime(update.getValue("UTM")), DayMidOpenPrice = StringToNullableDecimal(update.getValue("DAY_OPEN_MID")), DayChange = StringToNullableDecimal(update.getValue("DAY_NET_CHG_MID")), DayChangePct = StringToNullableDecimal(update.getValue("DAY_PERC_CHG_MID")), DayHigh = StringToNullableDecimal(update.getValue("DAY_HIGH")), DayLow = StringToNullableDecimal(update.getValue("DAY_LOW")), TickCount = StringToNullableInt(update.getValue("CONS_TICK_COUNT")) }; var conEnd = StringToNullableInt(update.getValue("CONS_END")); updateData.EndOfConsolidation = conEnd.HasValue ? conEnd > 0 : (bool?)null; return(updateData); } catch (Exception) { return(null); } }
public void onItemUpdate(ItemUpdate update) { string command = update.getValue("command"); if (command.Equals("ADD")) { Console.WriteLine("first update for this key (" + update.getValue("key") + "), the library is now automatically subscribing the second level item for it"); } else if (command.Equals("UPDATE")) { StringBuilder updateString = new StringBuilder("Update for "); updateString.Append(update.getValue("stock_name")); //2nd level field updateString.Append(", last price is "); updateString.Append(update.getValue("last_price")); //2nd level field updateString.Append(" ("); updateString.Append(update.getValue("time")); // 2nd level field updateString.Append("), we own "); updateString.Append(update.getValue("qty")); //1st level field updateString.Append(" --> "); updateString.Append(getCtv(update)); Console.WriteLine(updateString); //there is the possibility that a second update for the first level is received before the first update for the second level //thus we might print a message that contains a few NULLs } else if (command.Equals("DELETE")) { Console.WriteLine("key (" + update.getValue("key") + "), was removed, the library is now automatically unsubscribing the second level item for it"); } }
protected override ChartTickData LoadUpdate(ItemUpdate update) { try { var updateData = new ChartTickData { Bid = StringToNullableDecimal(update.getValue("BID")), Offer = StringToNullableDecimal(update.getValue("OFR")), LastTradedPrice = StringToNullableDecimal(update.getValue("LTP")), LastTradedVolume = StringToNullableDecimal(update.getValue("LTV")), IncrimetalTradingVolume = StringToNullableDecimal(update.getValue("TTV")), UpdateTime = EpocStringToNullableDateTime(update.getValue("UTM")), DayMidOpenPrice = StringToNullableDecimal(update.getValue("DAY_OPEN_MID")), DayChange = StringToNullableDecimal(update.getValue("DAY_NET_CHG_MID")), DayChangePct = StringToNullableDecimal(update.getValue("DAY_PERC_CHG_MID")), DayHigh = StringToNullableDecimal(update.getValue("DAY_HIGH")), DayLow = StringToNullableDecimal(update.getValue("DAY_LOW")) }; return(updateData); } catch (Exception) { return(null); } }
public void onItemUpdate(ItemUpdate itemUpdate) { if (!IGClient.Pause) { ExecuteUpdate(0, itemUpdate.ItemName, itemUpdate.ChangedFields); } }
/// <summary> /// 批量更新商品描述 /// </summary> /// <param name="goods"></param> /// <param name="token"></param> /// <returns></returns> public bool UpdateGoodsDesc(ItemUpdate goods, string token, out List <string> errorMsgs) { errorMsgs = null; IList <Item> list = new List <Item>(); list = GetListItems(token, goods.ListGoodsId); foreach (Item item in list) { string str = item.Desc; switch (goods.Updatedtype) { case "1": str = goods.repalcword + str; break; case "3": str = str + goods.repalcword; break; } goods.Desc = str; goods.ListGoodsId = item.NumIid.ToString(); simpleupdategoods(token, goods, out errorMsgs); } return(true); }
/// <summary> /// 简单更新商品信息 /// </summary> /// <param name="token"></param> /// <param name="goods"></param> /// <param name="ErrorMsg"></param> /// <returns></returns> public void simpleupdategoods(string token, ItemUpdate goods, out List <string> errorMsgs) { errorMsgs = new List <string>(); if (CommonFunc.CheckListGoodsId(goods.ListGoodsId)) { string[] ListGoodsId = goods.ListGoodsId.Split(','); bool result = false; List <string> listerrorMsgs = new List <string>(); string errorMsg; foreach (string itemId in ListGoodsId) { if (string.IsNullOrEmpty(itemId)) { return; } errorMsg = null; goods.NumIid = long.Parse(itemId); result = setgoods.UpdateGoodsPrice(token, goods, out errorMsg); if (result == false) { string str; str = "商品ID: " + goods.NumIid + ",状态: "; str += result == true ? "更新成功" : "更新失败"; str += ",失败原因:"; str += errorMsg; listerrorMsgs.Add(str); } } errorMsgs = listerrorMsgs; } }
public void UpdateReceived(int ph, int itemPos, ItemUpdate update) { if (ph != this.phase) { return; } demoForm.BeginInvoke(updateDelegate, new Object[] { itemPos, update }); }
void SubscriptionListener.onItemUpdate(ItemUpdate update) { Debug.WriteLine("Details received."); Debug.WriteLine(NotifyUpdate(update) + " for " + update.ItemName + ":" + update.getValue(1) + " - " + update.getValue(3) ); if (update.isValueChanged(1)) { rTfeed.DetailsName = update.getValue(1); } if (update.isValueChanged(2)) { rTfeed.DetailsLast = update.getValue(2); } if (update.isValueChanged(3)) { rTfeed.DetailsTime = update.getValue(3); } if (update.isValueChanged(4)) { rTfeed.DetailsMin = update.getValue(4); } if (update.isValueChanged(5)) { rTfeed.DetailsMax = update.getValue(5); } if (update.isValueChanged(6)) { rTfeed.DetailsChg = update.getValue(6); if (float.Parse(update.getValue(6)) > 0) { rTfeed.DetailsChgDiff = Color.Green; } else { rTfeed.DetailsChgDiff = Color.Red; } } if (update.isValueChanged(7)) { rTfeed.DetailsBid = update.getValue(7); } if (update.isValueChanged(8)) { rTfeed.DetailsAsk = update.getValue(8); } }
public IActionResult UpdateItem(ItemUpdate item) { try { return(new JsonResult(ItemBAL.UpdateItem(item))); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, "Failed to update Item")); } }
public override Task RunAsyncInternal(IBackgroundTaskInstance taskInstance) { if (taskInstance == null) { return(null); } _deferral = taskInstance.GetDeferral(); return(Task.Run(async() => { var details = taskInstance.TriggerDetails as ToastNotificationActionTriggerDetail; Settings settings = await new UwpMemory().Read <Settings>("settings.json"); var Todoist = new TodoistService(settings.TodoistKey, settings.TodoistUserAgent); if (details != null) { string arguments = details.Argument; var userInput = details.UserInput; if (arguments.StartsWith("complete")) { TodoistService todoist = Todoist; await todoist.MarkTodoAsDone(long.Parse(details.Argument.Remove(0, 9))); } if (arguments.StartsWith("remove")) { TodoistService todoist = Todoist; ItemUpdate update = new ItemUpdate(long.Parse(details.Argument.Remove(0, 7))) { Labels = new List <long>() }; await todoist.Update(update); } // Perform tasks } //// TODO WTS: Insert the code that should be executed in the background task here. //// This sample initializes a timer that counts to 100 in steps of 10. It updates Message each time. //// Documentation: //// * General: https://docs.microsoft.com/en-us/windows/uwp/launch-resume/support-your-app-with-background-tasks //// * Debug: https://docs.microsoft.com/en-us/windows/uwp/launch-resume/debug-a-background-task //// * Monitoring: https://docs.microsoft.com/windows/uwp/launch-resume/monitor-background-task-progress-and-completion //// To show the background progress and message on any page in the application, //// subscribe to the Progress and Completed events. //// You can do this via "BackgroundTaskService.GetBackgroundTasksRegistration" _deferral.Complete(); _taskInstance = taskInstance; })); }
public TestRunItems PostRunItem(TestRunItems testRunItems) { ItemUpdate itemUpdate = new ItemUpdate(); itemUpdate.automated = testRunItems.automated; itemUpdate.configuration_name = testRunItems.configuration_name; itemUpdate.id = testRunItems.id; itemUpdate.last_run_by_name = testRunItems.last_run_by_name; itemUpdate.project_id = testRunItems.project_id; itemUpdate.release_id = testRunItems.release_id; itemUpdate.release_name = testRunItems.release_name; itemUpdate.run_by_user_id = testRunItems.run_by_user_id; itemUpdate.status_code = testRunItems.status_code; itemUpdate.test_host = testRunItems.test_host; itemUpdate.test_id = testRunItems.test_id; itemUpdate.test_name = testRunItems.test_name; itemUpdate.test_run_id = testRunItems.test_run_id; itemUpdate.test_set_id = testRunItems.test_set_id; itemUpdate.test_set_name = testRunItems.test_set_name; itemUpdate.steps = testRunItems.test_run_results; foreach (var i in itemUpdate.steps) { i.step_name = i.step; i.actual_result = testRunItems.actualResult; i.status_code = testRunItems.status_code; } itemUpdate.run_time = testRunItems.run_time; var client = new RestClient(conFIG.QACompleteEndPoint + "v2/projects/{projectID}/testruns/{runID}/items/{runItemID}"); var request = new RestRequest(Method.PATCH); request.AddUrlSegment("runID", testRunItems.test_run_id); request.AddUrlSegment("runItemID", testRunItems.id); request.AddUrlSegment("projectID", Project); request.AddJsonBody(itemUpdate); request.AddHeader("Authorization", Auth); request.AddHeader("Content-Type", "application/json"); var response = client.Execute(request); string L = response.Content; TestRunItems item = new TestRunItems(); item = JsonConvert.DeserializeObject <QACDataModel.TestRunItems>(L); return(item); }
public void OnLightstreamerUpdate(int item, ItemUpdate values) { lock (quotessource) { chartQ.SuspendLayout(); chartQ.DataBind(); chartQ.ChartAreas[0].AxisY.Minimum = minvisual - (minvisual * 0.01); chartQ.ChartAreas[0].RecalculateAxesScale(); chartQ.ResumeLayout(); } }
static public float GetExtractedXp(bool Destroy, ItemUpdate item) { float exp = 0; if (Destroy) { exp = GetTotalEarnedXp(item) * 0.5f; } else { exp = GetTotalEarnedXp(item) * 0.75f; } return(exp); }
static public long GetTotalEarnedXp(ItemUpdate item) { long xp = 0; int level = item.Level; int ascLevel = item.Ascention; for (int j = 0; j < item.Level; j++) { xp += item.GetExpToNextLevel(j, ascLevel); } return(xp); }
public IHttpActionResult Put(ItemUpdate model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } ItemService itemService = CreateItemService(); if (!itemService.UpdateItem(model)) { return(InternalServerError()); } return(Ok()); }
public bool UpdateItem(ItemUpdate model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .Items .Single(e => e.OwnerId == _userId && e.Id == model.Id); entity.Name = model.Name; entity.Nombre = model.Nombre; entity.Location = model.Location; return(ctx.SaveChanges() == 1); } }
static public string[] GetModifierDesc(ItemUpdate itemU) { List <string> SList = new List <string>(); Modifier[] List = (Enum.GetValues(typeof(Modifier)) as Modifier[]); for (int i = 1; i < List.Length; i++) { if (HaveModifier(List[i], itemU.modifier)) { SList.Add(GetModDesc(List[i], itemU)); } } return(SList.ToArray()); }
public static ItemSkillTree ConvertToTree(string save, ItemUpdate source) { string[] nodeListSave; string[] nodeDetails; ItemSkillTree tree = new ItemSkillTree(); nodeListSave = save.Split(';'); tree.m_ItemSource = source; string[] a; ItemNode bufferNode; foreach (string nodeSave in nodeListSave) { bufferNode = null; nodeDetails = nodeSave.Split(','); if (nodeDetails.Length != 8) { AnotherRpgMod.Instance.Logger.Warn("Item tree corrupted, reseting tree"); tree = new ItemSkillTree(); tree.Init(source); return(tree); } bufferNode = (ItemNode)ItemNodeAtlas.GetCorrectNode(int.Parse(nodeDetails[0])); a = nodeDetails[6].Split(':'); bufferNode.Init(tree, tree.GetSize, int.Parse(nodeDetails[4]), int.Parse(nodeDetails[5]), new Vector2(int.Parse(a[0]), int.Parse(a[1]))); //Ignore it if there is no neighboor if (nodeDetails[1] != "") { a = nodeDetails[1].Split(':'); foreach (string neightboor in a) { bufferNode.AddNeightboor(int.Parse(neightboor)); } } bufferNode.ForceLockNode(int.Parse(nodeDetails[2])); bufferNode.SetLevel = int.Parse(nodeDetails[3]); if (nodeDetails[7] != "") { bufferNode.LoadValue(nodeDetails[7]); } tree.AddNode(bufferNode); } return(tree); }
/// <summary> /// 批量修改商品信息 /// </summary> /// <returns></returns> public Task <ActionResult> SetupdateGoods(ItemUpdate goods) { tbClientUser clientuser = GetUser("UserInfo"); string ErrorMsg = string.Empty; return(Task.Factory.StartNew(() => { List <string> errorMsg = new List <string>(); goodsinfo.simpleupdategoods(clientuser.UserShops[0].SessionKey, goods, out errorMsg); AsyncManager.Timeout = 5000; AsyncManager.Parameters["content"] = errorMsg; }).ContinueWith <ActionResult>(task => { List <string> errorMsg = (List <string>)AsyncManager.Parameters["content"]; return Json(new { ErrorMsg = errorMsg }); })); }
/// <summary> /// 批量更新商品描述 /// </summary> /// <param name="goods"></param> /// <returns></returns> public Task <ActionResult> UpdateGoodsDesc(ItemUpdate goods) { tbClientUser clientuser = GetUser("UserInfo"); List <string> errorMsg; return(Task.Factory.StartNew(() => { errorMsg = new List <string>(); goodsinfo.UpdateGoodsDesc(goods, clientuser.UserShops[0].SessionKey, out errorMsg); AsyncManager.Parameters["content"] = errorMsg; }).ContinueWith <ActionResult>(task => { errorMsg = new List <string>(); errorMsg = (List <string>)AsyncManager.Parameters["content"]; return Json(new { ErrorMsg = errorMsg }); })); }
public static RollInfo RollItem(ItemUpdate ItemRoll, Item item) { RollInfo info = new RollInfo(); info.rarity = GetRarity(item); info.modifier = GetModifier(item, info.rarity); if (item.accessory) { info.stats = GetStatsAccesories(info.rarity); } else if (item.bodySlot > 0 || item.legSlot > 0 || item.headSlot > 0) { info.stats = GetStatsArmor(info.rarity); } return(info); }
public IStoreItem Create(ItemUpdate itemUpdate, IStoreItem predecessor) { var model = new StoreItem( new ItemId(0), itemUpdate.Name, isDeleted: false, itemUpdate.Comment, isTemporary: false, itemUpdate.QuantityType, itemUpdate.QuantityInPacket, itemUpdate.QuantityTypeInPacket, itemUpdate.ItemCategoryId, itemUpdate.ManufacturerId, itemUpdate.Availabilities, null); model.SetPredecessor(predecessor); return(model); }
protected override StreamingAccountData LoadUpdate(ItemUpdate update) { try { var streamingAccountData = new StreamingAccountData { ProfitAndLoss = StringToNullableDecimal(update.getValue("PNL")), Deposit = StringToNullableDecimal(update.getValue("DEPOSIT")), UsedMargin = StringToNullableDecimal(update.getValue("USED_MARGIN")), AmountDue = StringToNullableDecimal(update.getValue("AMOUNT_DUE")), AvailableCash = StringToNullableDecimal(update.getValue("AVAILABLE_CASH")) }; return(streamingAccountData); } catch (Exception) { return(null); } }
public void GetXmlTest() { string expected = @"<?xml version=""1.0"" encoding=""utf-8""?> <function controlid=""unittest""> <update> <ITEM> <ITEMID>I1234</ITEMID> <NAME>hello world</NAME> </ITEM> </update> </function>"; ItemUpdate record = new ItemUpdate("unittest") { ItemId = "I1234", ItemName = "hello world" }; this.CompareXml(expected, record); }
public override void Action(CommandCaller caller, string input, string[] args) { Player player = caller.Player; RPGPlayer character = player.GetModPlayer <RPGPlayer>(); if (args.Length == 0) { Main.NewText(Description); return; } if (int.TryParse(args[0], out int slot) == false) { Main.NewText("Slot Number invalid"); return; } ItemUpdate item = player.HeldItem.GetGlobalItem <ItemUpdate>(); ItemUpdate Source = player.inventory[slot].GetGlobalItem <ItemUpdate>(); Main.NewText(player.inventory[slot].Name); }
public IItemUpdate UpdateInventory(int itemId, double updateQty, double afterQty, string updateAction, int inventoryLocationId, int clientId) { var item = Require<InventoryItem>(itemId); var itemUpdate = new ItemUpdate { ItemID = itemId, BeforeQty = item.StockQuantity, UpdateQty = updateQty, AfterQty = afterQty, UpdateDateTime = DateTime.Now, UpdateAction = updateAction, ItemInventoryLocationID = inventoryLocationId, ClientID = clientId }; Session.Save(itemUpdate); return itemUpdate; }
private void HandlePetLevelupCmd(CommandParser.Command param) { int num = 0; int.TryParse(param.GetParam(1), out num); long itemID = 0L; long.TryParse(param.GetParam(2), out itemID); int count = 0; int.TryParse(param.GetParam(3), out count); long num2 = 0L; long.TryParse(param.GetParam(4), out num2); int num3 = 0; int.TryParse(param.GetParam(5), out num3); MC2S_PetLevelup mC2S_PetLevelup = new MC2S_PetLevelup(); SocketDataEx socket = Globals.Instance.Player.TeamSystem.GetSocket(num); if (socket == null) { global::Debug.LogFormat("pet is empty, slot = {0}", new object[] { num }); } PetDataEx pet = socket.GetPet(); if (pet != null) { mC2S_PetLevelup.PetID = pet.Data.ID; ItemUpdate itemUpdate = new ItemUpdate(); itemUpdate.ItemID = (ulong)itemID; itemUpdate.Count = count; Globals.Instance.CliSession.Send(402, mC2S_PetLevelup); } }
public async Task<ItemUpdate.response> ItemUpdate(ItemUpdate.request request, CancellationToken? token = null) { return await SendAsync<ItemUpdate.response>(request.ToXmlString(), token.GetValueOrDefault(CancellationToken.None)); }