示例#1
0
 private void lvw_ItemDrag(object sender, ItemDragEventArgs e)
 {
     if (this.lvw.SelectedItems.Count >= 1)
     {
         CLCopyData data = new CLCopyData();
         foreach (ListViewItem item in this.lvw.SelectedItems)
         {
             DataRowView tag = (DataRowView)item.Tag;
             try
             {
                 DEBusinessItem item2 = PLItem.Agent.GetBizItemByMaster(new Guid((byte[])tag[0]), 0, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem;
                 if (item2 != null)
                 {
                     data.Add(item2);
                 }
             }
             catch (PLMException exception)
             {
                 PrintException.Print(exception);
                 return;
             }
             catch (Exception exception2)
             {
                 MessageBoxPLM.Show("拖动资源数据出错:" + exception2.Message, "工程资源");
                 return;
             }
         }
         this.lvw.DoDragDrop(data, DragDropEffects.Link | DragDropEffects.Move | DragDropEffects.Copy);
     }
 }
示例#2
0
 private void lvwTSD_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data != null)
     {
         DEBusinessItem item;
         ArrayList      list  = new ArrayList();
         ArrayList      list2 = new ArrayList();
         foreach (ListViewItem item2 in this.lvwTSD.Items)
         {
             IBizItem tag = item2.Tag as IBizItem;
             list2.Add(tag.MasterOid);
         }
         if (e.Data.GetDataPresent(typeof(CLCopyData)))
         {
             CLCopyData data = (CLCopyData)e.Data.GetData(typeof(CLCopyData));
             foreach (object obj2 in data)
             {
                 item = PlArchivManage.GetItem(obj2);
                 if ((item.Master.ClassName == "DQDOSSIERPRINT") && ((item != null) && !list2.Contains(item.MasterOid)))
                 {
                     list2.Add(item.MasterOid);
                     list.Add(item);
                 }
             }
         }
         else
         {
             item = PlArchivManage.GetItem(e.Data.GetData(typeof(IBizItem)));
             if (item != null)
             {
                 if (item.Master.ClassName != "DQDOSSIERPRINT")
                 {
                     return;
                 }
                 if (!list2.Contains(item.MasterOid))
                 {
                     list2.Add(item.MasterOid);
                     list.Add(item);
                 }
             }
         }
         if (list.Count > 0)
         {
             foreach (DEBusinessItem item4 in list)
             {
                 PlArchivManage.SetLvwValues(this.hsCols, this.lvwTSD, this.lstOrder, item4);
             }
             this.lvwTSD.Refresh();
         }
     }
 }
示例#3
0
 private void txtInput_DragDrop(object sender, DragEventArgs e)
 {
     if (!this.txtInput.ReadOnly)
     {
         this.metaAttr = (DEMetaAttribute)base.Tag;
         CLCopyData data = new CLCopyData();
         data = (CLCopyData)e.Data.GetData(typeof(CLCopyData));
         if (data != null)
         {
             DECopyData data2 = (DECopyData)data[0];
             if (data2 != null)
             {
                 if (data2.ClassName != this.clsName)
                 {
                     MessageBoxPLM.Show("资源类不匹配", "工程资源", MessageBoxButtons.OK);
                     this.txtInput.Focus();
                 }
                 else
                 {
                     DataRowView view = (DataRowView)data2.ItemList[0];
                     if (view != null)
                     {
                         if ((this.metaAttr != null) && (this.metaAttr.LinkType == 1))
                         {
                             this.flag = 1;
                             string combination = this.metaAttr.Combination;
                             foreach (DEMetaAttribute attribute in this.attrs)
                             {
                                 if (this.metaAttr.Combination.IndexOf("[" + attribute.Name + "]") > -1)
                                 {
                                     string str2 = "PLM_" + attribute.Name;
                                     combination = combination.Replace("[" + attribute.Name + "]", Convert.ToString(view[str2]));
                                 }
                             }
                             this.txtInput.Text = combination.Trim();
                         }
                         else
                         {
                             this.flag          = 1;
                             this.txtInput.Text = view["PLM_ID"].ToString();
                         }
                         this.resOid = new Guid((byte[])view["PLM_OID"]);
                         this.txtInput.Focus();
                     }
                 }
             }
         }
     }
 }
