Esempio n. 1
0
 public ActionResult Create(FloorEntity model)
 {
     model.Id             = null;
     model.OrganizationId = CurrentOrganization.Id;
     _floorRepository.Update(model);
     return(RedirectToAction("Index"));
 }
Esempio n. 2
0
        private void Save()
        {
            string message = "";

            try
            {
                var coreModel = Mapper.Map <Floor>(this);
                if (FloorID == 0)
                {
                    coreModel = _floorRepo.Insert(coreModel);
                    FloorID   = coreModel.FloorID;
                    message   = "增加楼层成功!";
                }
                else
                {
                    coreModel = _floorRepo.Insert(coreModel);
                    _floorRepo.Update(coreModel);
                    message = "修改设楼层成功!";
                }

                ViewModelAttachment.CoreModel            = coreModel;
                ViewModelAttachment.LastOperationSuccess = true;
            }
            catch (Exception ex)
            {
                Log.Error("Update floor fails.", ex);
                message = "保存楼层失败";
                SendMessage(message);
                return;
            }

            RaisePropertyChanged(null);
            Close(message);
        }
Esempio n. 3
0
        private void OkBtn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            try
            {
                if (_photoChanged)
                {
                    _userAvatorService.UploadAvatorToServer(_floorViewModel.Photo);
                }

                var coreModel = Mapper.Map <Floor>(_floorViewModel);
                foreach (var dropDoor in dropDoors)
                {
                    var floorDoorViewModel = Mapper.Map <FloorDoor>(dropDoor.DataContext as FloorDoorViewModel);
                    coreModel.Doors.Add(floorDoorViewModel);
                }

                var validator = NinjectBinder.GetValidator <FloorValidator>();
                var results   = validator.Validate(coreModel);
                if (!results.IsValid)
                {
                    var message = string.Join("\n", results.Errors);
                    ShowSubViewNotification(new NotificationMessage(message));
                    return;
                }

                if (coreModel.FloorID == 0)
                {
                    coreModel.Status        = GeneralStatus.Enabled;
                    coreModel               = _floorRepo.Insert(coreModel);
                    _floorViewModel.FloorID = coreModel.FloorID;
                    _floorViewModel.BindDoors(coreModel.Doors);
                    //UpdateAuthorizationDoorsForFloor(coreModel);
                }
                else
                {
                    _floorRepo.Update(coreModel);
                    coreModel = _floorRepo.GetByKey(coreModel.FloorID);
                    _floorViewModel.BindDoors(coreModel.Doors);
                    //UpdateAuthorizationDoorsForFloor(coreModel);
                }

                _floorViewModel.ViewModelAttachment.CoreModel            = coreModel;
                _floorViewModel.ViewModelAttachment.LastOperationSuccess = true;
                ProcessCloseViewMessage(new NotificationMessage("保存成功"));
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                ShowSubViewNotification(new NotificationMessage("保存失败"));
            }
        }
        public HttpResponseMessage Update(Floor floor)
        {
            var response = Validate(floor);

            if (response.StatusCode != HttpStatusCode.OK)
            {
                return(response);
            }

            _floorRepository.Update(floor);

            var worker = new Thread(() => _elevatorManagerService.Operate(floor))
            {
                IsBackground = true
            };

            worker.Start();

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
Esempio n. 5
0
 public void Update(Floor floor)
 {
     repository.Update(floor);
 }
Esempio n. 6
0
 public Task Update(Floor floor)
 {
     return(_floorRepository.Update(floor));
 }
Esempio n. 7
0
 public void Update(FloorDto floorDto)
 {
     _floorRepository.Update(floorDto);
 }