Exemplo n.º 1
0
 private void bkgWork_DoWork(object sender, DoWorkEventArgs e)
 {
     try {
         this.exception = null;
         this.lvw.FillItemImage();
     } catch (Exception exception) {
         this.exception = exception;
         PLMEventLog.WriteExceptionLog(exception);
     }
 }
Exemplo n.º 2
0
 public static void RetriveConfigInfo(string regpath)
 {
     try
     {
         DEProxyServer internalProxyServer = ((IProxyServer)RemoteProxy.GetObject(typeof(IProxyServer))).GetInternalProxyServer();
         LocalProxyIP    = internalProxyServer.HostAddress;
         LocalProxyPorts = new int[] { internalProxyServer.BusinessPort, internalProxyServer.MonitorPort };
     }
     catch (Exception exception)
     {
         PLMEventLog.WriteExceptionLog(exception);
         LocalProxyIP    = "localhost";
         LocalProxyPorts = new int[] { 0x2326, 0x2328 };
     }
 }
Exemplo n.º 3
0
 private void OnTick(object sender, EventArgs e)
 {
     try {
         if (DateTime.Now.Subtract(this.request).Milliseconds > 300)
         {
             this.bkgWork.RunWorkerAsync();
             this.time_MouseWheelListener.Enabled = false;
             if (this.exception != null)
             {
                 throw this.exception;
             }
         }
     } catch (Exception exception) {
         PLMEventLog.WriteExceptionLog(exception);
     }
 }
Exemplo n.º 4
0
        public static object GetObject(Type objType, string id)
        {
            string url  = string.Format(Protocal + "://{0}:{1}/{2}", Server, Port, id);
            object obj2 = null;

            try
            {
                obj2 = Activator.GetObject(objType, url);
            }
            catch (Exception exception)
            {
                PLMEventLog.WriteExceptionLog(exception);
                throw new PLMException("应用服务器没有响应!", exception);
            }
            return(obj2);
        }
Exemplo n.º 5
0
 public static void SetConfigInfo(string cfgName, string cfgValue)
 {
     try
     {
         RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\北京清软英泰信息技术有限公司\TiPLM\Common", true);
         if (key == null)
         {
             key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\北京清软英泰信息技术有限公司\TiPLM\Common");
         }
         key.SetValue(cfgName, cfgValue);
         key.Close();
     }
     catch (Exception exception)
     {
         PLMEventLog.WriteExceptionLog(exception);
     }
 }
Exemplo n.º 6
0
        public static object GetObject(Type objType)
        {
            string uRL = GetURL(objType.FullName);

            if (uRL == null)
            {
                throw new PLMException("获得远程对象" + objType + "路径失败!请检查远程对象配置文件!");
            }
            object obj2 = null;

            try
            {
                obj2 = Activator.GetObject(objType, uRL);
            }
            catch (Exception exception)
            {
                PLMEventLog.WriteExceptionLog(exception);
                throw new PLMException("应用服务器没有响应!", exception);
            }
            return(obj2);
        }
Exemplo n.º 7
0
        private bool DoConnect(string xml, ref string errText)
        {
            MSXML2.XMLHTTPClass xmlHttp = new MSXML2.XMLHTTPClass();
            xmlHttp.open("POST", EaiAddress, false, null, null);//TODO:地址需要改
            xmlHttp.send(xml);
            String responseXml = xmlHttp.responseText;
            //…… //处理返回结果
            XmlDocument resultDoc = new XmlDocument();

            resultDoc.LoadXml(responseXml);
            var itemNode = resultDoc.SelectSingleNode("ufinterface//item");
            var s        = ConstCommon.CURRENT_PRODUCTNAME;

            if (itemNode == null)
            {
                errText = "没有收到ERP回执";

                PLMEventLog.WriteLog("没有收到ERP回执!", EventLogEntryType.Error);
                System.Runtime.InteropServices.Marshal.FinalReleaseComObject(xmlHttp); //COM释放
                return(false);
            }
            var succeed = Convert.ToInt32(itemNode.Attributes["succeed"].Value);//成功标识:0:成功;非0:失败;
            var dsc     = itemNode.Attributes["dsc"].Value.ToString();

            //var u8key =itemNode.Attributes["u8key"].ToString();
            //var proc = itemNode.Attributes["proc"].ToString();
            if (succeed != 0)
            {
                //errText = responseXml;
                errText = string.Format("ERP导入失败,原因:{0}", dsc);

                PLMEventLog.WriteLog(dsc, EventLogEntryType.Error);
                System.Runtime.InteropServices.Marshal.FinalReleaseComObject(xmlHttp); //COM释放
                return(false);
            }
            System.Runtime.InteropServices.Marshal.FinalReleaseComObject(xmlHttp); //COM释放
            return(true);
        }
