コード例 #1
0
        public bool loadLanguages()
        {
            if (_tableName == "")
            {
                return(false);
            }
            if (_keyName == "")
            {
                return(false);
            }
            if (_objectID < 1)
            {
                return(false);
            }
            _languages.Clear();
            string strSQL = "SELECT langID FROM " + _tableName + " WHERE " + _keyName + "=" + _objectID;

            if (_conn.executeData(strSQL, Common.getCaller()))
            {
                DbDataReader dr = _conn.Reader;
                while (dr.Read())
                {
                    ObjectLanguage ol = new ObjectLanguage(this);
                    ol.LanguageID = dr.GetInt32(0);
                    if (ol.load())
                    {
                        _languages.Add(ol);
                    }
                }
                dr.Close();
                dr.Dispose();
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public ObjectLanguage addLanguage(int langID, string[] properties)
        {
            if (langID < 1)
            {
                return(null);
            }
            if (properties == null)
            {
                return(null);
            }
            if (properties.Length != _fields.Count)
            {
                return(null);
            }
            ObjectLanguage aLang = null;
            bool           found = false;

            foreach (ObjectLanguage ol in _languages)
            {
                if (ol.LanguageID == langID)
                {
                    found = true;
                    aLang = ol;
                }
            }
            if (!found)
            {
                aLang = new ObjectLanguage(this);
            }
            int i = 0;

            foreach (FieldInfo fi in _fields)
            {
                aLang.setProperties(fi.MapName, properties[i]);
            }
            if (aLang.save())
            {
                if (!found)
                {
                    _languages.Add(aLang);
                }
                return(aLang);
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
        public static void OpenLibrary(Application anApp, string aName, string aLang)
        {
            PdOOM.BaseObject modelObject;
            WorkspaceModel   model = RetrieveModelByFile(anApp, aName);

            if (model == null)
            {
                Workspace activeWorkspace = (Workspace)anApp.ActiveWorkspace;
                if (activeWorkspace == null)
                {
                    throw new Exception("Unable to reach the Workspace");
                }
                modelObject = (PdOOM.BaseObject)activeWorkspace.AddDocument(aName, -1);
                if (modelObject == null)
                {
                    return;
                }
                model = (WorkspaceModel)modelObject;
            }
            Model aModel = null;

            if (model.ModelKind == 0x18112060)
            {
                modelObject = (PdOOM.BaseObject)model.ModelObject;
                if (modelObject == null)
                {
                    long interactiveMode = (long)anApp.InteractiveMode;
                    anApp.InteractiveMode = InteractiveModeValue.im_Batch;
                    try
                    {
                        modelObject = (PdOOM.BaseObject)model.Open();
                    }
                    catch (Exception exception)
                    {
                        if (LZ.Reverse.Info._bDebug)
                        {
                            LZ.Reverse.Info.Write(new string[] { exception.StackTrace });
                        }
                    }
                    finally
                    {
                        anApp.InteractiveMode = (InteractiveModeValue)((int)interactiveMode);
                    }
                }
                if (modelObject != null)
                {
                    aModel = (Model)modelObject;
                    ObjectLanguage objectLanguage = (ObjectLanguage)aModel.ObjectLanguage;
                    if (objectLanguage.Name == aLang)
                    {
                        string name;
                        if (aModel.Name != aModel.Code)
                        {
                            name = aModel.Name + " (" + aModel.Code + ")";
                        }
                        else
                        {
                            name = aModel.Name;
                        }
                        LZ.Reverse.Info.Write(new string[] { "... indexation of the library \"{0}\"", name });
                        IndexModelClassifiers(aModel);
                    }
                }
            }
        }