Beispiel #1
0
        /// <summary>
        /// File Append
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FileAdd_Click(object sender, MouseButtonEventArgs e)
        {
            try
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();

                if (openFileDialog.ShowDialog() == true)
                {
                    EmsAppdFile aF = new EmsAppdFile()
                    {
                        APPD_FILE_NM       = openFileDialog.FileName,
                        APPD_FILE_DEV_CD   = "D",
                        APPD_FILE_GROUP_CD = "BB_" + CurrentChkID.ToString(),
                        APPD_FILE_GUID     = Guid.NewGuid().ToString(),
                        IsNew = true
                    };

                    ChkFileList.Add(aF);

                    gridFile.Focus();
                    gridFile.CurrentColumn         = gridFile.Columns.First();
                    gridFile.View.FocusedRowHandle = ChkFileList.Count - 1;
                }
            }
            catch (Exception err)
            {
                this.BaseClass.Error(err);
            }
        }
        /// <summary>
        /// 첨부화일 다운로드
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridFile_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            int rowHandle = gridFileView.GetRowHandleByMouseEventArgs(e);

            if (rowHandle == GridControl.InvalidRowHandle)
            {
                return;
            }

            if (gridFile.IsGroupRowHandle(rowHandle))
            {
                return;
            }                                                     // A group row has been double clicked

            EmsAppdFile target = gridFile.SelectedItem as EmsAppdFile;

            string aName = System.IO.Path.GetFileName(target.APPD_FILE_NM);
            string aExt  = System.IO.Path.GetExtension(aName);

            string aDown = target.APPD_FILE_GUID + aExt;

            string path = System.IO.Path.GetDirectoryName(
                Environment.GetFolderPath(
                    Environment.SpecialFolder.Personal));

            path = System.IO.Path.Combine(path, "Downloads\\");

            try
            {
                WebClient myWebClient = new WebClient();

                myWebClient.DownloadFile(EmsSession.Instance.FileDownloadUrl + aDown, path + aName);

                myWebClient.Dispose();


                Process          p  = new Process();
                ProcessStartInfo pi = new ProcessStartInfo();
                pi.UseShellExecute = true;
                pi.FileName        = path + aName;
                p.StartInfo        = pi;

                p.Start();
            }
            catch (Exception err)
            {
                this.BaseClass.Error(err);
                // "파일 전송에 실패하였습니다."
                this.BaseClass.MsgError("EMS_FILETRANS_FAIL");
            }
        }