当前位置: 首页>>代码示例>>C#>>正文


C# ModelDoc2.GetCustomInfoValue方法代码示例

本文整理汇总了C#中ModelDoc2.GetCustomInfoValue方法的典型用法代码示例。如果您正苦于以下问题:C# ModelDoc2.GetCustomInfoValue方法的具体用法?C# ModelDoc2.GetCustomInfoValue怎么用?C# ModelDoc2.GetCustomInfoValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelDoc2的用法示例。


在下文中一共展示了ModelDoc2.GetCustomInfoValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FillForProductQuery

        private void FillForProductQuery(ModelDoc2 swSelModel, string config, ref int size1, ref int size2, ref int size3, ref int size4, ref int size5, ref int size6, ref int size7, ref int size8, ref string idColor1, ref string idColor2, ref string idColor3, ref string idColor4, ref string idColor5)
        {
            int tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size1"), out tmpInt))
                size1 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size2"), out tmpInt))
                size2 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size3"), out tmpInt))
                size3 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size4"), out tmpInt))
                size4 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size5"), out tmpInt))
                size5 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size6"), out tmpInt))
                size6 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size7"), out tmpInt))
                size7 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size8"), out tmpInt))
                size8 = tmpInt;

            string tmpString = swSelModel.GetCustomInfoValue(config, "Color1");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor1 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Color2");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor2 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Color3");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor3 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Color4");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor4 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Color5");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor5 = tmpString;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:46,代码来源:Repository.cs