Exemplo n.º 8
0
 public static object GetObject(Type objType, string SServer, int PPort)
 {
     lock (pv)
     {
         SetProxy(SServer, PPort);
         string url = GetURL(objType.FullName, SServer, PPort);
         if (url == null)
         {
             throw new PLMException("获得远程对象" + objType + "路径失败!请检查远程对象配置文件!");
         }
         object obj2 = null;
         try
         {
             obj2 = Activator.GetObject(objType, url);
         }
         catch (Exception exception)
         {
             PLMEventLog.WriteExceptionLog(exception);
             throw new PLMException("应用服务器没有响应!", exception);
         }
         return(obj2);
     }
 }
Exemplo n.º 9
0
 public static void RetriveConfigInfo4Service()
 {
     try
     {
         RegistryKey key = Registry.Users.OpenSubKey(@".DEFAULT\SOFTWARE\北京清软英泰信息技术有限公司\TiPLM\Common", true);
         if (key != null)
         {
             object obj2 = key.GetValue("Server");
             if (obj2 != null)
             {
                 Server = Convert.ToString(obj2);
             }
             obj2 = key.GetValue("Port");
             if (obj2 != null)
             {
                 Port = Convert.ToInt32((string)obj2);
             }
             obj2 = key.GetValue("Protocal");
             if (obj2 != null)
             {
                 Protocal = Convert.ToString(obj2);
             }
             key.Close();
         }
         else
         {
             Registry.Users.CreateSubKey(@".DEFAULT\SOFTWARE\北京清软英泰信息技术有限公司\TiPLM\Common");
         }
     }
     catch (Exception exception)
     {
         Protocal = "tcp";
         Port     = 0x22c4;
         PLMEventLog.WriteExceptionLog(exception);
     }
 }
Exemplo n.º 10
0
        private TreeNode CreateClassNode(Guid pOid, string parentText, string parentClass, SelectClassConstraint constraint, DEMetaClass meta)
        {
            TreeNode node  = null;
            bool     flag  = false;
            bool     flag2 = true;

            if (constraint == SelectClassConstraint.InstancableClass)
            {
                Hashtable creatableClasses = ClientData.GetCreatableClasses();
                if (creatableClasses == null)
                {
                    return(null);
                }
                flag2 = Convert.ToBoolean(creatableClasses[parentClass]);
            }
            if (pOid != Guid.Empty)
            {
                node = new TreeNode(parentClass)
                {
                    Text = parentText
                };
                node.SelectedImageIndex = node.ImageIndex = ClientData.MyImageList.GetIconIndex("ICO_DMM_CLASS");
                node.Tag = meta;
            }
            else
            {
                node = new TreeNode("");
            }
            foreach (DEMetaClass class2 in ModelContext.MetaModel.GetClasses())
            {
                if (((constraint == SelectClassConstraint.CanSchableClass) || (class2.SystemClass != 'Y')) && ModelContext.MetaModel.IsVisibleCustomizedClass(class2.Name))
                {
                    if ((constraint == SelectClassConstraint.CanSchableClass) || (constraint == SelectClassConstraint.CustomizedClasses))
                    {
                        if (!class2.IsSearchable)
                        {
                            continue;
                        }
                        try
                        {
                            if (PLGrantPerm.CanDoClassOperation(ClientData.LogonUser.Oid, class2.Name, Guid.Empty, "ClaRel_BROWSE") == 0)
                            {
                                continue;
                            }
                        }
                        catch (Exception exception)
                        {
                            PLMEventLog.WriteExceptionLog(exception);
                            continue;
                        }
                    }
                    if (((pOid == Guid.Empty) && (class2.Parent == Guid.Empty)) || ((class2.Parent == pOid) && (class2.Parent != Guid.Empty)))
                    {
                        flag = true;
                        string   label = class2.Label;
                        string   name  = class2.Name;
                        TreeNode node2 = this.CreateClassNode(class2.Oid, label, name, constraint, class2);
                        if (node2 != null)
                        {
                            node.Nodes.Add(node2);
                        }
                    }
                }
            }
            if (node == null)
            {
                return(null);
            }
            if ((node.Nodes.Count <= 0) && (((node.Nodes.Count != 0) || flag) || !flag2))
            {
                return(null);
            }
            return(node);
        }
