// Применяем свойства из SQL public void AddCustomProperty(string configName, string matName, SldWorks swApp) { try { var materialDataTable = MaterialsTable(); foreach (DataRow dataRow in materialDataTable.Rows) { if (dataRow["MaterialsName"].ToString() == matName) { var Thickness = dataRow["Thickness"].ToString(); var setThickness = new SetMaterials(); if (Convert.ToBoolean(Thickness)) { setThickness.AddPropThickness(configName, true); } else { setThickness.AddPropThickness(configName, false); } var lvlId = dataRow["LevelID"].ToString(); //string MaterialName = datarow[MatName].ToString(); //string matName = dataRow["MaterialsName"].ToString(); var materialsNameEng = dataRow["MaterialsNameEng"].ToString(); var codeErp = dataRow["ERP"].ToString(); //string Plotnost = dataRow["destiny"].ToString(); var swProp = dataRow["swProperty"].ToString(); //string Description = dataRow["Descrip"].ToString(); var codeMateriala = dataRow["CodeMaterial"].ToString(); var descriptCode = dataRow["DescriptionCode"].ToString(); var setCustomProperty = new SetMaterials(); setCustomProperty.CustomProperty(lvlId, configName, swProp, materialsNameEng, codeErp, codeMateriala, descriptCode, swApp); } } } catch (Exception ex) { Error = ex.Message; } }
// Применяем свойства из SQL public void AddCustomProperty(string configName, int materialID, SldWorks swApp) { int lvlId; string materialsNameEng; string codeErp; string swProp; string codeMateriala; string descriptCode; DataTable materialDataTable = MaterialsTable(); SetMaterials setMat = new SetMaterials(swApp); foreach (DataRow dataRow in materialDataTable.Rows) { if ((int)dataRow["LevelID"] == materialID) { string Thickness = dataRow["Thickness"].ToString(); if (Convert.ToBoolean(Thickness)) { setMat.Thickness(configName, true); } else { setMat.Thickness(configName, false); } lvlId = (int)dataRow["LevelID"]; materialsNameEng = dataRow["MaterialsNameEng"].ToString(); codeErp = dataRow["ERP"].ToString(); swProp = dataRow["swProperty"].ToString(); codeMateriala = dataRow["CodeMaterial"].ToString(); descriptCode = dataRow["MaterialsName"].ToString(); setMat.CustomProperty(lvlId, configName, swProp, materialsNameEng, codeErp, codeMateriala, descriptCode, swApp); } } setMat.ApplyMaterial("", configName, materialID, swApp); }