private void addConfs(int zoom, int x, int y, int iterations) { if (_output_pb.BackgroundImage != null) { _output_pb.BackgroundImage.Dispose(); } int limit = (int)Math.Pow(2, zoom); double each_tile_x = (XMAX - XMIN) / limit; // 2 = double each_tile_y = (YMAX - YMIN) / limit; // 2 = double XMin = (x * each_tile_x) + XMIN; // 2 = double XMax = XMin + each_tile_x; double YMin = ((limit - y - 1) * each_tile_y) + YMIN; // 2 = double YMax = YMin + each_tile_y; colsDone = 0; prog_pri.Maximum = PicWidth; prog_pri.Value = 0; _Image = new Bitmap(PicWidth, PicHeight); _output_pb.BackgroundImage = _Image; _output_pb.Refresh(); for (int j = 0; j < Lyaps.Count; j++) { double deltaX = (XMax - XMin) / Lyaps.Count; double xmin = XMin + (j * deltaX); double xmax = XMin + ((j + 1) * deltaX); int width = (int)(PicWidth / Lyaps.Count); int startX = (int)(PicWidth / Lyaps.Count * j); Confs.Add(new Configuration(xmin, xmax, YMin, YMax, Pattern, iterations, InitX, width, PicHeight, startX)); } }
internal static SyndicationFeed GetUnprocessedQueueItems(string namedIndexingService, int pageSize, out System.Collections.ObjectModel.Collection <Identity> ids) { SyndicationFeed syndicationFeed = new SyndicationFeed(); System.Collections.Generic.List <SyndicationItem> list = new System.Collections.Generic.List <SyndicationItem>(); ids = new System.Collections.ObjectModel.Collection <Identity>(); IQueryable <IndexRequestQueueItem> queryable = ( from queueItem in SearchSettings.GetDynamicDataStore().Items <IndexRequestQueueItem>() where queueItem.NamedIndexingService == namedIndexingService orderby queueItem.Timestamp select queueItem).Take(pageSize); foreach (IndexRequestQueueItem current in queryable) { list.Add(SearchFactory.ConstructSyndicationItem(current)); ids.Add(current.Id); } System.Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; string value = string.Format(System.Globalization.CultureInfo.InvariantCulture, "EPiServer.Search v.{0}.{1}.{2}.{3}", new object[] { version.Major.ToString(System.Globalization.CultureInfo.InvariantCulture), version.Minor.ToString(System.Globalization.CultureInfo.InvariantCulture), version.Build.ToString(System.Globalization.CultureInfo.InvariantCulture), version.Revision.ToString(System.Globalization.CultureInfo.InvariantCulture) }); syndicationFeed.AttributeExtensions.Add(new XmlQualifiedName(SearchSettings.Config.SyndicationItemAttributeNameVersion, SearchSettings.Config.XmlQualifiedNamespace), value); syndicationFeed.Items = list; return(syndicationFeed); }
private static System.Collections.ObjectModel.Collection <KeyValuePair <Guid, string> > GetParentProjects(Guid projectId, UserConnection userConnection) { Select projectSelect = new Terrasoft.Core.DB.Select(userConnection) .Column("Id").As("Id") .Column("Name").As("Name") .Column("ParentProjectId").As("ParentProjectId") .From("Project") as Select; HierarchicalSelectOptions options = new HierarchicalSelectOptions() { PrimaryColumnName = "Id", ParentColumnName = "ParentProjectId", SelectType = HierarchicalSelectType.Parents }; QueryCondition startingCondition = options.StartingPrimaryColumnCondition; startingCondition.LeftExpression = new QueryColumnExpression("Id"); startingCondition.IsEqual(Column.Parameter(projectId, "ParentProjectId", Terrasoft.Common.ParameterDirection.Input)); projectSelect.HierarchicalOptions = options; var list = new System.Collections.ObjectModel.Collection <KeyValuePair <Guid, string> >(); using (var dbExecutor = userConnection.EnsureDBConnection()) { using (var reader = projectSelect.ExecuteReader(dbExecutor)) { while (reader.Read()) { Guid id = Guid.Empty; if (Guid.TryParse(reader[0].ToString(), out id)) { list.Add(new KeyValuePair <Guid, string>(id, reader[1].ToString())); } } } } return(list); }
public override bool TryParseRequiredClaimsElement(XmlElement element, out System.Collections.ObjectModel.Collection <XmlElement> requiredClaims) { if (element == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element"); } if (element.LocalName == this.DriverDictionary.Claims.Value && element.NamespaceURI == this.DriverDictionary.Namespace.Value) { requiredClaims = new System.Collections.ObjectModel.Collection <XmlElement>(); foreach (XmlNode node in element.ChildNodes) { if (node is XmlElement) { // PreSharp Bug: Parameter 'requiredClaims' to this public method must be validated: A null-dereference can occur here. #pragma warning disable 56506 requiredClaims.Add((XmlElement)node); } } return(true); } requiredClaims = null; return(false); }
public void CanUseIndexOnCollection() { var collection = new System.Collections.ObjectModel.Collection <string>(); collection.Add("Mickey Mouse"); collection.Add("Goofy"); _engine.SetValue("dictionary", collection); RunTest(@" dictionary[1] = 'Donald Duck'; assert(dictionary[1] === 'Donald Duck'); "); Assert.Equal("Mickey Mouse", collection[0]); Assert.Equal("Donald Duck", collection[1]); }
/// <summary> /// checks whether email address exist in auth.logins table /// </summary> /// <param name="emailId"></param> /// <returns></returns> public virtual int SetPassword(string emailId, string token, string password) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); parameters.Add(new DBParameters() { Name = "@email", Value = emailId, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@token", Value = token, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@password", Value = password, DBType = DbType.AnsiString }); return(Convert.ToInt32(this.ExecuteProcedure("dbo.user_update_password", ExecuteType.ExecuteScalar, parameters))); }
/// <summary> /// Update user password /// </summary> /// <param name="userId"></param> /// <param name="oldPassword"></param> /// <param name="newPassword"></param> /// <returns></returns> public virtual int UpdatePassword(int userId, string oldPassword, string newPassword) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); parameters.Add(new DBParameters() { Name = "@user_id", Value = userId, DBType = DbType.Int32 }); parameters.Add(new DBParameters() { Name = "@old_password", Value = oldPassword, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@new_password", Value = newPassword, DBType = DbType.AnsiString }); return(Convert.ToInt32(this.ExecuteProcedure("[dbo].[user_password_update]", ExecuteType.ExecuteScalar, parameters))); }
public virtual UserModel GetUserByEmail(string emailId) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); parameters.Add(new DBParameters() { Name = "@email", Value = emailId, DBType = DbType.AnsiString }); return(this.ExecuteProcedure <UserModel>("[dbo].[user_detail_get]", parameters).FirstOrDefault()); }
/// <summary> /// checks whether email address exist in auth.logins table /// </summary> /// <param name="emailId"></param> /// <returns></returns> public virtual bool IsActiveUser(string emailId) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); parameters.Add(new DBParameters() { Name = "@email", Value = emailId, DBType = DbType.String }); return(Convert.ToBoolean(this.ExecuteProcedure("dbo.user_active_check", ExecuteType.ExecuteScalar, parameters))); }
public SingleTileForm() { Pattern = new char[] { 'a', 'b' }; InitializeComponent(); for (int i = 0; i < System.Environment.ProcessorCount; i++) { Lyaps.Add(new LyapunovGenerator()); InitLyap(Lyaps[Lyaps.Count - 1]); } }
/// <summary> /// Sets the selection to the specified item. /// </summary> /// <param name="item">Item to set selection to.</param> public void SetSelection(GraphicalDependenciesItem item) { ClearSelection(); selectedDItems.Add(item); item.IsSelected = true; System.Collections.ObjectModel.Collection <object> col = new System.Collections.ObjectModel.Collection <object>(); col.Add(item.SelectedData); this.SelectedItems = col; }
/// <summary> /// Sets the selection to the specified item. /// </summary> /// <param name="item">Item to set selection to.</param> public void SetSelection(GraphicalDependenciesItem item) { ClearSelection(); selectedDItems.Add(item); item.IsSelected = true; System.Collections.ObjectModel.Collection<object> col = new System.Collections.ObjectModel.Collection<object>(); col.Add(item.SelectedData); this.SelectedItems = col; }
private void KeepRoundObjects() { // Filter out all very small particles Algorithms.RemoveParticle(imageViewer1.Image, imageViewer1.Image, 1); // Filter out non-circular particles Collection <ParticleFilterCriteria> criteria = new System.Collections.ObjectModel.Collection <ParticleFilterCriteria>(); criteria.Add(new ParticleFilterCriteria(MeasurementType.HeywoodCircularityFactor, new Range(0, 1.06))); Algorithms.ParticleFilter(imageViewer1.Image, imageViewer1.Image, criteria); }
/// <summary> /// Update permission from database /// </summary> /// <param name="userId"></param> /// <returns></returns> public virtual bool UpdatePermissionDetail(PermissionModel objPermissionModel, string roleList) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); parameters.Add(new DBParameters() { Name = "@permission_uid", Value = objPermissionModel.permission_uid, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@permission_name", Value = objPermissionModel.permission_name, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@permission_description", Value = objPermissionModel.permission_description, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@page_name", Value = objPermissionModel.page_name, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@role_list", Value = roleList, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@updated_by", Value = 1, DBType = DbType.String }); return(Convert.ToBoolean(this.ExecuteProcedure("[auth].[permission_update]", ExecuteType.ExecuteScalar, parameters))); }
/// <summary> /// checks whether email address exist in auth.logins table /// </summary> /// <param name="emailId"></param> /// <returns></returns> public virtual bool UpdateTokenInDatabase(string emailId, string oldToken, string newToken) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); parameters.Add(new DBParameters() { Name = "@email", Value = emailId, DBType = DbType.String }); if (!string.IsNullOrEmpty(oldToken)) { parameters.Add(new DBParameters() { Name = "@old_token", Value = oldToken, DBType = DbType.String }); } parameters.Add(new DBParameters() { Name = "@new_token", Value = newToken, DBType = DbType.AnsiString }); return(Convert.ToBoolean(this.ExecuteProcedure("dbo.user_update_token", ExecuteType.ExecuteScalar, parameters))); }
private static System.Collections.ObjectModel.Collection <string> RemoveDuplicates(System.Collections.ObjectModel.Collection <string> inputList) { System.Collections.Generic.Dictionary <string, int> dictionary = new System.Collections.Generic.Dictionary <string, int>(); System.Collections.ObjectModel.Collection <string> collection = new System.Collections.ObjectModel.Collection <string>(); foreach (string current in inputList) { if (!dictionary.ContainsKey(current)) { dictionary.Add(current, 0); collection.Add(current); } } return(collection); }
/// <summary> /// Update the Email details into the database. /// </summary> /// <param name="objEmailModel"></param> /// <param name="productUid"></param> /// <returns></returns> public virtual bool UpdateEmailTemplate(EmailModel objEmailModel) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); parameters.Add(new DBParameters() { Name = "@email_uid", Value = objEmailModel.email_uid, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@to_address", Value = objEmailModel.to_address, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@cc_list", Value = objEmailModel.cc_list, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@bcc_list", Value = objEmailModel.bcc_list, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@language_code", Value = objEmailModel.language_code, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@subject_text", Value = objEmailModel.subject_text, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@friendly_email_name", Value = objEmailModel.friendly_email_name, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@body_text", Value = objEmailModel.body_text, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@updated_by", Value = objEmailModel.updated_by, DBType = DbType.String }); return(Convert.ToBoolean(this.ExecuteProcedure("[doc].[email_update]", ExecuteType.ExecuteScalar, parameters))); }
private static System.Collections.ObjectModel.Collection <KeyValuePair <Guid, string> > GetParentProjects(Guid projectId, UserConnection userConnection) { Query projectSelect = new Terrasoft.Core.DB.Select(userConnection) .Column("Id").As("Id") .Column("Name").As("Name") .Column("ParentProjectId").As("ParentProjectId") .From("Project"); projectSelect.Parameters.Add(new QueryParameter("StartingUnitId", null)); projectSelect.Parameters.Add(new QueryParameter("MaxDepth", null)); projectSelect.InitializeParameters(); HierarchicalSelectOptions options = new HierarchicalSelectOptions() { PrimaryColumnName = "Id", ParentColumnName = "ParentProjectId", SelectType = HierarchicalSelectType.Parents, MaxDepthParameter = projectSelect.Parameters.GetByName("MaxDepth") }; QueryCondition startingCondition = options.StartingPrimaryColumnCondition; startingCondition.LeftExpression = new QueryColumnExpression("Id"); startingCondition.IsEqual(Column.Parameter(projectId, "ParentProjectId", Terrasoft.Common.ParameterDirection.Input)); string sqlText = userConnection.DBEngine.GetQuerySqlText(projectSelect as Select, options); var parameters = new QueryParameterCollection(); parameters.Add(new QueryParameter() { Name = "ParentProjectId", Value = projectId }); var list = new System.Collections.ObjectModel.Collection <KeyValuePair <Guid, string> >(); using (var dbExecutor = userConnection.EnsureDBConnection()) { using (var reader = dbExecutor.ExecuteReader(sqlText, parameters)) { while (reader.Read()) { Guid id = Guid.Empty; if (Guid.TryParse(reader[0].ToString(), out id)) { list.Add(new KeyValuePair <Guid, string>(id, reader[1].ToString())); } } } } return(list); }
public Collection<WindowInfo> FindChildren(string className, string text) { bool canContinue = true; System.Collections.ObjectModel.Collection<WindowInfo> children = new System.Collections.ObjectModel.Collection<WindowInfo>(); do { IntPtr lastHandle = default(IntPtr); if (children.Count != 0) lastHandle = children[children.Count - 1].Handle; IntPtr h = User32.FindWindowEx(hWnd, lastHandle, className, text); if (h.ToInt32() == 0) { canContinue = false; } else { children.Add(new WindowInfo(h)); } } while (!(canContinue == false)); return children; }
/// <summary> /// Add Or Update User Detail In Database. /// </summary> /// <param name="objUserModel"></param> /// <returns></returns> public int AddEditUser(UserModel objUserModel) { System.Collections.ObjectModel.Collection <DBParameters> parameters = new System.Collections.ObjectModel.Collection <DBParameters>(); if (objUserModel.UserId > 0) { parameters.Add(new DBParameters() { Name = "@is_active", Value = objUserModel.Is_Active, DBType = DbType.Boolean }); parameters.Add(new DBParameters() { Name = "@user_id", Value = objUserModel.UserId, DBType = DbType.Int32 }); if (objUserModel.Role_Id > 0) /*only pass role in edit user*/ { parameters.Add(new DBParameters() { Name = "@role_id", Value = objUserModel.Role_Id, DBType = DbType.Int32 }); } } if (!string.IsNullOrEmpty(objUserModel.Profile_Picture)) { parameters.Add(new DBParameters() { Name = "@profile_picture", Value = Convert.FromBase64String(objUserModel.Profile_Picture.Split(',')[1]), DBType = DbType.Binary }); } if (!string.IsNullOrEmpty(objUserModel.Document)) { var documentContent = objUserModel.Document.Split(','); parameters.Add(new DBParameters() { Name = "@document_name", Value = objUserModel.Document_Name, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@document_detail", Value = documentContent[0] + ",", DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@document", Value = Convert.FromBase64String(documentContent[1]), DBType = DbType.Binary }); } parameters.Add(new DBParameters() { Name = "@email", Value = objUserModel.Email, DBType = DbType.String }); parameters.Add(new DBParameters() { Name = "@first_name", Value = objUserModel.First_name, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@last_name", Value = objUserModel.Last_name, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@mobile_number", Value = objUserModel.Mobile_number, DBType = DbType.AnsiString }); parameters.Add(new DBParameters() { Name = "@education_id", Value = objUserModel.Education_Id, DBType = DbType.Int32 }); parameters.Add(new DBParameters() { Name = "@salary", Value = objUserModel.Salary, DBType = DbType.Decimal }); parameters.Add(new DBParameters() { Name = "@birth_date", Value = objUserModel.BirthDay, DBType = DbType.Date }); parameters.Add(new DBParameters() { Name = "@is_married", Value = objUserModel.Is_Married, DBType = DbType.Boolean }); if (!string.IsNullOrEmpty(objUserModel.Token)) { parameters.Add(new DBParameters() { Name = "@token", Value = objUserModel.Token, DBType = DbType.String }); } if (!string.IsNullOrEmpty(objUserModel.Address)) { parameters.Add(new DBParameters() { Name = "@address", Value = objUserModel.Address, DBType = DbType.AnsiString }); } if (!string.IsNullOrEmpty(objUserModel.Blog)) { parameters.Add(new DBParameters() { Name = "@blog", Value = objUserModel.Blog, DBType = DbType.AnsiString }); } parameters.Add(new DBParameters() { Name = "@created_by", Value = objUserModel.Updated_by, DBType = DbType.Int32 }); return(Convert.ToInt32(this.ExecuteProcedure("dbo.user_add_edit", ExecuteType.ExecuteScalar, parameters))); }
public void Populate() { #region Types of Keywords FieldPublicDynamic = new { PropPublic1 = "A", PropPublic2 = 1, PropPublic3 = "B", PropPublic4 = "B", PropPublic5 = "B", PropPublic6 = "B", PropPublic7 = "B", PropPublic8 = "B", PropPublic9 = "B", PropPublic10 = "B", PropPublic11 = "B", PropPublic12 = new { PropSubPublic1 = 0, PropSubPublic2 = 1, PropSubPublic3 = 2 } }; FieldPublicObject = new StringBuilder("Object - StringBuilder"); FieldPublicInt32 = int.MaxValue; FieldPublicInt64 = long.MaxValue; FieldPublicULong = ulong.MaxValue; FieldPublicUInt = uint.MaxValue; FieldPublicDecimal = 100000.999999m; FieldPublicDouble = 100000.999999d; FieldPublicChar = 'A'; FieldPublicByte = byte.MaxValue; FieldPublicBoolean = true; FieldPublicSByte = sbyte.MaxValue; FieldPublicShort = short.MaxValue; FieldPublicUShort = ushort.MaxValue; FieldPublicFloat = 100000.675555f; FieldPublicInt32Nullable = int.MaxValue; FieldPublicInt64Nullable = 2; FieldPublicULongNullable = ulong.MaxValue; FieldPublicUIntNullable = uint.MaxValue; FieldPublicDecimalNullable = 100000.999999m; FieldPublicDoubleNullable = 100000.999999d; FieldPublicCharNullable = 'A'; FieldPublicByteNullable = byte.MaxValue; FieldPublicBooleanNullable = true; FieldPublicSByteNullable = sbyte.MaxValue; FieldPublicShortNullable = short.MaxValue; FieldPublicUShortNullable = ushort.MaxValue; FieldPublicFloatNullable = 100000.675555f; #endregion #region System FieldPublicDateTime = new DateTime(2000, 1, 1, 1, 1, 1); FieldPublicTimeSpan = new TimeSpan(1, 10, 40); FieldPublicEnumDateTimeKind = DateTimeKind.Local; // Instantiate date and time using Persian calendar with years, // months, days, hours, minutes, seconds, and milliseconds FieldPublicDateTimeOffset = new DateTimeOffset(1387, 2, 12, 8, 6, 32, 545, new System.Globalization.PersianCalendar(), new TimeSpan(1, 0, 0)); FieldPublicIntPtr = new IntPtr(100); FieldPublicTimeZone = TimeZone.CurrentTimeZone; FieldPublicTimeZoneInfo = TimeZoneInfo.Utc; FieldPublicTuple = Tuple.Create <string, int, decimal>("T-string\"", 1, 1.1m); FieldPublicType = typeof(object); FieldPublicUIntPtr = new UIntPtr(100); FieldPublicUri = new Uri("http://www.site.com"); FieldPublicVersion = new Version(1, 0, 100, 1); FieldPublicGuid = new Guid("d5010f5b-0cd1-44ca-aacb-5678b9947e6c"); FieldPublicSingle = Single.MaxValue; FieldPublicException = new Exception("Test error", new Exception("inner exception")); FieldPublicEnumNonGeneric = EnumTest.ValueA; FieldPublicAction = () => true.Equals(true); FieldPublicAction2 = (a, b) => true.Equals(true); FieldPublicFunc = () => true; FieldPublicFunc2 = (a, b) => true; #endregion #region Arrays and Collections FieldPublicArrayUni = new string[2]; FieldPublicArrayUni[0] = "[0]"; FieldPublicArrayUni[1] = "[1]"; FieldPublicArrayTwo = new string[2, 2]; FieldPublicArrayTwo[0, 0] = "[0, 0]"; FieldPublicArrayTwo[0, 1] = "[0, 1]"; FieldPublicArrayTwo[1, 0] = "[1, 0]"; FieldPublicArrayTwo[1, 1] = "[1, 1]"; FieldPublicArrayThree = new string[1, 1, 2]; FieldPublicArrayThree[0, 0, 0] = "[0, 0, 0]"; FieldPublicArrayThree[0, 0, 1] = "[0, 0, 1]"; FieldPublicJaggedArrayTwo = new string[2][]; FieldPublicJaggedArrayTwo[0] = new string[5] { "a", "b", "c", "d", "e" }; FieldPublicJaggedArrayTwo[1] = new string[4] { "a1", "b1", "c1", "d1" }; FieldPublicJaggedArrayThree = new string[1][][]; FieldPublicJaggedArrayThree[0] = new string[1][]; FieldPublicJaggedArrayThree[0][0] = new string[2]; FieldPublicJaggedArrayThree[0][0][0] = "[0][0][0]"; FieldPublicJaggedArrayThree[0][0][1] = "[0][0][1]"; FieldPublicMixedArrayAndJagged = new int[3][, ] { new int[, ] { { 1, 3 }, { 5, 7 } }, new int[, ] { { 0, 2 }, { 4, 6 }, { 8, 10 } }, new int[, ] { { 11, 22 }, { 99, 88 }, { 0, 9 } } }; FieldPublicDictionary = new System.Collections.Generic.Dictionary <string, string>(); FieldPublicDictionary.Add("Key1", "Value1"); FieldPublicDictionary.Add("Key2", "Value2"); FieldPublicDictionary.Add("Key3", "Value3"); FieldPublicDictionary.Add("Key4", "Value4"); FieldPublicList = new System.Collections.Generic.List <int>(); FieldPublicList.Add(0); FieldPublicList.Add(1); FieldPublicList.Add(2); FieldPublicQueue = new System.Collections.Generic.Queue <int>(); FieldPublicQueue.Enqueue(10); FieldPublicQueue.Enqueue(11); FieldPublicQueue.Enqueue(12); FieldPublicHashSet = new System.Collections.Generic.HashSet <string>(); FieldPublicHashSet.Add("HashSet1"); FieldPublicHashSet.Add("HashSet2"); FieldPublicSortedSet = new System.Collections.Generic.SortedSet <string>(); FieldPublicSortedSet.Add("SortedSet1"); FieldPublicSortedSet.Add("SortedSet2"); FieldPublicSortedSet.Add("SortedSet3"); FieldPublicStack = new System.Collections.Generic.Stack <string>(); FieldPublicStack.Push("Stack1"); FieldPublicStack.Push("Stack2"); FieldPublicStack.Push("Stack3"); FieldPublicLinkedList = new System.Collections.Generic.LinkedList <string>(); FieldPublicLinkedList.AddFirst("LinkedList1"); FieldPublicLinkedList.AddLast("LinkedList2"); FieldPublicLinkedList.AddAfter(FieldPublicLinkedList.Find("LinkedList1"), "LinkedList1.1"); FieldPublicObservableCollection = new System.Collections.ObjectModel.ObservableCollection <string>(); FieldPublicObservableCollection.Add("ObservableCollection1"); FieldPublicObservableCollection.Add("ObservableCollection2"); FieldPublicKeyedCollection = new MyDataKeyedCollection(); FieldPublicKeyedCollection.Add(new MyData() { Data = "data1", Id = 0 }); FieldPublicKeyedCollection.Add(new MyData() { Data = "data2", Id = 1 }); var list = new List <string>(); list.Add("list1"); list.Add("list2"); list.Add("list3"); FieldPublicReadOnlyCollection = new ReadOnlyCollection <string>(list); FieldPublicReadOnlyDictionary = new ReadOnlyDictionary <string, string>(FieldPublicDictionary); FieldPublicReadOnlyObservableCollection = new ReadOnlyObservableCollection <string>(FieldPublicObservableCollection); FieldPublicCollection = new Collection <string>(); FieldPublicCollection.Add("collection1"); FieldPublicCollection.Add("collection2"); FieldPublicCollection.Add("collection3"); FieldPublicArrayListNonGeneric = new System.Collections.ArrayList(); FieldPublicArrayListNonGeneric.Add(1); FieldPublicArrayListNonGeneric.Add("a"); FieldPublicArrayListNonGeneric.Add(10.0m); FieldPublicArrayListNonGeneric.Add(new DateTime(2000, 01, 01)); FieldPublicBitArray = new System.Collections.BitArray(3); FieldPublicBitArray[2] = true; FieldPublicSortedList = new System.Collections.SortedList(); FieldPublicSortedList.Add("key1", 1); FieldPublicSortedList.Add("key2", 2); FieldPublicSortedList.Add("key3", 3); FieldPublicSortedList.Add("key4", 4); FieldPublicHashtableNonGeneric = new System.Collections.Hashtable(); FieldPublicHashtableNonGeneric.Add("key1", 1); FieldPublicHashtableNonGeneric.Add("key2", 2); FieldPublicHashtableNonGeneric.Add("key3", 3); FieldPublicHashtableNonGeneric.Add("key4", 4); FieldPublicQueueNonGeneric = new System.Collections.Queue(); FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric1"); FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric2"); FieldPublicQueueNonGeneric.Enqueue("QueueNonGeneric3"); FieldPublicStackNonGeneric = new System.Collections.Stack(); FieldPublicStackNonGeneric.Push("StackNonGeneric1"); FieldPublicStackNonGeneric.Push("StackNonGeneric2"); FieldPublicIEnumerable = FieldPublicSortedList; FieldPublicBlockingCollection = new System.Collections.Concurrent.BlockingCollection <string>(); FieldPublicBlockingCollection.Add("BlockingCollection1"); FieldPublicBlockingCollection.Add("BlockingCollection2"); FieldPublicConcurrentBag = new System.Collections.Concurrent.ConcurrentBag <string>(); FieldPublicConcurrentBag.Add("ConcurrentBag1"); FieldPublicConcurrentBag.Add("ConcurrentBag2"); FieldPublicConcurrentBag.Add("ConcurrentBag3"); FieldPublicConcurrentDictionary = new System.Collections.Concurrent.ConcurrentDictionary <string, int>(); FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary1", 0); FieldPublicConcurrentDictionary.GetOrAdd("ConcurrentDictionary2", 0); FieldPublicConcurrentQueue = new System.Collections.Concurrent.ConcurrentQueue <string>(); FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue1"); FieldPublicConcurrentQueue.Enqueue("ConcurrentQueue2"); FieldPublicConcurrentStack = new System.Collections.Concurrent.ConcurrentStack <string>(); FieldPublicConcurrentStack.Push("ConcurrentStack1"); FieldPublicConcurrentStack.Push("ConcurrentStack2"); // FieldPublicOrderablePartitioner = new OrderablePartitioner(); // FieldPublicPartitioner; // FieldPublicPartitionerNonGeneric; FieldPublicHybridDictionary = new System.Collections.Specialized.HybridDictionary(); FieldPublicHybridDictionary.Add("HybridDictionaryKey1", "HybridDictionary1"); FieldPublicHybridDictionary.Add("HybridDictionaryKey2", "HybridDictionary2"); FieldPublicListDictionary = new System.Collections.Specialized.ListDictionary(); FieldPublicListDictionary.Add("ListDictionaryKey1", "ListDictionary1"); FieldPublicListDictionary.Add("ListDictionaryKey2", "ListDictionary2"); FieldPublicNameValueCollection = new System.Collections.Specialized.NameValueCollection(); FieldPublicNameValueCollection.Add("Key1", "Value1"); FieldPublicNameValueCollection.Add("Key2", "Value2"); FieldPublicOrderedDictionary = new System.Collections.Specialized.OrderedDictionary(); FieldPublicOrderedDictionary.Add(1, "OrderedDictionary1"); FieldPublicOrderedDictionary.Add(2, "OrderedDictionary1"); FieldPublicOrderedDictionary.Add("OrderedDictionaryKey2", "OrderedDictionary2"); FieldPublicStringCollection = new System.Collections.Specialized.StringCollection(); FieldPublicStringCollection.Add("StringCollection1"); FieldPublicStringCollection.Add("StringCollection2"); #endregion #region Several PropXmlDocument = new XmlDocument(); PropXmlDocument.LoadXml("<xml>something</xml>"); var tr = new StringReader("<Root>Content</Root>"); PropXDocument = XDocument.Load(tr); PropStream = GenerateStreamFromString("Stream"); PropBigInteger = new System.Numerics.BigInteger(100); PropStringBuilder = new StringBuilder("StringBuilder"); FieldPublicIQueryable = new List <string>() { "IQueryable" }.AsQueryable(); #endregion #region Custom FieldPublicMyCollectionPublicGetEnumerator = new MyCollectionPublicGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionInheritsPublicGetEnumerator = new MyCollectionInheritsPublicGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionExplicitGetEnumerator = new MyCollectionExplicitGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionInheritsExplicitGetEnumerator = new MyCollectionInheritsExplicitGetEnumerator("a b c", new char[] { ' ' }); FieldPublicMyCollectionInheritsTooIEnumerable = new MyCollectionInheritsTooIEnumerable("a b c", new char[] { ' ' }); FieldPublicEnumSpecific = EnumTest.ValueB; MyDelegate = MethodDelegate; EmptyClass = new EmptyClass(); StructGeneric = new ThreeTuple <int>(0, 1, 2); StructGenericNullable = new ThreeTuple <int>(0, 1, 2); FieldPublicNullable = new Nullable <ThreeTuple <int> >(StructGeneric); #endregion }
protected void ASPxGridView3_BatchUpdate(object sender, ASPxDataBatchUpdateEventArgs e) { if (!ValidarConexionYUsuarioLogueado(sender)) { return; } try { var fieldValues = ASPxGridView3.GetSelectedFieldValues(new[] { "CODE_CUSTOMER", "NAME_CUSTOMER" }); var newval = new int[e.UpdateValues.Count]; var customerKey = new string[e.UpdateValues.Count]; var conteo = 0; var customerValues = new Customer[fieldValues.Count]; var objSync = new System.Collections.ObjectModel.Collection <SyncSellers>(); var objNewTask = new System.Collections.ObjectModel.Collection <NewTask>(); foreach (var args in e.UpdateValues) { foreach (string valor in args.Keys.Values) { customerKey[conteo] = valor; } foreach (int valor in args.NewValues.Values) { newval[conteo] = valor; } conteo++; } conteo = 0; foreach (object[] value in fieldValues) { var flag = false; customerValues[conteo] = new Customer { CodeCustomer = value[0].ToString(), NameCustomer = value[1].ToString() }; for (var i = 0; customerKey.Count() > i; i++) { if (customerKey[i] != value[0].ToString()) { continue; } customerValues[conteo].Priority = newval[i]; flag = true; } if (flag == false) { customerValues[conteo].Priority = 1; } conteo++; } for (var i = 0; customerValues.Count() > i; i++) { var pResult = ""; _objTask.UpdateInsertPresaleTasks(Session["connectionString"].ToString(), customerValues[i].CodeCustomer, customerValues[i].NameCustomer, ASPxGridLookup1.Text, ASPxMemo1.Text, ASPxTimeEdit1.DateTime, ASPxCalendar1.SelectedDate, customerValues[i].Priority, ref pResult); if (pResult != ASPxGridLookup1.Text) { objSync.Add(new SyncSellers { OldSeller = pResult, NewSeller = ASPxGridLookup1.Text }); } else { objNewTask.Add(new NewTask { NewSeller = ASPxGridLookup1.Text }); } } //puede ser distinct por si solo se desea una notificacion ASPxGridView3.JSProperties.Add("cpSyncUsers", new object[] { objSync }); ASPxGridView3.JSProperties.Add("cpNewTask", new object[] { objNewTask }); GetTasksByDate(ASPxCalendar1.SelectedDate); ASPxPopupControl1.ShowOnPageLoad = false; ASPxGridLookup1.Text = ""; ASPxMemo1.Text = ""; ASPxGridView3.Selection.UnselectAll(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } e.Handled = true; }
public void CanUseIndexOnCollection() { var collection = new System.Collections.ObjectModel.Collection<string>(); collection.Add("Mickey Mouse"); collection.Add("Goofy"); _engine.SetValue("dictionary", collection); RunTest(@" dictionary[1] = 'Donald Duck'; assert(dictionary[1] === 'Donald Duck'); "); Assert.Equal("Mickey Mouse", collection[0]); Assert.Equal("Donald Duck", collection[1]); }
/// <summary> /// Removes all instances of a window /// </summary> /// <param name="rw">Windowinfo of the window that needs to be removed</param> public void RemoveAllInstances(WindowInfo rw) { lock (windows) { System.Collections.ObjectModel.Collection<WindowInfo> remItems = new System.Collections.ObjectModel.Collection<WindowInfo>(); foreach (WindowInfo w in windows) { if (w == rw) { remItems.Add(w); } } foreach (WindowInfo w in windowsRestore) { if (w == rw) { remItems.Add(w); } } foreach (WindowInfo w in remItems) { this.windows.Remove(w); } } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { int aid = 0; try { User user=(User)Session["CurrentUser"]; if (user == null) return; System.Collections.ObjectModel.Collection<ResultEmailDetail> _list = new System.Collections.ObjectModel.Collection<ResultEmailDetail>(); ResultEmailDetail emailDetail=null; aid = (Session["aid"] != null) ? (Convert.ToInt32(Session["aid"])) : 0; Assessment ass = new Assessment(); ass = ass.GetAssessmentByOID(aid); ResultEmail resultEmail = new ResultEmail(); //resultEmail.Header = TextBoxHeader.Text; //resultEmail.ShowAboveResult = TextBoxShowAboveResult.Text; resultEmail.Header = TextBoxHeaderHtml; resultEmail.ShowAboveResult = TextBoxShowAboveResultHtml; resultEmail.AssessmentOID = aid; resultEmail.CreatedBy = user.UserOID; resultEmail.LastModifiedBy = user.UserOID; //Result Detail ResultEmail rEmail = resultEmail.GetResultEmailByAOID(aid); //TextBox txt; string val = ""; foreach (Section s in ass.SectionList) { emailDetail = new ResultEmailDetail(); ////Positive Result //val = Request.Form["txtPositive" + s.SectionOID.ToString()]; //emailDetail.PositiveResult = val; ////Negative Result //val = Request.Form["txtNegative" + s.SectionOID.ToString()]; //emailDetail.NegativeResult = val; //Low Result val = Request.Form["txtLow" + s.SectionOID.ToString()]; emailDetail.LowResult = val; //Medium Result val = Request.Form["txtMedium" + s.SectionOID.ToString()]; emailDetail.MediumResult = val; //High Result val = Request.Form["txtHigh" + s.SectionOID.ToString()]; emailDetail.HighResult = val; emailDetail.SectionOID = s.SectionOID; emailDetail.LastModifiedBy = user.UserOID; emailDetail.CreatedBy = user.UserOID; _list.Add(emailDetail); } resultEmail.ResultDetail = _list; //check whether It is exist or not if (rEmail == null) { if (resultEmail.AddResultEmail()) { LabelMessage.Text = "Saved Successfully."; } else { LabelMessage.Text = "Not Saved."; } } else { resultEmail.AssessmentResultOID = rEmail.AssessmentResultOID; for (int i = 0; i < rEmail.ResultDetail.Count; i++) { resultEmail.ResultDetail[i].ResultSectionOID = rEmail.ResultDetail[i].ResultSectionOID; } if (resultEmail.UpdateResultEmail()) { LabelMessage.Text = "Update Successfully."; } else { LabelMessage.Text = "Update Failed."; } } TextBoxShowAboveResultHtml = ""; TextBoxHeaderHtml = ""; this.Initialize(aid); } catch (Exception ex) { this.Initialize(aid); } }
/// <summary> /// Draws the flag sticks. /// </summary> private void DrawFlagSticks() { System.Collections.ObjectModel.Collection<UIElement> flagSticks = new System.Collections.ObjectModel.Collection<UIElement>(); foreach (FrameworkElement label in this.labelsLayer.Children) { double left = (int)Canvas.GetLeft(label); double top = (int)Canvas.GetTop(label); double height = this.interpolationLineStartYPosition; FrameworkElement flagStick = GetFlagStick(left, top, height); SetFlagStick(label, flagStick); flagSticks.Add(flagStick); } foreach (UIElement element in flagSticks) { this.labelsLayer.Children.Add(element); } }