Beispiel #1
0
		internal static void BuildAccessLevelsDropDown(ComboBox dropdown)
		{
			AccessLevel accessLevel = new AccessLevel();
			accessLevel.Id = 1;
			accessLevel.Name = "Public";
			AccessLevel accessLevel2 = new AccessLevel();
			accessLevel2.Id = 2;
			accessLevel2.Name = "Private";
			dropdown.DataSource = new Collection<AccessLevel>
			{
				accessLevel,
				accessLevel2
			};
			dropdown.ValueMember = "Id";
			dropdown.DisplayMember = "Name";
		}
Beispiel #2
0
		internal static AccessLevel GetAccessLevelFromDropDown(ComboBox dropdown)
		{
			AccessLevel accessLevel = new AccessLevel();
			string a;
			if ((a = dropdown.SelectedValue.ToString()) != null)
			{
				if (!(a == "1"))
				{
					if (a == "2")
					{
						accessLevel.Id = 2;
						accessLevel.Name = "Private";
					}
				}
				else
				{
					accessLevel.Id = 1;
					accessLevel.Name = "Public";
				}
			}
			return accessLevel;
		}