예제 #1
0
 private void OnSaveExecute()
 {
     Busy           = true;
     securityClient = ContainerProvider.GetInstance.Resolve <SecurityServiceClient>();
     if (SelectedUser != null)
     {
         oldObject                           = SelectedUser;
         SelectedUser.Password               = null;
         SelectedUser.Roles                  = (UserInRole != null ? Functionality.CloneCollection(UserInRole) : null);
         SelectedUser.DetachmentID           = SelectedDetachment.ID;
         SelectedUser.WorkerID               = (SelectedWorker != null ? SelectedWorker.ID : (int?)null);
         securityClient.UpdateUserCompleted += UpdateUserCompleted;
         securityClient.UpdateUserAsync(SelectedUser);
     }
     else
     {
         User user = new User()
         {
             Name         = UserName,
             Roles        = (UserInRole != null ? UserInRole : null),
             WorkerID     = (SelectedWorker != null ? SelectedWorker.ID : (int?)null),
             DetachmentID = SelectedDetachment.ID
         };
         securityClient.AddUserCompleted += AddUserCompleted;
         securityClient.AddUserAsync(user);
     }
 }
예제 #2
0
 void FindWorkerCompleted(object sender, FindWorkerCompletedEventArgs e)
 {
     if (e.Error == null)
     {
         update             = false;
         Worker             = e.Result;
         WorkerTours        = Functionality.CloneCollection(Worker.Tours);
         Description        = Worker.Description;
         FirstName          = Worker.FirstName;
         LastName           = Worker.LastName;
         PersonalEmail      = Worker.PersonalEmail;
         PersonalPhone      = Worker.PersonalPhone;
         SapNumber          = Worker.SapNumber;
         ServiceEmail       = Worker.ServiceEmail;
         ServiceNumber      = Worker.ServiceNumber;
         ServicePhone       = Worker.ServicePhone;
         Photo              = PhotoConvert(worker.Photo);
         SelectedTour       = null;
         SelectedWorkerTour = null;
         Enabled            = false;
     }
     else
     {
         ErrorProvider.ShowError(e.Error, Navigator);
     }
     dataClient.FindWorkerCompleted -= FindWorkerCompleted;
     Busy = false;
 }