/// <summary> /// Initializes a new instance of the <see cref="Coverage"/> class. /// </summary> /// <param name="coverageType"> /// The coverage type /// </param> /// <param name="limit"> /// The Coverage Limit /// </param> /// <param name="deductible"> /// The Coverage Deductible /// </param> /// <param name="vehicleId"> /// The vehicle Id. /// </param> public Coverage(CoverageType coverageType, Limit limit, Deductible deductible, int vehicleId) { this.CoverageType = coverageType; this.Limit = limit; this.Deductible = deductible; this.VehicleId = vehicleId; }
public void Apply_DadoFiltroSemLimit_DeveRetornar100() { var limit = new Limit(); var actual = limit.Apply(_filterStub.Object); actual.Should().Be(100); }
public GetDepositLimitResponse(Limit limit) { Amount = limit.Value; PeriodInDays = limit.PeriodInDays; StartDate = limit.StartDate; EndDate = limit.EndDate; Author = limit.Author; ModificationTime = limit.ModificationTime; Status = limit.Status.ToString(); IsRecurring = limit.IsRecurring; }
public Log(Limit limit) { CustomerId = limit.CustomerId; LimitType = limit.LimitType; Limit = limit.Value; PeriodInDays = limit.PeriodInDays; StartDate = limit.StartDate; EndDate = limit.EndDate; Author = limit.Author; ModificationTime = limit.ModificationTime; }
public void Apply_DadoFiltroComLimit_DeveRetornar(int limitValue, int expected) { _filterStub .Setup(p => p.Limit.Value) .Returns(limitValue); var limit = new Limit(); var actual = limit.Apply(_filterStub.Object); actual.Should().Be(expected); }
public ChannelStack(Limit<int> sizeLimit) { _sizeLimit = sizeLimit; _main = new Channel("main", ChannelVisibility.Public); _stack = new List<Channel> { _main }; _stackSize = 1; _channels = new Dictionary<string, Channel> { { "main", _main } }; }
private Limit GetEntity(DataRow dr) { Limit user = new Limit(); // user.Id = Convert.ToInt32(dr["Id"]); user.Name = dr["Name"].ToString(); // user.LoginName = dr["LoginName"].ToString(); user.URL = dr["URL"].ToString(); user.CanRepeater = (bool )dr["CanRepeater"]; // user.RoleId = Convert.ToInt32(dr["RoleId"]); // user.BoolUse = Convert.ToBoolean(dr["BoolUse"]); user.NeedIntegral = (bool)dr["NeedIntegral"]; user.Integral = (int)dr["Integral"]; user.Id =(int)dr["Id"]; user.ShengjiJiangli = (int)dr["ShengjiJiangli"]; return user; }
private void _SetLimit(int amount) { string LimitStr = Utility.Load <string>("ORDERSETTING", "AUTOLIMITAMOUNT"); string[] LimitItems = LimitStr.Split(';'); List <Limit> Limits = new List <Limit>(); foreach (var item in LimitItems) { if (string.IsNullOrEmpty(item)) { continue; } Limit L = new Limit(item); if (Limits.FirstOrDefault(e => e.Account == L.Account && e.Exchange == L.Exchange && e.OrderHead == L.OrderHead) == null) { Limits.Add(L); } } Limit now = Limits.FirstOrDefault(e => e.Account == m_Tick.Account && e.Exchange == m_Tick.Exchange && e.OrderHead == m_Tick.OrderHead); if (now == null) { now = new Limit() { Account = m_Tick.Account, Exchange = m_Tick.Exchange, OrderHead = m_Tick.OrderHead }; Limits.Add(now); } now.Amount = amount; string str = ""; foreach (var item in Limits) { str += item.ToString(); } Utility.Save("ORDERSETTING", "AUTOLIMITAMOUNT", str); }
public void DateIssue2() { HandHistorySummary expectedSummary = new HandHistorySummary() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.NoLimitHoldem, Limit = Limit.FromSmallBlindBigBlind(1.0m, 2.00m, Currency.USD), SeatType = SeatType.FromMaxPlayers(9), Site = SiteName.Values.PokerStars, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Cap) }, DateOfHandUtc = new DateTime(2011, 5, 10, 11, 27, 21), DealerButtonPosition = 1, HandId = 61910233643, NumPlayersSeated = 7, TableName = "Toutatis III" }; TestFullHandHistorySummary(expectedSummary, "DateIssue2"); }
public void TableNameWithDash() { HandHistorySummary expectedSummary = new HandHistorySummary() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.PotLimitOmaha, Limit = Limit.FromSmallBlindBigBlind(25.0m, 50.00m, Currency.USD), SeatType = SeatType.FromMaxPlayers(2), Site = SiteName.Values.PokerStars, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Regular) }, DateOfHandUtc = new DateTime(2011, 5, 19, 00, 41, 04), DealerButtonPosition = 1, HandId = 62279382715, NumPlayersSeated = 2, TableName = "Isildur's PLO 50" }; TestFullHandHistorySummary(expectedSummary, "TableNameWithDash"); }
public void DateIssue1() { HandHistorySummary expectedSummary = new HandHistorySummary() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.NoLimitHoldem, Limit = Limit.FromSmallBlindBigBlind(0.50m, 1.00m, Currency.USD), SeatType = SeatType.FromMaxPlayers(6), Site = SiteName.Values.PokerStars, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Regular) }, DateOfHandUtc = new DateTime(2011, 5, 7, 3, 51, 38), DealerButtonPosition = 4, HandId = 61777648755, NumPlayersSeated = 4, TableName = "Tezcatlipoca III" }; TestFullHandHistorySummary(expectedSummary, "DateIssue1"); }
public Sandbox(RantEngine engine, RantPattern pattern, RNG rng, int sizeLimit = 0, RantPatternArgs args = null) { _engine = engine; _format = engine.Format; _sizeLimit = new Limit(sizeLimit); _baseOutput = new OutputWriter(this); _outputs = new Stack <OutputWriter>(); _outputs.Push(_baseOutput); _rng = rng; _startingGen = rng.Generation; _pattern = pattern; _objects = new ObjectStack(engine.Objects); _blocks = new Stack <BlockState>(); _matches = new Stack <Match>(); _queryState = new QueryState(); _subroutineArgs = new Stack <Dictionary <string, RantAction> >(); _syncManager = new SyncManager(this); _blockManager = new BlockManager(); _scriptObjectStack = new Stack <object>(); _patternArgs = args; _stopwatch = new Stopwatch(); }
public static void DeleteLimit(int claimId, int policyId) { List <ClaimLimit> objclaimLimit = (from s in DbContextHelper.DbContext.ClaimLimit where s.ClaimID == claimId select s).ToList(); foreach (var claimlimit in objclaimLimit) { ClaimLimitManager.IsDeleted(claimId); PolicyLimitManager.IsDeleted(policyId); Limit objLimit = (from s in DbContextHelper.DbContext.Limit where s.LimitID == claimlimit.LimitID && s.IsStatic == false select s).FirstOrDefault(); if (objLimit != null) { DbContextHelper.DbContext.DeleteObject(objLimit); DbContextHelper.DbContext.SaveChanges(); } } }
public void PlayerWithColon() { HandHistorySummary expectedSummary = new HandHistorySummary() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.NoLimitHoldem, Limit = Limit.FromSmallBlindBigBlind(0.10m, 0.25m, Currency.USD), SeatType = SeatType.FromMaxPlayers(9), Site = SiteName.Values.PokerStars, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Regular) }, DateOfHandUtc = new DateTime(2012, 7, 18, 16, 25, 8), DealerButtonPosition = 9, HandId = 83504515230, NumPlayersSeated = 9, TableName = "Hygiea IV 40-100 bb" }; TestFullHandHistorySummary(expectedSummary, "PlayerWithColon"); }
public override string BuildUrl() { this.Url = this.EndPoint; // build URL string checkValue("datasetid", DatasetId); checkValue("datacategoryid", DatacategoryId); checkValue("locationid", LocationId); checkValue("datatypeid", DatatypeId); checkValue("startdate", From); checkValue("enddate", To); if (Limit <= 0) { Limit = DefaultValues.Limit; } checkValue("limit", Limit.ToString()); checkValue("offset", OffSet.ToString()); checkValue("sortfield", SortBy); checkValue("sortorder", Order); return(this.Url); }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope var objectContainer = context.GetFromContext <IObjectContainer>(TwilioApiScope.ParentContainerPropertyTag); // Inputs var friendlyname = FriendlyName.Get(context); var status = Status.Get(context); var limit = Limit.Get(context); var twilioStatus = status == AccountStatus.Active ? AccountResource.StatusEnum.Active : status == AccountStatus.Closed ? AccountResource.StatusEnum.Closed : status == AccountStatus.Suspended ? AccountResource.StatusEnum.Suspended : null; var accounts = await AccountWrappers.GetAccountsAsync(objectContainer.Get <ITwilioRestClient>(), friendlyname, twilioStatus, limit); // Outputs return((ctx) => { Accounts.Set(ctx, accounts); }); }
public Dictionary <string, string> ToDictionary() { var options = new Dictionary <string, string>(); if (!string.IsNullOrEmpty(UserId)) { options.Add("userId", UserId); } if (LastId.HasValue) { options.Add("lastId", LastId.ToString()); } if (Limit.HasValue) { options.Add("limit", Limit.ToString()); } if (SortOrder == ListSortOrder.Ascending) { options.Add("sortOrder", "asc"); } return(options); }
public void ZoomHand() { HandHistorySummary expectedSummary = new HandHistorySummary() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.PotLimitOmaha, Limit = Limit.FromSmallBlindBigBlind(1m, 2m, Currency.USD), SeatType = SeatType.FromMaxPlayers(6), Site = SiteName.Values.PokerStars, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Zoom) }, DateOfHandUtc = new DateTime(2014, 2, 21, 17, 45, 8), DealerButtonPosition = 1, HandId = 132630000000, NumPlayersSeated = 6, TableName = "Diotima" }; TestFullHandHistorySummary(expectedSummary, "ZoomHand"); }
public static void CreateJsonCoverLimit() { CoverTheft coverTheft = new CoverTheft(); Limit limit1 = new Limit("Limit1", new List <int>() { 100, 500, 1000, 5000, 10000 }); Limit limit2 = new Limit("Limit2", new List <int>() { 500, 1000, 10000, 50000 }); Question q1 = new Question("Q1", new List <string>() { "Are you mad?", "Do you park your car outside?", "Do you own a garage?" }); coverTheft.LimitsList = new List <Limit>() { limit1, limit2 }; coverTheft.QuestionsList = new List <Question>() { q1 }; var path1 = Path.Combine(Environment.CurrentDirectory, "CoverTheftLimit.json"); var path2 = Path.Combine(Environment.CurrentDirectory, "CoverTheftQuestion.json"); using (var sWriter = File.CreateText(path1)) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(sWriter, coverTheft.LimitsList); } using (var sWriter = File.CreateText(path2)) { JsonSerializer serializer = new JsonSerializer(); serializer.Serialize(sWriter, coverTheft.QuestionsList); } }
public void MucksHand() { HandHistory expectedHand = new HandHistory() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.PotLimitOmahaHiLo, Limit = Limit.FromSmallBlindBigBlind(0.05m, 0.10m, Currency.USD), SeatType = SeatType.FromMaxPlayers(6), Site = SiteName.Values.PokerStars, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Regular) }, DateOfHandUtc = new DateTime(2012, 9, 11, 7, 51, 48), DealerButtonPosition = 4, HandId = 86008517721, NumPlayersSeated = 6, TableName = "Muscida V 40-100 bb" }; HandHistory actualHand = TestFullHandHistory(expectedHand, "MucksHand"); }
private void btnLimitSave_Click(object sender, EventArgs e) { if (isValid.isPlaneTypeValid(cbEditLimitType.SelectedIndex) && isValid.isStartFinishValid(tbEditSpeedLimitStart.Text, tbEditSpeedLimitFinish.Text) && isValid.isStartFinishValid(tbEditDistanceLimitStart.Text, tbEditDistanceLimitFinish.Text)) { if (limitsDataLink.Exists(cbEditLimitType.SelectedItem.ToString()) && (limitToEdit.PlaneType != cbEditLimitType.SelectedItem.ToString())) { MessageBox.Show("Для данного типа самолета уже введено ограничение"); } else { Limit limit = limitsDataLink.Retrieve(limitToEdit.LimitID); limit.PlaneType = cbEditLimitType.SelectedItem.ToString(); limit.SpeedStart = Convert.ToInt32(tbEditSpeedLimitStart.Text); limit.SpeedFinish = Convert.ToInt32(tbEditSpeedLimitFinish.Text); limit.DistanceStart = Convert.ToInt32(tbEditDistanceLimitStart.Text); limit.DistanceFinish = Convert.ToInt32(tbEditDistanceLimitFinish.Text); limitsDataLink.Update(limit); this.Hide(); } } }
public static async Task <LimitModel> UpdateLimit(Limit newLimit) { client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var url = $"{Constants.URL}{Constants.ENDPOINT_LIMIT}"; var requestBody = new StringContent(JsonConvert.SerializeObject(newLimit)); HttpResponseMessage response = await client.PostAsync(url, requestBody); LimitModel limit = null; if (response.IsSuccessStatusCode) { string responseBody = await response.Content.ReadAsStringAsync(); limit = JsonConvert.DeserializeObject <LimitModel>(responseBody); } return(limit); }
public async Task <LimitResult> RegisterLimitAsync(Limit limit) { var failedValidation = ValidateLimit(limit); if (failedValidation != null) { return(failedValidation); } limit.Id = limit.Id ?? Guid.NewGuid(); _dbContext.Add(limit); try { await _dbContext.SaveChangesAsync(); return(LimitResult.SuccessResult); } catch (Exception exception) { return(LimitResult.FailureResult); } }
protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { // Object Container: Use objectContainer.Get<T>() to retrieve objects from the scope var objectContainer = context.GetFromContext <IObjectContainer>(TwilioApiScope.ParentContainerPropertyTag); // Inputs var countrycode = CountryCode; var accountsid = AccountSid.Get(context); var areacode = AreaCode.Get(context); var smsenabled = SmsEnabled.Get(context); var mmsenabled = MmsEnabled.Get(context); var voiceenabled = VoiceEnabled.Get(context); var faxenabled = FaxEnabled.Get(context); var contains = Contains.Get(context); var beta = Beta.Get(context); var nearnumber = NearNumber.Get(context); var nearlatlong = NearLatLong.Get(context); var distance = Distance.Get(context); var inpostalcode = InPostalCode.Get(context); var inregion = InRegion.Get(context); var inratecenter = InRateCenter.Get(context); var inlata = InLata.Get(context); var inlocality = InLocality.Get(context); var excludealladdressrequired = ExcludeAllAddressRequired.Get(context); var excludelocaladdressrequired = ExcludeLocalAddressRequired.Get(context); var excludeforeignaddressrequired = ExcludeForeignAddressRequired.Get(context); var limit = Limit.Get(context); var numbers = await AvailableMobilePhoneNumbersWrappers.GetAvailableMobilePhoneNumberAsync( objectContainer.Get <ITwilioRestClient>(), countrycode, accountsid, areacode, smsenabled, mmsenabled, faxenabled, voiceenabled, beta, contains, inlata, nearlatlong, nearnumber, distance, inlocality, inpostalcode, inratecenter, inregion, excludealladdressrequired, excludeforeignaddressrequired, excludelocaladdressrequired, limit); // Outputs return((ctx) => { PhoneNumbers.Set(ctx, numbers); }); }
protected override Limit ParseLimit(string[] handLines) { // The different formats for the stakes: // "$5/$10 USD FL Texas Hold'em" // "$600 USD PL Omaha" string line = handLines[1]; int endIndex = line.IndexOf(' '); string limitSubstring = line.Substring(1, endIndex - 1); Currency currency = ParseLimitCurrency(line); // If there is a game limit with a slash then the limit is in form $2/$4 // then convert the game limit into a game type without a slash which would be 400 for 2/4 if (limitSubstring.Contains("/")) { return(ParseNormalLimit(limitSubstring, currency)); } string tableName = ParseTableName(handLines); GameType game = ParseGameType(handLines); if (game == GameType.FixedLimitHoldem) { decimal limitBB = decimal.Parse(limitSubstring, System.Globalization.CultureInfo.InvariantCulture); return(Limit.FromSmallBlindBigBlind(limitBB / 2.0m, limitBB, currency)); } // Handle 20BB tables, due to Party putting the limit up as 40% of the actual // limit. So for instance 20BB party $100NL the limit is displayed as $40NL. // No idea why this is so. if (tableName.StartsWith("20BB")) { return(Parse20BBLimit(limitSubstring, currency)); } return(ParseBuyInLimit(limitSubstring, currency)); }
public Sandbox(RantEngine engine, RantProgram pattern, RNG rng, int sizeLimit = 0, CarrierState carrierState = null, RantProgramArgs args = null) { // Public members RNG = rng; StartingGen = rng.Generation; Engine = engine; Format = engine.Format; SizeLimit = new Limit(sizeLimit); Pattern = pattern; PatternArgs = args; // Private members _blockManager = new BlockAttribManager(); _stopwatch = new Stopwatch(); _carrierState = carrierState; // Output initialization BaseOutput = new OutputWriter(this); _outputs = new Stack <OutputWriter>(); _outputs.Push(BaseOutput); }
public Dictionary <string, string> ToDictionary() { var options = new Dictionary <string, string>(); if (UnreadOnly) { options.Add("unreadOnly", "true"); } if (Limit.HasValue) { options.Add("limit", Limit.ToString()); } if (LastId.HasValue) { options.Add("lastId", LastId.ToString()); } if (AllUsers) { options.Add("allUsers", "true"); } return(options); }
public void HandIssue1() { HandHistory expectedSummary = new HandHistory() { GameDescription = new GameDescriptor() { PokerFormat = PokerFormat.CashGame, GameType = GameType.NoLimitHoldem, Limit = Limit.FromSmallBlindBigBlind(5m, 10m, Currency.USD), SeatType = SeatType.FromMaxPlayers(6), Site = SiteName.Values.IPoker, TableType = TableType.FromTableTypeDescriptions(TableTypeDescription.Regular) }, DateOfHandUtc = new DateTime(2014, 1, 1, 22, 50, 13), DealerButtonPosition = 1, HandId = 987654, NumPlayersSeated = 5, TableName = "Andreapol__No_DP_" }; TestFullHandHistorySummary(expectedSummary, "DataMinerHandIssue1"); }
protected override void WriteToQueryDictionary(IDictionary <string, string> target) { SetValue <string>(target, "limit", Limit.ToString()); SetValue(target, "offset", Offset); SetValue <string>(target, "search", Keywords); SetBoolValue(target, "parents", Parents); SetBoolValue(target, "authenticated", Authenticated); switch (Sort) { case KittySortType.Price: SetValue(target, "orderBy", "current_price"); break; case KittySortType.Purrs: SetValue(target, "orderBy", "purr_count"); break; } if (SortAscending) { SetValue(target, "orderDirection", "asc"); } }
public Select AddClause(ISelectMember clause) { switch (clause) { case From from: _from = from; break; case IWhere where: _where = where; break; case GroupBy groupBy: _groupBy = groupBy; break; case OrderBy orderBy: _orderBy = orderBy; break; case Offset offset: _offset = offset; break; case Limit limit: _limit = limit; break; case For @for: _for = @for; break; case Exists exists: _exists = exists; break; } return(this); }
public GroupSelector() : base() { SetFlag (WidgetFlags.NoWindow); background = Rectangle.Zero; glass = new Glass (this); min_limit = new Limit (this, Limit.LimitType.Min); max_limit = new Limit (this, Limit.LimitType.Max); left = new Gtk.Button (); //left.Add (new Gtk.Image (Gtk.Stock.GoBack, Gtk.IconSize.Button)); left.Add (new Gtk.Arrow (Gtk.ArrowType.Left, Gtk.ShadowType.None)); left.Relief = Gtk.ReliefStyle.None; //left.Clicked += HandleScrollLeft; left.Pressed += HandleLeftPressed; left.ButtonReleaseEvent += HandleScrollReleaseEvent; left_delay = new Delay (50, new GLib.IdleHandler (HandleScrollLeft)); right = new Gtk.Button (); //right.Add (new Gtk.Image (Gtk.Stock.GoForward, Gtk.IconSize.Button)); right.Add (new Gtk.Arrow (Gtk.ArrowType.Right, Gtk.ShadowType.None)); right.Relief = Gtk.ReliefStyle.None; right.Pressed += HandleRightPressed; right.ButtonReleaseEvent += HandleScrollReleaseEvent; right_delay = new Delay (50, new GLib.IdleHandler (HandleScrollRight)); //right.Clicked += HandleScrollRight; this.Put (left, 0, 0); this.Put (right, 100, 0); left.Show (); right.Show (); CanFocus = true; Mode = RangeType.Min; UpdateButtons (); }
/// <summary> /// 设置回零方式 /// </summary> /// <param name="mode">-1 到负限位</param> /// <returns></returns> public override bool SetHomeMode(Limit mode) { bool flag = true;//= connecter.SendCommand(string.Format("I70{0}2=2", AmpCIndex));//设置捕捉模式 int value = 0; switch (mode) { case Limit.PLimit: { value = 1; connecter.SendCommand(string.Format("I70{0}2={1}", AmpCIndex, param.PosLimitCaptureMode)); //设置捕捉模式 } break; case Limit.NLimit: { value = 2; connecter.SendCommand(string.Format("I70{0}2={1}", AmpCIndex, param.NegLimitCaptureMode)); //设置捕捉模式 } break; case Limit.HomeLimit: { value = 0; connecter.SendCommand(string.Format("I70{0}2={1}", AmpCIndex, param.HomeLimitCaptureMode)); //设置捕捉模式 } break; case Limit.UserLimit: { value = 3; connecter.SendCommand(string.Format("I70{0}2={1}", AmpCIndex, param.UserLimitCaptureMode)); //设置捕捉模式 }; break; default: { value = 0; } break; } return(flag & connecter.SendCommand(string.Format("I70{0}3={1}", AmpCIndex, value))); }
public async Task<Limit> SetLimit(Limit limit) { // Retrieve current limit var currentDepositLimit = await _limitRepository.Get(limit.CustomerId, limit.LimitType); // Modify if it exists if (currentDepositLimit != null) { currentDepositLimit.Modify(limit.Value, limit.PeriodInDays, limit.EndDate, limit.Author); } // Create if it doesn't else { currentDepositLimit = limit; } _limitRepository.AddOrUpdate(currentDepositLimit); //Log limit var log = new Log(limit); //_logRepository.Add(log); return currentDepositLimit; }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is SearchCatalogItemsRequest other && ((TextFilter == null && other.TextFilter == null) || (TextFilter?.Equals(other.TextFilter) == true)) && ((CategoryIds == null && other.CategoryIds == null) || (CategoryIds?.Equals(other.CategoryIds) == true)) && ((StockLevels == null && other.StockLevels == null) || (StockLevels?.Equals(other.StockLevels) == true)) && ((EnabledLocationIds == null && other.EnabledLocationIds == null) || (EnabledLocationIds?.Equals(other.EnabledLocationIds) == true)) && ((Cursor == null && other.Cursor == null) || (Cursor?.Equals(other.Cursor) == true)) && ((Limit == null && other.Limit == null) || (Limit?.Equals(other.Limit) == true)) && ((SortOrder == null && other.SortOrder == null) || (SortOrder?.Equals(other.SortOrder) == true)) && ((ProductTypes == null && other.ProductTypes == null) || (ProductTypes?.Equals(other.ProductTypes) == true)) && ((CustomAttributeFilters == null && other.CustomAttributeFilters == null) || (CustomAttributeFilters?.Equals(other.CustomAttributeFilters) == true))); }
private static void Aquire(Server a_server, CancellationToken a_token, Priority a_priority, ulong a_limiter_order) { using (Limit limit = new Limit(a_priority, a_server, a_limiter_order)) { lock (s_limits) { s_limits.Add(limit); } s_loop_event.Set(); while (!limit.Event.WaitOne(WAIT_SLEEP_MS)) { lock (s_limits) { if (a_token.IsCancellationRequested) { s_limits.Remove(limit); a_token.ThrowIfCancellationRequested(); } } } } }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is V1ListEmployeesRequest other && ((Order == null && other.Order == null) || (Order?.Equals(other.Order) == true)) && ((BeginUpdatedAt == null && other.BeginUpdatedAt == null) || (BeginUpdatedAt?.Equals(other.BeginUpdatedAt) == true)) && ((EndUpdatedAt == null && other.EndUpdatedAt == null) || (EndUpdatedAt?.Equals(other.EndUpdatedAt) == true)) && ((BeginCreatedAt == null && other.BeginCreatedAt == null) || (BeginCreatedAt?.Equals(other.BeginCreatedAt) == true)) && ((EndCreatedAt == null && other.EndCreatedAt == null) || (EndCreatedAt?.Equals(other.EndCreatedAt) == true)) && ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) && ((ExternalId == null && other.ExternalId == null) || (ExternalId?.Equals(other.ExternalId) == true)) && ((Limit == null && other.Limit == null) || (Limit?.Equals(other.Limit) == true)) && ((BatchToken == null && other.BatchToken == null) || (BatchToken?.Equals(other.BatchToken) == true))); }
public IActionResult Put(Limit value) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); // 400 } _limitService.UpdateLimit(value); return(Ok(new { Result = true })); //200 } catch (Exception ex) { return(StatusCode(500, new { Result = false, ErrorMessage = ex.Message })); } }
public (int, double) StoreLimit(LimitViewModel viewModel) { Limit limit; if (viewModel.Id.HasValue && viewModel.Id != 0) { limit = repository.Limits.FirstOrDefault(x => x.Id == viewModel.Id); } else { limit = new Limit(); repository.Add(limit); } limit.LimitAmount = viewModel.Limit; limit.Category = repository.Categories.FirstOrDefault(x => x.Id == viewModel.CategoryId); repository.SaveChanges(); var sum = repository.Expenses.Where(x => x.Category == limit.Category).Sum(x => x.Amount); return(limit.Id, sum); }
private async Task LoadData() { await Task.Run(async() => { IsLoading = true; Dictionary <string, string> requestParameters = new Dictionary <string, string> { { "page", Page.ToString() }, { "limit", Limit.ToString() } }; _catalogItemsLoaded = new ObservableCollection <CatalogItemVM>( (await _productsRepository.GetProductList(requestParameters)).Value.Select(x => new CatalogItemVM() { Product = x })); CatalogItems = _catalogItemsLoaded; IsLoading = false; }, CancellationToken); }
private Limit LimitStep() { Limit limit = new Limit(); do { if (!(_curToken.Type == TokenType.Sing || _curToken.Type == TokenType.Var || _curToken.Type == TokenType.Number || _curToken.Type == TokenType.OpBr)) throw new ParseErrorException("Не верное описание слагаемого"); int koef = 1; Fraction koefVar = 1; if (_curToken.Type == TokenType.Sing) { if (_curToken.Value == "-") koef = -1; Match(_curToken.Type); } if (_curToken.Type == TokenType.Number || _curToken.Type == TokenType.OpBr) { koefVar = Number(); } if (_curToken.Type != TokenType.Var) throw new ParseErrorException("Ожидалась переменная"); if (!_table.ContainsKey(_curToken.Value)) throw new ParseErrorException("Переменная " + _curToken.Value + " не объявленная"); if (_table[_curToken.Value] == 0) throw new ParseErrorException("Ключевое слово " + _curToken.Value + " не может использоваться, как переменная"); limit.addVar(koef * koefVar, _table[_curToken.Value], _curToken.Value); Match(_curToken.Type); } while (_curToken.Type != TokenType.Eq); if (_curToken.Value == "=") limit.setSing(Sing.equality); else if (_curToken.Value == ">=") limit.setSing(Sing.moreEquality); else limit.setSing(Sing.lessEquality); Match(_curToken.Type); Fraction left = Number(); limit.setLeftSide(left); if (_curToken.Type != TokenType.SimCol) throw new ParseErrorException("Ожидалась точка с зяпятой"); Match(_curToken.Type); return limit; }
public Interpreter(Engine engine, Source input, RNG rng, int limitChars = 0) { _mainSource = input; _rng = rng; _engine = engine; _charLimit = new Limit<int>(0, limitChars, (a, b) => a + b, (a, b) => b == 0 || a <= b); _output = new ChannelStack(_charLimit); _mainState = State.Create(input, this); }
public static string SaveLossDetails(int policyID, string coverage, string type, string policyLimit, string deductible, string applyTo, string itv, string reserve, int acrossall, string catDeductible, string coInsuranceLimit) { string json = ""; int limitID = 0; ClaimLimit claimLimit = null; PolicyLimit objPolicyLimit = null; Limit limits = null; Limit limits2 = null; int userID = SessionHelper.getUserId(); ClaimManager objClaimManager = new ClaimManager(); try { using (TransactionScope scope = new TransactionScope()) { List<Claim> lstClaim = objClaimManager.GetPolicyClaim(policyID); bool isTemplate = ClaimLimitManager.PolicyIsStaticTrue(policyID); if (isTemplate) { PolicyLimitManager.IsDeleted(policyID); //if coverage first time then delete all template data from all claimid foreach (var claim in lstClaim) { int claimId = claim.ClaimID; ClaimLimitManager.IsDeleted(claimId); } } limits = new Limit(); limits.LimitLetter = coverage; if (type == "Contacts" || type == "Personal Liability" || type == "Medical Payments") { limits.LimitType = 2; } else { limits.LimitType = 1; } limits.LimitDescription = type; limits.IsStatic = false; limits2 = LimitManager.Save(limits); limitID = limits2.LimitID; objPolicyLimit = new PolicyLimit(); objPolicyLimit.PolicyID = policyID; objPolicyLimit.LimitID = limitID; if (!string.IsNullOrEmpty(policyLimit)) { objPolicyLimit.LimitAmount = Convert.ToDecimal(policyLimit); } else { objPolicyLimit.LimitAmount = 0; } if (!string.IsNullOrEmpty(deductible)) { objPolicyLimit.LimitDeductible = Convert.ToDecimal(deductible); } else { objPolicyLimit.LimitDeductible = 0; } //new fields add if (!string.IsNullOrEmpty(catDeductible)) { objPolicyLimit.CATDeductible = catDeductible; } if (!string.IsNullOrEmpty(coInsuranceLimit)) { objPolicyLimit.ConInsuranceLimit = Convert.ToDecimal(coInsuranceLimit); } else { objPolicyLimit.LimitDeductible = 0; } if (!string.IsNullOrEmpty(itv)) { objPolicyLimit.ITV = Convert.ToDecimal(itv); } else { objPolicyLimit.ITV = 0; } if (!string.IsNullOrEmpty(reserve)) { objPolicyLimit.Reserve = Convert.ToDecimal(reserve); } else { objPolicyLimit.Reserve = 0; } objPolicyLimit.IsDeleted = false; if (acrossall == 1) { objPolicyLimit.ApplyAcrossAllCoverage = true; } else { objPolicyLimit.ApplyAcrossAllCoverage = false; } objPolicyLimit.ApplyTo = applyTo; PolicyLimitManager.Save(objPolicyLimit); // enter data for each claim foreach (var claim in lstClaim) { claimLimit = new ClaimLimit(); claimLimit.ClaimID = claim.ClaimID; claimLimit.LimitID = limitID; claimLimit.LossAmountACV = 0; claimLimit.LossAmountRCV = 0; claimLimit.Depreciation = 0; claimLimit.OverageAmount = 0; claimLimit.NonRecoverableDepreciation = 0; claimLimit.IsDeleted = false; ClaimLimitManager.Save(claimLimit); } scope.Complete(); } json = "Loss details successfully add"; } catch (Exception ex) { Core.EmailHelper.emailError(ex); } return json; }
public void saveLimits(int policyID) { int policyLimitID = 0; int limitID = 0; //int claimLimitID = 0; int myClaimID = 0; int myClaimLimitID = 0; int myLimitId = 0; //anything prefaced with "my" is new; OC myClaimID = SessionHelper.getClaimID(); //Convert.ToInt32(Session["ClaimID"]); PolicyLimit limit = null; PolicyLimit myPolicyLimit = null; Limit myLimit = null; // ClaimLimit myClaimLimit = null; //added new; OC 9/11/2014: put in place to add new row to the policy limits grid. took the old 3 column one out. //crete the footer controls available for use here :OC 9/12/14 WebTextEditor txtMyCoverage = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyCoverage"); WebTextEditor txtMyDescription = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyDescription"); WebNumericEditor txtMyLimit = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLimit"); WebNumericEditor txtMyDeductible = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyDeductible"); WebTextEditor txtMyCATDeductible = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyCATDeductible"); WebDropDown ddlMySettlementType = (WebDropDown)gvLimits.FooterRow.FindControl("ddlMySettlementType"); WebPercentEditor txtMyCoInsuranceLimit = (WebPercentEditor)gvLimits.FooterRow.FindControl("txtMyCoInsuranceLimit"); WebPercentEditor txtMyITV = (WebPercentEditor)gvLimits.FooterRow.FindControl("txtMyITV"); WebNumericEditor txtMyReserve = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyReserve"); WebTextEditor txtMyWHDeductible = (WebTextEditor)gvLimits.FooterRow.FindControl("txtMyWHDeductible"); WebNumericEditor txtMyLossAmountACV = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLossAmountACV"); WebNumericEditor txtMyLossAmountRCV = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyLossAmountRCV"); WebNumericEditor txtMyOverage = (WebNumericEditor)gvLimits.FooterRow.FindControl("txtMyOverage"); if (txtMyCoverage.Text != "")//TODO: change this condition to something more stable (checkbox or something) { //LIMIT TABLE STUFF myLimit = new Limit(); myLimit.LimitLetter = txtMyCoverage.Text; myLimit.LimitType = 1;//need to change to user input and create text boxes myLimit.LimitDescription = txtMyDescription.Text; myLimit.IsStatic = false; try { LimitManager.Save(myLimit); } catch (Exception ex) { Core.EmailHelper.emailError(ex); } var a = LimitManager.GetLatest(); //need to get the lastly created limit id from the insert we just did above myLimitId = Convert.ToInt32(a.LimitID); //CLAIM LIMIT STUFF //myClaimLimit = new ClaimLimit(); //myClaimLimit.LimitID = myLimitId; //myClaimLimit.ClaimID = myClaimID; //myClaimLimit.PolicyID = policyID; //myClaimLimit.LossAmountACV = txtMyLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountACV.Text); //myClaimLimit.LossAmountRCV = txtMyLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountRCV.Text); //myClaimLimit.OverageAmount = txtMyOverage.Value == null ? 0 : Convert.ToDecimal(txtMyOverage.Text); //try //{ // ClaimLimitManager.Save(myClaimLimit); //} //catch (Exception ex) //{ //} //var b = ClaimLimitManager.GetLatest(); //myClaimLimitID = Convert.ToInt32(b.ClaimLimitID); //POLICY LIMIT STUFF myPolicyLimit = new PolicyLimit(); myPolicyLimit.PolicyID = policyID; myPolicyLimit.LimitID = myLimitId; myPolicyLimit.ClaimLimitID = myClaimLimitID; myPolicyLimit.LimitAmount = txtMyLimit.Value == null ? 0 : Convert.ToDecimal(txtMyLimit.Text); //= Convert.ToDecimal(txtMyLimit.Text); myPolicyLimit.LimitDeductible = txtMyDeductible.Value == null ? 0 : Convert.ToDecimal(txtMyDeductible.Text); myPolicyLimit.CATDeductible = txtMyCATDeductible.Text; if(ddlMySettlementType.SelectedItemIndex > 0) { myPolicyLimit.ApplyTo = ddlMySettlementType.SelectedItem.Text; } else { myPolicyLimit.ApplyTo = null; } myPolicyLimit.ConInsuranceLimit = Convert.ToDecimal(txtMyCoInsuranceLimit.Value); myPolicyLimit.ITV = Convert.ToDecimal(txtMyITV.Value); myPolicyLimit.Reserve = Convert.ToDecimal(txtMyReserve.Value); myPolicyLimit.WindHailDeductible = txtMyWHDeductible.Text; myPolicyLimit.LossAmountACV = txtMyLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountACV.Text); myPolicyLimit.LossAmountRCV = txtMyLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtMyLossAmountRCV.Text); myPolicyLimit.OverageAmount = txtMyOverage.Value == null ? 0 : Convert.ToDecimal(txtMyOverage.Text); try { PolicyLimitManager.Save(myPolicyLimit); } catch (Exception ex) { } } else //run the regular stuff it was doing before { //original code foreach (GridViewRow row in gvLimits.Rows) { if (row.RowType == DataControlRowType.DataRow) { //Label txtLimitLetter = row.FindControl("txtLimitLetter") as Label; //Label txtDescription = row.FindControl("txtDescription") as Label; WebNumericEditor txtLimit = row.FindControl("txtLimit") as WebNumericEditor; WebNumericEditor txtDeductible = row.FindControl("txtDeductible") as WebNumericEditor; WebTextEditor txtWHDeductible = row.FindControl("txtWHDeductible") as WebTextEditor;//new WebTextEditor txtCATDeductible = row.FindControl("txtCATDeductible") as WebTextEditor; WebTextEditor txtSettlementType = row.FindControl("txtSettlementType") as WebTextEditor; WebNumericEditor txtCoInsuranceLimit = row.FindControl("txtCoInsuranceLimit") as WebNumericEditor; WebDropDown ddlSettlementType = row.FindControl("ddlSettlementType") as WebDropDown; WebPercentEditor txtITV = row.FindControl("txtITV") as WebPercentEditor;//new WebNumericEditor txtReserve = row.FindControl("txtReserve") as WebNumericEditor;//new WebNumericEditor txtLossAmountACV = row.FindControl("txtLossAmountACV") as WebNumericEditor;//new WebNumericEditor txtLossAmountRCV = row.FindControl("txtLossAmountRCV") as WebNumericEditor;//new WebNumericEditor txtOverage = row.FindControl("txtOverage") as WebNumericEditor;//new policyLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[0]; limitID = (int)gvLimits.DataKeys[row.RowIndex].Values[1]; //claimLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[2]; //claimLimitID = (int)gvLimits.DataKeys[row.RowIndex].Values[2]; //if ((txtLossAmountACV.Text != "" || // txtLossAmountRCV.Text != "" || // txtOverage.Text != "" )&& // ( txtOverage.Text != "0.00" || // txtLossAmountRCV.Text != "0.00" || // txtLossAmountACV.Text != "0.00")) //{ //CLAIM LIMIT STUFF //myClaimLimit = new ClaimLimit(); //myClaimLimit.ClaimLimitID = claimLimitID; //myClaimLimit.LimitID = limitID; //myClaimLimit.ClaimID = myClaimID; //myClaimLimit.PolicyID = policyID; //myClaimLimit.PolicyLimitID = policyLimitID; //myClaimLimit.LossAmountACV = txtLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountACV.Text); //myClaimLimit.LossAmountRCV = txtLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountRCV.Text); //myClaimLimit.OverageAmount = txtOverage.Value == null ? 0 : Convert.ToDecimal(txtOverage.Text); //try //{ // ClaimLimitManager.Save(myClaimLimit); //} //catch (Exception ex) //{ //} //// var b = ClaimLimitManager.GetLatest2(policyLimitID); //// myClaimLimitID = Convert.ToInt32(b.ClaimLimitID); ////} if (policyLimitID == 0) limit = new PolicyLimit(); else limit = PolicyLimitManager.Get(policyLimitID); limit.PolicyLimitID = policyLimitID; limit.LimitID = limitID; //limit.ClaimLimitID = claimLimitID; limit.PolicyID = policyID; limit.LimitAmount = txtLimit.Value == null ? 0 : Convert.ToDecimal(txtLimit.Value); limit.LimitDeductible = txtDeductible.Value == null ? 0 : Convert.ToDecimal(txtDeductible.Value); limit.CATDeductible = txtCATDeductible.Text; limit.WindHailDeductible = txtWHDeductible.Text; limit.ConInsuranceLimit = txtCoInsuranceLimit.Value == null ? 0 : Convert.ToDecimal(txtCoInsuranceLimit.Value); limit.ITV = Convert.ToDecimal(txtITV.Value); limit.Reserve = Convert.ToDecimal(txtReserve.Value); limit.LossAmountACV = txtLossAmountACV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountACV.Text); limit.LossAmountRCV = txtLossAmountRCV.Value == null ? 0 : Convert.ToDecimal(txtLossAmountRCV.Text); limit.OverageAmount = txtOverage.Value == null ? 0 : Convert.ToDecimal(txtOverage.Text); if (ddlSettlementType.SelectedItemIndex > 0) { //limit.SettlementType = ddlSettlementType.SelectedValue; limit.ApplyTo = ddlSettlementType.SelectedValue; } else { limit.ApplyTo = null; } try { PolicyLimitManager.Save(limit); } catch (Exception ex) { Core.EmailHelper.emailError(ex); } } } } cbAddNewPolicy.Checked = false; disableNewRow(); }
public static string SaveLossDetailsEditPropertyEdit(int policyID, string coverage, string type, string policyLimit, string deductible, string applyTo, string itv, string reserve, int acrossall, int limitId, string catDeductible, string coInsuranceLimit) { string json = string.Empty; try { Limit objLimit = null; PolicyLimit objPolicyLimit = null; decimal decAmount = 0; decimal decDetuctible = 0; decimal decCoInsuranceLimit = 0; decimal decItv = 0; decimal decReserve = 0; bool bacrossall = false; if (!string.IsNullOrEmpty(policyLimit)) { decAmount = Convert.ToDecimal(policyLimit); } if (!string.IsNullOrEmpty(deductible)) { decDetuctible = Convert.ToDecimal(deductible); } //add new fields if (!string.IsNullOrEmpty(coInsuranceLimit)) { decCoInsuranceLimit = Convert.ToDecimal(coInsuranceLimit); } if (!string.IsNullOrEmpty(itv)) { decItv = Convert.ToDecimal(itv); } if (!string.IsNullOrEmpty(reserve)) { decReserve = Convert.ToDecimal(reserve); } if (acrossall == 1) { bacrossall = true; } else { bacrossall = false; } ///// int limitType = 0; if (type == "Contacts" || type == "Personal Liability" || type == "Medical Payments") { limitType = 2; } else { limitType = 1; } using (TransactionScope scope = new TransactionScope()) { objLimit = new Limit(); objLimit.LimitID = limitId; objLimit.LimitLetter = coverage; objLimit.LimitType = limitType; objLimit.LimitDescription = type; LimitManager.UpdateLimit(objLimit); objPolicyLimit = new PolicyLimit(); objPolicyLimit.PolicyID = policyID; objPolicyLimit.LimitID = limitId; objPolicyLimit.LimitAmount = decAmount; objPolicyLimit.LimitDeductible = decDetuctible; objPolicyLimit.CATDeductible = catDeductible; objPolicyLimit.ConInsuranceLimit = decCoInsuranceLimit; objPolicyLimit.ITV = decItv; objPolicyLimit.Reserve = decReserve; objPolicyLimit.ApplyAcrossAllCoverage = bacrossall; objPolicyLimit.ApplyTo = applyTo; PolicyLimitManager.UpdatePolicyLimit(objPolicyLimit); scope.Complete(); } json = "Loss details successfully add"; } catch (Exception ex) { Core.EmailHelper.emailError(ex); } return json; }
public void Edit(Limit user) { string str = "update T_Limit set [Name]='" + user.Name + "',[Integral]=" + user.Integral + ",[URL]='" + user.URL + "',[CanRepeater]=" + user.CanRepeater + ",[NeedIntegral]=" + user.NeedIntegral + ",[ShengjiJiangli]="+user .ShengjiJiangli+" where [Id]=" + user.Id + ""; _DBbase.ExecuteCommand(str); }
protected void AddLimitPolicy(int policyId) { Limit limits = null; Limit limits2 = null; PolicyLimit objPolicyLimit = null; DataTable tbllimitGet = HttpContext.Current.Session["Limit"] as DataTable; DataTable tblPolicylimitGet = HttpContext.Current.Session["PolicyLimit"] as DataTable; DataTable tblAllPolicylimitGet = HttpContext.Current.Session["tblAllPolicylimit"] as DataTable; string type = string.Empty; for (int count = 0; count < tbllimitGet.Rows.Count; count++) { limits = new Limit(); limits.LimitLetter = tbllimitGet.Rows[count]["LimitLetter"].ToString(); limits.LimitType =Convert.ToInt32(tbllimitGet.Rows[count]["LimitType"].ToString()); limits.LimitDescription = tbllimitGet.Rows[count]["LimitDescription"].ToString(); limits.IsStatic =Convert.ToBoolean(tbllimitGet.Rows[count]["IsStatic"].ToString()); limits2 = LimitManager.Save(limits); objPolicyLimit = new PolicyLimit(); objPolicyLimit.PolicyID = policyId; objPolicyLimit.LimitID = limits2.LimitID; objPolicyLimit.LimitAmount = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["LimitAmount"].ToString()); objPolicyLimit.LimitDeductible = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["LimitDeductible"].ToString()); objPolicyLimit.ITV = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["ITV"].ToString()); objPolicyLimit.Reserve = Convert.ToDecimal(tblAllPolicylimitGet.Rows[count]["Reserve"].ToString()); objPolicyLimit.IsDeleted = Convert.ToBoolean(tblAllPolicylimitGet.Rows[count]["IsDeleted"].ToString()); objPolicyLimit.ApplyAcrossAllCoverage = Convert.ToBoolean(tblAllPolicylimitGet.Rows[count]["ApplyAcrossAllCoverage"].ToString()); objPolicyLimit.ApplyTo = tblAllPolicylimitGet.Rows[count]["ApplyTo"].ToString(); PolicyLimitManager.Save(objPolicyLimit); } }
private void Parse(string file) { var ini = new IniFile(file); SetValues(this, ini["Version Section"].Values); SetValues(this, ini["Signature Section"].Values); SetValues(this, ini["Schedule"].Values); var steps = new List<Step>(); foreach (var section in ini.Where(x => x.Name.IsMatch(@"^Schedule_Step\d+$"))) { var step = new Step(); step.Number = int.Parse(section.Name.Match(@"^Schedule_Step(\d+)$")); SetValues(step, section.Values); steps.Add(step); } Steps = steps.OrderBy(x => x.Number).ToList(); foreach (var section in ini.Where(x => x.Name.IsMatch(@"^Schedule_Step\d+_Limit\d+$"))) { var limit = new Limit(); limit.Number = int.Parse(section.Name.Match(@"^Schedule_Step\d+_Limit(\d+)$")); SetValues(limit, section.Values); var equationNumber = @"^Equation(\d+).*$"; foreach (var equationValues in section.Values .Where(x => x.Key.IsMatch(@"^Equation\d+.*$")) .GroupBy(x => x.Key.Match(equationNumber))) { var equation = new Equation(); equation.Number = int.Parse(equationValues.First().Key.Match(equationNumber)); SetValues(equation, equationValues.ToDictionary(x => x.Key.Match(@"^Equation\d+(.*)$"), x => x.Value)); limit.Equations = limit.Equations.Concat(equation).OrderBy(x => x.Number).ToList(); } var step = Steps[int.Parse(section.Name.Match(@"^Schedule_Step(\d+)_Limit\d+$"))]; step.Limits = step.Limits.Concat(limit).OrderBy(x => x.Number).ToList(); } }
private void LimitContext(HingeJoint2D hingeJoint2D, int controlID, Limit limit) { var mousePosition = Event.current.mousePosition; var limitName = (limit == Limit.Min ? "Lower" : "Upper") + " Angle Limit"; EditorHelpers.ContextClick(controlID, () => { var menu = new GenericMenu(); menu.AddItem(new GUIContent("Edit " + limitName), false, () => ShowUtility( "Edit " + limitName, new Rect(mousePosition.x - 250, mousePosition.y + 15, 500, EditorGUIUtility.singleLineHeight * 2), delegate(Action close, bool focused) { EditorGUI.BeginChangeCheck(); GUI.SetNextControlName(limitName); var newLimit = EditorGUILayout.FloatField(limitName, limit == Limit.Min ? hingeJoint2D.limits.min : hingeJoint2D.limits.max); if (EditorGUI.EndChangeCheck()) { var limits = hingeJoint2D.limits; if (limit == Limit.Min) { limits.min = newLimit; } else { limits.max = newLimit; } EditorHelpers.RecordUndo(limitName, hingeJoint2D); hingeJoint2D.limits = limits; EditorUtility.SetDirty(hingeJoint2D); } if (GUILayout.Button("Done") || (Event.current.isKey && (Event.current.keyCode == KeyCode.Escape) && focused)) { close(); } })); menu.ShowAsContext(); }); }
private string PalletSolutionLimitToString(Limit limit) { switch (limit) { case Limit.LIMIT_MAXHEIGHTREACHED: return Resources.ID_PALLETMAXHEIGHT; case Limit.LIMIT_MAXWEIGHTREACHED: return Resources.ID_PALLETMAXWEIGHT; case Limit.LIMIT_MAXNUMBERREACHED: return Resources.ID_PALLETMAXNUMBER; default: return string.Empty; } }
private static void Aquire(Server server, CancellationToken cancellationToken, Priority priority, ulong limiterOrder) { using (var limit = new Limit(priority, server, limiterOrder)) { lock (Limits) { Limits.Add(limit); } LoopEvent.Set(); while (!limit.Event.WaitOne(WaitSleepMs)) { lock (Limits) { if (!cancellationToken.IsCancellationRequested) continue; Limits.Remove(limit); cancellationToken.ThrowIfCancellationRequested(); } } } }
/// <summary> /// Adds the component to componentAssembly_mo as an instance. /// </summary> /// <param name="componentAssembly_mo">ComponentAssembly that contains the component.</param> /// <param name="parentComponentAssembly_mo">ComponentAssembly that contains componentAssembly_mo.</param> /// <param name="component">CyPhy Component to add.</param> private void AddComponent(ComponentAssembly componentAssembly_mo, ComponentAssembly parentComponentAssembly_mo, CyPhy.Component component) { var ca = componentAssembly_mo.Impl; var modelicaModel = this.GetModelicaModelFromComponent(component); // Make sure there are margins to the top- and left-border int canvasX = component.GenericAspect.X > ScaleFactor * ComponentIconSize ? component.GenericAspect.X : ScaleFactor * ComponentIconSize; int canvasY = component.GenericAspect.Y > ScaleFactor * ComponentIconSize ? component.GenericAspect.Y : ScaleFactor * ComponentIconSize; // Make sure there are margins to the bottom- and right-border componentAssembly_mo.CanvasXMax = canvasX + (ScaleFactor * ComponentIconSize) > componentAssembly_mo.CanvasXMax ? canvasX + (ScaleFactor * ComponentIconSize) : componentAssembly_mo.CanvasXMax; componentAssembly_mo.CanvasYMax = canvasY + (ScaleFactor * ComponentIconSize) > componentAssembly_mo.CanvasYMax ? canvasY + (ScaleFactor * ComponentIconSize) : componentAssembly_mo.CanvasYMax; var componentInstance_mo = new ComponentInstance(component) { InstanceOf = this.treeComponents[component.DerivedFrom().ID], CanvasX = canvasX, CanvasY = canvasY }; foreach (var parameter in component.Children.ParameterCollection) { // META-3622 if (String.IsNullOrWhiteSpace(parameter.Attributes.Dimension) || parameter.Attributes.Dimension.Trim() == "1") { var vf = parameter.SrcConnections.ValueFlowCollection.FirstOrDefault(); if (vf != null && vf.ParentContainer.ID == ca.ID) { var parameter_mo = this.GetArgumentParameter(ca.ID, parameter, vf); componentInstance_mo.Parameters.Add(parameter_mo); } } } // META-2189 Overwrite ModelicaParameters connected to properties with formulated values in the design. foreach (var modelicaParameter in modelicaModel.Children.ModelicaParameterCollection) { var connection = modelicaParameter.SrcConnections.ModelicaParameterPortMapCollection.FirstOrDefault(); if (connection != null && connection.SrcEnds.Property != null) { double temp; var value = modelicaParameter.Attributes.Value.Trim(); if (double.TryParse(modelicaParameter.Attributes.Value, out temp) || value == "true" || value == "false" || (value.StartsWith("\"") && value.EndsWith("\""))) { var parameter_mo = new UnitParameter(); parameter_mo.Name = modelicaParameter.Name; parameter_mo.Value = new ModelicaValue(modelicaParameter.Attributes.Value.Trim()); componentInstance_mo.Parameters.Add(parameter_mo); } } } componentAssembly_mo.ComponentInstances.Add(componentInstance_mo); string componentModelicaURI = componentAssembly_mo.Name + "." + componentInstance_mo.Name; var parentCA = parentComponentAssembly_mo; while (parentCA != null) { componentModelicaURI = parentCA.Name + "." + componentModelicaURI; parentCA = parentCA.ParentComponentAssembly; } this.ExtractPCCInputs(component, componentModelicaURI); string modelType; if (modelicaModel is CyPhy.CyberModel) { modelType = "ControllerModel"; } else { modelType = "PlantModel"; } var componentInfo = new ComponentInfo(component.Impl as GME.MGA.IMgaFCO, modelType, this.traceability); this.instanceURIMap.Add(string.Format("{0}.TestBenches.{1}.{2}", MainPackage, this.testBench_mo.Name, componentModelicaURI), componentInfo); if (this.modelURIMap.ContainsKey(componentInstance_mo.InstanceOf.FullName) == false) { this.modelURIMap.Add(componentInstance_mo.InstanceOf.FullName, componentInfo); } if (this.extendsURIMap.ContainsKey(componentInstance_mo.InstanceOf.Extends) == false) { var componentExtendInfo = new ComponentInfo(modelicaModel.Impl as GME.MGA.IMgaFCO, modelType, this.traceability); this.extendsURIMap.Add(componentInstance_mo.InstanceOf.Extends, componentExtendInfo); } // Iterate over all ports and look for connections FROM the port. These connections will generate equations in the // component assembly if the connections is not entering a ModelicaModel. // Connections from ModelicaConnectors (Components) foreach (var port in component.Children.ModelicaConnectorCollection) { foreach (var dstPort in port.DstConnections.PortCompositionCollection .Select(c => c.DstEnds.ModelicaConnector) .Where(p => p.ParentContainer is CyPhy.ModelicaModel == false)) { CyPhy.ModelicaConnector srcConnector = this.GetModelicaModelConnectorFromComponentPort(port); if (srcConnector == null) { continue; } CyPhy.ModelicaConnector dstConnector = null; if (dstPort.ParentContainer is CyPhy.Component) { dstConnector = this.GetModelicaModelConnectorFromComponentPort(dstPort); } else if (dstPort.ParentContainer is CyPhy.ComponentAssembly) { dstConnector = dstPort; } // The Fidelty Selected might not have this Connection - don't make it. // Or it might be a floating connector with no purpose. if (dstConnector == null) { continue; } var connection_mo = new Connection(srcConnector.Name, dstConnector.Name) { SrcInstanceName = component.Name, Type = srcConnector.Attributes.Class }; if (dstPort.ParentContainer.ID != ca.ID) { connection_mo.DstInstanceName = dstPort.ParentContainer.Name; } componentAssembly_mo.Connections.Add(connection_mo); } } // Connections from Connectors (Components) foreach (var portContainer in component.Children.ConnectorCollection) { if (portContainer.Children.ModelicaConnectorCollection.Count() != 1) { continue; } foreach (var dstPortContainer in portContainer.DstConnections.ConnectorCompositionCollection.Select(c => c.DstEnds.Connector)) { if (dstPortContainer.Children.ModelicaConnectorCollection.Count() != 1) { continue; } CyPhy.ModelicaConnector srcConnector = this.GetModelicaModelConnectorFromComponentPortContainer(portContainer); if (srcConnector == null) { continue; } CyPhy.ModelicaConnector dstConnector = null; string dstConnectorName = "ERROR No Name Assigned"; if (dstPortContainer.ParentContainer is CyPhy.Component) { var portComponent = CyPhyClasses.Component.Cast(dstPortContainer.ParentContainer.Impl); if (this.ComponentIsDynamic(portComponent) == false) { this.Logger.WriteWarning("'{0}' does not contain any dynamic-components, connections to it skipped.", portComponent.Name); continue; } dstConnector = this.GetModelicaModelConnectorFromComponentPortContainer(dstPortContainer); if (dstConnector != null) { dstConnectorName = dstConnector.Name; } } else if (dstPortContainer.ParentContainer is CyPhy.ComponentAssembly) { var portCA = dstPortContainer.ParentContainer.Impl; if (this.ContainsDynamicComponents(CyPhyClasses.ComponentAssembly.Cast(portCA)) == false) { this.Logger.WriteWarning("'{0}' does not contain any dynamic-components, connections to it skipped.", portCA.Name); continue; } dstConnector = dstPortContainer.Children.ModelicaConnectorCollection.FirstOrDefault(); dstConnectorName = dstPortContainer.Name.Replace(' ', '_'); } // The Fidelty Selected might not have this Connection - don't make it. // Or it might be a floating connector with no purpose. if (dstConnector == null) { continue; } var connection_mo = new Connection(srcConnector.Name, dstConnectorName) { SrcInstanceName = component.Name, Type = srcConnector.Attributes.Class }; if (dstPortContainer.ParentContainer.ID != ca.ID) { connection_mo.DstInstanceName = dstPortContainer.ParentContainer.Name; } componentAssembly_mo.Connections.Add(connection_mo); } } // Add limit-checks for the component to the test-bench foreach (var modelicaModelLimit in modelicaModel.Children.LimitCheckCollection) { // TODO: When META-1124 and META-1129 both are merged, merge Limit and LimitCheck class. var limit = new Limit(modelicaModelLimit) { ComponentModelicaUri = componentModelicaURI }; this.testBench_mo.Limits.Add(limit); var limitCheck = new LimitCheck() { ParentKind = modelicaModelLimit.ParentContainer.Kind, LimitFullPath = modelicaModelLimit.Path, LimitName = modelicaModelLimit.Name, VariableName = modelicaModelLimit.Attributes.VariableName, Type = modelicaModelLimit.Attributes.LimitType.ToString(), Value = modelicaModelLimit.Attributes.Value, VariableFullPath = string.Format("{0}.{1}", componentModelicaURI, modelicaModelLimit.Attributes.VariableName), ModelicaRecordName = string.Format("Limit{0}", this.testBench_mo.Limits.Count) }; this.LimitDefintion.LimitChecks.Add(limitCheck); } }