예제 #1
0
		public Department(string name, Department[] children, Employee[] employees) {
			this.name      = name;
			this.children  = children;
			this.employees = employees;
		}
예제 #2
0
		private void EditEmployee(Employee e) {
			FirstNameInput.Value = ((e != null ? e.firstName : null) ?? "");
			LastNameInput.Value  = ((e != null ? e.lastName : null) ?? "");
			TitleInput.Value     = ((e != null ? e.title : null) ?? "");
			EmailInput.Value     = ((e != null ? e.email : null) ?? "");
			EditEmployeeDialog.Open();
		}
예제 #3
0
		private void EditEmployeeOKButton_Click(jQueryEvent evt) {
			string firstName = FirstNameInput.Value.Trim(),
			       lastName  = LastNameInput.Value.Trim(),
			       title     = TitleInput.Value.Trim(),
			       email     = EmailInput.Value.Trim();
			if (firstName == "") {
				Window.Alert("You must enter a first name.");
				FirstNameInput.Focus();
				return;
			}
			if (lastName == "") {
				Window.Alert("You must enter a last name.");
				LastNameInput.Focus();
				return;
			}
			if (title == "")
				title = null;
			if (email == "") {
				Window.Alert("You must enter an email address.");
				EmailInput.Focus();
				return;
			}
			
			bool add = (EmployeesGrid.GetData(EmployeesGrid.SelectedRowIndex) == null);
			Employee emp = new Employee(firstName, lastName, title, email);
			EmployeesGrid.UpdateItem(EmployeesGrid.SelectedRowIndex, GetGridTexts(emp), emp);
			if (add)
				EmployeesGrid.AddItem(GetGridTexts(null), null);

			Tree.SetTreeNodeData(DepartmentsTree.SelectedNode, GetCurrentEmployees());

			EditEmployeeDialog.Close();
		}
예제 #4
0
		private string[] GetGridTexts(Employee e) {
			return new string[] { e != null ? e.firstName : "<<New>>", e != null ? e.lastName : "", e != null ? "[Edit]" : "[New]" };
		}