internal void PopulateBusinessObjectFromReader2(clsProject businessObject, IDataReader dataReader) { if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.STATUS.ToString()))) { businessObject.STATUS = dataReader.GetString(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.STATUS.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.NAME.ToString()))) { businessObject.NAME = dataReader.GetString(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.NAME.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.FIRSTMONTH.ToString()))) { businessObject.FIRSTMONTH = dataReader.GetString(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.FIRSTMONTH.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.SECONDMONTH.ToString()))) { businessObject.SECONDMONTH = dataReader.GetString(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.SECONDMONTH.ToString())); } if (!dataReader.IsDBNull(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.THIRDMONTH.ToString()))) { businessObject.THIRDMONTH = dataReader.GetString(dataReader.GetOrdinal(clsProject.clsPROJECTFields2.THIRDMONTH.ToString())); } }
/// <summary> /// Populate business object from data reader /// </summary> /// <param name="businessObject">business object</param> /// <param name="dataReader">data reader</param> internal void PopulateBusinessObjectFromReader(clsProject businessObject, IDataReader dataReader) { businessObject.PROJ_ID = dataReader.GetInt32(dataReader.GetOrdinal(clsProject.clsPROJECTFields.PROJ_ID.ToString())); businessObject.PROJ_NAME = dataReader.GetString(dataReader.GetOrdinal(clsProject.clsPROJECTFields.PROJ_NAME.ToString())); businessObject.CATEGORY = (byte)dataReader.GetInt16(dataReader.GetOrdinal(clsProject.clsPROJECTFields.CATEGORY.ToString())); businessObject.BILLABILITY = (byte)dataReader.GetInt16(dataReader.GetOrdinal(clsProject.clsPROJECTFields.BILLABILITY.ToString())); }
private void menuFile_LoadProject_Click(object sender, EventArgs e) { dialogLoad.FileName = ""; DialogResult resultDialog = dialogLoad.ShowDialog(this); if (resultDialog == DialogResult.Cancel || resultDialog == DialogResult.Abort) { return; } if (!File.Exists(dialogLoad.FileName)) { return; } Stream file = dialogLoad.OpenFile(); XmlSerializer readBin = new XmlSerializer(typeof(Xml_Project), ProjectXmlTypes); Xml_Project XmlProject = (Xml_Project)readBin.Deserialize(file); file.Close(); file.Dispose(); CloseAllForms(); projectMain.Dispose(); GC.Collect(); projectMain = new clsProject(); XmlProject.InitObject(ref projectMain); windowProject.Project = projectMain; windowProject.UpdateProjectTree(); }
/// <summary> /// update row in the table /// </summary> /// <param name="businessObject">business object</param> /// <returns>true for successfully updated</returns> public bool Update(clsProject businessObject) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[sp_PROJECT_Update]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@PROJ_ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.PROJ_ID)); sqlCommand.Parameters.Add(new SqlParameter("@PROJ_CD", SqlDbType.NVarChar, 10, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.PROJ_CD)); sqlCommand.Parameters.Add(new SqlParameter("@PROJ_NAME", SqlDbType.VarChar, 20, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.PROJ_NAME)); sqlCommand.Parameters.Add(new SqlParameter("@CATEGORY", SqlDbType.SmallInt, 2, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.CATEGORY)); sqlCommand.Parameters.Add(new SqlParameter("@BILLABILITY", SqlDbType.SmallInt, 2, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, businessObject.BILLABILITY)); MainConnection.Open(); sqlCommand.ExecuteNonQuery(); return(true); } catch (Exception ex) { throw new Exception("clsPROJECT::Update::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
public void ListAndCount() { //create an instance of the class we want to create clsProjectCollection AllProjects = new clsProjectCollection(); //create some test data to assign to the property //in this case the data needs to be a list of objects List <clsProject> TestList = new List <clsProject>(); //add an item to the list //create the item of test data clsProject TestItem = new clsProject(); //set its properties TestItem.AppointmentID = 11; TestItem.AProjectDescription = "project"; TestItem.AProjectID = 2; TestItem.ClientID = 13; TestItem.EstimatedCompletionDate = DateTime.Now.Date; TestItem.ProjectName = "ProjectName"; TestItem.StaffID = 15; //add the item to the test list TestList.Add(TestItem); //assign the data to the property AllProjects.ListNames = TestList; //test to see that the two values are the same Assert.AreEqual(AllProjects.Count, TestList.Count); }
private void cmdOK_Click(object sender, EventArgs e) { if (txtProjectLocation.Text == P.F.Project.ProjectPathXName && txtProjectName.Text == P.F.Project.Name) { P.F.SaveProject(P.F.Project); DialogResult = DialogResult.OK; //close form return; } //* create project dir string fulldir = dlgNewProject.CreateProjectDir(txtProjectLocation, txtProjectName, chkAddNameToLocation); if (fulldir == "") { return; //do not close form } clsProject oldproject = P.F.Project; P.F.Project = new clsProject(P.F.Project, fulldir, txtProjectName.Text); bool ok = P.F.SaveProject(oldproject); //if (!ok) MessageBox.Show("Error saving project"); DialogResult = DialogResult.OK; //close form }
public void ProjectInstanceOK() { //create an instance of the class clsCompany clsProject AProject = new clsProject(); //check if it exists Assert.IsNotNull(AProject); }
private void menuFile_NewProject_Click(object sender, EventArgs e) { CloseAllForms(); projectMain.Dispose(); GC.Collect(); projectMain = new clsProject(); windowProject.Project = projectMain; windowProject.UpdateProjectTree(); }
public void ProjectEstimatedCompletedDatePropertyOK() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //create some test data to assign to the property DateTime EstimatedCompletedDate = DateTime.Now.Date; //assign the test data to the property AProject.EstimatedCompletionDate = EstimatedCompletedDate; //test to see that the two values are the same Assert.AreEqual(AProject.EstimatedCompletionDate, EstimatedCompletedDate); }
public void ProjectDescriptionPropertyOK() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //create some test data to assign to the property string AProjectDescription = "A new Project was created"; //assign the test data to the property AProject.AProjectDescription = AProjectDescription; //test to see that the two values are the same Assert.AreEqual(AProject.AProjectDescription, AProjectDescription); }
public void ProjectNamePropertyOK() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //create some test data to assign to the property string ProjectName = "New Project"; //assign the test data to the property AProject.ProjectName = ProjectName; //test to see that the two values are the same Assert.AreEqual(AProject.ProjectName, ProjectName); }
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); }
public void ProjectIDPropertyOK() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //create some test data to assign to the property int AProjectID = 13; //assign the test data to the property AProject.AProjectID = AProjectID; //test to see that the two values are the same Assert.AreEqual(AProject.AProjectID, AProjectID); }
internal List <clsProject> PopulateObjectsFromReader2(IDataReader dataReader2) { List <clsProject> list = new List <clsProject>(); while (dataReader2.Read()) { clsProject businessObject = new clsProject(); PopulateBusinessObjectFromReader2(businessObject, dataReader2); list.Add(businessObject); } return(list); }
private void SaveData(string IsDelete) { long lngID = 0; try { MasterTablesManager MasMgr = new MasterTablesManager(); if (hfIsUpadate.Value == "N") { lngID = objDB.GerMaxIDNumber("ProjectList", "ProjectId"); } else { lngID = Convert.ToInt32(hfID.Value); } clsProject objPrj = new clsProject(lngID.ToString(), txtProject.Text.Trim(), txtProjectCode.Text.Trim(), Common.ReturnDate(txtStartDate.Text.ToString()), Common.ReturnDate(txtEndDate.Text.ToString()), ddlWeekend.SelectedItem.Value.ToString(), ddlIncrement.SelectedItem.Value.ToString(), ddlIncrMonth.SelectedItem.Value.ToString(), txtIncrementYear.Text.ToString() == "" ? "0" : txtIncrementYear.Text.ToString(), (ChkIsActive.Checked == true ? "N" : "Y"), "N", Session["USERID"].ToString(), Common.SetDateTime(DateTime.Now.ToString())); MasMgr.InsertUpProject(grBenefits, objPrj, hfIsUpadate.Value, IsDelete); if (hfIsUpadate.Value == "N") { lblMsg.Text = "Record Saved Successfully"; } else { lblMsg.Text = "Record Updated Successfully"; } Common.EmptyTextBoxValues(this); this.EntryMode(false); this.OpenRecord(); } catch (Exception ex) { lblMsg.Text = ""; throw (ex); } }
private void FormMain_Load(object sender, EventArgs e) { formMain = this; glInit(Handle); DefaultScriptInit(); dockMainPanel = dockMain; projectMain = new clsProject(); windowProject = new frmProject(projectMain); if (menuProject.Checked) { windowProject.Show(dockMain, DockState.DockRight); } }
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 void FindMethodOk() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the search Boolean Found = false; //create some test data to use with the method int ProjectID = 2; //invoke the method Found = AProject.Find(ProjectID); //test to see that the result is correct Assert.IsTrue(Found); }
public void ProjectNameMinLessOne() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string EstimatedCompletionDate = DateTime.Now.Date.ToString(); string ProjectName = "";//this should fail string ProjectDescription = "A new Website was created"; //invoke the method OK = AProject.Valid(EstimatedCompletionDate, ProjectName, ProjectDescription); //test to see the result is correct Assert.IsFalse(OK); }
public void ProjectDescriptionMinPlusOne() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string ProjectName = "Website Creation"; string EstimatedCompletionDate = DateTime.Now.Date.ToString(); string ProjectDescription = "aa";//this should pass //invoke the method OK = AProject.Valid(ProjectName, ProjectDescription, EstimatedCompletionDate); //test to see that the result is correct Assert.IsTrue(OK); }
public void EstimatedCompletionDateInvalidData() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string ProjectName = "Website Creation"; string ProjectDescription = "a new website was created"; //set the EstimatedCompletionDate to a non date value string EstimatedCompletionDate = "no EstimatedCompletionDate mentioned"; //invoke the method OK = AProject.Valid(ProjectName, ProjectDescription, EstimatedCompletionDate); //test to see that the result is correct Assert.IsFalse(OK); }
public void ThisProjectPropertyOK() { //create an instance of the class we want to create clsProjectCollection AllProjects = new clsProjectCollection(); //create some test data to assign to the property clsProject TestProject = new clsProject(); //set the properties of the test object TestProject.AppointmentID = 11; TestProject.AProjectDescription = "project"; TestProject.AProjectID = 2; TestProject.EstimatedCompletionDate = DateTime.Now.Date; TestProject.ClientID = 13; TestProject.StaffID = 15; TestProject.ProjectName = "Website Creation"; //assign the data to the property AllProjects.ThisProject = TestProject; //test to see that the two values are the same Assert.AreEqual(AllProjects.ThisProject, TestProject); }
/// <summary> /// Select by primary key /// </summary> /// <param name="keys">primary keys</param> /// <returns>clsPROJECT business object</returns> public clsProject SelectByPrimaryKey(clsProjectKeys keys) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.CommandText = "dbo.[sp_PROJECT_SelectByPrimaryKey]"; sqlCommand.CommandType = CommandType.StoredProcedure; // Use connection object of base class sqlCommand.Connection = MainConnection; try { sqlCommand.Parameters.Add(new SqlParameter("@PROJ_ID", SqlDbType.Int, 4, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, keys.PROJ_ID)); MainConnection.Open(); IDataReader dataReader = sqlCommand.ExecuteReader(); if (dataReader.Read()) { clsProject businessObject = new clsProject(); PopulateBusinessObjectFromReader(businessObject, dataReader); return(businessObject); } else { return(null); } } catch (Exception ex) { throw new Exception("clsPROJECT::SelectByPrimaryKey::Error occured.", ex); } finally { MainConnection.Close(); sqlCommand.Dispose(); } }
public void TestEstimatedCompletionDateFound() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is ok (assume it is) Boolean OK = true; //create some test data to use with the method int AProjectID = 2; //invoke the method Found = AProject.Find(AProjectID); //check the EstimatedCompletionDate if (AProject.EstimatedCompletionDate != Convert.ToDateTime("19/06/2012")) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void TestAppointmentID() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is OK(Assume it is) Boolean OK = true; //create some test data to use with the method int AProjectID = 2; //invoke the method Found = AProject.Find(AProjectID); //check the AppointmentID if (AProject.AppointmentID != 11) { OK = false; } //test to see that the result is correct Assert.IsTrue(OK); }
public void TestProjectName() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the search Boolean Found = false; //boolean variable to record if data is ok (assume it is) Boolean OK = true; //create some test data to use with the method int AProjectID = 2; //invoke the method Found = AProject.Find(AProjectID); //check the ProjectID if (AProject.ProjectName != "Website Creation") { OK = false; } //test to see if the result is correct Assert.IsTrue(OK); }
public void EstimatedCompletionDateMid() { //create an instance of the class we want to create clsProject AProject = new clsProject(); //boolean variable to store the result of the validation Boolean OK = false; //create some test data to pass to the method string ProjectName = "Website Creation"; string ProjectDescription = "A new Website was created"; //create a variable to store the test date data DateTime TestDate; //set the date totodays date TestDate = DateTime.Now.Date; //convert the date variable to a string variable string EstimatedCompletionDate = TestDate.ToString(); //invoke the method OK = AProject.Valid(ProjectName, ProjectDescription, EstimatedCompletionDate); //test to see that the result is correct Assert.IsTrue(OK); }
////private void CopyAndMove_SW_Model_Dwg_Files(clsProject Project_In, clsFiles Files_In, String FilePath_In) //////======================================================================================================== ////{ //// try //// { //// // MODEL FILES. //// // ----------- //// // //// //....Complete Assy: //// // //// string pFileName_CompleteAssy = FilePath_In + "\\" + mcCompleteAssy_Title; //// if (File.Exists(pFileName_CompleteAssy)) //// File.Delete(pFileName_CompleteAssy); //// File.Copy(Files_In.FileTitle_Template_SW_CompleteAssy, pFileName_CompleteAssy); //// //....Blank Assy: //// // //// string pFileName_BlankAssy = FilePath_In + "\\" + mcBlankAssy_Title; //// if (File.Exists(pFileName_BlankAssy)) //// File.Delete(pFileName_BlankAssy); //// File.Copy(Files_In.FileTitle_Template_SW_BlankAssy, pFileName_BlankAssy); //// //....Radial: //// // //// string pFileName_Radial = FilePath_In + "\\" + mcRadial_Title; //// if (File.Exists(pFileName_Radial)) //// File.Delete(pFileName_Radial); //// File.Copy(Files_In.FileTitle_Template_SW_Radial, pFileName_Radial); //// //....Seal: //// // //// if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Seal || //// Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Seal) //// { //// string pFileName_Seal = FilePath_In + "\\" + mcSeal_Title; //// if (File.Exists(pFileName_Seal)) //// File.Delete(pFileName_Seal); //// File.Copy(Files_In.FileTitle_Template_SW_Seal, pFileName_Seal); //// } //// //....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 pFileName_TL_TB = FilePath_In + "\\" + mcTL_TB_Title; //// if (File.Exists(pFileName_TL_TB)) //// File.Delete(pFileName_TL_TB); //// File.Copy(Files_In.FileTitle_Template_SW_TL_TB, pFileName_TL_TB); //// string pFileName_TB_Assy = FilePath_In + "\\" + mcTBAssy_Title; //// if (File.Exists(pFileName_TB_Assy)) //// File.Delete(pFileName_TB_Assy); //// File.Copy(Files_In.FileTitle_Template_SW_TBAssy, pFileName_TB_Assy); //// } //// // DRAWING FILES. //// // ------------- //// Populate_Dwg_Title_Suffix_Array(Project_In); //// //....Complete Assy. //// // //// string pFileName_Dwg_CompleteAssy = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[1]; //// if (File.Exists(pFileName_Dwg_CompleteAssy)) //// File.Delete(pFileName_Dwg_CompleteAssy); //// //File.Copy(Files_In.FileTitle_Template_SW_CompleteAssy, pFileName_Dwg_CompleteAssy);\ //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_CompleteAssy, pFileName_Dwg_CompleteAssy); //// //....Radial. //// // //// string pFileName_Dwg_Radial = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[2]; //// if (File.Exists(pFileName_Dwg_Radial)) //// File.Delete(pFileName_Dwg_Radial); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_Radial, pFileName_Dwg_Radial); //// //....Roughing. //// // //// string pFileName_Dwg_Roughing = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[5]; //// if (File.Exists(pFileName_Dwg_Roughing)) //// File.Delete(pFileName_Dwg_Roughing); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_Roughing, pFileName_Dwg_Roughing); //// //....Seal(s): //// // //// //....FRONT. //// // //// if (modMain.gProject.Product.EndConfig[0].Type == clsEndConfig.eType.Seal) //// { //// string pFileName_Dwg_Seal_Front = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[3]; //// if (File.Exists(pFileName_Dwg_Seal_Front)) //// File.Delete(pFileName_Dwg_Seal_Front); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_Seal, pFileName_Dwg_Seal_Front); //// } //// //....BACK. //// // //// if (modMain.gProject.Product.EndConfig[1].Type == clsEndConfig.eType.Seal) //// { //// string pFileName_Dwg_Seal_Back = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[4]; //// if (File.Exists(pFileName_Dwg_Seal_Back)) //// File.Delete(pFileName_Dwg_Seal_Back); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_Seal, pFileName_Dwg_Seal_Back); //// } //// //....Thrust Bearing(s): //// // //// //....FRONT. //// // //// if (modMain.gProject.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL) //// { //// string pFileName_Dwg_TB_Front = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[3]; //// if (File.Exists(pFileName_Dwg_TB_Front)) //// File.Delete(pFileName_Dwg_TB_Front); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_TL_TB, pFileName_Dwg_TB_Front); //// //....Blank. //// string pFileName_Dwg_TB_Blank_Front = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[6]; //// if (File.Exists(pFileName_Dwg_TB_Blank_Front)) //// File.Delete(pFileName_Dwg_TB_Blank_Front); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_TL_TB_Blank, pFileName_Dwg_TB_Blank_Front); //// } //// //....BACK. //// // //// if (modMain.gProject.Product.EndConfig[1].Type == clsEndConfig.eType.Thrust_Bearing_TL) //// { //// string pFileName_Dwg_TB_Back = FilePath_In + "\\" + Project_In.AssyDwg.No + mDwg_Title_Suffix[4]; //// if (File.Exists(pFileName_Dwg_TB_Back)) //// File.Delete(pFileName_Dwg_TB_Back); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_TL_TB, pFileName_Dwg_TB_Back); //// //....Blank. //// // //// string pDwg_Title_Suffix = ""; //// if (modMain.gProject.Product.EndConfig[0].Type == clsEndConfig.eType.Seal) //// { //// pDwg_Title_Suffix = mDwg_Title_Suffix[6]; //// } //// else if (modMain.gProject.Product.EndConfig[0].Type == clsEndConfig.eType.Thrust_Bearing_TL) //// { //// pDwg_Title_Suffix = mDwg_Title_Suffix[7]; //// } //// string pFileName_Dwg_TB_Blank_Back = FilePath_In + "\\" + Project_In.AssyDwg.No + pDwg_Title_Suffix; //// if (File.Exists(pFileName_Dwg_TB_Blank_Back)) //// File.Delete(pFileName_Dwg_TB_Blank_Back); //// File.Copy(Files_In.FileTitle_Template_SW_Dwg_TL_TB_Blank, pFileName_Dwg_TB_Blank_Back); //// } //// } //// catch (Exception ex) //// { //// MessageBox.Show("Unable to copy SW File.Please close SW Files."); //// } ////} //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 + "\\" + Files_In.FileTitle_Template_Inventor_Complete; // if (File.Exists(pFileName_CompleteAssy)) // File.Delete(pFileName_CompleteAssy); // File.Copy(Files_In.FileTitle_Template_Inventor_Complete, pFileName_CompleteAssy); // //....Radial Assy: // // // string pFileName_RadialAssy = FilePath_In + "\\" + 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 + "\\" + Files_In.FileTitle_Template_Inventor_Radial; // if (File.Exists(pFileName_Radial)) // File.Delete(pFileName_Radial); // File.Copy(Files_In.FileTitle_Template_Inventor_Radial, pFileName_Radial); // //....Seal Front: // // // if (Project_In.Product.EndConfig[0].Type == clsEndConfig.eType.Seal) // { // string pFileName_Seal_Front = FilePath_In + "\\" + Files_In.FileTitle_Template_Inventor_Seal_Front; // if (File.Exists(pFileName_Seal_Front)) // File.Delete(pFileName_Seal_Front); // File.Copy(Files_In.FileTitle_Template_Inventor_Seal_Front, pFileName_Seal_Front); // } // //....Seal Back: // // // if (Project_In.Product.EndConfig[1].Type == clsEndConfig.eType.Seal) // { // string pFileName_Seal_Back = FilePath_In + "\\" + Files_In.FileTitle_Template_Inventor_Seal_Back; // if (File.Exists(pFileName_Seal_Back)) // File.Delete(pFileName_Seal_Back); // File.Copy(Files_In.FileTitle_Template_Inventor_Seal_Back, pFileName_Seal_Back); // } // } // catch (Exception ex) // { // MessageBox.Show("Unable to copy SW File.Please close SW Files."); // } //} #region "HELPER ROUTINE:" private void Populate_Dwg_Title_Suffix_Array(clsProject Project_In) //================================================================== { int pNo = Convert.ToInt32(Project_In.AssyDwg.No_Suffix); string pPrefix = ""; for (int i = 1; i < mDwg_Title_Suffix.Length; i++) { if (pNo < 10) { pPrefix = "-0"; } else { pPrefix = "-"; } mDwg_Title_Suffix [i] = pPrefix + pNo + ".SLDDRW"; pNo++; } }
private void Populate_tblMapping_Blank(clsProject Project_In, clsDB DB_In) //========================================================================== { try { //....Set Mapping Value. StringCollection pCellColName = new StringCollection(); StringCollection pSoftware_VarName = new StringCollection(); string pOrderBy = " ORDER BY fldItemNo ASC"; DB_In.PopulateStringCol(pCellColName, "tblMapping_Blank", "fldCellColName", pOrderBy); DB_In.PopulateStringCol(pSoftware_VarName, "tblMapping_Blank", "fldSoftware_VarName", pOrderBy); String pUPDATE = "UPDATE tblMapping_Blank "; String pSET = "SET fldSoftware_VarVal = "; String pVALUE = null; String pWHERE = null; String pSQL = null; pSQL = pUPDATE + pSET + "NULL"; DB_In.ExecuteCommand(pSQL); for (int i = 0; i < pSoftware_VarName.Count; i++) { pSQL = null; pWHERE = null; pVALUE = null; if (pSoftware_VarName[i] != "") { switch (pSoftware_VarName[i]) { case "gProject.Product.Bearing.Mat.Base/ gProject.Product.Bearing.Mat.Lining": //------------------------------------------------------------------------ //Col. I string pBaseMat = null; pBaseMat = MatAbbr(((clsBearing_Radial_FP)Project_In.Product.Bearing).Mat.Base); string pLiningMat = null; pLiningMat = MatAbbr(((clsBearing_Radial_FP)Project_In.Product.Bearing).Mat.Lining); pVALUE = "'" + pBaseMat + "/" + pLiningMat + "'"; break; case "gProject.Product.Bearing.SplitConfig": //--------------------------------------- //Col. K string pAny = null; if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SplitConfig) { pAny = "Y"; } else { pAny = "N"; } pVALUE = "'" + pAny + "'"; break; case "gProject.Product.Bearing.SL.Screw_Spec.Type": //------------------------------------------- //Col. N pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Type + "'"; break; case "gProject.Product.Bearing.SL.Screw_Spec.Unit.System": //---------------------------------------------------- //Col. O if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Unit.System.ToString() == "English") { pVALUE = "'I'"; } else { pVALUE = "'M'"; } break; case "gProject.Product.Bearing.SL.Screw_Spec.D": //------------------------------------------- //Col. P if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig.Contains('M')) { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig.Replace('M', ' ').Trim() + "'"; } else { if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig.Contains('/')) { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D.ToString("#0.000") + "'"; } else { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig + "'"; } } break; case "gProject.Product.Bearing.SL.Screw_Spec.Pitch": //----------------------------------------------- //Col. Q pVALUE = "'" + modMain.ConvDoubleToStr(((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Pitch, "") + "'"; break; case "gProject.Product.Bearing.SL.Screw_Spec.L": //-------------------------------------------- //Col. R pVALUE = "'" + modMain.ConvDoubleToStr(((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.L, "") + "'"; break; case "gProject.Product.Bearing.SL.Screw_Spec.Mat": //-------------------------------------------- //Col. S pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Mat + "'"; break; case "gProject.Product.Bearing.SL.Dowel_Spec.Type ": //---------------------------------------------- //Col. AB pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.Type + "'"; break; case "gProject.Product.Bearing.SL.Dowel_Spec.Unit.System": //---------------------------------------------------- //Col. AC if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.Unit.System.ToString() == "English") { pVALUE = "'I'"; } else { pVALUE = "'M'"; } break; case "gProject.Product.Bearing.SL.Dowel_Spec.D": //------------------------------------------ //Col. AD if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D_Desig.Contains('M')) { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D_Desig.Replace('M', ' ').Trim() + "'"; } else { if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D_Desig.Contains('/')) { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D.ToString("#0.000") + "'"; } else { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D_Desig + "'"; } } break; case "gProject.Product.Bearing.SL.Dowel_Spec.L": //------------------------------------------ //Col. AE pVALUE = "'" + modMain.ConvDoubleToStr(((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.L, "") + "'"; break; case "gProject.Product.Bearing.SL.Dowel_Spec.Mat": //-------------------------------------------- //Col. AF pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.Mat + "'"; break; case "gProject.Product.Bearing.SL.Screw_Spec": //---------------------------------------- //Col. BJ if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Unit.System == clsUnit.eSystem.Metric) { //if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig.Contains('M')) //{ // pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig.Replace('M', ' ').Trim() + "x" + // modMain.ConvDoubleToStr(((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Pitch, "") + // " THREAD'"; //} pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig + "x" + modMain.ConvDoubleToStr(((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Pitch, "") + " THREAD'"; } else if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Unit.System == clsUnit.eSystem.English) { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.D_Desig + "-" + modMain.ConvDoubleToStr(((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Screw_Spec.Pitch, "") + "UNC'"; } break; case "gProject.Product.Bearing.SL.Dowel_Spec": //-----------------------------------------//Col. BK if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.Unit.System == clsUnit.eSystem.Metric) { if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D_Desig.Contains('M')) { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D_Desig.Replace('M', ' ').Trim() + "mm'"; } } else if (((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.Unit.System == clsUnit.eSystem.English) { pVALUE = "'" + ((clsBearing_Radial_FP)Project_In.Product.Bearing).SL.Dowel_Spec.D_Desig + "'"; } break; } if (pVALUE != null) { pWHERE = " WHERE fldCellColName = '" + pCellColName[i] + "'"; pSQL = pUPDATE + pSET + pVALUE + pWHERE; DB_In.ExecuteCommand(pSQL); } } } } catch (Exception pEXP) { MessageBox.Show("Excel File Error - " + pEXP.Message); } }
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) { } }