프로젝트

일반

사용자정보

개정판 677a1d1f

ID677a1d1ff941cf3cdb9cb92584ba22c816de5d8f
상위 38e9d310
하위 99c0623d

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

issue #0000
공지사항 추가
- 공지사항 pdf 파일 등록
- 공지사항 pdf 파일 실행(view)
- db, class, repository 수정

Change-Id: I1be5e40f58ea65423ce1d34cdef63d2aeddc2bd9

차이점 보기:

ID2.Manager/ID2.Manager.Common/Globals.cs
4 4
using System.Text;
5 5
using System.Threading.Tasks;
6 6

  
7
using System.IO;
7 8
using System.Security.Cryptography;
8 9
using System.Text.RegularExpressions;
9 10

  
......
52 53
            return System.Convert.ToBase64String(arr);
53 54
        }
54 55

  
55
        public static byte[] Base64Decoding(string DecodingText, Encoding oEncoding = null)
56
        public static string Base64Decoding(string DecodingText, Encoding oEncoding = null)
56 57
        {
57 58
            if (oEncoding == null)
58 59
                oEncoding = Encoding.UTF8;
59 60

  
60 61
            byte[] arr = System.Convert.FromBase64String(DecodingText);
61
            return arr;
62
            return oEncoding.GetString(arr);
62 63
        }
63 64

  
64 65
        public static bool IsMatchEmailFormat(string EmailText)
65 66
        {
66 67
            return Regex.IsMatch(EmailText, @"[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?");
67 68
        }
69

  
70
        public static string ProgramDataFolder
71
        {
72
            get
73
            {
74
                return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "ID2Manager");
75
            }
76
        }
68 77
    }
69 78
}
ID2.Manager/ID2.Manager.Dapper/Repository/AttFileRepository.cs
57 57
                        switch (attFile.Category)
58 58
                        {
59 59
                            case "notice":
60
                                query = $@"
61
delete dbo.AttachFIles where RefID=@RefID and Category=@Category
62
insert into dbo.AttachFIles (FileID,RefID,Category,FileType,FileName,FilePath,FileData,Creator)
63
values
64
(
65
lower(newid())
66
,@RefID
67
,@Category
68
,@FileType
69
,@FileName
70
,@FilePath
71
,@FileData
72
,@Creator
73
)";
60
                                query = $@"delete dbo.AttachFIles where RefID=@RefID and Category=@Category";
74 61
                                break;
75
                            default:
76
                                query = $@"
77
insert into dbo.AttachFIles (FileID,RefID,Category,FileType,FileName,FilePath,FileData,Creator)
62
                        }
63
                        query += $@"
64
insert into dbo.AttachFIles (FileID,RefID,Category,FileType,FileName,FilePath,FileExtension,FileData,Creator)
78 65
values
79 66
(
80
lower(newid())
81
,@RefID
82
,@Category
83
,@FileType
84
,@FileName
85
,@FilePath
86
,@FileData
87
,@Creator
67
    lower(newid())
68
   ,@RefID
69
   ,@Category
70
   ,@FileType
71
   ,@FileName
72
   ,@FilePath
73
   ,@FileExtension
74
   ,@FileData
75
   ,@Creator
88 76
)";
89
                                break;
90
                        }
77

  
91 78
                        base.Execute(query, attFile, transaction);
92 79
                    }
93 80

  
ID2.Manager/ID2.Manager.Data/Models/AttFileInfo.cs
24 24
        [DataMember]
25 25
        public string FilePath { get; set; }
26 26
        [DataMember]
27
        public string FileExtension { get; set; }
28
        [DataMember]
27 29
        public byte[] FileData { get; set; }
28 30
        [DataMember]
29 31
        public DateTime CreatedDate { get; set; }
ID2.Manager/ID2.Manager/Main.cs
217 217

  
218 218
            if (this.IsID2Manager)
219 219
            {
220
                this.radButtonElementNoticeUpload.Enabled = true;
221

  
220 222
                this.backstageViewPageOpenProject.Controls[0].Visible = true;
221 223
                this.backstageTabItemOpenProject.Visibility = ElementVisibility.Visible;
222 224
                this.backstageButtonItemUserRegistration.Visibility = ElementVisibility.Visible;
223 225
            }
224 226
            else
