public static DataTable ReadPLD_Line(string strFileName) { String RLine; using (StreamReader SR = new StreamReader(strFileName, Encoding.Default, true)) { CTrans <_st_typePLD_Line> Trans_PLD_Line = new CTrans <_st_typePLD_Line>(); CMakeDataTable <_st_typePLD_Line> MakeTablePLD_Line = new CMakeDataTable <_st_typePLD_Line>(); bool chk99 = false; bool bRead = false; decimal tCnt = 0; int nInc = 0; while ((RLine = SR.ReadLine()) != null) { if (RLine.Trim().Length <= 0) { continue; } if (RLine.Substring(0, 3) == "-99") { chk99 = true; continue; } if (chk99) { tCnt = Convert.ToDecimal(RLine.Substring(0, 5).ToString()); if (tCnt > 0) { chk99 = false; bRead = true; } continue; } if (bRead) { if (nInc < tCnt) { _st_typePLD_Line st_typePLD_Line = Trans_PLD_Line.ByteToStruct(RLine); MakeTablePLD_Line.AddData(st_typePLD_Line); nInc++; } else { continue; } } } return(MakeTablePLD_Line.DATATABLE); } }
/// <summary> /// SPAN FILE을 LOAD 한다. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void elmFileLoad_Click(object sender, EventArgs e) { string strFileName; try { using (OpenFileDialog OpenDlg = new OpenFileDialog()) { OpenDlg.InitialDirectory = @"D:\Span\Data"; OpenDlg.Title = "Span Data Load"; OpenDlg.DefaultExt = "pa2"; OpenDlg.Filter = "Tops Data File (*.pa2)|*.pa2"; if (OpenDlg.ShowDialog() != DialogResult.OK) { XtraMessageBox.Show("취소 되었습니다."); return; } else { strFileName = OpenDlg.FileName.ToString(); } } string caption = string.Format("SPAN FILE Loading 중 입니다. {0}", Path.GetFileName(strFileName)); splashScreenManager1.ShowWaitForm(); splashScreenManager1.SetWaitFormCaption(caption); using (StreamReader sReader = new StreamReader(strFileName)) { string line; splashScreenManager1.SetWaitFormDescription("file type 별 구분 문석 중 입니다."); while ((line = sReader.ReadLine()) != null) { if (line.Substring(0, 2).ToString() == "1 ") { _st_type1 st_type1 = new _st_type1(); CTrans <_st_type1> trans = new CTrans <_st_type1>(); st_type1 = trans.ByteToStruct(line); CSpanData.Instance.mk_type1.AddData(st_type1); } else if (line.Substring(0, 2).ToString() == "2 ") { _st_type2 st_type2 = new _st_type2(); CTrans <_st_type2> trans = new CTrans <_st_type2>(); st_type2 = trans.ByteToStruct(line); CSpanData.Instance.mk_type2.AddData(st_type2); } else if (line.Substring(0, 2).ToString() == "3 ") { _st_type3 st_type3 = new _st_type3(); CTrans <_st_type3> trans = new CTrans <_st_type3>(); st_type3 = trans.ByteToStruct(line); CSpanData.Instance.mk_type3.AddData(st_type3); } else if (line.Substring(0, 2).ToString() == "5 ") { _st_type5 st_type5 = new _st_type5(); CTrans <_st_type5> trans = new CTrans <_st_type5>(); st_type5 = trans.ByteToStruct(line); CSpanData.Instance.mk_type5.AddData(st_type5); } else if (line.Substring(0, 2).ToString() == "6 ") { _st_type6 st_type6 = new _st_type6(); CTrans <_st_type6> trans = new CTrans <_st_type6>(); st_type6 = trans.ByteToStruct(line); CSpanData.Instance.mk_type6.AddData(st_type6); } else if (line.Substring(0, 2).ToString() == "81") { _st_type81 st_type81 = new _st_type81(); CTrans <_st_type81> trans = new CTrans <_st_type81>(); st_type81 = trans.ByteToStruct(line); CSpanData.Instance.mk_type81.AddData(st_type81); } else if (line.Substring(0, 2).ToString() == "82") { _st_type82 st_type82 = new _st_type82(); CTrans <_st_type82> trans = new CTrans <_st_type82>(); st_type82 = trans.ByteToStruct(line); CSpanData.Instance.mk_type82.AddData(st_type82); } else if (line.Substring(0, 2).ToString() == "B ") { _st_typeB st_typeB = new _st_typeB(); CTrans <_st_typeB> trans = new CTrans <_st_typeB>(); st_typeB = trans.ByteToStruct(line); CSpanData.Instance.mk_typeB.AddData(st_typeB); } else if (line.Substring(0, 2).ToString() == "C ") { _st_typeC st_typeC = new _st_typeC(); CTrans <_st_typeC> trans = new CTrans <_st_typeC>(); st_typeC = trans.ByteToStruct(line); CSpanData.Instance.mk_typeC.AddData(st_typeC); } else if (line.Substring(0, 2).ToString() == "E ") { _st_typeE st_typeE = new _st_typeE(); CTrans <_st_typeE> trans = new CTrans <_st_typeE>(); st_typeE = trans.ByteToStruct(line); CSpanData.Instance.mk_typeE.AddData(st_typeE); } else if (line.Substring(0, 2).ToString() == "P ") { _st_typeP st_typeP = new _st_typeP(); CTrans <_st_typeP> trans = new CTrans <_st_typeP>(); st_typeP = trans.ByteToStruct(line); CSpanData.Instance.mk_typeP.AddData(st_typeP); } else if (line.Substring(0, 2).ToString() == "R ") { _st_typeR st_typeR = new _st_typeR(); CTrans <_st_typeR> trans = new CTrans <_st_typeR>(); st_typeR = trans.ByteToStruct(line); CSpanData.Instance.mk_typeR.AddData(st_typeR); } else if (line.Substring(0, 2).ToString() == "S ") { _st_typeS st_typeS = new _st_typeS(); CTrans <_st_typeS> trans = new CTrans <_st_typeS>(); st_typeS = trans.ByteToStruct(line); CSpanData.Instance.mk_typeS.AddData(st_typeS); } else if (line.Substring(0, 2).ToString() == "Z ") { _st_typeZ st_typeZ = new _st_typeZ(); CTrans <_st_typeZ> trans = new CTrans <_st_typeZ>(); st_typeZ = trans.ByteToStruct(line); CSpanData.Instance.mk_typeZ.AddData(st_typeZ); } } } splashScreenManager1.SetWaitFormDescription("Market 정보를 Mapping 합니다."); //DataTable dt2 = CSpanData.Instance.dt_type2; ///당시기준 품목과 Mapping 테이블을 만든다. CSpanData.Instance.MakeMarketInfo(); ///당사기준 품목과 연관된 SeriesToSeries 테이블을 만든다. splashScreenManager1.SetWaitFormDescription("SeriesToSeries 정보를 생성합니다."); CSpanData.Instance.MakeSeriesToSeries(); CSpanData.Instance.MakefileP_modify(); splashScreenManager1.SetWaitFormDescription("RiskArray 정보를 생성합니다. "); CSpanData.Instance.MakeRiskArray(); CSpanData.Instance.MakefileC_Modify(); splashScreenManager1.SetWaitFormDescription("Inter Tier 정보를 생성합니다. "); CSpanData.Instance.MakeInterTierInfo(); splashScreenManager1.SetWaitFormDescription("Intra Tier 정보를 생성합니다. "); CSpanData.Instance.MakeIntraTierInfo(); splashScreenManager1.SetWaitFormDescription("계약당 증거금 정보를 생성합니다. "); CSpanData.Instance.MakeMarginInfo(); } catch (System.Exception ex) { throw ex; } finally { if (splashScreenManager1.IsSplashFormVisible) { splashScreenManager1.CloseWaitForm(); } } XtraMessageBox.Show("Loading 완료 되었습니다."); }
/// <summary> /// /// </summary> /// <param name="nombreProcAlm"></param> /// <param name="arrNombreParametros"></param> /// <param name="arrParametros"></param> /// <returns></returns> public int EjecutarProcAlm(string nombreProcAlm, ArrayList arrNombreParametros, ArrayList arrParametros, ref CTrans myTrans) { try { CConn local = new CConn(); int iTotal = local.execStoreProcedure(nombreProcAlm, arrNombreParametros, arrParametros, ref myTrans); return(iTotal); } catch (Exception exp) { throw exp; } }
private void simpleButton1_Click(object sender, EventArgs e) { ///marshal 로 처리 하려 하였으나 ///원래 PLH파일의 처리가 잘 못되어 있어 Marshal 처리 불가능 String FileName; String Extension; String RLine; CPLHMngr PLHMngr = new CPLHMngr(); XtraOpenFileDialog Opendlg; using (Opendlg = new XtraOpenFileDialog()) { //Opendlg.Filter = "PLH 파일 (*.PLH)|*.PLD|모든파일(*.*)|*.*"; Opendlg.Filter = "모든파일(*.*)|*.*"; Opendlg.Multiselect = true; if (Opendlg.ShowDialog() == DialogResult.OK) { foreach (string strFileName in Opendlg.FileNames) { FileName = Path.GetFileName(strFileName); Extension = Path.GetExtension(strFileName); if (Extension.ToUpper() == ".PLD") { DataTable ddt = CReadPLD.ReadPLD_Line(strFileName); if (ddt != null) { CPLHData PLHData = new CPLHData(); PLHData.FileName = Path.GetFileNameWithoutExtension(strFileName); PLHData.PLDLineData = ddt; PLHMngr.AddPLDData(PLHData); } } using (StreamReader SR = new StreamReader(strFileName, Encoding.Default, true)) { if (Extension.ToUpper() == ".PLH") { CTrans <_st_typePLH> Trans_PLH = new CTrans <_st_typePLH>(); CMakeDataTable <_st_typePLH> MakeTable = new CMakeDataTable <_st_typePLH>(); while ((RLine = SR.ReadLine()) != null) { if (RLine.Substring(0, 2) != "NO") { continue; } //RLine = RLine.Replace('+', ' '); _st_typePLH st_typePLH = Trans_PLH.ByteToStruct(RLine); MakeTable.AddData(st_typePLH); } if (MakeTable.DATATABLE != null) { DataTable dt = MakeTable.DATATABLE; CPLHData PLHData = new CPLHData(); PLHData.FileName = Path.GetFileNameWithoutExtension(strFileName); PLHData.PLHData = dt; PLHMngr.AddPLHData(PLHData); } } else if (Extension.ToUpper() == ".PLD") { CTrans <_st_typePLD> Trans_PLD = new CTrans <_st_typePLD>(); CMakeDataTable <_st_typePLD> MakeTablePLD = new CMakeDataTable <_st_typePLD>(); while ((RLine = SR.ReadLine()) != null) { if (RLine.Contains("CROSS") == false) { continue; } _st_typePLD st_typePLD = Trans_PLD.ByteToStruct(RLine); MakeTablePLD.AddData(st_typePLD); } if (MakeTablePLD.DATATABLE != null) { DataTable dt = MakeTablePLD.DATATABLE; CPLHData PLHData = new CPLHData(); PLHData.FileName = Path.GetFileNameWithoutExtension(strFileName); PLHData.PLDData = dt; PLHMngr.AddPLDData(PLHData); } } } } } else { //취소하면 이후 처리는 SKIP return; } CPLHDataProc DataProc = new CPLHDataProc(PLHMngr); DataProc.MakePipeToolData(); gridControl2.DataSource = PLHMngr.GetData(); ExportToSpreadSheet(DataProc); ExportToSpread2(DataProc); } }
/// <summary> /// /// </summary> /// <param name="nombreProcAlm"></param> /// <param name="arrNombreParametros"></param> /// <param name="arrParametros"></param> /// <returns></returns> public DataTable ObtenerDatosProcAlm(string nombreProcAlm, ArrayList arrNombreParametros, ArrayList arrParametros, ref CTrans myTrans) { try { DataTable table = new DataTable(); CConn local = new CConn(); table = local.execStoreProcedureToDataTable(nombreProcAlm, arrNombreParametros, arrParametros, ref myTrans); return(table); } catch (Exception exp) { throw exp; } }