tempPath = "c:\\temp\\" + System.Guid.NewGuid().ToString();
try
{
if (!Directory.Exists(tempPath)) Directory.CreateDirectory(tempPath);
OutlookDataObject dataObject = new OutlookDataObject(e.Data);
string[] filenames = (string[])dataObject.GetData("FileGroupDescriptorW");
MemoryStream[] filestreams = (MemoryStream[])dataObject.GetData("FileContents");
for (int fileIndex = 0; fileIndex < filenames.Length; fileIndex++)
{
string filename = filenames[fileIndex];
MemoryStream filestream = filestreams[fileIndex];
FileStream outputStream = File.Create(tempPath + "\\" + filename);
filestream.WriteTo(outputStream);
outputStream.Close();
}
if (string.IsNullOrEmpty(_docID))
{
string attachTitle = _taskNM + "_" + DateTimeHelper.ToDateTimeSecString(DateTime.Now).ToString();
doc = CommonManager.GetEDMSDocument("1027", attachTitle, user.UserName, string.Empty);
doc.Attributes["cd_team"] = user.DEPTCode;
doc.Attributes["cd_vessel"] = _vessel;
doc.Attributes["ds_team"] = user.DEPTName;
doc.Attributes["ds_vessel"] = _vesselNM;
doc.Attributes["no_voyage"] = _voy;
doc.AttachFileList = new List<string>();
string[] locFileList = Directory.GetFiles(tempPath);
for (int idx = 0; idx < locFileList.Length; idx++)
{
doc.AttachFileList.Add(locFileList[idx]);
}
EDMSResult ret = EDMSHelper.CreateDocument(doc);
ret.DeptCD = user.DEPTCode;
ret.DeptNm = user.DEPTName;
ret.Creator = user.UserId;
ret.CreateDate = DateTime.Now;
foreach (AttachFileInfo afInfo in ret.AttachFileInfoList)
{
afInfo.Remark = "";
}
CommonManager.InsertAttachInformation(ret);
_docID = ret.DocumentID;
}
else
{
//이미 존재 하는 문서에 파일을 첨부
doc = new EDMSDocument();
doc.DocumentID = _docID;
string[] locFileList2 = Directory.GetFiles(tempPath);
List<string> fileList = new List<string>();
for (int idx = 0; idx < locFileList2.Length; idx++)
{
fileList.Add(locFileList2[idx]);
}
EDMSResult ret = EDMSHelper.AddAttachedFile(_docID, fileList);
ret.DeptCD = user.DEPTCode;
ret.DeptNm = user.DEPTName;
ret.Creator = user.UserId;
ret.CreateDate = DateTime.Now;
foreach (AttachFileInfo afInfo in ret.AttachFileInfoList)
{
afInfo.Remark = "";
}
CommonManager.InsertAttachInformation(ret);
_docID = ret.DocumentID;
}
SaveDocID();
this.sfdEDMS.LoadEDMSFiles(_docID);
PrintDocument 사용 Sample (0) | 2013.05.20 |
---|---|
오직 한 번만 실행되는 프로그램 - 이미 실행중인 프로그램에 데이터 전달하기 (0) | 2013.05.13 |
Keyboard Hooking (0) | 2013.04.17 |
Mouse Hooking (0) | 2013.04.17 |
TableLayoutPanel Position 얻기 (0) | 2013.04.16 |