프로젝트

일반

사용자정보

통계
| 브랜치(Branch): | 개정판:

markus / KCOM / ViewModel / BiddersSearchViewModel.cs @ df2e7646

이력 | 보기 | 이력해설 | 다운로드 (3.63 KB)

1
using System;
2
using System.Collections.Generic;
3
using System.Collections.ObjectModel;
4
using System.Linq;
5
using System.Text;
6
using System.Threading.Tasks;
7
using System.Windows;
8
using KCOM.Common;
9
using KCOM.Converters;
10
using KCOM.PemssService;
11
using Markus.Mvvm.ToolKit;
12
using Telerik.Windows.Controls;
13

    
14
namespace KCOM.ViewModel
15
{
16
    public class BiddersSearchViewModel : Markus.Mvvm.ToolKit.ViewModelBase
17
    {
18
        PemssService.PemssServiceClient pemssServiceClient;
19

    
20
        private System.Collections.ObjectModel.ObservableCollection<Bidders> biddersList;
21

    
22
        public ObservableCollection<Bidders> BiddersList
23
        {
24
            get
25
            {
26
                if (biddersList == null)
27
                {
28
                    biddersList = new ObservableCollection<Bidders>();
29
                }
30

    
31
                return biddersList;
32
            }
33
            set
34
            {
35
                if (biddersList != value)
36
                {
37
                    biddersList = value;
38
                    OnPropertyChanged(() => BiddersList);
39
                }
40
            }
41
        }
42

    
43
        private Bidders selectBidders;
44

    
45
        public Bidders SelectBidders
46
        {
47
            get
48
            {
49
                return selectBidders;
50
            }
51
            set
52
            {
53
                if (selectBidders != value)
54
                {
55
                    selectBidders = value;
56
                    OnPropertyChanged(() => SelectBidders);
57
                }
58
            }
59
        }
60

    
61
        private VpCommant selectVPComment;
62

    
63
        public VpCommant SelectVPComment
64
        {
65
            get
66
            {
67
                return selectVPComment;
68
            }
69
            set
70
            {
71
                if (selectVPComment != value)
72
                {
73
                    selectVPComment = value;
74
                    OnPropertyChanged(() => SelectVPComment);
75
                }
76
            }
77
        }
78

    
79
        #region UI에 대한 이벤트
80

    
81
        public RelayCommand<GridSelectMultiValues> SelectedBiddersCommand
82
                    => new RelayCommand<GridSelectMultiValues>(x => OnSelectedBiddersCommand(x));
83

    
84
        #endregion
85

    
86
        #region 초기화 및 종료 이벤트
87

    
88
        public BiddersSearchViewModel()
89
        {
90
            if (App.IsDesignMode)
91
                return;
92

    
93
            try
94
            {
95
                if (pemssServiceClient == null)
96
                {
97
                    pemssServiceClient = new PemssServiceClient(App._binding, App._PemssEndPoint);
98
                }
99

    
100
                OnGetBiddersDataAsync().ConfigureAwait(false);
101
            }
102
            catch (Exception ex)
103
            {
104
                System.Diagnostics.Debug.WriteLine(ex);
105
            }
106
        }
107

    
108
        public override void Loaded()
109
        {
110
            base.Loaded();
111
        }
112

    
113
        public override void Closed()
114
        {
115
            base.Closed();
116
        }
117

    
118
        #endregion
119

    
120
        #region Command
121
        private async Task OnGetBiddersDataAsync()
122
        {
123
            var result = await pemssServiceClient.GetBidderstListAsync(App.ViewInfo.ProjectNO, App.ViewInfo.DocumentItemID);
124

    
125
            BiddersList.Clear();
126

    
127
            result.ForEach(newItem =>
128
            {
129
                newItem.IsExpanded = true;
130
                newItem.IsExpandable = true;
131

    
132
                BiddersList.Add(newItem);
133
            });
134
        }
135

    
136
        private void OnSelectedBiddersCommand(GridSelectMultiValues values)
137
        {
138
            var bidders = values.SelectItem as Bidders;
139
            values.RadWindow.PromptResult = bidders.bdId;
140
            values.RadWindow.DialogResult = true;
141
            values.RadWindow.Close();
142
        }
143

    
144

    
145
        #endregion Command
146

    
147
    }
148
}
클립보드 이미지 추가 (최대 크기: 500 MB)