MobileAppSettingActions.cs
2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.MobileApps.MobileAppSetting;
namespace Sungero.MobileApps.Client
{
partial class MobileAppSettingActions
{
public virtual void AddFolder(Sungero.Domain.Client.ExecuteActionArgs e)
{
var folders = Functions.MobileAppSetting.Remote.GetFolderNameWithIds(_obj);
if (!folders.Any())
{
Dialogs.NotifyMessage(Sungero.MobileApps.MobileAppSettings.Resources.FolderListIsAlreadyUpdated);
return;
}
var dialog = Dialogs.CreateInputDialog(Sungero.MobileApps.MobileAppSettings.Resources.SelectFolder);
dialog.Text = Sungero.MobileApps.MobileAppSettings.Resources.SelectAFolderToAdd;
var addButton = dialog.Buttons.AddCustom(Sungero.MobileApps.MobileAppSettings.Resources.AddButton);
dialog.Buttons.AddCancel();
var addedFolderName = dialog.AddSelect(Sungero.MobileApps.MobileAppSettings.Resources.Folder, true).From(folders.Select(t => t.FolderName).ToArray());
if (dialog.Show() != addButton)
return;
var addedFolder = folders.FirstOrDefault(t => t.FolderName == addedFolderName.Value);
var newFolder = _obj.VisibleFolders.AddNew();
newFolder.FolderId = addedFolder.Id;
newFolder.FolderName = addedFolder.FolderName;
}
public virtual bool CanAddFolder(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return _obj.Employee != null;
}
public virtual void Reset(Sungero.Domain.Client.ExecuteActionArgs e)
{
// Вместо обработки удалений и переименований.
_obj.VisibleFolders.Clear();
var folders = Functions.MobileAppSetting.Remote.GetFolderNameWithIds(_obj);
foreach (var folder in folders)
{
var newFolder = _obj.VisibleFolders.AddNew();
newFolder.FolderId = folder.Id;
newFolder.FolderName = folder.FolderName;
}
Dialogs.NotifyMessage(Sungero.MobileApps.MobileAppSettings.Resources.FolderListIsAlreadyUpdated);
}
public virtual bool CanReset(Sungero.Domain.Client.CanExecuteActionArgs e)
{
return _obj.Employee != null;
}
}
partial class MobileAppSettingAnyChildEntityActions
{
public override void AddChildEntity(Sungero.Domain.Client.ExecuteChildCollectionActionArgs e)
{
base.AddChildEntity(e);
}
public override bool CanCopyChildEntity(Sungero.Domain.Client.CanExecuteChildCollectionActionArgs e)
{
return false;
}
public override bool CanAddChildEntity(Sungero.Domain.Client.CanExecuteChildCollectionActionArgs e)
{
return false;
}
}
}