public void Populate_EXCEL_DesignTables(clsFiles Files_In, clsProject Project_In, clsOpCond OpCond_In, clsDB DB_In, string FilePath_In) //============================================================================================ { CloseExcelFiles(); // RADIAL: // ------- Populate_tblMapping_Radial(Project_In, OpCond_In, DB_In); //....Software variable value field. Populate_EXCEL_Radial(Files_In, Project_In, DB_In, FilePath_In); //....Design Table. // BLANK Assy: // ----------- Populate_tblMapping_Blank(Project_In, DB_In); Populate_EXCEL_BlankAssy(Files_In, Project_In, DB_In, FilePath_In); // SEAL: // ----- if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Seal || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Seal) { Populate_tblMapping_Seal(Project_In, DB_In); Populate_EXCEL_Seal(Files_In, Project_In, DB_In, FilePath_In); } // TL THRUST BEARING: // ------------------ if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { Populate_tblMapping_TL_TB(Project_In, DB_In); Populate_EXCEL_TL_TB(Files_In, Project_In, DB_In, FilePath_In); } // THRUST BEARING ASSY: // -------------------- if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { Populate_tblMapping_TB_Assy(Project_In, DB_In); Populate_EXCEL_TB_Assy(Files_In, Project_In, DB_In, FilePath_In); } // COMPLETE ASSY: // -------------- Populate_tblMapping_Complete(Project_In, OpCond_In, DB_In); Populate_EXCEL_CompleteAssy(Files_In, Project_In, DB_In, FilePath_In); // Solid Works Files. // ------------------ CreateSWFiles(Project_In, Files_In, FilePath_In); }
private string[] mDwg_Title_Suffix = new string[8]; //....1-based #endregion #region "CLASS METHODS:" //---------------------- ////public void PopulateAndMove_SWFiles_ProjectFolder(clsFiles Files_In, clsProject Project_In, //// clsOpCond OpCond_In, clsDB DB_In, string FilePath_In) //////==================================================================================================== ////{ //// //....SWFiles - Design tables, Model & Drawing files. //// // //// PopulateAndMove_DesignTables(Files_In, Project_In, OpCond_In, DB_In, FilePath_In); //// CopyAndMove_SW_Model_Dwg_Files(Project_In, Files_In, FilePath_In); ////} #region "DESIGN TABLES POPULATION:" private void PopulateAndMove_DesignTables(clsFiles Files_In, clsProject Project_In, clsOpCond OpCond_In, clsDB DB_In, string FilePath_In) //=============================================================================================== { //....This routine copies the design table templates to the project design tables, populates them //........and places them in the given project folder. Close_DesignTables(); // RADIAL: // ------- Populate_tblMapping_Radial(Project_In, OpCond_In, DB_In); //....Software variable value field. PopulateAndMove_DT_Radial(Files_In, Project_In, DB_In, FilePath_In); //....Design Table. // BLANK Assy: // ----------- Populate_tblMapping_Blank(Project_In, DB_In); PopulateAndMove_DT_BlankAssy(Files_In, Project_In, DB_In, FilePath_In); // SEAL: // ----- if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Seal || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Seal) { Populate_tblMapping_Seal(Project_In, DB_In); PopulateAndMove_DT_Seal(Files_In, Project_In, DB_In, FilePath_In); } // TL THRUST BEARING: // ------------------ if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { Populate_tblMapping_TL_TB(Project_In, DB_In); PopulateAndMove_DT_TL_TB(Files_In, Project_In, DB_In, FilePath_In); } // THRUST BEARING ASSY: // -------------------- if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { Populate_tblMapping_TB_Assy(Project_In, DB_In); PopulateAndMove_DT_TB_Assy(Files_In, Project_In, DB_In, FilePath_In); } // COMPLETE ASSY: // -------------- Populate_tblMapping_Complete(Project_In, OpCond_In, DB_In); PopulateAndMove_DT_CompleteAssy(Files_In, Project_In, DB_In, FilePath_In); }
public static clsFiles exportToCsv(DataSet ds) { clsFiles oFiles = new clsFiles(); foreach (DataTable t in ds.Tables) { using (System.IO.MemoryStream ms = new System.IO.MemoryStream()) { /* * var sw = new System.IO.StreamWriter(ms); * for (int i = 0; i < t.Columns.Count; i++) * { * sw.Write("{0},", t.Columns[i].ColumnName); * } * sw.Write("\r\n"); * foreach (DataRow r in t.Rows) * { * for (int iCol = 0; iCol < t.Columns.Count; iCol++) * { * sw.Write("{0},", r[iCol].ToString()); * } * * sw.Write("\r\n"); * } * */ var sw = new System.IO.StreamWriter(ms); sw.WriteLine("<?xml version=\"1.0\" standalone=\"yes\"?>"); t.WriteXml(sw, true); var oFileData = new FileData(); oFileData.ContentType = "application/unknown"; oFileData.FileName = t.TableName + ".xls"; oFileData.Data = g.ConvertStreamToByteArray(ms); oFiles.Add(oFileData); } } return(oFiles); }
private void PopulateAndMove_DT_BlankAssy(clsFiles Files_In, clsProject Project_In, clsDB DB_In, string FilePath_In) //================================================================================= { try { EXCEL.Application pApp = null; pApp = new EXCEL.Application(); //....Open Original WorkBook. EXCEL.Workbook pWkbOrg = null; pWkbOrg = pApp.Workbooks.Open(Files_In.FileTitle_Template_EXCEL_BlankAssy, mobjMissing, false, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing); //....Open 'Sketchs' WorkSheets. EXCEL.Worksheet pWkSheet = (EXCEL.Worksheet)pWkbOrg.Sheets[1]; //....Set Project Number. int pNo_Suffix = 1; if (Project_In.AssyDwg.No_Suffix != "") { pNo_Suffix = Convert.ToInt32(Project_In.AssyDwg.No_Suffix); } if (pNo_Suffix <= 9) { pWkSheet.Cells[3, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 1).ToString(); pWkSheet.Cells[4, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 1).ToString() + "T"; pWkSheet.Cells[5, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 4).ToString(); } else { pWkSheet.Cells[3, 1] = Project_In.AssyDwg.No + "-" + (pNo_Suffix + 1).ToString(); pWkSheet.Cells[4, 1] = Project_In.AssyDwg.No + "-" + (pNo_Suffix + 1).ToString() + "T"; pWkSheet.Cells[5, 1] = Project_In.AssyDwg.No + "-" + (pNo_Suffix + 4).ToString(); } //....Set Value. StringCollection pCellColName = new StringCollection(); StringCollection pSoftware_VarVal = new StringCollection(); DB_In.PopulateStringCol(pCellColName, "tblMapping_Blank", "fldCellColName", ""); DB_In.PopulateStringCol(pSoftware_VarVal, "tblMapping_Blank", "fldSoftware_VarVal", ""); for (int i = 0; i < pCellColName.Count; i++) { for (int j = 3; j < 6; j++) { if (pSoftware_VarVal[i] != "") { int pIndx = ColumnNumber(pCellColName[i]); pWkSheet.Cells[j, pIndx] = pSoftware_VarVal[i]; } } } string pFile = modMain.ExtractPreData(mcBlankAssy_Title, "."); String pFileName = FilePath_In + "\\" + pFile + ".xlsx"; if (!Directory.Exists(FilePath_In)) { Directory.CreateDirectory(FilePath_In); } if (File.Exists(pFileName)) { File.Delete(pFileName); } EXCEL.XlSaveAsAccessMode pAccessMode = Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive; pWkbOrg.SaveAs(pFileName, pWkbOrg.FileFormat, mobjMissing, mobjMissing, false, mobjMissing, pAccessMode, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing); //pApp.Visible = true; if (FilePath_In.Contains("Ref. Files")) { pApp.Visible = false; } else { pApp.Visible = true; } } catch (Exception pEXP) { } }
private void Populate_EXCEL_TB_Assy(clsFiles Files_In, clsProject Project_In, clsDB DB_In, string FileName_In) //============================================================================ { try { EXCEL.Application pApp = null; pApp = new EXCEL.Application(); //....Open Original WorkBook. EXCEL.Workbook pWkbOrg = null; pWkbOrg = pApp.Workbooks.Open(Files_In.FileTitle_Template_EXCEL_TB_Assy, mobjMissing, false, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing); //....Open 'Sketchs' WorkSheets. EXCEL.Worksheet pWkSheet = (EXCEL.Worksheet)pWkbOrg.Sheets[1]; //....Set Project Number. int pRowBegin = 3; int pJCount = 6; bool pTL_TB_Both = false; int pNo_Suffix = 1; if (Project_In.AssyDwg.No_Suffix != "") { pNo_Suffix = Convert.ToInt32(Project_In.AssyDwg.No_Suffix); } if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL && Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { if (pNo_Suffix <= 9) { pWkSheet.Cells[pRowBegin, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 2).ToString(); pWkSheet.Cells[pRowBegin + 1, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 2).ToString() + "D"; pWkSheet.Cells[pRowBegin + 2, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 5).ToString(); pWkSheet.Cells[pRowBegin + 3, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 3).ToString(); pWkSheet.Cells[pRowBegin + 4, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 3).ToString() + "D"; pWkSheet.Cells[pRowBegin + 5, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 6).ToString(); } else { pWkSheet.Cells[pRowBegin, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 2).ToString(); pWkSheet.Cells[pRowBegin + 1, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 2).ToString() + "D"; pWkSheet.Cells[pRowBegin + 2, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 5).ToString(); pWkSheet.Cells[pRowBegin + 3, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 3).ToString(); pWkSheet.Cells[pRowBegin + 4, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 3).ToString() + "D"; pWkSheet.Cells[pRowBegin + 5, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 6).ToString(); } pJCount = 9; pTL_TB_Both = true; } else { if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL) { if (pNo_Suffix <= 9) { pWkSheet.Cells[pRowBegin, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 2).ToString(); pWkSheet.Cells[pRowBegin + 1, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 2).ToString() + "D"; pWkSheet.Cells[pRowBegin + 2, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 5).ToString(); } else { pWkSheet.Cells[pRowBegin, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 2).ToString(); pWkSheet.Cells[pRowBegin + 1, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 2).ToString() + "D"; pWkSheet.Cells[pRowBegin + 2, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 5).ToString(); } pRowBegin++; } if (Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { if (pNo_Suffix <= 9) { pWkSheet.Cells[pRowBegin, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 3).ToString(); pWkSheet.Cells[pRowBegin + 1, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 3).ToString() + "D"; pWkSheet.Cells[pRowBegin + 2, 1] = Project_In.AssyDwg.No + "-0" + (pNo_Suffix + 5).ToString(); } else { pWkSheet.Cells[pRowBegin, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 3).ToString(); pWkSheet.Cells[pRowBegin + 1, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 3).ToString() + "D"; pWkSheet.Cells[pRowBegin + 2, 1] = Project_In.AssyDwg.No + (pNo_Suffix + 5).ToString(); } } } //.....Set Value. StringCollection pCellColName = new StringCollection(); StringCollection pSoftware_Var_Val = new StringCollection(); DB_In.PopulateStringCol(pCellColName, "tblMapping_TB_Assy", "fldCellColName", ""); DB_In.PopulateStringCol(pSoftware_Var_Val, "tblMapping_TB_Assy", "fldSoftware_VarVal", ""); for (int i = 0; i < pCellColName.Count; i++) { for (int j = 3; j < pJCount; j++) { if (pSoftware_Var_Val[i] != "") { int pIndx = ColumnNumber(pCellColName[i]); string pSoftware_Val; if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL) { if (pTL_TB_Both) { if (i == 0 && j == 7) { //pWkSheet.Cells[j, pIndx] = "B"; } else { pSoftware_Val = modMain.ExtractPreData(pSoftware_Var_Val[i], ","); pWkSheet.Cells[j, pIndx] = pSoftware_Val; } } else { if (i == 0 && j == 5) { //pWkSheet.Cells[j, pIndx] = "B"; } else { pSoftware_Val = modMain.ExtractPreData(pSoftware_Var_Val[i], ","); pWkSheet.Cells[j, pIndx] = pSoftware_Val; } } } if (Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { if (pTL_TB_Both) { if (i == 0 && j == 8) { //pWkSheet.Cells[j, pIndx] = "B"; } else { pSoftware_Val = modMain.ExtractPostData(pSoftware_Var_Val[i], ","); pWkSheet.Cells[j, pIndx] = pSoftware_Val; } } else { if (i == 0 && j == 5) { //pWkSheet.Cells[j, pIndx] = "B"; } else { pSoftware_Val = modMain.ExtractPostData(pSoftware_Var_Val[i], ","); pWkSheet.Cells[j, pIndx] = pSoftware_Val; } } } } } } String pFileName = FileName_In + "\\" + mcTB_Assy_Title + ".xlsx"; if (!Directory.Exists(FileName_In)) { Directory.CreateDirectory(FileName_In); } if (File.Exists(pFileName)) { File.Delete(pFileName); } EXCEL.XlSaveAsAccessMode pAccessMode = Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive; pWkbOrg.SaveAs(pFileName, pWkbOrg.FileFormat, mobjMissing, mobjMissing, false, mobjMissing, pAccessMode, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing); pApp.Visible = true; //} } catch (Exception pEXP) { MessageBox.Show("Excel File Error - " + pEXP.Message); } }
private void CreateSWFiles(clsProject Project_In, clsFiles Files_In, String FilePath_In) //===================================================================================== { try { // Project Dependent Files. // ------------------------ //....Model Files. // //....Radial: string pSWRadialFileName = FilePath_In + "\\" + mcSWRadial_Title; if (File.Exists(pSWRadialFileName)) { File.Delete(pSWRadialFileName); } File.Copy(Files_In.FileTitle_Template_SW_Radial, pSWRadialFileName); //....Seal: . if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Seal || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Seal) { string pSWSealFileName = FilePath_In + "\\" + mcSWSeal_Title; if (File.Exists(pSWSealFileName)) { File.Delete(pSWSealFileName); } File.Copy(Files_In.FileTitle_Template_SW_Seal, pSWSealFileName); } //....Blank Assembly: string pSWBlankAssy = FilePath_In + "\\" + mcSWBlankAssy_Title; if (File.Exists(pSWBlankAssy)) { File.Delete(pSWBlankAssy); } File.Copy(Files_In.FileTitle_Template_SW_BlankAssy, pSWBlankAssy); //....Complete Assembly: string pSWCompleteAssy = FilePath_In + "\\" + mcSWCompleteAssy_Title; if (File.Exists(pSWCompleteAssy)) { File.Delete(pSWCompleteAssy); } File.Copy(Files_In.FileTitle_Template_SW_CompleteAssy, pSWCompleteAssy); //....Thrust Bearing: if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL || Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) { string pSWTL_TB = FilePath_In + "\\" + mcSWTL_TB_Title; string pSWTB_Assy = FilePath_In + "\\" + mcSWTBAssy_Title; if (File.Exists(pSWTL_TB)) { File.Delete(pSWTL_TB); } File.Copy(Files_In.FileTitle_Template_SW_TL_TB, pSWTL_TB); if (File.Exists(pSWTB_Assy)) { File.Delete(pSWTB_Assy); } File.Copy(Files_In.FileTitle_Template_SW_TBAssy, pSWTB_Assy); } //....Drawing Files. // ---------------- //....-01: string pSWDwg01FileName = FilePath_In + "\\" + Project_In.AssyDwg.No + mcSWDwg01_Title; if (File.Exists(pSWDwg01FileName)) { File.Delete(pSWDwg01FileName); } File.Copy(Files_In.FileTitle_Template_SW_Dwg01_Title, pSWDwg01FileName); //....-02: string pSWDwg02FileName = FilePath_In + "\\" + Project_In.AssyDwg.No + mcSWDwg02_Title; if (File.Exists(pSWDwg02FileName)) { File.Delete(pSWDwg02FileName); } File.Copy(Files_In.FileTitle_Template_SW_Dwg02_Title, pSWDwg02FileName); //....-03: string pSWDwg03FileName = FilePath_In + "\\" + Project_In.AssyDwg.No + mcSWDwg03_Title; if (File.Exists(pSWDwg03FileName)) { File.Delete(pSWDwg03FileName); } File.Copy(Files_In.FileTitle_Template_SW_Dwg03_Title, pSWDwg03FileName); //....-04: string pSWDwg04FileName = FilePath_In + "\\" + Project_In.AssyDwg.No + mcSWDwg04_Title; if (File.Exists(pSWDwg04FileName)) { File.Delete(pSWDwg04FileName); } File.Copy(Files_In.FileTitle_Template_SW_Dwg04_Title, pSWDwg04FileName); //....-05: string pSWDwg05FileName = FilePath_In + "\\" + Project_In.AssyDwg.No + mcSWDwg05_Title; if (File.Exists(pSWDwg05FileName)) { File.Delete(pSWDwg05FileName); } File.Copy(Files_In.FileTitle_Template_SW_Dwg05_Title, pSWDwg05FileName); //....-06: string pSWDwg06FileName = FilePath_In + "\\" + Project_In.AssyDwg.No + mcSWDwg06_Title; if (File.Exists(pSWDwg06FileName)) { File.Delete(pSWDwg06FileName); } File.Copy(Files_In.FileTitle_Template_SW_Dwg06_Title, pSWDwg06FileName); ////....-07: // string pSWDwg07FileName = FileName_In + "\\" + Project_In.AssyDwg.No + mcSWDwg07_Title; // if (File.Exists(pSWDwg07FileName)) // File.Delete(pSWDwg07FileName); // File.Copy(Files_In.FileTitle_Template_SW_Dwg07_Title, pSWDwg07FileName); } catch (Exception ex) { MessageBox.Show("Unable to copy SW File.Please close SW Files."); } }
//private void Write_Parameter_Complete_Accessories(clsProject Project_In, clsAccessories Accessories_In, // EXCEL.Worksheet WorkSheet_In) ////====================================================================================================== //{ // EXCEL.Range pExcelCellRange = WorkSheet_In.UsedRange; // int pRowCount = pExcelCellRange.Rows.Count; // string pVarName = ""; // Double pConvF = 1; // if (modMain.gProject.PNR.Unit.System == clsUnit.eSystem.Metric) // { // pConvF = 25.4; // } // //....EndPlate: Seal // clsSeal[] mEndSeal = new clsSeal[2]; // for (int i = 0; i < 2; i++) // { // if (modMain.gProject.Product.EndPlate[i].Type == clsEndPlate.eType.Seal) // { // mEndSeal[i] = (clsSeal)((clsSeal)(modMain.gProject.Product.EndPlate[i])).Clone(); // } // } // for (int i = 3; i <= pRowCount; i++) // { // if (((EXCEL.Range)pExcelCellRange.Cells[i, 1]).Value2 != null || Convert.ToString(((EXCEL.Range)pExcelCellRange.Cells[i, 1]).Value2) != "") // { // pVarName = Convert.ToString(((EXCEL.Range)pExcelCellRange.Cells[i, 2]).Value2); // switch (pVarName) // { // case "Bearing.TempSensor.Exists": // String pTemp_Exists = ""; // if (((clsBearing_Radial_FP)Project_In.Product.Bearing).TempSensor.Exists) // { // pTemp_Exists = "Y"; // } // else // { // pTemp_Exists = "N"; // } // WorkSheet_In.Cells[i, 4] = pTemp_Exists; // break; // case "Bearing.TempSensor.Count": // WorkSheet_In.Cells[i, 4] = ((clsBearing_Radial_FP)Project_In.Product.Bearing).TempSensor.Count; // break; // case "Accessories.TempSensor.Name": // WorkSheet_In.Cells[i, 4] = Accessories_In.TempSensor.Name.ToString(); // break; // case "Accessories.TempSensor.Type": // WorkSheet_In.Cells[i, 4] = Accessories_In.TempSensor.Type.ToString(); // break; // case "Bearing.TempSensor.D": // WorkSheet_In.Cells[i, 4] = ((clsBearing_Radial_FP)Project_In.Product.Bearing).TempSensor.D * pConvF; // break; // case "Bearing.TempSensor.CanLength": // WorkSheet_In.Cells[i, 4] = ((clsBearing_Radial_FP)Project_In.Product.Bearing).TempSensor.CanLength * pConvF; // break; // case "Bearing.TempSensor.Loc": // WorkSheet_In.Cells[i, 4] = ((clsBearing_Radial_FP)Project_In.Product.Bearing).TempSensor.Loc.ToString(); // break; // case "Bearing.TempSensor.Depth": // WorkSheet_In.Cells[i, 4] = ((clsBearing_Radial_FP)Project_In.Product.Bearing).TempSensor.Depth * pConvF; // break; // case "Bearing.TempSensor.AngStart": // WorkSheet_In.Cells[i, 4] = ((clsBearing_Radial_FP)Project_In.Product.Bearing).TempSensor.AngStart; // break; // case "Bearing.Pad.AngBetween()": // WorkSheet_In.Cells[i, 4] = ((clsBearing_Radial_FP)Project_In.Product.Bearing).Pad.AngBetween(); // break; // case "EndSeal[0].TempSensor_D_ExitHole": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].TempSensor_D_ExitHole * pConvF; // } // break; // case "EndSeal[0].TempSensor_DBC_Hole()": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].TempSensor_DBC_Hole() * pConvF; // } // break; // case "EndSeal[1].TempSensor_D_ExitHole": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].TempSensor_D_ExitHole * pConvF; // } // break; // case "EndSeal[1].TempSensor_DBC_Hole()": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].TempSensor_DBC_Hole() * pConvF; // } // break; // case "Accessories.WireClip.Supplied": // String pSupplied = ""; // if (Accessories_In.WireClip.Supplied) // { // pSupplied = "Y"; // } // else // { // pSupplied = "N"; // } // WorkSheet_In.Cells[i, 4] = pSupplied; // break; // case "Accessories.WireClip.Count": // WorkSheet_In.Cells[i, 4] = Accessories_In.WireClip.Count; // break; // case "Accessories.WireClip.Size": // WorkSheet_In.Cells[i, 4] = Accessories_In.WireClip.Size.ToString(); // break; // //....Front // case "EndSeal[0].WireClipHoles.DBC": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.DBC * pConvF; // } // break; // case "EndSeal[0].Unit.System": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].Unit.System.ToString(); // } // break; // case "EndPlate[0].WireClipHoles.Screw_Spec.D_Desig": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.Screw_Spec.D_Desig; // } // break; // case "EndPlate[0].WireClipHoles.Screw_Spec.Pitch": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.Screw_Spec.Pitch; // } // break; // case "EndPlate[0].WireClipHoles.ThreadDepth": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.ThreadDepth * pConvF; // } // break; // case "EndPlate[0].WireClipHoles.AngStart": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.AngStart; // } // break; // case "EndPlate[0].WireClipHoles.AngOther(0)": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // if (mEndSeal[0].WireClipHoles.AngOther.Length > 0) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.AngOther[0]; // } // } // break; // case "EndPlate[0].WireClipHoles.AngOther(1)": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // if (mEndSeal[0].WireClipHoles.AngOther.Length > 1) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.AngOther[1]; // } // } // break; // case "EndPlate[0].WireClipHoles.AngOther(2)": // if (modMain.gProject.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) // { // if (mEndSeal[0].WireClipHoles.AngOther.Length > 2) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[0].WireClipHoles.AngOther[2]; // } // } // break; // //....Back // case "EndSeal[1].WireClipHoles.DBC": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.DBC * pConvF; // } // break; // case "EndSeal[1].Unit.System": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].Unit.System.ToString(); // } // break; // case "EndPlate[1].WireClipHoles.Screw_Spec.D_Desig": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.Screw_Spec.D_Desig; // } // break; // case "EndPlate[1].WireClipHoles.Screw_Spec.Pitch": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.Screw_Spec.Pitch; // } // break; // case "EndPlate[1].WireClipHoles.ThreadDepth": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.ThreadDepth * pConvF; // } // break; // case "EndPlate[1].WireClipHoles.AngStart": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.AngStart; // } // break; // case "EndPlate[1].WireClipHoles.AngOther(0)": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // if (mEndSeal[1].WireClipHoles.AngOther.Length > 0) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.AngOther[0]; // } // } // break; // case "EndPlate[1].WireClipHoles.AngOther(1)": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // if (mEndSeal[1].WireClipHoles.AngOther.Length > 1) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.AngOther[1]; // } // } // break; // case "EndPlate[1].WireClipHoles.AngOther(2)": // if (modMain.gProject.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) // { // if (mEndSeal[1].WireClipHoles.AngOther.Length > 2) // { // WorkSheet_In.Cells[i, 4] = mEndSeal[1].WireClipHoles.AngOther[2]; // } // } // break; // } // } // } //} private void Copy_Inventor_Model_Files(clsProject Project_In, clsFiles Files_In, String FilePath_In) //=================================================================================================== { try { // MODEL FILES. // ----------- // ////....Complete Assy: //// //string pFileName_CompleteAssy = FilePath_In + "\\" + System.IO.Path.GetFileName(Files_In.FileTitle_Template_Inventor_Complete); //if (System.IO.File.Exists(pFileName_CompleteAssy)) // System.IO.File.Delete(pFileName_CompleteAssy); //System.IO.File.Copy(Files_In.FileTitle_Template_Inventor_Complete, pFileName_CompleteAssy); ////....Radial Assy: //// //string pFileName_RadialAssy = FilePath_In + "\\" + Path.GetFileName(Files_In.FileTitle_Template_Inventor_Radial_Assy); //if (File.Exists(pFileName_RadialAssy)) // File.Delete(pFileName_RadialAssy); //File.Copy(Files_In.FileTitle_Template_Inventor_Radial_Assy, pFileName_RadialAssy); //....Radial: // string pFileName_Radial = FilePath_In + "\\" + System.IO.Path.GetFileName(Files_In.FileTitle_Template_Inventor_Radial); if (System.IO.File.Exists(pFileName_Radial)) { System.IO.File.Delete(pFileName_Radial); } System.IO.File.Copy(Files_In.FileTitle_Template_Inventor_Radial, pFileName_Radial); ////....Seal Front: //// //if (Project_In.Product.EndPlate[0].Type == clsEndPlate.eType.Seal) //{ // string pFileName_Seal_Front = FilePath_In + "\\" + System.IO.Path.GetFileName(Files_In.FileTitle_Template_Inventor_Seal_Front); // if (System.IO.File.Exists(pFileName_Seal_Front)) // System.IO.File.Delete(pFileName_Seal_Front); // System.IO.File.Copy(Files_In.FileTitle_Template_Inventor_Seal_Front, pFileName_Seal_Front); //} ////....Seal Back: //// //if (Project_In.Product.EndPlate[1].Type == clsEndPlate.eType.Seal) //{ // string pFileName_Seal_Back = FilePath_In + "\\" + System.IO.Path.GetFileName(Files_In.FileTitle_Template_Inventor_Seal_Back); // if (System.IO.File.Exists(pFileName_Seal_Back)) // System.IO.File.Delete(pFileName_Seal_Back); // System.IO.File.Copy(Files_In.FileTitle_Template_Inventor_Seal_Back, pFileName_Seal_Back); //} ////....Thrust Bearing Front: //// //if (Project_In.Product.EndPlate[0].Type == clsEndPlate.eType.TL_TB) //{ // string pFileName_Thrust_Front = FilePath_In + "\\" + System.IO.Path.GetFileName(Files_In.FileTitle_Template_Inventor_Thrust_Front); // if (System.IO.File.Exists(pFileName_Thrust_Front)) // System.IO.File.Delete(pFileName_Thrust_Front); // System.IO.File.Copy(Files_In.FileTitle_Template_Inventor_Thrust_Front, pFileName_Thrust_Front); //} ////....Thrust Bearing Back: //// //if (Project_In.Product.EndPlate[1].Type == clsEndPlate.eType.TL_TB) //{ // string pFileName_Thrust_Back = FilePath_In + "\\" + System.IO.Path.GetFileName(Files_In.FileTitle_Template_Inventor_Thrust_Back); // if (System.IO.File.Exists(pFileName_Thrust_Back)) // System.IO.File.Delete(pFileName_Thrust_Back); // System.IO.File.Copy(Files_In.FileTitle_Template_Inventor_Thrust_Back, pFileName_Thrust_Back); //} } catch (Exception ex) { MessageBox.Show("Unable to copy Inventor File.Please close Inventor Files."); } }
private void Populate_EXCEL_CompleteAssy(clsFiles Files_In, clsProject Project_In, clsDB DB_In, string FileName_In) //================================================================================ { try { EXCEL.Application pApp = null; pApp = new EXCEL.Application(); //....Open Original WorkBook. EXCEL.Workbook pWkbOrg = null; pWkbOrg = pApp.Workbooks.Open(Files_In.FileTitle_Template_EXCEL_CompleteAssy, mobjMissing, false, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing); //....Open 'Sketchs' WorkSheets. EXCEL.Worksheet pWkSheet = (EXCEL.Worksheet)pWkbOrg.Sheets[1]; //....Set Value. StringCollection pCellColName = new StringCollection(); StringCollection pSoftware_VarVal = new StringCollection(); DB_In.PopulateStringCol(pCellColName, "tblMapping_Complete", "fldCellColName", ""); DB_In.PopulateStringCol(pSoftware_VarVal, "tblMapping_Complete", "fldSoftware_VarVal", ""); for (int i = 0; i < pCellColName.Count; i++) { for (int j = 3; j < 4; j++) { if (pSoftware_VarVal[i] != "") { int pIndx = ColumnNumber(pCellColName[i]); pWkSheet.Cells[j, pIndx] = pSoftware_VarVal[i]; } } } String pFileName = FileName_In + "\\" + mcCompleteAssy_Title + ".xlsx"; if (!Directory.Exists(FileName_In)) { Directory.CreateDirectory(FileName_In); } if (File.Exists(pFileName)) { File.Delete(pFileName); } EXCEL.XlSaveAsAccessMode pAccessMode = Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive; pWkbOrg.SaveAs(pFileName, pWkbOrg.FileFormat, mobjMissing, mobjMissing, false, mobjMissing, pAccessMode, mobjMissing, mobjMissing, mobjMissing, mobjMissing, mobjMissing); pApp.Visible = true; } catch (Exception pEXP) { } }