コード例 #1
0
        //public IBRServiceContracts.ComosActivity GetComosActivityBySysUID(string user, string projectname, int workinglayer, string object_sysuid)
        //{

        //    Plt.IComosBaseObject device = null;

        //    try
        //    {
        //        m_ComosSession.SetCurrentUser(user);
        //        m_ComosSession.SetCurrentProjectAndWorkingOverlay(projectname, workinglayer);

        //        device = m_ComosSession.GetComosDeviceBySystemUID(object_sysuid);

        //        return ComosSpecsEngine.GetDeviceSpecifications(device);
        //    }
        //    catch (Exception ex)
        //    {
        //        ComosBRWeb.LogHandler.WriteLog(ex.Message + ":GetComosActivityBySysUID");
        //        System.Diagnostics.Debug.Assert(false);
        //    }
        //    return null;
        //}

        //public IBRServiceContracts.ComosActivity GetComosActivityBySysFullName(string user, string projectname, int workinglayer, string object_sysuid)
        //{

        //    Plt.IComosBaseObject device = null;

        //    try
        //    {
        //        m_ComosSession.SetCurrentUser(user);
        //        m_ComosSession.SetCurrentProjectAndWorkingOverlay(projectname, workinglayer);

        //        device = m_ComosSession.GetDeviceByFullName(object_sysuid);

        //        return ComosSpecsEngine.GetDeviceSpecifications(device);
        //    }
        //    catch (Exception ex)
        //    {
        //        ComosBRWeb.LogHandler.WriteLog(ex.Message + ":GetComosActivityBySysFullName");
        //        System.Diagnostics.Debug.Assert(false);
        //    }
        //    return null;
        //}

        // @ToDo : Split in Sys and fullname. Avoid exception.
        public IBRServiceContracts.ComosActivity GetComosActivity(string user, string projectname, int workinglayer, string object_sysuid)
        {
            Plt.IComosBaseObject device = null;

            try
            {
                m_ComosSession.SetCurrentUser(user);
                m_ComosSession.SetCurrentProjectAndWorkingOverlay(projectname, workinglayer);

                if (object_sysuid.Contains("|"))
                {
                    device = m_ComosSession.GetDeviceByFullName(object_sysuid);
                }
                else
                {
                    device = m_ComosSession.GetComosDeviceBySystemUID(object_sysuid);

                    if (device == null)
                    {
                        device = m_ComosSession.GetComosDocumentBySystemUID(object_sysuid);
                    }
                }

                if (device != null)
                {
                }
            }
            catch (Exception)
            {
                // ComosBRWeb.LogHandler.WriteLog(ex.Message + ":GetComosActivity");
                //  System.Diagnostics.Debug.Assert(false);
            }
            return(null);
        }