//....Class Constructor //public clsProduct(clsUnit.eSystem UnitSystem_In, clsBearing.eType Type_In, clsBearing_Radial_FP.eDesign Design_In, // clsEndConfig.eType [] EndConfigType_In, clsDB DB_In) ////================================================================================================================ //{ // mUnit.System = UnitSystem_In; // //Main Component. // //--------------- // // // if (Type_In == clsBearing.eType.Radial) // { // if (Design_In == clsBearing_Radial.eDesign.Flexure_Pivot) // { // mBearing = new clsBearing_Radial_FP(UnitSystem_In, Type_In, Design_In, DB_In, this); // } // } // //End Configurations: // //------------------- // // // mEndConfig = new clsEndConfig[2]; // for (int i = 0; i < 2; i++) // { // if (EndConfigType_In [i]== clsEndConfig.eType.Seal) //....End Seal. // { // mEndConfig[i] = new clsSeal (UnitSystem_In, EndConfigType_In [i], DB_In, this); // } // else if (EndConfigType_In[i] == clsEndConfig.eType.Thrust_Bearing_TL) //....End TB. // { // mEndConfig[i] = new clsBearing_Thrust_TL (UnitSystem_In, EndConfigType_In [i], DB_In, this); // } // } // //Accessories. // //--------------- // // // mAccessories = new clsAccessories(); //} public clsProduct(clsUnit.eSystem UnitSystem_In, clsDB DB_In) //=========================================================== { //PB 23JAN13. At the time of instantiation of this object, the Bearing Type & Bearing Design, EndConfig [0,1] Types are //....known. Hence, instantiate mBearing & mEndConfig [0,1] using the above info. To be done in the future. // Initialize. // ----------- // //....Unit System. mUnit = new clsUnit(); //....Default unit = English (automatically). mUnit.System = UnitSystem_In; //....Bearing. //mBearing = new clsBearing_Radial_FP(clsUnit.eSystem.English, clsBearing.eType.Radial, // clsBearing_Radial.eDesign.Flexure_Pivot, DB_In, this); mBearing = new clsBearing_Radial_FP(mUnit.System, clsBearing.eType.Radial, clsBearing_Radial.eDesign.Flexure_Pivot, DB_In, this); //....End Configurations: clsEndConfig.eType[] pEndConfig = new clsEndConfig.eType[2]; for (int i = 0; i < pEndConfig.Length; i++) { pEndConfig[i] = clsEndConfig.eType.Seal; //....Default cofigs = [Seal, Seal] } mEndConfig = new clsEndConfig[2]; for (int i = 0; i < 2; i++) { mEndConfig[i] = new clsSeal(mUnit.System, pEndConfig[i], DB_In, this); } //....Accessories. mAccessories = new clsAccessories(); }
private void CopyProject() //======================== { mProject.No = cmbProjectNo_From.Text; mProject.No_Suffix = cmbProjectNo_Suffix_From.Text; clsEndConfig.eType[] pEndConfig_Type = new clsEndConfig.eType[2]; ////modMain.gDB.Retrieve_EndConfigs_Type(mProject, pEndConfig_Type); //BG 21DEC12 mProject = new clsProject(modMain.gProject.Unit.System); mProject.Product = new clsProduct(mProject.Unit.System, modMain.gDB); for (int i = 0; i < 2; i++) { if (pEndConfig_Type[i] == clsEndConfig.eType.Seal) //....End Seal. { mProject.Product.EndConfig[i] = new clsSeal(mProject.Unit.System, pEndConfig_Type[i], modMain.gDB, mProject.Product); } else if (pEndConfig_Type[i] == clsEndConfig.eType.Thrust_Bearing_TL) //....End TB. { mProject.Product.EndConfig[i] = new clsBearing_Thrust_TL(mProject.Unit.System, pEndConfig_Type[i], modMain.gDB, mProject.Product); } } mProject.No = cmbProjectNo_From.Text; mProject.No_Suffix = cmbProjectNo_Suffix_From.Text; ////modMain.gDB.RetrieveRecord(mProject, mOpCond); modMain.gProject = (clsProject)mProject.Clone(); modMain.gOpCond = (clsOpCond)mOpCond.Clone(); modMain.gProject.No = txtProjectNo_To.Text; modMain.gProject.No_Suffix = txtProjectNo_Suffix_To.Text; }
private void cmbEndConfig_SelectedIndexChanged(object sender, EventArgs e) //========================================================================= { clsEndConfig.eType[] pEndConfig_Type_Existing = new clsEndConfig.eType[] { mProject.Product.EndConfig[0].Type, mProject.Product.EndConfig[1].Type }; clsEndConfig.eType[] pEndConfig_Type_Current = new clsEndConfig.eType[2]; ComboBox pCmbBox = (ComboBox)sender; string pName = pCmbBox.Name; int index = 0; switch (pName) { case "cmbEndConfig_Front": index = 0; break; case "cmbEndConfig_Back": index = 1; break; } pEndConfig_Type_Current[index] = (clsEndConfig.eType)Enum.Parse(typeof(clsEndConfig.eType), pCmbBox.Text.Replace(" ", "_")); if (pEndConfig_Type_Current[index] != pEndConfig_Type_Existing[index]) { if (pEndConfig_Type_Current[index] == clsEndConfig.eType.Seal) { mProject.Product.EndConfig[index] = new clsSeal(mProject.Unit.System, pEndConfig_Type_Current[index], modMain.gDB, mProject.Product); } else { mProject.Product.EndConfig[index] = new clsBearing_Thrust_TL(mProject.Unit.System, pEndConfig_Type_Current[index], modMain.gDB, mProject.Product); } } }
private void SaveData() //====================== { Boolean pNewProject = true; if (modMain.gProject != null) { if (modMain.gProject.Unit.System != (clsUnit.eSystem)Enum.Parse(typeof(clsUnit.eSystem), cmbUnitSystem.Text)) { pNewProject = true; } else { clsEndConfig.eType[] pType = new clsEndConfig.eType[2]; pType[0] = (clsEndConfig.eType)Enum.Parse(typeof(clsEndConfig.eType), cmbEndConfig_Front.Text.Replace(" ", "_")); pType[1] = (clsEndConfig.eType)Enum.Parse(typeof(clsEndConfig.eType), cmbEndConfig_Back.Text.Replace(" ", "_")); for (int i = 0; i < 2; i++) { if (modMain.gProject.Product.EndConfig[i].Type != pType[i]) { pNewProject = true; break; } else { pNewProject = false; } } } } if (pNewProject) { clsUnit.eSystem pUnitSystem = (clsUnit.eSystem)Enum.Parse(typeof(clsUnit.eSystem), cmbUnitSystem.Text); modMain.gProject = new clsProject(pUnitSystem); modMain.gProject.No = txtNo.Text; //modMain.gProject.No_Suffix = txtNo_Suffix.Text; //....Product //........Bearing modMain.gProject.Product.Bearing.Type = (clsBearing.eType)Enum.Parse(typeof(clsBearing.eType), cmbProduct.Text); ((clsBearing_Radial)modMain.gProject.Product.Bearing).Design = (clsBearing_Radial.eDesign)Enum.Parse(typeof(clsBearing_Radial.eDesign), cmbType.Text.ToString().Replace(" ", "_")); //Customer. //--------- modMain.gProject.Customer_Name = txtCustomer_Name.Text; clsEndConfig.eType[] pType = new clsEndConfig.eType[2]; pType[0] = (clsEndConfig.eType)Enum.Parse(typeof(clsEndConfig.eType), cmbEndConfig_Front.Text.Replace(" ", "_")); pType[1] = (clsEndConfig.eType)Enum.Parse(typeof(clsEndConfig.eType), cmbEndConfig_Back.Text.Replace(" ", "_")); for (int i = 0; i < 2; i++) { if (pType[i] == clsEndConfig.eType.Seal) { modMain.gProject.Product.EndConfig[i] = new clsSeal(modMain.gProject.Unit.System, pType[i], modMain.gDB, modMain.gProject.Product); } else if (pType[i] == clsEndConfig.eType.Thrust_Bearing_TL) { modMain.gProject.Product.EndConfig[i] = new clsBearing_Thrust_TL(modMain.gProject.Unit.System, pType[i], modMain.gDB, modMain.gProject.Product); } } } }