Пример #1
0
        public bool AddRecord(object data)
        {
            bool result = false;

            try
            {
                JObject jo = restConnection.Post("api/ClassroomBuilding/CreatClassroomBuilding", data);
                if (null != jo)
                {
                    ClassroomBuilding classroomBuilding = jo.Value <JObject>("data").ToObject <ClassroomBuilding>();
                    SelectedItem.Id = classroomBuilding.Id;
                    result          = true;
                }
            }
            catch (Exception e)
            {
                RadWindow.Alert(new DialogParameters
                {
                    OkButtonContent = "确定",
                    Content         = e.Message,
                    Owner           = App.Current.MainWindow,
                    Header          = "错误"
                });
            }
            return(result);
        }
Пример #2
0
 public void ClassroomBuildingCheckedChange(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsChecked")
     {
         ClassroomBuilding classroomBuilding = sender as ClassroomBuilding;
         if (classroomBuilding.IsChecked.HasValue)
         {
             ICollection <ClassRoom> beforeChange = SelectedClassrooms;
             foreach (var classroom in classroomBuilding.ClassRooms)
             {
                 classroom.PropertyChanged -= new PropertyChangedEventHandler(ClassroomCheckedChange);
                 classroom.IsChecked        = classroomBuilding.IsChecked.Value;
                 classroom.PropertyChanged += new PropertyChangedEventHandler(ClassroomCheckedChange);
             }
             ICollection <ClassRoom> afterChange = SelectedClassrooms;
             RaiseSelectedClassroomsChanged(beforeChange, afterChange);
         }
     }
 }