示例2: AutoDimensionDrawing2

        private void AutoDimensionDrawing2(ModelDoc2 swModel, bool many )
        {
            bool del3List = false;
            var thrdList = new List<string>();
            int shi = 0;
            isValidXml = true;

            var swDrawing = (DrawingDoc)swModel;
            if (swModel.GetCustomInfoValue("", "AutoDim") == "No")
            {
                if (many)
                {
                    MessageBox.Show(@"Если хотите образмерить чертеж, смените No на Yes в поле 'AutoDim' свойств данного чертежа",
                        @"MrDoors", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                isValidXml = false;
            }
            if (swModel.GetCustomInfoValue("", "MakeCNCprog") == "Yes")
            {
                _createProgramm = true;
            }
            if (!isValidXml && !_createProgramm) // если не надо создавать программу и авто дим = но, то образмеривать просто не нужно.
                return;
            swModel.Extension.SetUserPreferenceDouble((int)swUserPreferenceDoubleValue_e.swDetailingDimToDimOffset,
                                                      (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, 0.006);
            swModel.Extension.SetUserPreferenceDouble((int)swUserPreferenceDoubleValue_e.swDetailingObjectToDimOffset,
                                                      (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified, 0.010);

            Dictionary<string, bool> listSide;
            string targetModelPath = null;
            if (!File.Exists(Path.Combine(Path.GetDirectoryName(_swAdd.RootModel.GetPathName()), "fpTime.txt")))
            {
                //MessageBox.Show("Образмеривание детали может пройти некорректно! Для корректного образмеривания детали необходимо произвести Окончательную обработку заказа.");
                throw new Exception("Образмеривание детали может пройти некорректно! Для корректного образмеривания детали необходимо произвести Окончательную обработку заказа.");
            }
            else
            {
                //просто взять Sketch Number

               string fnameWithoutExt = Path.GetFileNameWithoutExtension(swModel.GetPathName());
                fnameWithoutExt = fnameWithoutExt.Substring(fnameWithoutExt.Length - 4, 4);
                SwDMDocument8 swDoc = null;
                SwDMApplication swDocMgr = SwAddin.GetSwDmApp();
                SwDmDocumentOpenError oe;
                SwDmCustomInfoType type;
                if (!(fnameWithoutExt[0] == '#' && (fnameWithoutExt[3] == 'P' || fnameWithoutExt[3] == 'p')))
                {

                    swDoc = (SwDMDocument8) swDocMgr.GetDocument(Path.ChangeExtension(swModel.GetPathName(), "SLDASM"),SwDmDocumentType.swDmDocumentAssembly, true, out oe);

                }
                else
                {
                    object brokenRefVar;
                    SwDMSearchOption src = swDocMgr.GetSearchOptionObject();

                    var swDocDraw = (SwDMDocument8)swDocMgr.GetDocument(swModel.GetPathName(), SwDmDocumentType.swDmDocumentDrawing, true, out oe);
                    var varRef = (object[])swDocDraw.GetAllExternalReferences2(src, out brokenRefVar);
                    swDocDraw.CloseDoc();
                    targetModelPath = (string)varRef[0];
                    swDoc = (SwDMDocument8)swDocMgr.GetDocument(targetModelPath, SwDmDocumentType.swDmDocumentAssembly, true, out oe);
                }
                if (swDoc != null)
                {
                    var prop = swDoc.GetCustomProperty("Sketch Number", out type);
                    if (string.IsNullOrEmpty(prop) || prop == "0")
                        throw new Exception("Образмеривание детали прервано, т.к. может пройти некорректно ! Для корректного образмеривания детали необходимо произвести Окончательную обработку заказа.");
                    swDoc.CloseDoc();
                }
                _swAdd.SetModelProperty(swModel, "WasMesure", string.Empty, swCustomInfoType_e.swCustomInfoYesOrNo, "Yes", true);
            }
            string pathXml = WriteXmlFile(swModel, isValidXml, targetModelPath);

            bool isNeededSheetNumber = PrepareDrawingDoc(swModel, out listSide);
            bool dimOnlyNew = false;
            if (swModel.GetCustomInfoValue("", "DimOnlyNew") == "Yes")
                dimOnlyNew = true;
            var vSheetNames = (string[])swDrawing.GetSheetNames();
            var rootNode = _node;
            bool atLeastOneF1View = false;

            foreach (var vSheetName in vSheetNames)
            {
                bool iftherewasAhole = false;
                XmlElement element = null;
                XmlElement sheetNode = null;
                KeyValuePair<string,string> tableNameAttribute = new KeyValuePair<string, string>();
                if (_createProgramm && !string.IsNullOrEmpty(pathXml))
                {
                    element = _cxml.CreateElement("Sheet");
                    element.SetAttribute("Name", vSheetName);
                    _node = rootNode.AppendChild(element);
                    sheetNode = element;
                }

                double vScale = 0;
                var type = new List<string>();
                var listSize = new List<SizeForDim>();
                swDrawing.ActivateSheet(vSheetName);
//.........这里部分代码省略.........
开发者ID:digger1985,项目名称:MyCode,代码行数:101,代码来源:DimensionDraft.cs

示例3: execQueryProduct

        //через открытое соединение
        private decimal execQueryProduct(string sql, ModelDoc2 swSelModel)
        {
            string currentConfig = swSelModel.IGetActiveConfiguration().Name;
            if (currentConfig.ToLower().Contains("по умолчани") || currentConfig.ToLower().Contains("default"))
                currentConfig = string.Empty;
            string articul = swSelModel.GetCustomInfoValue(currentConfig, "Articul");
            if (string.IsNullOrEmpty(articul))
            {
                articul = swSelModel.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    throw new ArticleNotFoundException("Отсутствует артикул!", swSelModel);
            }
            int size1 = 0, size2 = 0, size3 = 0, size4 = 0, size5 = 0, size6 = 0, size7 = 0, size8 = 0;
            string idColor1 = string.Empty, idColor2 = string.Empty, idColor3 = string.Empty, idColor4 = string.Empty, idColor5 = string.Empty;
            FillForProductQuery(swSelModel, string.Empty, ref size1, ref size2, ref size3, ref size4, ref size5, ref size6, ref size7, ref size8, ref idColor1, ref idColor2, ref idColor3, ref idColor4, ref idColor5);
            if (currentConfig != string.Empty)
                FillForProductQuery(swSelModel, currentConfig, ref size1, ref size2, ref size3, ref size4, ref size5, ref size6, ref size7, ref size8, ref idColor1, ref idColor2, ref idColor3, ref idColor4, ref idColor5);

            using (OracleCommand cmd = new OracleCommand(sql))
            {
                cmd.Connection = Connection;
                cmd.CommandType = CommandType.Text;
                cmd.BindByName = true;
                cmd.Parameters.Add(new OracleParameter("P_NUMAGREE", _orderNumber));//"040714-1255-0101"));
                cmd.Parameters.Add(new OracleParameter("P_IDCOMPONENT", articul));
                cmd.Parameters.Add(new OracleParameter("P_SIZE1", size1));
                cmd.Parameters.Add(new OracleParameter("P_SIZE2", size2));
                cmd.Parameters.Add(new OracleParameter("P_SIZE3", size3));
                cmd.Parameters.Add(new OracleParameter("P_SIZE4", size4));
                cmd.Parameters.Add(new OracleParameter("P_SIZE5", size5));
                cmd.Parameters.Add(new OracleParameter("P_SIZE6", size6));
                cmd.Parameters.Add(new OracleParameter("P_SIZE7", size7));
                cmd.Parameters.Add(new OracleParameter("P_SIZE8", size8));

                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR1", idColor1));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR2", idColor2));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR3", idColor3));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR4", idColor4));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR5", idColor5));

                OracleDataReader reader = cmd.ExecuteReader();

                if (reader.Read())
                {
                    if (reader["PRICE"] is decimal)
                        return (decimal)reader["PRICE"];
                    else
                        throw new Exception("Неправильный результат цены:" + reader["PRICE"]);
                }
                else
                    throw new Exception("Ошибка соединения с БД.");
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:54,代码来源:Repository.cs

示例4: FillForNonProductQuery

        private void FillForNonProductQuery(ModelDoc2 swSelModel, string config, ref int size1, ref int size2, ref int size1Work, ref int size2Work, ref string idColor1, ref string idColor2, ref string idColor3, ref string faner11, ref string faner12, ref string faner21, ref string faner22, ref string colorfaner11, ref string colorfaner12, ref string colorfaner21, ref string colorfaner22)
        {
            int tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size1"), out tmpInt))
                size1 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Size2"), out tmpInt))
                size2 = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Part Size1"), out tmpInt))
                size1Work = tmpInt;
            if (int.TryParse(swSelModel.GetCustomInfoValue(config, "Part Size2"), out tmpInt))
                size2Work = tmpInt;

            string tmpString = swSelModel.GetCustomInfoValue(config, "Color1");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor1 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Color2");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor2 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Color3");
            if (tmpString.Contains("Color") || tmpString == "-")
                tmpString = string.Empty;
            if (!string.IsNullOrEmpty(tmpString))
                idColor3 = tmpString;

            tmpString = swSelModel.GetCustomInfoValue(config, "Faner11");
            if (!string.IsNullOrEmpty(tmpString))
                faner11 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Faner12");
            if (!string.IsNullOrEmpty(tmpString))
                faner12 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Faner21");
            if (!string.IsNullOrEmpty(tmpString))
                faner21 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "Faner22");
            if (!string.IsNullOrEmpty(tmpString))
                faner22 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "colorFaner11");
            if (!string.IsNullOrEmpty(tmpString))
                colorfaner11 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "colorFaner12");
            if (!string.IsNullOrEmpty(tmpString))
                colorfaner12 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "colorFaner21");
            if (!string.IsNullOrEmpty(tmpString))
                colorfaner21 = tmpString;
            tmpString = swSelModel.GetCustomInfoValue(config, "colorFaner22");
            if (!string.IsNullOrEmpty(tmpString))
                colorfaner22 = tmpString;
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:53,代码来源:Repository.cs

