public EditDepartmentViewModel(Department department) { _canExecute = true; _departmentId = department.Id; _departmentName = department.Name; _departmentUniversity = department.Parent; }
public void SelectedDepartmentChanged(Department d) { currentDepartmentId = d.Id; int i = 0; foreach (Department department in AllUniversities[universitySelected].Departments) { if (department.Id == d.Id) departmentSelected = i; i++; } DepartmentsViewModel(d); }
public async Task EditDepartment(Department department) { await Task.Run(() => { AppDelegate.Instance.dataController.EditDepartment(() => { AppDelegate.Instance.Context.ChangeLoaderVisible(false); AppDelegate.Instance.Alert.ShowAlert("Department successfully edited! No errors reported.", true); }, department); }); }
public bool Validate(Department model) { if (StandartValidate(model.Name)) { errMsg += "Invalid length of the field name! \n"; } if (model.Parent < -1 || model.Parent > maxSizeParentId) { errMsg += "Invalid length of the field parent! \n"; } if (errMsg == null) { return true; } else { AppDelegate.Instance.Alert.ShowAlert(errMsg); return false; } }
public void Should_create(TestContextFixture fixture, Department dept) { fixture.SaveAll(dept); var command = new Create.Command { Title = "Blarg", Credits = 10, Department = dept }; fixture.Send(command); Course course = null; fixture.DoClean(ctx => course = ctx.Set<Course>().FirstOrDefault(c => c.Title == command.Title)); course.Title.ShouldBe(command.Title); course.Credits.ShouldBe(command.Credits); course.DepartmentID.ShouldBe(dept.DepartmentID); }
public ActionResult InsertDepartments_Post() { DepartmentRepository dr = new DepartmentRepository(); Department d1 = new Department { DepartmentId = 1, DepartmentName = "BS Math" }; Department d2 = new Department { DepartmentId = 2, DepartmentName = "BS Science" }; dr.InsertOnSubmit(d1); dr.InsertOnSubmit(d2); return View(); }
public void EditDepartment(Department department) { PostHandler(CommonSettings.EditDepartmentUrlString(),CommonSettings.EditDepartmentDataString(department)); }
public void CreateNewDepartment(Department department) { PostHandler(CommonSettings.CreateNewDepartmentUrlString(),CommonSettings.CreateNewDepartmentDataString(department)); }
public async Task EditDepartment(Action action, Department department) { //System.Threading.Thread.Sleep(t); dataProvider.EditDepartment(department); action(); }
public static string EditDepartmentDataString(Department department) { return "queryName=Department&id=" + department.Id + "&Name=" + department.Name + "&Parent=" + department.Parent; }
public static string CreateNewDepartmentDataString(Department department) { return "queryName=Department&Name=" + department.Name + "&Parent=" + department.Parent; }
public async Task DepartmentsViewModel(Department d = null) { currentUniversityName = allUniversities[universitySelected].Name; currentUniversityAddress = allUniversities[universitySelected].Address; System.Timers.Timer aTimer = new System.Timers.Timer(1000); aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent); aTimer.Interval = 1000; aTimer.Enabled = true; CurrentPageInMainWindow(1); if (allUniversities[universitySelected].Departments.Count > 0) { currentDepartmentName = allUniversities[universitySelected].Departments[0].Name; } else { currentDepartmentName = "Not match any of the department!"; } if(d!=null) { currentDepartmentName = d.Name; for(int i = 0; i < allUniversities.Count; i++) { foreach(Department dep in allUniversities[i].Departments) { if(dep.Id == d.Id) { universitySelected = i; } } } } currentUniversityLevel = allUniversities[universitySelected].Level.ToString(); if (allUniversities[universitySelected].Departments.Count == 0) { currentDepartmentId = -2; _canExecuteAddStudent = false; _canExecuteEditStudent = false; _canExecuteRemoveStudent = false; RaisePropertyChanged("canExecuteAddStudent"); RaisePropertyChanged("canExecuteEditStudent"); RaisePropertyChanged("canExecuteRemoveStudent"); allStudents = new List<Student>(); RaisePropertyChanged("AllStudents"); } else { if (currentDepartmentId < 1) { currentDepartmentId = allUniversities[universitySelected].Departments[0].Id; } StudentsViewModel(); } RaisePropertyChanged("AllUniversities"); RaisePropertyChanged("Preloader1"); RaisePropertyChanged("CurrentUniversityName"); RaisePropertyChanged("CurrentUniversityAddress"); RaisePropertyChanged("CurrentDepartmentName"); RaisePropertyChanged("CurrentUniversityLevel"); RaisePropertyChanged("AllUniversities"); }
public void EditDepartment(Department department) { RemoveDepartment(department.Id); CreateNewDepartment(department); }
public void CreateNewDepartment(Department department) { List<Department> departments = GetAllDepartments(); if (department.Id == -1) department.Id = AutoIncrementIndex(departments); departments.Add(department); TextWriter writer = new StreamWriter(fs_xml_file_Departments); XmlSerializer serializer = new XmlSerializer(typeof(List<Department>)); serializer.Serialize(writer, departments); writer.Close(); }