/// <summary> /// Update the current rules /// </summary> /// <param name="rules"></param> public void UpdateRules(IEnumerable <RateLimitRule> rules) { if (_updatable) { using (var l = _mutex.WriterLock()) { if (!_rules.Equals(rules)) { _rules = rules; } } } }
private void cbxSortBy_SelectionChanged(object sender, SelectionChangedEventArgs e) { //Sets the radio button to "All" (Couldn't get it working otherwise) rbnAll.IsChecked = true; lbxDisplay.ItemsSource = ""; filteredVehicles.Equals(""); string sortedBy = cbxSortBy.SelectedValue.ToString(); switch (sortedBy) { case "Make": filteredVehicles = vehicleType.OrderBy(i => i.Make); break; case "Mileage": filteredVehicles = vehicleType.OrderBy(i => i.Mileage); break; case "Price": filteredVehicles = vehicleType.OrderBy(i => i.Price); break; } lbxDisplay.ItemsSource = filteredVehicles; }
public void GetBankAccountsTest() { IEnumerable <BankAccountsDTO> result = _persistence.ReadAccountsAsync().Result; result.Equals(_bankAccountsDTOs); Assert.Equal(_bankAccountsDTOs, result); }
/// <summary> /// Add a new template asynchronously. /// </summary> /// <param name="name"> /// The name for the new template - must be unique. /// </param> /// <param name="fromEmail"> /// A default sending address for emails sent using this template. /// </param> /// <param name="fromName">A default from name to be used.</param> /// <param name="subject">A default subject line to be used.</param> /// <param name="code"> /// The HTML code for the template with <c>mc:edit</c> attributes for /// the editable elements. /// </param> /// <param name="text"> /// A default text part to be used when sending with this template. /// </param> /// <param name="published"> /// Set to false to add a draft template without publishing. /// </param> /// <param name="labels"> /// Array of up to 10 labels to use for filtering templates. /// </param> /// <returns>A <see cref="TemplateResponse" /> object.</returns> public Task <TemplateInfo> AddTemplateAsync( string name, string fromEmail, string fromName, string subject, string code, string text, bool publish, IEnumerable <string> labels) { const string path = "/templates/add.json"; dynamic payload = new ExpandoObject(); payload.name = name; payload.from_email = fromEmail; payload.from_name = fromName; payload.subject = subject; payload.code = code; payload.text = text; payload.publish = publish; if (!labels.Equals(Enumerable.Empty <string>())) { payload.labels = labels; } Task <IRestResponse> post = this.PostAsync(path, payload); return(post.ContinueWith( p => { return JSON.Parse <TemplateInfo>(p.Result.Content); }, TaskContinuationOptions.ExecuteSynchronously)); }
public Expression Update(IEnumerable<Expression> Initializers) { if (Initializers.Equals(Initializers)) { return this; } return AstExpression.ArrayInitializer(_arrayInitializerExpression, ParentScope, Visitor); }
public async Task AddMultipleToProd(IEnumerable <ClientScript> clientScripts) { if (!clientScripts.Equals(null)) { IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["AgentProdDb"].ConnectionString); var sql = @"IF NOT EXISTS (SELECT clientkey FROM ClientScripts) BEGIN INSERT INTO ClientScripts (criteriaSetName,[ClientKey],ClientLocationKey,PayerKey,TransactionType, InitialScriptId) VALUES(@criteriaSetName, @clientKey, @clientLocationKey ,@payerKey,3, @InitialScriptId) END"; foreach (var clientScript in clientScripts) { var p = new DynamicParameters(); p.Add("@criteriaSetName", clientScript.CriteriaSetName); p.Add("@clientKey", clientScript.ClientKey); p.Add("@clientLocationKey", clientScript.ClientLocationKey); p.Add("@payerKey", clientScript.PayerKey); p.Add("@InitialScriptId", clientScript.InitialScriptId); await db.ExecuteAsync(sql, p); } } }
private void PortalUsersToDataGridView(IEnumerable <PortalUser> portalUsers) { if (!portalUsers.Equals(null)) { PortalUsersGridVeiw.DataSource = portalUsers; } }
/// <summary> /// /// </summary> /// <param name="name">控件name</param> /// <param name="lists">可选值列表</param> /// <param name="repeatDirection">排版方向</param> /// <param name="type">checkbox/radio</param> /// <param name="stateValue">选中值</param> /// <returns></returns> public static MvcHtmlString GenerateHtml(string name, ICollection <string> lists, RepeatDirection repeatDirection, string type, object stateValue) { StringBuilder html = new StringBuilder(); int i = 0; bool isCheckBox = type == "checkbox"; if (repeatDirection == RepeatDirection.Horizontal) { foreach (var listitem in lists) { i++; string id = string.Format("{0}_{1}", name, i); bool isChecked = false; if (isCheckBox) { IEnumerable <string> currentValues = stateValue as IEnumerable <string>; isChecked = (null != currentValues && currentValues.Equals(listitem)); } else { string currentValue = stateValue as string; isChecked = (null != currentValue && listitem == currentValue); } html.Append(GenerateRadioHtml(name, id, listitem, listitem, isChecked, type, repeatDirection)); } } return(new MvcHtmlString(html.ToString())); }
public void AddRange(IEnumerable <int> Collection) { if (!Collection.Equals(null)) //todo != { if (Capacity - Count < Collection.Count()) //todo в противном случае забиваем на добавление? вообще не понял смысла этого условия { List <int> buf = new List <int>(DinArray); //todo "коллекции .NET не использовать" int CountAfter = Count; DinArray = new int[(Capacity + Collection.Count()) * 2]; Count = Count + Collection.Count();; for (int i = 0; i < buf.Count; i++) { DinArray[i] = buf[i]; } buf.Clear(); int j = 0; for (int i = CountAfter; i < Count; i++) { DinArray[i] = Collection.ElementAt(j); j++; } } } else { DinArray = new int[0]; Count = 0; Exception = new Dictionary <DateTime, System.Exception>(); Exception.Add(DateTime.Now, new ArgumentNullException()); } }
public static bool AreDeepEqual(this IEnumerable a, IEnumerable b) { if (a.Equals(b)) { return(true); } var ea = a.GetEnumerator(); var eb = b.GetEnumerator(); while (true) { if (!ea.MoveNext()) { return(!eb.MoveNext()); } if (!eb.MoveNext()) { return(false); } if ((ea.Current == eb.Current) || (ea.Current != null && ea.Current.Equals(eb.Current))) { continue; } var ca = ea.Current as IEnumerable; var cb = eb.Current as IEnumerable; if (ca == null || cb == null || !AreDeepEqual(ca, cb)) { return(false); } } }
public static bool RecursiveCompare <T>(this IEnumerable <T> source, IEnumerable <T> other, Func <T, IEnumerable <T> > childSelector) { if (source.Equals(other)) { var result = true; for (var i = 0; i < source.Count(); i++) { if (childSelector(source.ElementAt(i)) != null && childSelector(other.ElementAt(i)) != null) { result = childSelector(source.ElementAt(i)).RecursiveCompare(childSelector(other.ElementAt(i)), childSelector); if (result == false) { break; } } else if (childSelector(source.ElementAt(i)) == null && childSelector(other.ElementAt(i)) == null) { // do nothing, result is still true; } else { result = false; break; } } return(result); } else { return(false); } }
public static void AreEqual <T>(IEnumerable <T> expected, IEnumerable <T> actual, string varName = "", params object[] args) { if (!expected.Equals(actual)) { string errorMsg = $"Assert.AreEqual() FAILED for {varName}: {CalcMultiLineUnequalText(expected, actual)}"; Assert(false, errorMsg, args); } }
public override bool Equals(object obj) { if (obj is JEnumerable <T> ) { return(_enumerable.Equals(((JEnumerable <T>)obj)._enumerable)); } return(false); }
public void Given_RepositoryWithInactiveTodoList_Then_RetriveInactiveTodosReturnsOrderedByStartDateInactiveTodoList() { //Act IEnumerable <Todo> actual = _todoRepository.RetriveAllOrderByStartDateAndInactiveAscending(); var expected = _todoRepository.RetriveInactiveTodos().OrderBy(t => t.StartDate); //Assert Assert.IsTrue(actual.Equals(expected)); }
public Expression Update(IEnumerable <Expression> Initializers) { if (Initializers.Equals(Initializers)) { return(this); } return(AstExpression.ArrayInitializer(_arrayInitializerExpression, ParentScope, Visitor)); }
public KokDugumu(char harf, IEnumerable <char> icerik, Kok kok) { this.harf = harf; this.kok = kok; if (!icerik.Equals(kok.icerik())) { this.kelime = icerik; } }
protected virtual MemberListBinding VisitMemberListBinding(MemberListBinding binding) { IEnumerable <ElementInit> initializers = VisitElementInitializerList(binding.Initializers); if (!initializers.Equals(binding.Initializers)) { return(Expression.ListBind(binding.Member, initializers)); } return(binding); }
public bool addCataloge(Cataloge cata) { IEnumerable <Cataloge> categories = CategorieRepos.getAll().Where(b => b.nom == cata.nom); if (categories.Equals(null)) { return(CategorieRepos.Ajouter(cata)); } return(false); }
private void PortalIds_To_DropDownList(IEnumerable <Portal> portalRecords) { ddlPortalId.Items.Clear(); if (!portalRecords.Equals(null)) { foreach (var item in portalRecords) { } } }
public bool addAdmin(Admin user) { IEnumerable <Admin> users = AdminRepos.getAll().Where(client => client.username == user.username); if (users.Equals(null)) { return(AdminRepos.Ajouter(user)); } return(false); }
protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding) { IEnumerable <MemberBinding> bindings = VisitBindingList(binding.Bindings); if (!bindings.Equals(binding.Bindings)) { return(Expression.MemberBind(binding.Member, bindings)); } return(binding); }
public override bool Equals(object obj) { if (obj is JEnumerable <T> ) { IEnumerable <T> enumerable = _enumerable; JEnumerable <T> jEnumerable = (JEnumerable <T>)obj; return(enumerable.Equals(jEnumerable._enumerable)); } return(false); }
public bool addPhoto(Photo photo) { IEnumerable <Photo> users = PhotoRepos.getAll().Where(client => client.emplacement == photo.emplacement); if (users.Equals(null)) { return(PhotoRepos.Ajouter(photo)); } return(false); }
public void SetValue(IEnumerable <T> value) { if (value.Equals(_value)) { return; } _expanded.Clear(); _value = value; }
public bool addClient(Utilisateur user) { IEnumerable <Utilisateur> users = ClientsRepos.getAll().Where(client => client.username == user.username); if (users.Equals(null)) { return(ClientsRepos.Ajouter(user)); } return(false); }
private void PortalsToDropDownList(IEnumerable <Portal> portals) { ddlPortalId.Items.Clear(); if (!portals.Equals(null)) { foreach (var portal in portals) { ddlPortalId.Items.Add(portal.Id); } } }
protected virtual Expression VisitMethodCall(MethodCallExpression m) { Expression obj = Visit(m.Object); IEnumerable <Expression> args = VisitExpressionList(m.Arguments); if (obj != m.Object || !args.Equals(m.Arguments)) { return(Expression.Call(obj, m.Method, args)); } return(m); }
protected virtual Expression VisitMemberInit(MemberInitExpression init) { NewExpression n = VisitNew(init.NewExpression); IEnumerable <MemberBinding> bindings = VisitBindingList(init.Bindings); if (n != init.NewExpression || !bindings.Equals(init.Bindings)) { return(Expression.MemberInit(n, bindings)); } return(init); }
protected virtual Expression VisitInvocation(InvocationExpression iv) { IEnumerable <Expression> args = VisitExpressionList(iv.Arguments); Expression expr = Visit(iv.Expression); if (!args.Equals(iv.Arguments) || expr != iv.Expression) { return(Expression.Invoke(expr, args)); } return(iv); }
protected virtual Expression VisitListInit(ListInitExpression init) { NewExpression n = VisitNew(init.NewExpression); IEnumerable <ElementInit> initializers = VisitElementInitializerList(init.Initializers); if (n != init.NewExpression || !initializers.Equals(init.Initializers)) { return(Expression.ListInit(n, initializers)); } return(init); }
/// <summary> /// Tests equality /// </summary> /// <param name="obj"></param> /// <returns></returns> public override bool Equals(object obj) { if (!obj.GetType().Equals(GetType())) { return(false); } if (obj == this) { return(true); } return(_innerEnumerable.Equals(((EnumerableWrapper <T>)obj)._innerEnumerable)); }
public void Update(TaskView item, IEnumerable itemsSource) { if (Done.Contains(item)) { return; } if (itemsSource.Equals(_inProgress)) { item.ViewModel.InProgress(); } else if (itemsSource.Equals(_toDo)) { item.ViewModel.ToDo(); } if (itemsSource.Equals(Done)) { if (item.Equals(Current)) { if (item.ViewModel.CommitBranch()) { Current = null; Done.AddInOrder(item); item.PopUpLastComment(); } else { item.SetTemporarWarningMessage("Nothing to commit"); } } else { return; } } else { if (item.Equals(Current)) { Current.ViewModel.SaveBranch(); Current = null; RaisePropertyChanged("Current"); } else { RemoveItemFromCollections(item); } var source = (itemsSource as ObservableCollection<TaskView>); source.AddInOrder(item); } }
/// <summary> /// Add a new template asynchronously. /// </summary> /// <param name="name"> /// The name for the new template - must be unique. /// </param> /// <param name="fromEmail"> /// A default sending address for emails sent using this template. /// </param> /// <param name="fromName">A default from name to be used.</param> /// <param name="subject">A default subject line to be used.</param> /// <param name="code"> /// The HTML code for the template with <c>mc:edit</c> attributes for /// the editable elements. /// </param> /// <param name="text"> /// A default text part to be used when sending with this template. /// </param> /// <param name="published"> /// Set to false to add a draft template without publishing. /// </param> /// <param name="labels"> /// Array of up to 10 labels to use for filtering templates. /// </param> /// <returns>A <see cref="TemplateResponse" /> object.</returns> public Task<TemplateInfo> AddTemplateAsync( string name, string fromEmail, string fromName, string subject, string code, string text, bool publish, IEnumerable<string> labels) { const string path = "/templates/add.json"; dynamic payload = new ExpandoObject(); payload.name = name; payload.from_email = fromEmail; payload.from_name = fromName; payload.subject = subject; payload.code = code; payload.text = text; payload.publish = publish; if (!labels.Equals(Enumerable.Empty<string>())) { payload.labels = labels; } Task<IRestResponse> post = this.PostAsync(path, payload); return post.ContinueWith( p => { return JSON.Parse<TemplateInfo>(p.Result.Content); }, TaskContinuationOptions.ExecuteSynchronously); }
//----------------------------------------------------------------------------------- //TabControl上のコントロールからテキストを生成する。 private string makeString(IEnumerable<Control> ctls) { string strtemp = ""; if (ctls.Equals(FREETAB) && (bool)isCommentCheckBox.IsChecked) strtemp += "#"; strtemp += makeEventString(); bool isFirstString = true; foreach (Control t1 in ctls) { if (t1.IsEnabled) { var t = t1 as TextBox; if (t == null) { var c = t1 as ComboBox; if (c == null) { var ch = t1 as CheckBox; strtemp += ((bool)ch.IsChecked) ? "|ON" : "|OFF"; } else { if (c.Text != string.Empty) { strtemp += (isFirstString) ? c.Text : "|" + c.Text; isFirstString = false; } } } else { if (t.Text != string.Empty) { strtemp += (isFirstString) ? t.Text : "|" + t.Text; isFirstString = false; } } } } return strtemp + "\n"; }
public virtual bool ShowUsersMessageBoxWasCalledWith(IEnumerable<User> users){ return ( users.Equals(ShowUsersMessageBoxParameter_users_LastCalledWith) ); }
public KokDugumu(char harf, IEnumerable<char> icerik, Kok kok) { this.harf = harf; this.kok = kok; if (!icerik.Equals(kok.icerik())) this.kelime = icerik; }