private void File_Download() { try { string strFTP_PATH = ""; if (_pMenuInfoRegisterEntity.CRUD == "") { _dtList.Rows.Clear(); } if (_gdSUB_VIEW.FocusedValue.ToString() == "") { return; } _pMenuInfoRegisterEntity.TEMPLETE_FILE_NAME = _gdSUB_VIEW.FocusedValue.ToString(); //ftp에서 local로 다운로드 SaveFileDialog saveFile = new SaveFileDialog(); saveFile.InitialDirectory = @"C:\"; saveFile.Filter = "ALL(*.*)|*.*"; saveFile.FileName = _pMenuInfoRegisterEntity.TEMPLETE_FILE_NAME; strFTP_PATH = string.Format(@"{0}{1}/{2}/", _pMenuInfoRegisterEntity.FTP_IP_PORT, "PROGRAM_VIEW", _luMENU_CODE.Text.ToString()); if (saveFile.ShowDialog() == DialogResult.OK) { string _pDOWNLOAD_PATH = saveFile.FileName; CoFAS_FTPManager.FTPDownLoad(strFTP_PATH, (saveFile.FileName.ToString().Split('\\')).Last(), _pFTP_ID, _pFTP_PW, _pDOWNLOAD_PATH, false); //DisplayMessage("선택한 파일이 지정한 폴더(" + _pFTP_DOWNLOAD_PATH + ")에 저장되었습니다."); DisplayMessage(_pMSG_SAVE + "(path:" + _pDOWNLOAD_PATH + ")"); } } catch (ExceptionManager pExceptionManager) { CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager.TargetSite.ToString())); } finally { CoFAS_DevExpressManager.SetCursor(this, Cursors.Default); } }
private void label1_Paint(object sender, PaintEventArgs e) { if (i < 1) { i++; if (CoFAS_DevExpressManager.ShowQuestionMessage("저장하시겠습니까?") == DialogResult.Yes) { if (strFILE_NAME != "") { SaveFileDialog saveFile = new SaveFileDialog(); saveFile.InitialDirectory = @"C:\"; saveFile.Filter = "Excel.XLSX(*.xlsx) | *.xls | ALL(*.*) | *.*"; saveFile.FileName = strFILE_NAME; switch (strUSE_TYPE) { case "PRINT": strFTP_PATH = string.Format(@"{0}{1}/{2}/", _pFTP_PATH, "ORDER_FORM", "MaterialOrderRegister_T03"); break; case "VIEW": strFTP_PATH = string.Format(@"{0}{1}/", _pFTP_PATH, "PROGRAM_VIEW"); break; } if (saveFile.ShowDialog() == DialogResult.OK) { _pFTP_DOWNLOAD_PATH = saveFile.FileName; CoFAS_FTPManager.FTPDownLoad(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW, _pFTP_DOWNLOAD_PATH); this.Dispose(); } } else { MessageBox.Show("선택된 파일이 없습니다!"); } } } }
public void SetExcel() { _pProductionResultState_T50Entity.WINDOW_NAME = this.Name; string strUSE_TYPE = ""; string strFILE_NAME = ""; string strFTP_PATH = ""; _dtList = new ProductionResultState_T50Business().Sheet_Info_Sheet(_pProductionResultState_T50Entity); strUSE_TYPE = _dtList.Rows[0]["USE_TYPE"].ToString(); strFILE_NAME = _dtList.Rows[0]["FILE_NAME"].ToString(); switch (strUSE_TYPE) { case "PRINT": strFTP_PATH = string.Format(@"{0}{1}/{2}/", _pFTP_PATH, "ORDER_FORM", _pWINDOW_NAME); break; case "VIEW": strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_PATH, "USER", "PROGRAM_VIEW", _pWINDOW_NAME); break; case "REGIT": strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_PATH, "USER", "PROGRAM_VIEW", _pWINDOW_NAME); break; } string curfile = Application.StartupPath + "\\Template\\" + strFILE_NAME; if (!File.Exists(curfile)) { CoFAS_FTPManager.FTPDownLoad(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW, curfile, false); } spreadsheetControl1.LoadDocument(curfile); }
private void SheetFind_DisplayData() { try { CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor); _sdMAIN = new SpreadsheetControl(); _sdMAIN.Options.Behavior.ShowPopupMenu = DevExpress.XtraSpreadsheet.DocumentCapability.Disabled; string strFTP_PATH = ""; string strUSE_TYPE = ""; string strFILE_NAME = ""; _pucWorkOrderInfoPopup_T50Entity.WINDOW_NAME = this.Name.ToString(); _pucWorkOrderInfoPopup_T50Entity.CRUD = "R"; //조회할거 프로시져 _dtList = new ucWorkOrderInfoPopup_T50Business().Sheet_Info_Sheet(_pucWorkOrderInfoPopup_T50Entity); //엑셀 시트 조회하기 //엑셀서식관리 되면 다시 설정하기 strUSE_TYPE = _dtList.Rows[0]["USE_TYPE"].ToString(); strFILE_NAME = _dtList.Rows[0]["FILE_NAME"].ToString(); switch (strUSE_TYPE) { case "PRINT": strFTP_PATH = string.Format(@"{0}{1}/{2}/", _pFTP_PATH, "ORDER_FORM", _pWINDOW_NAME); break; case "VIEW": strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_PATH, "USER", "PROGRAM_VIEW", _pWINDOW_NAME); break; case "REGIT": strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_PATH, "USER", "PROGRAM_VIEW", _pWINDOW_NAME); break; } string curfile = Application.StartupPath + "\\Template\\" + strFILE_NAME; // 같은 것이 있으면, 폴더에서 해당 파일명을 불러와서 SpreadSheet에 띄우기 / 없으면, 폴더에 다운 if (!File.Exists(curfile)) { CoFAS_FTPManager.FTPDownLoad(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW, curfile, false); } //using (FileStream file = File.OpenWrite(curfile)) using (Stream file = File.Open(curfile, FileMode.Open)) { if (file != null) { _sdMAIN.LoadDocument(file, DocumentFormat.Xlsx); } else { _sdMAIN.CloseCellEditor(CellEditorEnterValueMode.Default); _sdMAIN.CreateNewDocument(); } } } catch (ExceptionManager pExceptionManager) { CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager)); } finally { CoFAS_DevExpressManager.SetCursor(this, Cursors.Default); } }
private void SheetFind_DisplayData() { try { CoFAS_DevExpressManager.SetCursor(this, Cursors.WaitCursor); string strFTP_PATH = ""; string strUSE_TYPE = ""; string strFILE_NAME = ""; _pEquipmentHistoryEntity.CRUD = "R"; //조회할거 프로시져 _dtList = new EquipmentHistoryBusiness().Sheet_Info_Sheet(_pEquipmentHistoryEntity); //엑셀 시트 조회하기 //엑셀서식관리 되면 다시 설정하기 strUSE_TYPE = _dtList.Rows[0]["USE_TYPE"].ToString(); strFILE_NAME = _dtList.Rows[0]["FILE_NAME"].ToString(); /* strUSE_TYPE = "VIEW"; strFILE_NAME = "RawMaterialInspectRegister_Sample_v1.xlsx"; */ switch (strUSE_TYPE) { case "PRINT": strFTP_PATH = string.Format(@"{0}{1}/{2}/", _pFTP_PATH, "ORDER_FORM", _pWINDOW_NAME); break; case "VIEW": strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_PATH, "USER", "PROGRAM_VIEW", _pWINDOW_NAME); break; case "REGIT": strFTP_PATH = string.Format(@"{0}{1}/{2}/{3}/", _pFTP_PATH, "USER", "PROGRAM_VIEW", _pWINDOW_NAME); break; } string curfile = Application.StartupPath + "\\Template\\" + strFILE_NAME; // 같은 것이 있으면, 폴더에서 해당 파일명을 불러와서 SpreadSheet에 띄우기 / 없으면, 폴더에 다운 if (!File.Exists(curfile)) { CoFAS_FTPManager.FTPDownLoad(strFTP_PATH, strFILE_NAME, _pFTP_ID, _pFTP_PW, curfile, false); } //using (FileStream file = File.OpenWrite(curfile)) using (Stream file = File.Open(curfile, FileMode.Open)) { if (file != null) { _sdMAIN.LoadDocument(file, DocumentFormat.Xlsx); // 일반 컨트롤 일때 : DocumentFormat.Xls // UC일때, enFileFormat.Xls IWorkbook workbook = _sdMAIN.Document; Worksheet sheet_0 = workbook.Worksheets[0]; // Worksheet sheet_2 = workbook.Worksheets[2]; // Range rg = sheet_2.Range["J2:J3"];//판정유무 // sheet_0.CustomCellInplaceEditors.Add(sheet_0.Range["B28"], CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(rg)); // sheet_0.CustomCellInplaceEditors.Add(sheet_0.Range["H11:H22"], CustomCellInplaceEditorType.ComboBox, ValueObject.FromRange(rg)); // Range rg2 = sheet_2.Range["K2:K3"];//승인여부 try { } catch { } } else { _sdMAIN.CloseCellEditor(CellEditorEnterValueMode.Default); _sdMAIN.CreateNewDocument(); } } } catch (ExceptionManager pExceptionManager) { CoFAS_DevExpressManager.ShowErrorMessage(string.Format("{0}\n{1}", pExceptionManager.Exception.Message.ToString(), pExceptionManager)); } finally { CoFAS_DevExpressManager.SetCursor(this, Cursors.Default); } }