本文整理汇总了C#中ModelDoc2.GetCustomInfoNames2方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.GetCustomInfoNames2方法的具体用法?C# ModelDoc2.GetCustomInfoNames2怎么用?C# ModelDoc2.GetCustomInfoNames2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelDoc2
的用法示例。
在下文中一共展示了ModelDoc2.GetCustomInfoNames2方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sendAttributes
private void sendAttributes(ModelDoc2 model, Collection<AttributeInfo> componentsAttributesCollection, string path, string orderNumber, int fileType, string filePath, string fileName, string configuration)
{
string[] attributeNames = model.GetCustomInfoNames2(configuration);
foreach (string attributeName in attributeNames)
{
string attributeValue = model.GetCustomInfoValue(configuration, attributeName);
//Проверка записано ли свойство такого файла
AttributeInfo attributeInfo = new AttributeInfo { Path = path, AttributeName = attributeName, AttributeValue = attributeValue };
KeyValuePair<string, string> componentAttribute = new KeyValuePair<string, string>(path, attributeName);
if (!componentsAttributesCollection.Contains(attributeInfo))
{
componentsAttributesCollection.Add(attributeInfo);
//конвертация булевых атрибутов в формат БД
if (model.GetCustomInfoType3(configuration, attributeName) == 11)
attributeValue = (attributeValue == "Yes") ? "T" : "F";
//пропуск свойств без значений
if (!string.IsNullOrEmpty(attributeValue))
using (OracleCommand cmd = new OracleCommand())
{
cmd.Connection = Connection;
cmd.CommandText = "GENERAL.SWR_FILEDATA_ADD_SW";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("P_NUMAGREE", OracleDbType.Varchar2).Value = orderNumber;
cmd.Parameters.Add("P_CODEFILETYPE", OracleDbType.Int32).Value = fileType;
cmd.Parameters.Add("P_FILEPATH", OracleDbType.Varchar2).Value = filePath;
cmd.Parameters.Add("P_FILENAME", OracleDbType.Varchar2).Value = fileName;
cmd.Parameters.Add("P_IDFILEATTRIBUTE", OracleDbType.Varchar2).Value = attributeName;
cmd.Parameters.Add("P_ATTRIBUTEVALUE", OracleDbType.Varchar2).Value = attributeValue;
cmd.Parameters.Add("P_COMMIT", OracleDbType.Char).Value = 'T';
cmd.ExecuteNonQuery();
}
}
else
{
}
}
}
示例2: SetColorProperty
private bool SetColorProperty(ModelDoc2 inModel, string colorProp, OleDbConnection oleDb, string colorName,
string column, OleDbConnection oleDbDecorDef)
{
bool isColorChanged = false;
if (colorProp != "")
{
var names = (string[])inModel.GetCustomInfoNames2("");
if (names.Contains(colorProp))
{
isColorChanged = _mSwAddin.SetModelProperty(inModel, colorProp, "",
swCustomInfoType_e.swCustomInfoText,
colorName, true);
if (oleDbDecorDef != null)
{
string fullDecorName = string.Empty;
string[] restrictionValues = new string[3] { null, null, "decornames" };
DataTable schemaInformation = oleDbDecorDef.GetSchema("Tables", restrictionValues);
if (schemaInformation.Rows.Count == 0)
fullDecorName = string.Empty;
else
{
string selectStr = @"select * from decornames where FILEJPG = """ +
colorName + @"""";
var cmDecorDef = new OleDbCommand(selectStr, oleDbDecorDef);
var rdDecorDef = cmDecorDef.ExecuteReader();
while (rdDecorDef.Read())
{
fullDecorName = rdDecorDef["DecorName"].ToString();
}
schemaInformation.Dispose();
cmDecorDef.Dispose();
rdDecorDef.Close();
}
int index;
if (int.TryParse(colorProp.Substring(colorProp.Length - 1, 1), out index))
_mSwAddin.SetModelProperty(inModel, "ColorName" + index.ToString(), "",
swCustomInfoType_e.swCustomInfoText,
fullDecorName, true);
}
}
}
else
{
if (column == "Part Color Priority")
MessageBox.Show(@"В файле " + Environment.NewLine + oleDb.DataSource + Environment.NewLine +
@" в столбце 'Part Color Priority', Element: " +
Path.GetFileNameWithoutExtension(
_mSwAddin.GetModelNameWithoutSuffix(inModel.GetPathName()))
+ @" ошибка!", _mSwAddin.MyTitle, MessageBoxButtons.OK,
MessageBoxIcon.Information);
else
MessageBox.Show(@"В файле " + Environment.NewLine + oleDb.DataSource + Environment.NewLine +
@" в столбце '" + column + @"' ошибка!", _mSwAddin.MyTitle, MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
return isColorChanged;
}
示例3: CheckPropForArticul
private bool CheckPropForArticul(ModelDoc2 model)
{
bool ret = false;
var commonPropNames = (string[])model.GetCustomInfoNames();
foreach (var commonPropName in commonPropNames)
{
if (commonPropName.ToLower() == "articul" && model.GetCustomInfoValue("", commonPropName) != "")
ret = true;
}
if (model.GetConfigurationCount() >= 1)
{
string confName = model.IGetActiveConfiguration().Name;
var confPropNames = (string[])model.GetCustomInfoNames2(confName);
foreach (var confPropName in confPropNames)
{
if (confPropName.ToLower() == "articul" && model.GetCustomInfoValue(confName, confPropName) != "")
ret = true;
}
}
return ret;
}