225 227
            {
228
                this.radButtonElementNoticeUpload.Enabled = false;
229

  
226 230
                if (string.IsNullOrEmpty(informations.ActiveUser.RefProjectID))
227 231
                {
228 232
                    this.backstageViewPageOpenProject.Controls[0].Visible = true;
......
1478 1482

  
1479 1483
        private void RadButtonElementNotice_Click(object sender, EventArgs e)
1480 1484
        {
1481
            RadMessageBox.Show("공지사항 click!!", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1485
            try
1486
            {
1487
                AttFileInfo notiFileInfo = new AttFileController().GetAttFileInfo(informations.ActiveProject.ProjectID, "notice");
1488

  
1489
                if (notiFileInfo == null)
1490
                {
1491
                    RadMessageBox.Show("No notice.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Info);
1492
                }
1493
                else
1494
                {
1495
                    string noticePath = Path.Combine(Globals.ProgramDataFolder, "NoticeFiles");
1496
                    string noticeFileFullName = Path.Combine(noticePath, $"{notiFileInfo.FileID}{notiFileInfo.FileExtension}");
1497

  
1498
                    System.IO.FileInfo finfo = new System.IO.FileInfo(noticeFileFullName);
1499

  
1500
                    if (!finfo.Directory.Exists)
1501
                    {
1502
                        Directory.CreateDirectory(noticePath);
1503
                    }
1504

  
1505
                    if (!finfo.Exists)
1506
                    {
1507
                        var arrayBinary = notiFileInfo.FileData.ToArray();
1508

  
1509
                        using (MemoryStream ms = new MemoryStream(arrayBinary))
1510
                        {
1511
                            ms.Write(arrayBinary, 0, arrayBinary.Length);
1512
                            ms.Seek(0, SeekOrigin.Begin);
1513

  
1514
                            using (FileStream fs = finfo.Create())
1515
                            {
1516
                                ms.CopyTo(fs);
1517
                            }
1518
                        }
1519
                    }
1520

  
1521
                    try
1522
                    {
1523
                        ProcessStartInfo startInfo = new ProcessStartInfo
1524
                        {
1525
                            FileName = finfo.FullName,
1526
                            UseShellExecute = true,
1527
                            CreateNoWindow = false,
1528
                            WindowStyle = ProcessWindowStyle.Normal
1529
                        };
1530

  
1531
                        using (Process process = new Process())
1532
                        {
1533
                            process.StartInfo = startInfo;
1534
                            process.Start();
1535
                        }
1536
                        //Process.Start(finfo.FullName);
1537
                    }
1538
                    catch (Exception ex)
1539
                    {
1540
                        throw ex;
1541
                    }
1542

  
1543
                    //using (MemoryStream ms = new MemoryStream(arrayBinary))
1544
                    //{
1545
                    //    ProcessStartInfo startInfo = new ProcessStartInfo
1546
                    //    {
1547
                    //        FileName = Path.Combine(attFileInfo.FilePath, attFileInfo.FileName),
1548
                    //        RedirectStandardInput = true,
1549
                    //        UseShellExecute = false,
1550
                    //        CreateNoWindow = true,
1551
                    //        WindowStyle = ProcessWindowStyle.Hidden
1552
                    //    };
1553

  
1554
                    //    using (Process process = new Process())
1555
                    //    {
1556
                    //        process.StartInfo = startInfo;
1557
                    //        process.Start();
1558

  
1559
                    //        // Write the memory stream contents to the process standard input
1560
                    //        byte[] buffer = ms.ToArray();
1561
                    //        process.StandardInput.BaseStream.Write(buffer, 0, buffer.Length);
1562
                    //        process.StandardInput.Close();
1563

  
1564
                    //        process.WaitForExit();
1565
                    //    }
1566
                    //}
1567
                }
1568
            }
1569
            catch (Exception ex)
1570
            {
1571
                Program.logger.Error($"An exception occurred from {MethodBase.GetCurrentMethod().Name}", ex);
1572
                RadMessageBox.Show("Notification lookup failed.", Globals.Name, MessageBoxButtons.OK, RadMessageIcon.Error);
1573
            }
1482 1574
        }
1483 1575

  
1484 1576
        private void RadButtonElementNoticeUpload_Click(object sender, EventArgs e)
......
1523 1615
                                Category = "notice",
1524 1616
                                FileType = GetContentType(fileInfo.FullName),
1525 1617
                                FileName = fileInfo.Name,
1526
                                FilePath = fileInfo.DirectoryName
1618
                                FilePath = fileInfo.DirectoryName,
1619
                                FileExtension = fileInfo.Extension
1527 1620
                            };
1528 1621

  
1529 1622
                            using (var stream = new FileStream(ofd.FileName, FileMode.Open, FileAccess.Read))

내보내기 Unified diff

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