示例#4
0
 private void lvw_ItemDrag(object sender, ItemDragEventArgs e)
 {
     if (this.lvw.SelectedItems.Count >= 1)
     {
         DECopyData data  = new DECopyData();
         CLCopyData data2 = new CLCopyData();
         data.ClassName = this.ClsName;
         foreach (ListViewItem item in this.lvw.SelectedItems)
         {
             data.ItemList.Add((DataRowView)item.Tag);
         }
         data2.Add(data);
         this.lvw.DoDragDrop(data2, DragDropEffects.Link | DragDropEffects.Move | DragDropEffects.Copy);
     }
 }
示例#5
0
        private void lvwNavigator_ItemDrag(object sender, ItemDragEventArgs e)
        {
            this.lvwNavigater.AllowDrop = true;
            CLCopyData data = new CLCopyData();

            for (int i = 0; i < this.lvwNavigater.SelectedItems.Count; i++)
            {
                TreeNode tag = this.lvwNavigater.SelectedItems[i].Tag as TreeNode;
                if (!(tag.Tag is DELProcessDefProperty))
                {
                    break;
                }
                data.Add(tag);
            }
            if (data.Count > 0)
            {
                base.DoDragDrop(data, DragDropEffects.Move);
            }
        }
示例#6
0
 private void lvwTSD_DragEnter(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(typeof(CLCopyData)))
     {
         CLCopyData data = (CLCopyData)e.Data.GetData(typeof(CLCopyData));
         if (((data != null) && (data.Count != 0)) && (((data[0] is DEBusinessItem) || (data[0] is DESmartBizItem)) || (data[0] is DERelationBizItem)))
         {
             e.Effect = DragDropEffects.Copy;
         }
         else
         {
             e.Effect = DragDropEffects.None;
         }
     }
     else if ((e.Data.GetDataPresent(typeof(DEBusinessItem)) || e.Data.GetDataPresent(typeof(DESmartBizItem))) || e.Data.GetDataPresent(typeof(DERelationBizItem)))
     {
         e.Effect = DragDropEffects.Copy;
     }
     else
     {
         e.Effect = DragDropEffects.None;
     }
 }
示例#7
0
 private void ResCombo_DragDrop(object sender, DragEventArgs e)
 {
     if (!base.ReadOnly)
     {
         this.LoadData();
         DEMetaAttribute deMetaAttri = this.deMetaAttri;
         CLCopyData      data        = new CLCopyData();
         data = (CLCopyData)e.Data.GetData(typeof(CLCopyData));
         if (data != null)
         {
             string combination;
             if (data[0] is DEBusinessItem)
             {
                 DEBusinessItem item = (DEBusinessItem)data[0];
                 combination = deMetaAttri.Combination;
                 foreach (DEMetaAttribute attribute2 in this.Attrs)
                 {
                     if (deMetaAttri.Combination.IndexOf("[" + attribute2.Name + "]") > -1)
                     {
                         combination = combination.Replace("[" + attribute2.Name + "]", item.GetAttrValue(this.className, attribute2.Name).ToString());
                     }
                 }
                 combination      = combination.Replace("[ID]", item.Id.ToString());
                 this.Text        = combination.Trim();
                 this.ResourceOid = item.MasterOid;
             }
             else
             {
                 DECopyData data2 = (DECopyData)data[0];
                 if (data2 != null)
                 {
                     if (data2.ClassName != this.className)
                     {
                         MessageBoxPLM.Show("资源类不匹配", "工程资源", MessageBoxButtons.OK);
                     }
                     else
                     {
                         DataRowView view = (DataRowView)data2.ItemList[0];
                         if (view != null)
                         {
                             if ((deMetaAttri != null) && (deMetaAttri.LinkType == 1))
                             {
                                 combination = deMetaAttri.Combination;
                                 foreach (DEMetaAttribute attribute3 in this.Attrs)
                                 {
                                     if (deMetaAttri.Combination.IndexOf("[" + attribute3.Name + "]") > -1)
                                     {
                                         string str2 = "PLM_" + attribute3.Name;
                                         combination = combination.Replace("[" + attribute3.Name + "]", Convert.ToString(view[str2]));
                                     }
                                 }
                                 if (ResFunc.IsRefRes(this.classOid))
                                 {
                                     string str3 = "PLM_M_ID";
                                     combination = combination.Replace("[ID]", Convert.ToString(view[str3]));
                                 }
                                 this.Text = combination.Trim();
                             }
                             else
                             {
                                 this.Text = view["PLM_ID"].ToString();
                             }
                             this.ResourceOid = new Guid((byte[])view["PLM_OID"]);
                         }
                     }
                 }
             }
         }
     }
 }