111 lines
2.8 KiB
C#
111 lines
2.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Forms;
|
|
using System.Windows.Input;
|
|
|
|
using BeWo.Annotations;
|
|
using BeWo.Core;
|
|
using BeWo.ServiceProxy;
|
|
using BeWo.Validation;
|
|
using BeWo.ViewModel;
|
|
using BeWo.ViewModel.ListViewModel;
|
|
|
|
using BS.Shared;
|
|
using BS.Shared.Core;
|
|
using BS.Shared.DataContracts;
|
|
using BS.Shared.Extensions;
|
|
using BS.Shared.Translation;
|
|
using DevExpress.Utils;
|
|
using DevExpress.Xpf.Editors;
|
|
using DevExpress.Xpf.Grid;
|
|
using MessageBox = System.Windows.MessageBox;
|
|
|
|
namespace BeWo.View.Document
|
|
{
|
|
public partial class TeamFolderRightView : INotifyPropertyChanged
|
|
{
|
|
private TeamFolderRightListVM _ViewModel;
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
public event Action CloseButtonClicked;
|
|
|
|
|
|
public TeamFolderRightView(TeamFolderRightListVM pViewModel)
|
|
{
|
|
InitializeComponent();
|
|
|
|
CreateRightList(pViewModel);
|
|
|
|
ViewModel = pViewModel;
|
|
|
|
ReloadViewModel();
|
|
}
|
|
|
|
private void CreateRightList(TeamFolderRightListVM vm)
|
|
{
|
|
foreach (var team in vm.PossibleTeams)
|
|
{
|
|
var tfr = vm.VMList.FirstOrDefault(v => v.TeamOid == team.TeamOid);
|
|
if (tfr == null)
|
|
{
|
|
tfr = new TeamFolderRightVM(new TeamFolderRightDC { BeWoFolderOid = vm.Folder.BeWoFolderOid.Value });
|
|
vm.VMList.Add(tfr);
|
|
}
|
|
tfr.Team = team;
|
|
|
|
}
|
|
}
|
|
|
|
private TeamFolderRightListVM ViewModel
|
|
{
|
|
get { return _ViewModel; }
|
|
|
|
set
|
|
{
|
|
_ViewModel = value;
|
|
root.DataContext = value;
|
|
}
|
|
}
|
|
|
|
|
|
private void ReloadViewModel()
|
|
{
|
|
|
|
}
|
|
|
|
private void ClearControls()
|
|
{
|
|
GridControlRights.ItemsSource = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btnSave_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
var dcList = ViewModel.VMList.Select(v => v.CommitToDataContract()).ToList();
|
|
ServiceFacade.DoEmployeeServiceAsync(s => s.SaveTeamFolderRights(dcList));
|
|
|
|
CloseButtonClicked?.Invoke();
|
|
//var result = ServiceFacade.DoCustomerServiceSync(s => s.ImportSupportConcept(ViewModel));
|
|
//if (!String.IsNullOrEmpty(result.ImportMessage))
|
|
//{
|
|
// MessageBox.Show(result.ImportMessage, "Import", MessageBoxButton.OK, MessageBoxImage.Information);
|
|
//}
|
|
}
|
|
|
|
|
|
private void btnClose_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
CloseButtonClicked?.Invoke();
|
|
}
|
|
}
|
|
|
|
|
|
}
|