private void Parse(TransactionConstructParams constructParams) { _placedByRiskMonitor = this.CreateSoundItem(TransactionBusinessItemNames.PlacedByRiskMonitor, constructParams.PlaceByRiskMonitor); _freePlacingPreCheck = this.CreateSoundItem(TransactionBusinessItemNames.FreePlacingPreCheck, constructParams.FreePlacingPreCheck); _disableAcceptLmtVariation = this.CreateReadonlyItem("DisableLmtVariation", constructParams.DisableAcceptLmtVariation); _id = this.CreateItem(TransactionBusinessItemNames.Id, constructParams.Id, PermissionFeature.Key); _code = this.CreateSoundItem(TransactionBusinessItemNames.Code, constructParams.Code); _type = this.CreateSoundItem(TransactionBusinessItemNames.Type, constructParams.Type); _accountId = this.CreateReadonlyItem(TransactionBusinessItemNames.AccountId, _account.Id); _instrumentId = this.CreateReadonlyItem(TransactionBusinessItemNames.InstrumentId, constructParams.InstrumentId); _subType = this.CreateSoundItem(TransactionBusinessItemNames.SubType, constructParams.SubType); _phase = this.CreateSoundItem(TransactionBusinessItemNames.Phase, constructParams.Phase); _orderType = this.CreateReadonlyItem(TransactionBusinessItemNames.OrderType, constructParams.OrderType); _contractSize = this.CreateSoundItem(TransactionBusinessItemNames.ContractSize, constructParams.ConstractSize); _beginTime = this.CreateReadonlyItem(TransactionBusinessItemNames.BeginTime, constructParams.BeginTime); _endTime = this.CreateReadonlyItem(TransactionBusinessItemNames.EndTime, constructParams.EndTime); _expireType = this.CreateReadonlyItem(TransactionBusinessItemNames.ExpireType, constructParams.ExpireType); _submitTime = this.CreateReadonlyItem(TransactionBusinessItemNames.SubmitTime, constructParams.SubmitTime); _submitorId = this.CreateReadonlyItem(TransactionBusinessItemNames.SubmitorId, constructParams.SubmitorId); _executeTime = this.CreateSoundItem(TransactionBusinessItemNames.ExecuteTime, constructParams.ExecuteTime); _approverId = this.CreateSoundItem(TransactionBusinessItemNames.ApproverId, constructParams.ApproveId); _sourceOrderId = this.CreateReadonlyItem(TransactionBusinessItemNames.SourceOrderId, constructParams.SourceOrderId); _setPriceTimestamp = this.CreateSoundItem(TransactionBusinessItemNames.SetPriceTimestamp, constructParams.SetPriceTimestamp); _instrumentCategory = this.CreateReadonlyItem(TransactionBusinessItemNames.InstrumentCategory, constructParams.GetInstrumentCategory(_account.Id)); _placePhase = this.CreateSoundItem("PlacePhase", PlacePhase.None); _placeDetail = this.CreateSoundItem("PlaceDetail", string.Empty); _appType = this.CreateReadonlyItem("AppType", constructParams.AppType); _updateTime = this.CreateSoundItem("UpdateTime", DateTime.Now); }
public async Task <BusinessItem> GetById(int id) { var searchParams = new SearchQueryParams() { EventId = id, StartDate = DateTime.MinValue }; var eventItem = (await _calendarService.Get(searchParams)).FirstOrDefault(); if (eventItem == null) { return(null); } var item = new BusinessItem() { Id = eventItem.Id, Category = eventItem.Category, Type = eventItem.Type, StartDate = eventItem.StartDate, StartTime = eventItem.StartTime, EndDate = eventItem.EndDate, Description = eventItem.Description }; foreach (var eventItemMember in eventItem.Members) { var member = await _memberService.Get(eventItemMember.Id); item.Members.Add(member); } return(item); }
// 下架物品 private void UnItem(string groupPath, string itemNo, CqGroupMessageEventArgs e) { BusinessItem businessItem = GetBusinessItem(groupPath, itemNo); if (businessItem.ItemName == "") { Common.CqApi.SendGroupMessage(e.FromGroup, "没有改编号的物品"); return; } if (e.FromQQ.ToString() != businessItem.UserId) { Common.CqApi.SendGroupMessage(e.FromGroup, "该物品不属于您"); return; } SetKnapsackItemNum(businessItem.ItemName, businessItem.Num, groupPath, e.FromQQ.ToString()); iniTool.DeleteSectionKey(groupPath, businessIni, "商品", businessItem.No); UpdateItem(groupPath); Common.CqApi.SendGroupMessage(e.FromGroup, "成功下架商品:" + businessItem.ItemName); return; }
internal RiskData(BusinessRecord parent) { this._necessary = BusinessItemFactory.Create("Necessary", 0m, PermissionFeature.Sound, parent); this._netNecessary = BusinessItemFactory.Create("NetNecessary", 0m, PermissionFeature.Dumb, parent); this._hedgeNecessary = BusinessItemFactory.Create("HedgeNecessary", 0m, PermissionFeature.Dumb, parent); this._minEquityAvoidRiskLevel1 = BusinessItemFactory.Create("MinEquityAvoidRiskLevel1", 0m, PermissionFeature.Dumb, parent); this._minEquityAvoidRiskLevel2 = BusinessItemFactory.Create("MinEquityAvoidRiskLevel2", 0m, PermissionFeature.Dumb, parent); this._minEquityAvoidRiskLevel3 = BusinessItemFactory.Create("MinEquityAvoidRiskLevel3", 0m, PermissionFeature.Dumb, parent); this._necessaryFillingOpenOrder = BusinessItemFactory.Create("NecessaryFillingOpenOrder", 0m, PermissionFeature.Dumb, parent); this._necessaryFillingCloseOrder = BusinessItemFactory.Create("NecessaryFillingCloseOrder", 0m, PermissionFeature.Dumb, parent); this._tradePLFloat = BusinessItemFactory.Create("TradePLFloat", 0m, PermissionFeature.Dumb, parent); this._interestPLFloat = BusinessItemFactory.Create("InterestPLFloat", 0m, PermissionFeature.Dumb, parent); this._storagePLFloat = BusinessItemFactory.Create("StoragePLFloat", 0m, PermissionFeature.Dumb, parent); this._valueAsMargin = BusinessItemFactory.Create("ValueAsMargin", 0m, PermissionFeature.Dumb, parent); this._tradePLNotValued = BusinessItemFactory.Create("TradePLNotValued", 0m, PermissionFeature.Dumb, parent); this._interestPLNotValued = BusinessItemFactory.Create("InterestPLNotValued", 0m, PermissionFeature.Dumb, parent); this._storagePLNotValued = BusinessItemFactory.Create("StoragePLNotValued", 0m, PermissionFeature.Dumb, parent); this._lockOrderTradePLFloat = BusinessItemFactory.Create("LockOrderTradePLFloat", 0m, PermissionFeature.Dumb, parent); this._feeForCutting = BusinessItemFactory.Create("FeeForCutting", 0m, PermissionFeature.Dumb, parent); this._riskCredit = BusinessItemFactory.Create("RiskCredit", 0m, PermissionFeature.Dumb, parent); _partialPaymentPhysicalNecessary = BusinessItemFactory.Create("PartialPaymentPhysicalNecessary", 0m, PermissionFeature.Dumb, parent); _totalPaidAmount = BusinessItemFactory.Create("TotalPaidAmount", 0m, PermissionFeature.Dumb, parent); _credit = BusinessItemFactory.Create("Credit", 0m, PermissionFeature.Dumb, parent); _shortMargin = BusinessItemFactory.Create("ShortMargin", 0m, PermissionFeature.Dumb, parent); }
public bool Post([FromBody] BusinessItem businessItem) { if ((businessItem == null) || (businessItem.ProcedureWorkPackages == null) || (businessItem.ProcedureWorkPackages.Any() == false)) { return(false); } List <string> tripleStoreIds = new List <string>();; foreach (int wp in businessItem.ProcedureWorkPackages.Distinct()) { string tripleStoreId = GetTripleStoreId(); if (string.IsNullOrWhiteSpace(tripleStoreId)) { return(false); } else { tripleStoreIds.Add(tripleStoreId); } } List <CommandDefinition> updates = new List <CommandDefinition>(); updates.AddRange(GenerateCreateCommand(businessItem, tripleStoreIds.ToArray())); return(Execute(updates.ToArray())); }
internal FakeAccount(Guid id, string code) : base("Account", 10) { _trans = new BusinessRecordDictionary <Guid, FakeTransaction>("Transactions", this); _id = BusinessItemFactory.Create("Id", id, PermissionFeature.Key, this); _code = BusinessItemFactory.Create("Code", code, PermissionFeature.ReadOnly, this); }
public List <CommandDefinition> GenerateCreateCommand(BusinessItem businessItem, string[] tripleStoreIds) { List <CommandDefinition> commands = new List <CommandDefinition>(); for (int i = 0; i < businessItem.ProcedureWorkPackages.Distinct().Count(); i++) { commands.Add(new CommandDefinition(@"insert into ProcedureBusinessItem (WebLink,ProcedureWorkPackageId,BusinessItemDate, ModifiedBy,ModifiedAt,TripleStoreId) values(@WebLink,@ProcedureWorkPackageId,@BusinessItemDate, @ModifiedBy,@ModifiedAt,@TripleStoreId)", new { WebLink = businessItem.WebLink, ProcedureWorkPackageId = businessItem.ProcedureWorkPackages[i], BusinessItemDate = businessItem.BusinessItemDate, ModifiedBy = EMail, ModifiedAt = DateTimeOffset.UtcNow, TripleStoreId = tripleStoreIds[i] })); if (businessItem.Steps != null) { commands.AddRange(businessItem.Steps.Select(s => new CommandDefinition(@"insert into ProcedureBusinessItemProcedureStep (ProcedureBusinessItemId, ProcedureStepId) select Id, @ProcedureStepId from ProcedureBusinessItem where TripleStoreId=@TripleStoreId", new { TripleStoreId = tripleStoreIds[i], ProcedureStepId = s }))); } } return(commands); }
internal OrderResetItem(Guid id, bool isBuy) : base("Order", 5) { _isBuy = BusinessItemFactory.Create("IsBuy", isBuy, PermissionFeature.ReadOnly, this); _id = BusinessItemFactory.Create("ID", id, PermissionFeature.Key, this); _bills = new BusinessRecordList <ResetBill>("Bills", this, 10); }
/// <summary> /// Gets a collection of business items using the start and end dates. /// </summary> public Collection <BusinessItem> GetCalendarOfEventsByDate(DateTime startDate, DateTime endDate) { Collection <BusinessItem> businessItems = new Collection <BusinessItem>(); Collection <CalendarEvent> calendarEvents; calendarEvents = GetCalendarEvent(startDate, endDate); foreach (var calendarEvent in calendarEvents) { var businessItem = new BusinessItem { Description = calendarEvent.Description, StartDate = DateTime.Parse(calendarEvent.StartDate), EndDate = DateTime.Parse(calendarEvent.EndDate) }; if (calendarEvent.Members.Count > 0) { var member = GetMemberById(calendarEvent.Members[0].Id); businessItem.Members.Add(member); } businessItems.Add(businessItem); } return(businessItems); }
private void UpdateItem(string groupPath) { List <string> items = iniTool.IniReadSectionKey(groupPath, businessIni, "商品"); List <BusinessItem> businessItemlist = new List <BusinessItem>(); int count = 1; foreach (string item in items) { BusinessItem businessItem = GetBusinessItem(groupPath, item); businessItem.No = count.ToString(); businessItemlist.Add(businessItem); count++; } iniTool.DeleteSection(groupPath, businessIni, "商品"); foreach (BusinessItem item in businessItemlist) { string val = item.ItemName + "*" + item.Num.ToString() + "|" + item.Coin + "|" + item.UserName + "|" + item.UserId; iniTool.IniWriteValue(groupPath, businessIni, "商品", item.No, val); } }
private void DeleteItemAll(string groupPath) { List <string> items = iniTool.IniReadSectionKey(groupPath, businessIni, "商品"); List <BusinessItem> businessItemlist = new List <BusinessItem>(); int count = 1; foreach (string item in items) { BusinessItem businessItem = GetBusinessItem(groupPath, item); businessItem.No = count.ToString(); businessItemlist.Add(businessItem); count++; } foreach (BusinessItem item in businessItemlist) { SetKnapsackItemNum(item.ItemName, item.Num, groupPath, item.UserId); } iniTool.DeleteSection(groupPath, businessIni, "商品"); return; }
internal FundContent(BusinessRecord parent, decimal?balance, decimal?frozenFund, Account account) { _totalDeposit = BusinessItemFactory.Create("TotalDeposit", 0m, PermissionFeature.Sound, parent); _balance = BusinessItemFactory.Create(FundBusinessItemNames.Balance, balance, PermissionFeature.Sound, parent); _frozenFund = BusinessItemFactory.Create(FundBusinessItemNames.FrozenFund, frozenFund, PermissionFeature.Sound, parent); this._riskRawData = new RiskData(parent); _account = account; }
private void ParseSettings(OrderConstructParams constructParams) { _interestValueDate = this.CreateSoundItem(OrderBusinessItemNames.InterestValueDate, constructParams.InterestValueDate); _setPriceMaxMovePips = this.CreateReadonlyItem(OrderBusinessItemNames.SetPriceMaxMovePips, constructParams.SetPriceMaxMovePips); _dqMaxMove = this.CreateReadonlyItem(OrderBusinessItemNames.DQMaxMove, constructParams.DQMaxMove); _phase = this.CreateSoundItem(OrderBusinessItemNames.Phase, constructParams.Phase); _tradeOption = this.CreateReadonlyItem(OrderBusinessItemNames.TradeOption, constructParams.TradeOption); }
internal ResetBalance(DateTime tradeDay, Guid accountId, Guid currencyId, decimal value) : base("Balance", 3) { _tradeDay = BusinessItemFactory.Create("TradeDay", tradeDay, PermissionFeature.Key, this); _value = BusinessItemFactory.Create("Value", value, PermissionFeature.Sound, this); _currencyId = BusinessItemFactory.Create("CurrencyID", currencyId, PermissionFeature.Key, this); _accountId = BusinessItemFactory.Create("AccountID", accountId, PermissionFeature.Key, this); }
internal DeliveryRequestSpecification(DeliveryRequest owner, Protocal.Physical.DeliveryRequestSpecificationData specification) : base("DeliveryRequestSpecification", 2) { owner.AddDeliveryRequestSpecification(this, OperationType.AsNewRecord); _quantity = BusinessItemFactory.Create("Quantity", specification.Quantity, PermissionFeature.ReadOnly, this); _size = BusinessItemFactory.Create("Size", specification.Size, PermissionFeature.ReadOnly, this); _unitId = BusinessItemFactory.Create("UnitId", specification.UnitId, PermissionFeature.ReadOnly, this); }
public IActionResult DeleteConfirmed(int id) { BusinessItem businessItem = _context.BusinessItems.Single(m => m.Id == id); _context.BusinessItems.Remove(businessItem); _context.SaveChanges(); return(RedirectToAction("Index")); }
private bool hasBusinessitemChanged(BusinessItem businessItem) { return(businessItem.Name != this.BU_NameTextBox.Text || businessItem.domain?.domainPath != ((Domain)this.BU_DomainComboBox.SelectedItem)?.domainPath || businessItem.Description != this.BU_DescriptionTextBox.Text || businessItem.Status != this.BU_StatusCombobox.Text || businessItem.Version != this.BU_VersionTextBox.Text || string.Join(",", businessItem.Keywords) != this.BU_KeywordsTextBox.Text); }
internal OrderFloating(Order order, CalculateParams calculateParams) { _owner = order; _calculateParams = calculateParams; _interestPLFloat = BusinessItemFactory.Create("InterestPLFloat", 0m, PermissionFeature.Dumb, order); _storagePLFloat = BusinessItemFactory.Create("StoragePLFloat", 0m, PermissionFeature.Dumb, order); _tradePLFloat = BusinessItemFactory.Create("TradePLFloat", 0m, PermissionFeature.Dumb, order); _livePrice = BusinessItemFactory.Create("LivePrice", (Price)null, PermissionFeature.Dumb, order); }
internal AccountPersistence(Account owner) { _leverage = this.CreateSoundItem <decimal?>("Leverage", owner); _rateMarginD = this.CreateSoundItem <decimal?>("RateMarginD", owner); _rateMarginO = this.CreateSoundItem <decimal?>("RateMarginO", owner); _rateMarginLockD = this.CreateSoundItem <decimal?>("RateMarginLockD", owner); _rateMarginLockO = this.CreateSoundItem <decimal?>("RateMarginLockO", owner); this.ClearStatus(); }
internal FakeTransaction(Guid id, string code, FakeAccount parent, OperationType type = OperationType.None) : base("Transaction", 5) { _id = BusinessItemFactory.Create("Id", id, PermissionFeature.Key, this); _code = BusinessItemFactory.Create("Code", code, PermissionFeature.ReadOnly, this); _updateTime = BusinessItemFactory.Create("UpdateTime", DateTime.Now, PermissionFeature.Sound, this); _orders = new BusinessRecordList <FakeOrder>("Orders", this); parent.AddTran(this, type); }
private void Parse(PhysicalOrderRelationConstructParams constructParams) { _physicalValueMatureDay = this.CreateSoundItem(OrderRelationBusinessItemNames.PhysicalValueMatureDate, constructParams.PhysicalValueMatureDay); _overdueCutPenalty = this.CreateSoundItem("OverdueCutPenalty", constructParams.OverdueCutPenalty); _closePenalty = this.CreateSoundItem("ClosePenalty", constructParams.ClosePenalty); _payBackPledge = this.CreateSoundItem("PayBackPledge", constructParams.PayBackPledge); _closedPhysicalValue = this.CreateSoundItem("ClosedPhysicalValue", constructParams.ClosedPhysicalValue); _physicalValue = this.CreateSoundItem("physicalValue", constructParams.PhysicalValue); }
internal HitOrderSettings(Order parent, OrderConstructParams constructParams) : base(parent) { _owner = parent; _bestTime = this.CreateSoundItem("BestTime", constructParams.BestTime); _hitCount = this.CreateSoundItem(OrderBusinessItemNames.HitCount, constructParams.HitCount); _bestPrice = this.CreateSoundItem(OrderBusinessItemNames.BestPrice, constructParams.BestPrice); _hitStatus = this.CreateSoundItem(OrderBusinessItemNames.HitStatus, constructParams.HitStatus); }
private void ParseLot(OrderConstructParams constructParams) { _lot = this.CreateSoundItem(OrderBusinessItemNames.Lot, constructParams.Lot); _originalLot = this.CreateReadonlyItem(OrderBusinessItemNames.OriginalLot, constructParams.OriginalLot); _lotBalance = this.CreateSoundItem(OrderBusinessItemNames.LotBalance, constructParams.LotBalance); _interestPerLot = this.CreateSoundItem("InterestPerLot", constructParams.InterestPerLot); _storagePerLot = this.CreateSoundItem("StoragePerLot", constructParams.StoragePerLot); _minLot = this.CreateSoundItem("MinLot", constructParams.MinLot); _maxShow = this.CreateSoundItem("MaxShow", constructParams.MaxShow); }
internal ResetBill(Guid orderId, decimal value, ResetBillType type, DateTime tradeDay) : base("Bill", 20) { _id = BusinessItemFactory.Create("ID", Guid.NewGuid(), PermissionFeature.Key, this); _value = BusinessItemFactory.Create("Value", value, PermissionFeature.Sound, this); _tradeDay = BusinessItemFactory.Create("TradeDay", tradeDay, PermissionFeature.ReadOnly, this); _type = BusinessItemFactory.Create("Type", type, PermissionFeature.ReadOnly, this); _updateTime = BusinessItemFactory.Create("UpdateTime", DateTime.Now, PermissionFeature.ReadOnly, this); _orderId = BusinessItemFactory.Create("OrderID", orderId, PermissionFeature.Key, this); }
internal FakeOrder(FakeTransaction tran, Guid id, string code, decimal lot, decimal lotBalance, OperationType type = OperationType.None) : base("Order", 5) { tran.AddOrder(this, type); _id = BusinessItemFactory.Create("Id", id, PermissionFeature.Key, this); _code = BusinessItemFactory.Create("Code", code, PermissionFeature.ReadOnly, this); _lot = BusinessItemFactory.Create("Lot", lot, PermissionFeature.ReadOnly, this); _lotBalance = BusinessItemFactory.Create("LotBalance", lotBalance, PermissionFeature.Sound, this); _phase = BusinessItemFactory.Create("Phase", OrderPhase.Placed, PermissionFeature.Sound, this); }
internal TradingBill(Guid id, Guid accountId, Guid currencyId, decimal value, TradingBillType type, DateTime updateTime) : base("TradingBill", 6) { _id = BusinessItemFactory.Create("ID", id, PermissionFeature.Key, this); _accountId = BusinessItemFactory.Create("AccountId", accountId, PermissionFeature.ReadOnly, this); _currencyId = BusinessItemFactory.Create("CurrencyId", currencyId, PermissionFeature.ReadOnly, this); _value = BusinessItemFactory.Create("Value", value, PermissionFeature.Sound, this); _updateTime = BusinessItemFactory.Create("updateTime", updateTime, PermissionFeature.Sound, this); _type = BusinessItemFactory.Create("Type", type, PermissionFeature.ReadOnly, this); }
private void unloadBusinessItemData(BusinessItem item) { item.Name = this.BU_NameTextBox.Text; item.domain = (Domain)this.BU_DomainComboBox.SelectedItem; item.Description = this.BU_DescriptionTextBox.Text; item.Status = this.BU_StatusCombobox.Text; item.Version = this.BU_VersionTextBox.Text; item.Keywords = this.BU_KeywordsTextBox.Text.Split(',') .Select(x => x.Trim()) .Where(x => !string.IsNullOrWhiteSpace(x)).ToList(); }
public IActionResult Edit(BusinessItem businessItem) { if (ModelState.IsValid) { _context.Update(businessItem); _context.SaveChanges(); return(RedirectToAction("Index")); } ViewData["BusinessId"] = new SelectList(_context.Businesses, "Id", "Business", businessItem.BusinessId); return(View(businessItem)); }
private void PurchaseItemEvent(object[] args) { // Store the products and price int index = Convert.ToInt32(args[0]); int amount = Convert.ToInt32(args[1]); // Get the purchased item and its cost BusinessItem purchasedItem = JsonConvert.DeserializeObject <List <BusinessItem> >(businessItems)[index]; Events.CallRemote("businessPurchaseMade", purchasedItem.description, amount); }
/// <summary> /// Maps a Data Model to a View Model /// </summary> /// <param name="src">Data Model that </param> /// <param name="mapModel"></param> /// <returns></returns> public static T MapToViewModel <T>(this BaseDataModel src) where T : class, BaseViewModel { var mapType = typeof(T); switch (mapType.Name) { case "BusinessItemOModel": { var srcObj = new BusinessItem(); srcObj.CopyPropertiesFrom(src); var mapObj = new BusinessItemOModel() { Id = srcObj.Id, Name = srcObj.Item.Name, Description = srcObj.Item.Description, Group = srcObj.Item.Group.Name, Quantity = srcObj.Quantity, PriceCost = srcObj.Prices.Single(p => p.Type == PriceType.Cost).Amount, PriceTarget = 100, PricePremium = 200, DateOfProduction = srcObj.DateOfProduction.Date.ToString("dd/MM/yyyy"), DateOfLastSoldItem = srcObj.DateOfLastSold.Date.ToString("dd/MM/yyyy") }; var map = (T)Activator.CreateInstance(mapType); map.CopyPropertiesFrom(mapObj); return(map); } case "BusinessEntityOModel": { var srcObj = new BusinessEntity(); srcObj.CopyPropertiesFrom(src); var mapObj = new BusinessEntityOModel(); mapObj.Id = srcObj.Id; mapObj.Name = srcObj.Name; mapObj.Type = srcObj.Type.ToString(); mapObj.Currency = srcObj.Currency.ToString(); var map = (T)Activator.CreateInstance(mapType); map.CopyPropertiesFrom(mapObj); return(map); } default: throw new Exception($"No implementation to map ${mapType.Name}!"); } }