示例5: NullReferenceException

        /// <summary>
        /// Возвращает цену компонента из БД
        /// </summary>
        /// <param name="model">Модель компонента</param>
        /// <returns>Цена</returns>
        private decimal сalculatePriceForModel(ModelDoc2 model)
        {
            try
            {
                bool isProduct = false;
                string isProductStr = model.GetCustomInfoValue("", "IsProduct");
                if (!string.IsNullOrEmpty(currentState))
                    throw new NullReferenceException("currentState");

                if (string.IsNullOrEmpty(isProductStr))
                    isProduct = false;
                if (isProductStr.ToLower().Contains("yes"))
                    isProduct = true;
                if (!isProduct)
                    return execQueryNonProduct("SELECT SCENTRE.GETSCICOMPPRICE_SWR(:P_NUMAGREE,:P_IDCOMPONENT,:P_SIZE1,:P_SIZE2,:P_SIZE1WORK,:P_SIZE2WORK,:P_IDCOLOR1,:P_IDCOLOR2,:P_IDCOLOR3,:P_IDFANER11,:P_IDFANER12,:P_IDCOLORFANER11,:P_IDCOLORFANER12,:P_IDFANER21,:P_IDFANER22,:P_IDCOLORFANER21,:P_IDCOLORFANER22,:P_ITPRODCALCPARENT) AS PRICE FROM DUAL", model);
                else
                    return execQueryProduct("SELECT SCENTRE.GETSCIPRODPRICE_SWR(:P_NUMAGREE,:P_IDCOMPONENT,:P_SIZE1,:P_SIZE2,:P_SIZE3,:P_SIZE4,:P_SIZE5,:P_SIZE6,:P_SIZE7,:P_SIZE8,:P_IDCOLOR1,:P_IDCOLOR2,:P_IDCOLOR3,:P_IDCOLOR4,:P_IDCOLOR5) AS PRICE FROM DUAL", model);

            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("ORA-01012") || ex.Message.Contains("ORA - 02396"))
                {
                    instance = new Repository();
                }
                throw ex;
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:33,代码来源:Repository.cs

示例6: execQueryNonProduct

        private decimal execQueryNonProduct(string sql, ModelDoc2 swSelModel)
        {
            string currentConfig = swSelModel.IGetActiveConfiguration().Name;
            if (currentConfig.ToLower().Contains("по умолчани") || currentConfig.ToLower().Contains("default"))
                currentConfig = string.Empty;
            string articul = swSelModel.GetCustomInfoValue(currentConfig, "Articul");
            if (string.IsNullOrEmpty(articul))
            {
                articul = swSelModel.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    throw new ArticleNotFoundException("Отсутствует артикул!", swSelModel);
            }
            int size1Work = 0, size2Work = 0, size1 = 0, size2 = 0;
            string idColor1 = string.Empty, idColor2 = string.Empty, idColor3 = string.Empty, faner11 = string.Empty, faner12 = string.Empty, faner21 = string.Empty, faner22 = string.Empty, colorfaner11 = string.Empty, colorfaner12 = string.Empty, colorfaner21 = string.Empty, colorfaner22 = string.Empty;
            FillForNonProductQuery(swSelModel, string.Empty, ref size1, ref size2, ref size1Work, ref size2Work, ref idColor1, ref idColor2, ref idColor3, ref faner11, ref faner12, ref faner21, ref faner22, ref colorfaner11, ref colorfaner12, ref colorfaner21, ref colorfaner22);
            if (currentConfig != string.Empty)
                FillForNonProductQuery(swSelModel, currentConfig, ref size1, ref size2, ref size1Work, ref size2Work, ref idColor1, ref idColor2, ref idColor3, ref faner11, ref faner12, ref faner21, ref faner22, ref colorfaner11, ref colorfaner12, ref colorfaner21, ref colorfaner22);

            using (OracleCommand cmd = new OracleCommand(sql))
            {
                cmd.Connection = Connection;
                cmd.CommandType = CommandType.Text;
                cmd.BindByName = true;
                cmd.Parameters.Add(new OracleParameter("P_NUMAGREE", _orderNumber));//"040714-1255-0101"));
                cmd.Parameters.Add(new OracleParameter("P_IDCOMPONENT", articul));
                cmd.Parameters.Add(new OracleParameter("P_SIZE1", size1));
                cmd.Parameters.Add(new OracleParameter("P_SIZE2", size2));
                var curPrm = new OracleParameter("P_SIZE1WORK", OracleDbType.Int32, ParameterDirection.Input);
                curPrm.Value = size1Work;
                cmd.Parameters.Add(curPrm);
                curPrm = new OracleParameter("P_SIZE2WORK", OracleDbType.Int32, ParameterDirection.Input);
                curPrm.Value = size2Work;
                cmd.Parameters.Add(curPrm);
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR1", idColor1));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR2", idColor2));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLOR3", idColor3));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER11", faner11));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER12", faner12));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER11", colorfaner11));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER12", colorfaner12));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER21", faner21));
                cmd.Parameters.Add(new OracleParameter("P_IDFANER22", faner22));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER21", colorfaner21));
                cmd.Parameters.Add(new OracleParameter("P_IDCOLORFANER22", colorfaner22));
                cmd.Parameters.Add(new OracleParameter("P_ITPRODCALCPARENT", DBNull.Value));
                OracleDataReader reader = cmd.ExecuteReader();
                if (reader.Read())
                {
                    if (reader["PRICE"] is decimal)
                        return (decimal)reader["PRICE"];
                    else
                        return 0;
                }
                else
                    throw new Exception("Ошибка соединения с БД.");
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:57,代码来源:Repository.cs

