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(); } } } } } }
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); } }
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"]); } } } } } } }