프로젝트

일반

사용자정보

개정판 4d2d5397

ID4d2d539763c36fc6d0223e0ca464790ec1546d6b
상위 c75ae54c
하위 64811fe5, 7aa369fc

유성호이(가) 일년 이상 전에 추가함

issue #0000
fileinfo => attfileinfo 로 변경
fileinfo 삭제

Change-Id: I8384f3d5c3407be5ba3a573e96c88eda43f596cf

차이점 보기:

ID2.Manager/ID2.Manager.Controller/ID2.Manager.Controller.csproj
64 64
    <Compile Include="Controllers\BaseController.cs" />
65 65
    <Compile Include="Controllers\DocumentController.cs" />
66 66
    <Compile Include="Controllers\ExcelDataController.cs" />
67
    <Compile Include="Controllers\FileController.cs" />
68 67
    <Compile Include="Controllers\ID2Controller.cs" />
69 68
    <Compile Include="Controllers\MarkusInfoController.cs" />
70 69
    <Compile Include="Controllers\ProjectController.cs" />
ID2.Manager/ID2.Manager.Dapper/ID2.Manager.Dapper.csproj
72 72
    <Compile Include="Repository\BaseRepository.cs" />
73 73
    <Compile Include="Repository\DocumentRepository.cs" />
74 74
    <Compile Include="Repository\ExcelDataRepository.cs" />
75
    <Compile Include="Repository\FileRepository.cs" />
76 75
    <Compile Include="Repository\ID2Repository.cs" />
77 76
    <Compile Include="Repository\MarkusRepository.cs" />
78 77
    <Compile Include="Repository\ProjectRepository.cs" />
ID2.Manager/ID2.Manager.Data/ID2.Manager.Data.csproj
67 67
    <Compile Include="Models\ExcelDataInfo.cs" />
68 68
    <Compile Include="Models\MarkupText.cs" />
69 69
    <Compile Include="Models\Documents.cs" />
70
    <Compile Include="Models\FileInfo.cs" />
71 70
    <Compile Include="Models\ProjectInfo.cs" />
72 71
    <Compile Include="Models\UserInfo.cs" />
73 72
    <Compile Include="Properties\AssemblyInfo.cs" />
ID2.Manager/ID2.Manager/Forms/ImageView.cs
21 21
{
22 22
    public partial class ImageView : RadForm
23 23
    {
24
        string DocumentID = string.Empty;
24
        readonly Informations informations = Informations.Instance;
25

  
26
        string RefID = string.Empty;
27
        string Category = string.Empty;
25 28
        public OpenFileDialog ofd;
26 29
        
27
        public ImageView(string docID)
30
        public ImageView(string docID, string category)
28 31
        {
29 32
            InitializeComponent();
30 33

  
31
            this.DocumentID = docID;
34
            this.RefID = docID;
35
            this.Category = category;
32 36

  
33 37
            this.Initialize();
34 38

  
......
68 72

  
69 73
        public void GetFileList()
70 74
        {
71
            var files = new FileController().GetFileList(this.DocumentID).ToList();
75
            //var files = new FileController().GetFileList(this.RefID).ToList();
76
            var files = new AttFileController().GetFileList(this.RefID, this.Category);
72 77

  
73
            foreach (Data.Models.FileInfo file in files)
78
            foreach (AttFileInfo file in files)
74 79
            {
75 80
                var arrayBinary = file.FileData.ToArray();
76 81

  
......
98 103

  
99 104
        private void RadButtonSave_Click(object sender, EventArgs e)
100 105
        {
106
            string GetContentType(string filePath)
107
            {
108
                string extension = Path.GetExtension(filePath).ToLower();
109

  
110
                switch (extension)
111
                {
112
                    case ".txt":
113
                        return "text/plain";
114
                    case ".pdf":
115
                        return "application/pdf";
116
                    case ".jpg":
117
                    case ".jpeg":
118
                        return "image/jpeg";
119
                    case ".png":
120
                        return "image/png";
121
                    default:
122
                        return "application/octet-stream";
123
                }
124
            }
125

  
101 126
            if (string.IsNullOrEmpty(ofd.FileName) && !File.Exists(ofd.FileName))
102 127
            {
103 128
                RadMessageBox.Show($"There is no Image File selected.", "Information", MessageBoxButtons.OK, RadMessageIcon.Info);
104 129
                return;
105 130
            }
106 131

  
107
            var file = new Data.Models.FileInfo();
108
            file.RefDocID = this.DocumentID;
109
            file.FileName = ofd.FileName;
110
            file.FilePath = ofd.FileName;
111
            file.FileType = ofd.FileName;
112
            using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read))
132
            System.IO.FileInfo fileInfo = new System.IO.FileInfo(ofd.FileName);
133
            if (fileInfo.Exists)
113 134
            {
114
                using (var reader = new BinaryReader(stream))
135
                AttFileInfo attFile = new AttFileInfo()
115 136
                {
116
                    file.FileData = reader.ReadBytes((int)stream.Length);
137
                    RefID = this.RefID,
138
                    Category = this.Category,
139
                    FileType = GetContentType(fileInfo.FullName),
140
                    FileName = fileInfo.Name,
141
                    FilePath = fileInfo.DirectoryName,
142
                    FileExtension = fileInfo.Extension
143
                };
144

  
145
                using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read))
146
                {
147
                    using (var reader = new BinaryReader(stream))
148
                    {
149
                        attFile.FileData = reader.ReadBytes((int)stream.Length);
150
                    }
117 151
                }
118
            }
119 152

  
120
            var files = new List<Data.Models.FileInfo>() { file };
153
                bool result = new AttFileController().SetAttFiles(new List<AttFileInfo>() { attFile }, informations.ActiveUser.ID);
121 154

  
122
            bool result = new FileController().SetFileInfo(files);
123

  
124
            if (result)
125
            {
126
                RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
127
            }
128
            else
129
            {
130
                RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
155
                if (result)
156
                {
157
                    RadMessageBox.Show("Save is complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
158
                }
159
                else
160
                {
161
                    RadMessageBox.Show("Save is not complete", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
162
                }
131 163
            }
132 164
        }
133 165
    }
ID2.Manager/ID2.Manager/Main.cs
792 792
                        MessageBox.Show($"{e.Column.Name} 실행");
793 793
                        break;
794 794
                    case "ToCapture":
795
                        {
796
                            if (e.Row.DataBoundItem is Documents dd)
797
                            {
798
                                using (var frm = new ImageView(dd.DocID, "toreview"))
799
                                {
800
                                    frm.ShowDialog(this);
801
                                }
802
                            }
803
                        }
804
                        break;
795 805
                    case "FrCapture":
796

  
797
                        if (e.Row.DataBoundItem is Documents dd)
798 806
                        {
799
                            using (var frm = new ImageView(dd.DocID))
807
                            if (e.Row.DataBoundItem is Documents dd)
800 808
                            {
801
                                frm.ShowDialog(this);
809
                                using (var frm = new ImageView(dd.DocID, "frreview"))
810
                                {
811
                                    frm.ShowDialog(this);
812
                                }
802 813
                            }
803 814
                        }
804 815
                        break;

내보내기 Unified diff

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