markus / ConvertService / ServiceBase / Markus.Service.StationController / ViewModel / ConvertAddDialogViewModel.cs @ 43b2e236
이력 | 보기 | 이력해설 | 다운로드 (4.19 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.Linq; |
4 |
using System.Text; |
5 |
using System.Threading.Tasks; |
6 |
using Telerik.Windows.Controls; |
7 |
using System.IO; |
8 |
using Microsoft.Win32; |
9 |
using Markus.Service.Extensions; |
10 |
using System.Windows; |
11 |
|
12 |
namespace Markus.Service.StationController.ViewModel |
13 |
{ |
14 |
class ConvertAddDialogViewModel : Mvvm.ToolKit.ViewModelBase |
15 |
{ |
16 |
#region Construrtor |
17 |
|
18 |
public ConvertAddDialogViewModel() |
19 |
{ |
20 |
ConverAdd_Select_FoldCommand = new DelegateCommand(ConverAdd_Select_Fold); |
21 |
ConverAdd_OKCommand = new DelegateCommand(ConverAdd_OK); |
22 |
} |
23 |
|
24 |
#endregion |
25 |
|
26 |
#region Propertise |
27 |
|
28 |
private string _ConverAdd_Project_NO; |
29 |
public string ConverAdd_Project_NO |
30 |
{ |
31 |
get { return _ConverAdd_Project_NO; } |
32 |
set |
33 |
{ |
34 |
_ConverAdd_Project_NO = value; |
35 |
OnPropertyChanged(() => ConverAdd_Project_NO); |
36 |
} |
37 |
} |
38 |
|
39 |
private string _ConverAdd_DOCUMENT_ID; |
40 |
public string ConverAdd_DOCUMENT_ID |
41 |
{ |
42 |
get { return _ConverAdd_DOCUMENT_ID; } |
43 |
set |
44 |
{ |
45 |
_ConverAdd_DOCUMENT_ID = value; |
46 |
OnPropertyChanged(() => ConverAdd_DOCUMENT_ID); |
47 |
} |
48 |
} |
49 |
|
50 |
private string _ConverAdd_DOCUMENT_URL; |
51 |
public string ConverAdd_DOCUMENT_URL |
52 |
{ |
53 |
get { return _ConverAdd_DOCUMENT_URL; } |
54 |
set |
55 |
{ |
56 |
_ConverAdd_DOCUMENT_URL = value; |
57 |
OnPropertyChanged(() => ConverAdd_DOCUMENT_URL); |
58 |
} |
59 |
} |
60 |
|
61 |
#endregion |
62 |
|
63 |
#region Command |
64 |
|
65 |
public DelegateCommand ConverAdd_Select_FoldCommand { get; private set; } |
66 |
public DelegateCommand ConverAdd_OKCommand { get; private set; } |
67 |
|
68 |
#endregion |
69 |
|
70 |
#region Fuction |
71 |
|
72 |
#region ConverAdd_Select_Fold |
73 |
|
74 |
/// <summary> |
75 |
/// 그리드 상단 Conver 추가 버튼에서 Document URL Select Fold 버튼 |
76 |
/// </summary> |
77 |
|
78 |
public void ConverAdd_Select_Fold(object obj) |
79 |
{ |
80 |
//RadOpenFileDialog openFileDialog = new RadOpenFileDialog(); |
81 |
|
82 |
//openFileDialog.ShowDialog(); |
83 |
|
84 |
// |
85 |
SaveFileDialog saveFileDialog = new SaveFileDialog(); |
86 |
|
87 |
saveFileDialog.FileName = "Document"; // Default file name |
88 |
saveFileDialog.DefaultExt = ".txt"; // Default file extension |
89 |
saveFileDialog.Filter = "Word Documents (*.doc)|*.doc|Excel Worksheets (*.xls;*.xlsx)|*.xls;*.xlsx|PowerPoint Presentations (*.ppt)|*.ppt" + |
90 |
"|Office Files (*.doc;*.xls;*.ppt)|*.doc;*.xls;*.ppt" + |
91 |
"|All Files (*.*)|*.*"; |
92 |
|
93 |
|
94 |
if (saveFileDialog.ShowDialog() == true) |
95 |
{ |
96 |
|
97 |
|
98 |
if (!string.IsNullOrWhiteSpace(saveFileDialog.FileName)) |
99 |
{ |
100 |
ConverAdd_DOCUMENT_URL = saveFileDialog.FileName; |
101 |
} |
102 |
} |
103 |
// |
104 |
|
105 |
// if (openFileDialog.DialogResult == true) |
106 |
//{ |
107 |
// try |
108 |
// { |
109 |
|
110 |
// } |
111 |
// catch (Exception ex) |
112 |
// { |
113 |
// MessageBox.Show(ex.ToString()); |
114 |
// } |
115 |
//} |
116 |
|
117 |
} |
118 |
#endregion |
119 |
|
120 |
#region ConverAdd_OK |
121 |
/// <summary> |
122 |
/// 그리드 상단 Conver 추가 버튼 |
123 |
/// ProjectNo, DocumentURL, DocumentID, 입력해서 저장 프로시저에서 추가 |
124 |
/// </summary> |
125 |
public void ConverAdd_OK(object obj) |
126 |
{ |
127 |
|
128 |
try |
129 |
{ |
130 |
|
131 |
using (markusEntities entities = new markusEntities()) |
132 |
{ |
133 |
string ConverAdd_ID = GuidExtension.shortGuid(); |
134 |
var items = entities.SELECT_CONVERT_INSERT(ConverAdd_ID, ConverAdd_Project_NO, ConverAdd_DOCUMENT_URL, ConverAdd_DOCUMENT_ID); |
135 |
System.Diagnostics.Debug.WriteLine(items); |
136 |
|
137 |
} |
138 |
MessageBox.Show("데이터베이스에 추가 완료! "); |
139 |
} |
140 |
catch (Exception ex) |
141 |
{ |
142 |
MessageBox.Show(ex.ToString()); |
143 |
} |
144 |
} |
145 |
|
146 |
#endregion |
147 |
|
148 |
|
149 |
#endregion |
150 |
} |
151 |
} |