示例7: 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
                {
                }
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:44,代码来源:Repository.cs

示例8: getPriceForComponent

        private void getPriceForComponent(ModelDoc2 model, bool ParentCalcStruct, Action<decimal> nextPrice, Action<Exception, string> nextError)
        {
            string currentConfig = model.IGetActiveConfiguration().Name;

            if (currentConfig.ToLower().Contains("по умолчани") || currentConfig.ToLower().Contains("default"))
                currentConfig = string.Empty;

            string isProduct = model.GetCustomInfoValue(currentConfig, "IsProduct");
            if (string.IsNullOrEmpty(isProduct))
            {
                isProduct = model.GetCustomInfoValue(string.Empty, "IsProduct");
                if (string.IsNullOrEmpty(isProduct))
                    isProduct = "No";
            }

            if (isProduct == "Yes")
            {
                //изделие

                //Проверка существования артикула для компонента в случает отсутствия, расчет цены на сам компонент не производится
                string articul = model.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    articul = model.GetCustomInfoValue(currentConfig, "Articul");

                if (!string.IsNullOrEmpty(articul))
                {
                    try
                    {
                        nextPrice(сalculatePriceForModel(model));
                    }
                    catch (Exception e)
                    {
                        if (checkError(e))
                            nextError(e, Path.GetFileName(model.GetPathName()));
                    }
                }

                string s = model.GetPathName();
                AssemblyDoc model_assembly = model as AssemblyDoc;
                if (model_assembly != null)
                {
                    bool calcStruct = true;
                    if (!string.IsNullOrEmpty(articul))
                    {
                        string calcStructStr = model.get_CustomInfo2(string.Empty, "CalcStruct");
                        if (calcStructStr.ToLower() == "no")
                            calcStruct = false;
                    }

                    var components = (object[])((AssemblyDoc)model).GetComponents(true);
                    foreach (var component in components)
                    {
                        var comp = (Component2)component;
                        ModelDoc2 _model = comp.IGetModelDoc();
                        if (_model != null)
                        {
                            getPriceForComponent(_model, calcStruct, nextPrice, nextError);
                        }
                    }
                }
            }
            else
            {
                //не изделие

                string articul = model.GetCustomInfoValue(string.Empty, "Articul");
                if (string.IsNullOrEmpty(articul))
                    articul = model.GetCustomInfoValue(currentConfig, "Articul");

                string isIndependentStr = model.get_CustomInfo2(string.Empty, "IsIndependent");
                bool isIndependent = true;
                if (string.IsNullOrEmpty(isIndependentStr) || isIndependentStr.ToLower() == "no")
                    isIndependent = false;

                if (isIndependent)
                {
                    bool calcStruct = true;
                    if (!string.IsNullOrEmpty(articul))
                    {
                        //независимый и с артикулом
                        try
                        {
                            nextPrice(сalculatePriceForModel(model));
                        }
                        catch (Exception e)
                        {
                            if (checkError(e))
                                nextError(e, Path.GetFileName(model.GetPathName()));
                        }
                        string calcStructStr = model.get_CustomInfo2(string.Empty, "CalcStruct");

                        if (calcStructStr.ToLower() == "no")
                            calcStruct = false;
                    }

                    if (calcStruct)
                    {
                        AssemblyDoc model_assembly = model as AssemblyDoc;
                        if (model_assembly != null)
                        {
//.........这里部分代码省略.........
开发者ID:digger1985,项目名称:MyCode,代码行数:101,代码来源:Repository.cs

示例9: 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;
 }
开发者ID:digger1985,项目名称:MyCode,代码行数:21,代码来源:SwAddin.cs

示例10: SetModelProperty

 public bool SetModelProperty(ModelDoc2 model, string fieldName, string cfgName, swCustomInfoType_e fieldType, string val, bool checkFirst = false)
 {
     bool isPropertyChanged = false;
     string fieldValue = string.Empty;
     if (checkFirst)
     {
         fieldValue = model.GetCustomInfoValue(cfgName, fieldName);
         if (fieldValue == val)
             return isPropertyChanged;
     }
     if (!string.IsNullOrEmpty(fieldValue.Trim()) && fieldValue != "-" && !fieldValue.Contains("Color"))
         isPropertyChanged = true;
     model.AddCustomInfo3(cfgName, fieldName, (int)fieldType, val);
     model.set_CustomInfo2(cfgName, fieldName, val);
     return isPropertyChanged;
 }
开发者ID:digger1985,项目名称:MyCode,代码行数:16,代码来源:SwAddin.cs

示例11: Actualization

        public static void Actualization(ModelDoc2 model, SwAddin _mSwAddin)
        {
            Component2 _swSelectedComponent = model.ConfigurationManager.ActiveConfiguration.GetRootComponent3(true);
            OleDbCommand cm;
            OleDbDataReader rd;
            OleDbConnection oleDb;
            if (!_mSwAddin.OpenModelDatabase(model, out oleDb))
                return;
            cm = new OleDbCommand("SELECT * FROM faners ORDER BY FanerName ", oleDb);
            rd = cm.ExecuteReader();
            List<Faner> faners = new List<Faner>();
            while (rd.Read())
            {
                if (rd["FanerType"] as string != null)
                {
                    faners.Add(new Faner((string)rd["FanerName"], (string)rd["FanerType"], (string)rd["DecorGroup"]));
                }
                else
                {
                    faners.Add(new Faner((string)rd["FanerName"], string.Empty, (string)rd["DecorGroup"]));
                }
            }
            rd.Close();
            Feature feature;
            foreach (var faner in faners)
            {
                string suffix = faner.FanerName.Substring(faner.FanerName.Length - 2, 2);

                feature = FindEdge(_swSelectedComponent, faner.AxFanerName);
                if (feature != null)
                {
                    if (feature.IsSuppressed())
                    {
                        _mSwAddin.SetModelProperty(model, "Faner" + suffix, "", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                        _mSwAddin.SetModelProperty(model, "colorFaner" + suffix, "", swCustomInfoType_e.swCustomInfoText, string.Empty, true);
                    }
                    else
                    {
                        string fieldValue = model.GetCustomInfoValue(string.Empty, "Faner" + suffix);
                        if (fieldValue == string.Empty)
                        {
                            string msgText = "Для данной детали: " + model.GetPathName() + " кромка Faner" + suffix + " в модели не соответствует свойствам файла сборки. Данная кромка не будет импортирована в программу Покупки! Чтобы исправить эту ошибку используйте опцию \"MrDoors - Отделка кромки\"";
                            MessageBox.Show(msgText, @"MrDoors", MessageBoxButtons.OK);
                        }
                    }
                }
            }
        }
开发者ID:digger1985,项目名称:MyCode,代码行数:48,代码来源:frmEdge.cs


注:本文中的ModelDoc2.GetCustomInfoValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。