Exemplo n.º 11
0
 public static void FillItemImage(ThumbnailListView lvw)
 {
     try {
         try {
             if ((!lvw.Visible || (lvw.TopItem == null)) || (lvw.TopItem.Index == -1))
             {
                 return;
             }
         } catch {
             return;
         }
         Cursor.Current = Cursors.WaitCursor;
         if ((lvw.SmallImageList == null) || (lvw.SmallImageList != lvw.ThumImageList))
         {
             lvw.SmallImageList = lvw.ThumImageList;
         }
         int             generation = GC.GetGeneration(lvw.ThumImageList);
         List <IBizItem> bizItems   = new List <IBizItem>();
         ArrayList       masterOids = new ArrayList();
         ArrayList       revNums    = new ArrayList();
         for (int i = lvw.TopItem.Index; i < lvw.Items.Count; i++)
         {
             if ((lvw.Items[i] != null) && (lvw.Bounds.Bottom > lvw.Items[i].Bounds.Top))
             {
                 ListViewItem item = lvw.Items[i];
                 IBizItem     tag  = null;
                 if (item.Tag is IBizItem)
                 {
                     tag = item.Tag as IBizItem;
                 }
                 else if (item.Tag is DataRowView)
                 {
                     try {
                         masterOids.Add(new Guid((byte[])((DataRowView)item.Tag)[0]));
                         revNums.Add(0);
                     } catch {
                     }
                 }
                 if (tag != null)
                 {
                     bizItems.Add(tag);
                 }
             }
         }
         if (masterOids.Count > 0)
         {
             ArrayList list4 = PLItem.Agent.GetBizItemsByMasters(masterOids, revNums, lvw.ThumPSOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem);
             if (list4.Count > 0)
             {
                 bizItems.AddRange((IBizItem[])list4.ToArray(typeof(IBizItem)));
             }
         }
         Dictionary <Guid, string> dictionary = new Dictionary <Guid, string>();
         if (bizItems.Count > 0)
         {
             try {
                 dictionary = UIThumbnailHelper.Instance.DownLoadThumFiles(bizItems, lvw.ThumPSOption);
             } catch (Exception exception) {
                 PLMEventLog.WriteExceptionLog(exception);
             }
         }
         string key = 0.ToString() + ".jpg";
         if (!lvw.ThumImageList.Images.ContainsKey(key))
         {
             string path = Path.Combine(ConstConfig.GetTempfilePath(), "Thum");
             if (!Directory.Exists(path))
             {
                 Directory.CreateDirectory(path);
             }
             string filename = Path.Combine(path, key);
             Image  image    = ClientData.ItemImages.imageList.Images[0];
             image.Save(filename);
             lock (typeof(ImageList)) {
                 lvw.ThumImageList.Images.Add(key, image);
             }
             image.Dispose();
         }
         for (int j = lvw.TopItem.Index; j < lvw.Items.Count; j++)
         {
             if ((lvw.Items[j] != null) && (lvw.Bounds.Bottom > lvw.Items[j].Bounds.Top))
             {
                 ListViewItem item3 = lvw.Items[j];
                 IBizItem     item4 = null;
                 if (item3.Tag is IBizItem)
                 {
                     item4 = item3.Tag as IBizItem;
                 }
                 else if (item3.Tag is DataRowView)
                 {
                     try {
                         Guid masterOid = new Guid((byte[])((DataRowView)item3.Tag)[0]);
                         item4 = FindBizItems(bizItems, masterOid);
                     } catch {
                     }
                 }
                 if (item4 != null)
                 {
                     string str4         = "";
                     string fileName     = "";
                     Image  reducedImage = null;
                     if (dictionary.ContainsKey(item4.IterOid))
                     {
                         str4 = dictionary[item4.IterOid];
                         if (File.Exists(str4))
                         {
                             fileName     = Path.GetFileName(str4);
                             reducedImage = UIThumbnailHelper.Instance.GetReducedImage(str4);
                             if (reducedImage != null)
                             {
                                 if (lvw.ThumImageList.Images.ContainsKey(fileName))
                                 {
                                     int num5 = lvw.ThumImageList.Images.IndexOfKey(fileName);
                                     lvw.ThumImageList.Images[num5] = reducedImage;
                                 }
                                 else
                                 {
                                     lock (typeof(ImageList)) {
                                         lvw.ThumImageList.Images.Add(fileName, reducedImage);
                                     }
                                 }
                                 reducedImage.Dispose();
                             }
                         }
                     }
                     else
                     {
                         fileName = ClientData.ItemImages.GetObjectImage(item4.ClassName, PLDataModel.GetStateByMasterInfo(item4.ExactState, item4.HasFile)).ToString() + ".jpg";
                         if (!lvw.ThumImageList.Images.ContainsKey(fileName))
                         {
                             string str6 = Path.Combine(ConstConfig.GetTempfilePath(), "Thum");
                             if (!Directory.Exists(str6))
                             {
                                 Directory.CreateDirectory(str6);
                             }
                             string str7 = Path.Combine(str6, fileName);
                             reducedImage = ClientData.ItemImages.GetObjectImage1(item4.ClassName, PLDataModel.GetStateByMasterInfo(item4.ExactState, item4.HasFile));
                             reducedImage.Save(str7);
                             lock (typeof(ImageList)) {
                                 lvw.ThumImageList.Images.Add(fileName, reducedImage);
                             }
                             reducedImage.Dispose();
                         }
                     }
                     item3.ImageIndex = lvw.ThumImageList.Images.IndexOfKey(fileName);
                 }
             }
         }
         lvw.Refresh();
         GC.GetGeneration(generation);
     } finally {
         Cursor.Current = Cursors.Default;
     }
 }