Пример #1
0
        private string GetIDValue()
        {
            if (string.IsNullOrEmpty(this.txtEditID.Text))
            {
                return("");
            }
            if ((this.txtEditID.Text != null) && (this.txtEditID.Text.Length > 0x7d0))
            {
                MessageBoxPLM.Show("输入的代号数据超长,请重新修改后输入。", "代号超长", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return("");
            }
            string str = "";

            char[]   separator = "\r\n".ToCharArray();
            string[] strArray  = this.txtEditID.Text.Split(separator);
            for (int i = 0; i < strArray.Length; i++)
            {
                string str3 = strArray[i].ToString();
                if (!string.IsNullOrEmpty(str3))
                {
                    str = str + str3 + ",";
                }
            }
            if (str.EndsWith(","))
            {
                str = str.Substring(0, str.Length - 1);
            }
            return(str);
        }
Пример #2
0
 public void OnExportToERP(object sender, PLMOperationArgs args)
 {
     if (((args != null) && (args.BizItems != null)) && (args.BizItems.Length != 0))
     {
         //IBizItem item = args.BizItems[0];
         //var bItem = BusinessHelper.Instance.GetDEBusinessItem(item);
         //20181113 modified by kexp 修改为导入完成后统一提示一次;
         //BusinessHelper.Instance.ExportToERP(bItem,false);
         //DEBusinessItem theItem = PSConvert.ToBizItem(args.BizItems[0], args.Option.CurView, ClientData.LogonUser);
         string    message = "ERP导入成功!";
         ArrayList list    = new ArrayList(args.BizItems);
         foreach (object obj2 in list)
         {
             if (typeof(IBizItem).IsInstanceOfType(obj2))
             {
                 IBizItem item = (IBizItem)obj2;
                 //ExportExecute(item);
                 var bItem = BusinessHelper.Instance.GetDEBusinessItem(item);
                 //var ss = OperationConfigHelper.Instance;
                 string errText;
                 BusinessHelper.Instance.ExportToERP(bItem, false, out errText);
                 if (errText == "ERP导入成功!")
                 {
                     continue;
                 }
                 else
                 {
                     message = errText;
                     break;
                 }
             }
         }
         MessageBoxPLM.Show(message);
     }
 }
Пример #3
0
 private void SetIDValue(string str_in)
 {
     if (string.IsNullOrEmpty(str_in))
     {
         this.txtEditID.Text = "";
     }
     else if (str_in.Length > 0x7d0)
     {
         MessageBoxPLM.Show("输入的代号数据超长,请重新修改后输入。", "代号超长", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.txtEditID.Text = "";
     }
     else
     {
         string   str       = "";
         char[]   separator = ",".ToCharArray();
         string[] strArray  = str_in.Split(separator);
         for (int i = 0; i < strArray.Length; i++)
         {
             string str3 = strArray[i].ToString();
             if (!string.IsNullOrEmpty(str3))
             {
                 str = str + str3 + "\r\n";
             }
         }
         this.txtEditID.Text = str;
     }
 }
Пример #4
0
 private void EditProperties(bool readOnly)
 {
     if (this.lvwTemplates.SelectedItems.Count != 1)
     {
         MessageBoxPLM.Show("请选中一个模板。", "PPC - FrmBrowse", MessageBoxButtons.OK, MessageBoxIcon.Question);
     }
     else
     {
         DEBusinessItem tag = (DEBusinessItem)this.lvwTemplates.SelectedItems[0].Tag;
         if (!readOnly && (tag.Master.Holder != this.user.Oid))
         {
             MessageBoxPLM.Show("请先检出该对象。", "PPC - FrmBrowse", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             Cursor current = Cursor.Current;
             Cursor.Current = Cursors.WaitCursor;
             FrmProperty property = null;
             try {
                 property = new FrmProperty(this.user.Oid, readOnly, false, tag.Master.Oid);
             } catch (Exception exception) {
                 MessageBoxPLM.Show("载入属性失败。\n" + exception.Message, "PPC - FrmBrowse", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             } finally {
                 Cursor.Current = current;
             }
             property.ShowDialog();
         }
     }
 }
Пример #5
0
 private void ShowMarkup()
 {
     if (this.curMarkup == null)
     {
         throw new Exception("错误,无法显示批注信息");
     }
     if (this.curMarkup.Markup != null)
     {
         this.txtMark.Text = this.curMarkup.Markup;
     }
     if (this.FileName != null)
     {
         try
         {
             bool allowMarkup = true;
             if (this.Mode == 1)
             {
                 allowMarkup = false;
             }
             if (this.markFileName == null)
             {
                 this.browser.EnterMarkupMode(this.FileName, this.markLocation, Path.GetFileName(this.FileName) + ".plmmkp", allowMarkup);
             }
             else
             {
                 this.browser.EnterMarkupMode(this.FileName, this.markLocation, Path.GetFileName(this.markFileName), allowMarkup);
             }
         }
         catch (Exception exception)
         {
             MessageBoxPLM.Show(exception.Message);
         }
     }
 }
Пример #6
0
 private void SelectTemplate()
 {
     if (this.lvwTemplates.SelectedItems.Count == 0)
     {
         MessageBoxPLM.Show("尚未选中模板。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         DEBusinessItem item = null;
         if (this.SelectOldRevision)
         {
             if (this.selectedItem == null)
             {
                 MessageBoxPLM.Show("尚未选中模板。", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return;
             }
             int revNum = Convert.ToInt32(this.numRevisions.Value);
             item = PLItem.Agent.GetBizItemByMaster(this.selectedItem.Master.Oid, revNum, PLOption.GetUserGlobalOption(this.user.Oid).CurView, this.user.Oid, BizItemMode.BizItem) as DEBusinessItem;
             this.SelectedTemplate = new CLCardTemplate(this.user.Oid, false, true, item);
         }
         else
         {
             item = PLItem.Agent.GetBizItemByMaster(this.selectedItem.Master.Oid, 0, PLOption.GetUserGlobalOption(ClientData.LogonUser.Oid).CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem;
             this.SelectedTemplate = new CLCardTemplate(this.user.Oid, false, true, item);
         }
         try {
             this.SelectedTemplate.CheckProperties();
         } catch (Exception exception) {
             MessageBoxPLM.Show("严重警告:该模板有关属性填写有错,不能选择该模板,请联系定制人员更正。\n详细信息是:" + exception.Message, "PPM警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             return;
         }
         base.DialogResult = DialogResult.OK;
     }
 }
Пример #7
0
        //20181113 modified by kexp 修改为导入完成后统一提示一次;
        /// <summary>
        /// 定版后启动
        /// </summary>
        /// <param name="bizItems"></param>
        private void AfterItemReleased(IBizItem[] bizItems)
        {
            string message = "";

            if (bizItems != null)
            {
                ArrayList list = new ArrayList(bizItems);
                foreach (object obj2 in list)
                {
                    if (typeof(IBizItem).IsInstanceOfType(obj2))
                    {
                        IBizItem item = (IBizItem)obj2;
                        //ExportExecute(item);
                        var bItem = BusinessHelper.Instance.GetDEBusinessItem(item);
                        //var ss = OperationConfigHelper.Instance;
                        string errText;
                        BusinessHelper.Instance.ExportToERP(bItem, true, out errText);
                        if (errText == "ERP导入成功!")
                        {
                            continue;
                        }
                        else
                        {
                            message = errText;
                            break;
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(message) && !message.Equals("sys_error"))
            {
                return;
            }
            MessageBoxPLM.Show(message);
        }
Пример #8
0
        private void GetOutResAddin()
        {
            new ArrayList();
            Cursor.Current = Cursors.Default;
            DEAddinReg tag = null;

            if (this.lV_Addin.SelectedItems.Count > 0)
            {
                tag = this.lV_Addin.SelectedItems[0].Tag as DEAddinReg;
            }
            if ((tag != null) && ((tag.Status & 2) > 0))
            {
                IOutResAddIn addinEntryObject = AddinFramework.Instance.GetAddinEntryObject(tag.Oid) as IOutResAddIn;
                if (addinEntryObject != null)
                {
                    if (!addinEntryObject.Execute(this.parent, this.OperType))
                    {
                        MessageBoxPLM.Show("外部资源插件调用失败!");
                    }
                }
                else
                {
                    MessageBoxPLM.Show("插件调用失败!");
                }
            }
        }
Пример #9
0
        private void AddOperationBinding()
        {
            var cols = PLOperationDef.Agent.GetAllBindingCollection(new Guid());

            //var oldCols = GetBindingCollections(cols);
            //PLOperationDef.Agent.SaveBindingCollection
            if (OBCOLLECTION_CLASSNAME.Count == 0)
            {
                return;
            }
            try {
                for (int i = 0; i < OBCOLLECTION_CLASSNAME.Count; i++)
                {
                    for (int j = 0; j < OBCOLLECTION_SENCE.Count; j++)
                    {
                        for (int k = 0; k < OBCOLLECTION_MODE.Count; k++)
                        {
                            var col = CreateDEBindingOprt(OBCOLLECTION_CLASSNAME[i], OBCOLLECTION_MODE[k], OBCOLLECTION_SENCE[j], cols);
                            PLOperationDef.Agent.SaveBindingCollection(col, Guid.NewGuid());
                        }
                    }
                }
            } catch (Exception ex) {
                MessageBoxPLM.Show(ex.Message);
            }
        }
Пример #10
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     if ((this.tvwRole.SelectedNode == null) || !(this.tvwRole.SelectedNode.Tag is DERole))
     {
         MessageBoxPLM.Show("请先选择角色。");
     }
     else
     {
         DERole tag = this.tvwRole.SelectedNode.Tag as DERole;
         foreach (ListViewItem item in this.lvwTeam.SelectedItems)
         {
             if (item.ImageIndex == ClientData.MyImageList.GetIconIndex("ICO_MSG_OFFLINE"))
             {
                 break;
             }
             Guid      guid = (Guid)item.Tag;
             ArrayList list = this.hsTable[tag.Oid] as ArrayList;
             if ((list != null) && list.Contains(guid))
             {
                 item.Remove();
                 list.Remove(guid);
             }
         }
     }
 }
Пример #11
0
 private void FilterData(string str)
 {
     if (this.myView != null)
     {
         try
         {
             StringBuilder builder = new StringBuilder();
             if (str != "")
             {
                 builder.Append("PLM_Res_ComColumn");
                 builder.Append(" LIKE ");
                 builder.Append(" '");
                 builder.Append(str);
                 builder.Append("*' ");
                 this.myView.RowFilter = builder.ToString();
             }
             else
             {
                 this.myView.RowFilter = "";
             }
         }
         catch
         {
             MessageBoxPLM.Show("过滤数据发生错误:请检查输入的数据类型是否正确!", "筛选数据集", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
     }
 }
Пример #12
0
 private void btnSetShow_Click(object sender, EventArgs e)
 {
     if (this.tV_define.SelectedNode == null)
     {
         MessageBoxPLM.Show("请选择主键!", "设置主键数据显示提示", MessageBoxButtons.OK);
     }
     else
     {
         this.b_chek = true;
         DEResModelPrimaryKey tag = (DEResModelPrimaryKey)this.tV_define.SelectedNode.Tag;
         if (this.tV_define.SelectedNode.Checked)
         {
             this.tV_define.SelectedNode.Checked = false;
             if (tag.PLM_ISSHOWDATA)
             {
                 tag.PLM_OPTION -= 2;
             }
         }
         else
         {
             this.tV_define.SelectedNode.Checked = true;
             if (!tag.PLM_ISSHOWDATA)
             {
                 tag.PLM_OPTION += 2;
             }
         }
     }
 }
Пример #13
0
        /// <summary>
        /// 开始匹配
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnStartMatch_Click(object sender, EventArgs e)
        {
            this.dataGridView1.DataSource = null;
            if (!CheckSelected())
            {
                MessageBoxPLM.Show("匹配选项不能为空!");
                return;
            }
            var currentAttr = this.cmboxCurrentAttributes.SelectedItem as GenericAttribute;
            var matchAttr   = this.cmboxRelationAttributes.SelectedItem as GenericAttribute;
            var items       = GetMatchItems(currentAttr, matchAttr);

            if (items == null || items.Length == 0)
            {
                return;
            }
            var attrs = this.cmboxRelationAttributes.DataSource as GenericAttribute[];
            DEBusinessItemCus cusItem = new DEBusinessItemCus(items, attrs);
            var cusItems = cusItem.GetTableByItem();

            SetDataGridViewData(cusItems, this.dataGridView1);
            _relatedClassName = this.cmboxRelations.SelectedValue.ToString();
            _isParent         = this.cmboxMatchType.SelectedIndex == 0;
            var rlt = this.cmboxRelations.SelectedItem as DEMetaRelation;

            _relationName = rlt == null ? "" : rlt.Name;
            //this.dataGridView1.DataSource = cusItems;
            //for (int i = 0; i < cusItems.Columns.Count; i++) {
            //    this.dataGridView1.Columns[i].HeaderText = cusItems.Columns[i].Caption;
            //}
        }
Пример #14
0
 private void txtInput_Leave(object sender, EventArgs e)
 {
     if ((!this.lbFilter.Focused && !this.spl.Focused) && (this.metaAttr != null))
     {
         if (this.txtInput.Text.Trim() == "")
         {
             this.attrValue = "";
         }
         else if (!this.IsInDataSet(this.txtInput.Text.Trim()))
         {
             this.flag          = 1;
             this.txtInput.Text = this.attrValue;
             MessageBoxPLM.Show("该值在资源数据中不存在,请重新输入!", "工程资源", MessageBoxButtons.OK);
             this.txtInput.Focus();
         }
         else
         {
             this.attrValue = this.txtInput.Text.Trim();
         }
         if ((this.metaAttr.LinkType == 0) && (this.metaAttr.DataType == 8))
         {
             this.resOid = this.GetResourceOID(this.txtInput.Text.Trim(), this.clsName);
         }
         if ((this.lbFilter != null) && this.lbFilter.Visible)
         {
             this.lbFilter.Visible = false;
             this.spl.Visible      = false;
             base.Parent.Controls.Remove(this.lbFilter);
         }
     }
 }
Пример #15
0
        /// <summary>
        /// 创建表格的列
        /// </summary>
        /// <param name="attributes">属性集合</param>
        /// <returns></returns>
        private DataTable CreateNewTable(GenericAttribute[] attributes)
        {
            if (attributes == null || attributes.Length == 0)
            {
                return(null);
            }
            DataTable dt = new DataTable();

            try {
                var selectCol = new DataColumn(IS_SELECTED, typeof(bool))
                {
                    ReadOnly = false, DefaultValue = false, Caption = IS_SELECTED_CAPTION
                };
                dt.Columns.Add(selectCol);
                foreach (GenericAttribute attr in attributes)
                {
                    if (attr == null)
                    {
                        continue;
                    }
                    var        type     = DataModelUtil.GetTypeOfAttribute(attr);
                    var        attrName = string.Format("{0}.{1}", attr.Category, attr.Name);
                    DataColumn col      = new DataColumn(attrName, type)
                    {
                        Caption = attr.Label, ReadOnly = true
                    };
                    dt.Columns.Add(col);
                }
            } catch (Exception ex) {
                MessageBoxPLM.Show(ex.Message);
                return(null);
            }
            return(dt);
        }
Пример #16
0
 private void cmbFileList_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.item != null)
     {
         this.file = this.item.FileList[this.cmbFileList.SelectedIndex] as DESecureFile;
     }
     if (this.AllMarkups.Contains(this.file.FileOid))
     {
         this.MarkupList = this.AllMarkups[this.file.FileOid] as ArrayList;
     }
     else
     {
         try
         {
             this.MarkupList = PLItem.Agent.GetMarkups(this.file.ItemMasterOid, this.file.FileOid, ClientData.LogonUser.Oid);
         }
         catch (Exception exception)
         {
             PrintException.Print(exception, "获取批注信息");
             this.FillProcess();
             return;
         }
         if ((this.MarkupList != null) && (this.MarkupList.Count != 0))
         {
             this.AllMarkups.Add(this.file.FileOid, this.MarkupList);
         }
         else
         {
             MessageBoxPLM.Show("文件未被批注过!");
             this.FillProcess();
             return;
         }
     }
     this.FillProcess();
 }
Пример #17
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);
     }
 }
Пример #18
0
        private void FilterData()
        {
            int           num3     = 0;
            StringBuilder builder  = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();

            if (this.myView != null)
            {
                for (int i = 0; i < this.txtBoxList.Count; i++)
                {
                    TextEditPLM txtBox = (TextEditPLM)this.txtBoxList[i];
                    if (txtBox.Text != "")
                    {
                        ComboBoxEditPLM cob = (ComboBoxEditPLM)this.cobList[i];
                        if ((cob.Text == "在..之间") || (cob.Text == "不在..之间"))
                        {
                            DEMetaAttribute tag = (DEMetaAttribute)txtBox.Tag;
                            for (int j = 0; j < this.txtList.Count; j++)
                            {
                                TextEditPLM     tplm2      = (TextEditPLM)this.txtList[j];
                                DEMetaAttribute attribute2 = (DEMetaAttribute)tplm2.Tag;
                                if ((tag.Oid == attribute2.Oid) && (tplm2.Text != ""))
                                {
                                    num3++;
                                    if (num3 > 1)
                                    {
                                        builder.Append(" AND ");
                                    }
                                    builder2 = this.CreateCondition(cob, txtBox);
                                    builder.Append(builder2.ToString());
                                }
                            }
                        }
                        else
                        {
                            num3++;
                            if (num3 > 1)
                            {
                                builder.Append(" AND ");
                            }
                            builder.Append(this.CreateCondition(cob, txtBox).ToString());
                        }
                    }
                }
                try
                {
                    this.myView.RowFilter = builder.ToString();
                    this.DisplayData(this.myView);
                }
                catch (PLMException exception)
                {
                    PrintException.Print(exception);
                }
                catch
                {
                    MessageBoxPLM.Show("过滤数据发生错误:请检查输入的数据类型是否正确", "筛选数据集", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }
Пример #19
0
        public string GetValue()
        {
            string str = "SearchInFolder(";

            if (string.IsNullOrEmpty(this.dropDownFolderTree.TextValue))
            {
                MessageBoxPLM.Show("文件夹路径没有定义", "在文件夹中查询对象函数", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return("");
            }
            if (this.dropDownFolderTree.treeView.SelectedNode.Parent == null)
            {
                if (this.dropDownFolderTree.treeView.SelectedNode.FullPath == "公共文件夹")
                {
                    str = str + Guid.Empty.ToString("N");
                }
                else
                {
                    str = str + ClientData.LogonUser.Oid.ToString("N");
                }
            }
            else
            {
                DEFolder2 tag = this.dropDownFolderTree.treeView.SelectedNode.Tag as DEFolder2;
                str = str + tag.Oid.ToString("N");
            }
            if (this.chContainSubFolder.Checked)
            {
                str = str + ",true";
            }
            else
            {
                str = str + ",false";
            }
            if (this.iFolderType == 0)
            {
                str = str + ",private,";
            }
            else
            {
                str = str + ",public,";
            }
            if (this.dropDownFolderTree.treeView.SelectedNode.Parent == null)
            {
                if (this.dropDownFolderTree.treeView.SelectedNode.FullPath == "公共文件夹")
                {
                    str = str + "C";
                }
                else
                {
                    str = str + "P";
                }
            }
            else
            {
                DEFolder2 folder2 = this.dropDownFolderTree.treeView.SelectedNode.Tag as DEFolder2;
                str = str + folder2.Status.ToString();
            }
            return((str + "," + ClientData.LogonUser.Oid.ToString("N")) + ")");
        }
Пример #20
0
        private void InitializeLvwImage()
        {
            string str = "";

            this.ImageListLarge          = new ImageList();
            this.ImageListSmall          = new ImageList();
            this.lvwImage.LargeImageList = this.ImageListLarge;
            this.lvwImage.SmallImageList = this.ImageListSmall;
            this.lvwImage.View           = View.Details;
            this.lvwImage.Items.Clear();
            try
            {
                this.myList = new PLPicture().GetAllPictures();
                if (this.myList.Count > 0)
                {
                    int       num;
                    DEPicture picture2 = null;
                    string    filename = "";
                    for (num = 0; num < this.myList.Count; num++)
                    {
                        picture2      = (DEPicture)this.myList[num];
                        filename      = FSClientUtil.DownloadFile(picture2.Oid, "ClaRel_BROWSE");
                        picture2.Name = filename;
                        this.ImageListLarge.Images.Add(Image.FromFile(filename));
                        this.ImageListSmall.Images.Add(Image.FromFile(filename));
                    }
                    ListViewItem item = null;
                    for (num = 0; num < this.myList.Count; num++)
                    {
                        picture2 = (DEPicture)this.myList[num];
                        item     = new ListViewItem(picture2.Alias, num);
                        long size = picture2.Size;
                        if (picture2.Size >= 0x400L)
                        {
                            size = picture2.Size / 0x400L;
                            str  = size.ToString() + " KB";
                        }
                        else if (picture2.Size < 0x400L)
                        {
                            str = size.ToString() + " 字节";
                        }
                        item.SubItems.AddRange(new string[] { str, picture2.Creator, picture2.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), picture2.Modifier, picture2.ModifyTime.ToString("yyyy-MM-dd HH:mm:ss"), picture2.Description });
                        item.Tag = picture2;
                        this.lvwImage.Items.Add(item);
                    }
                }
            }
            catch (PLMException exception)
            {
                PrintException.Print(exception);
            }
            catch (Exception exception2)
            {
                MessageBoxPLM.Show("初始化图片列表出错:" + exception2.Message, "图片资源");
            }
        }
Пример #21
0
 private void miSelected_Click(object sender, EventArgs e)
 {
     if ((this.lvwImage.SelectedItems.Count > 0) && (MessageBoxPLM.Show("选择该图片?", "选择图片", MessageBoxButtons.OKCancel) == DialogResult.OK))
     {
         DEPicture tag = (DEPicture)this.lvwImage.SelectedItems[0].Tag;
         this.picOid          = tag.Oid;
         this.selectedPicture = tag;
         base.DialogResult    = DialogResult.OK;
     }
 }
Пример #22
0
        /// <summary>
        /// 格式化日期类型
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        private XmlDocument DateTimeFormat(XmlDocument doc, List <string> eles)
        {
            if (eles == null || eles.Count == 0 || doc == null)
            {
                return(doc);
            }
            XmlDocument newDoc = new XmlDocument();

            try {
                // 建立一个 XmlTextReader 对象来读取 XML 数据。
                using (XmlTextReader myXmlReader = new XmlTextReader(doc.OuterXml, XmlNodeType.Element, null)) {
                    // 使用指定的文件与编码方式来建立一个 XmlTextWriter 对象。
                    using (System.Xml.XmlTextWriter myXmlWriter = new System.Xml.XmlTextWriter(_filePath, Encoding.UTF8)) {
                        myXmlWriter.Formatting  = Formatting.Indented;
                        myXmlWriter.Indentation = 4;
                        myXmlWriter.WriteStartDocument();

                        string elementName = "";

                        // 解析并显示每一个节点。
                        while (myXmlReader.Read())
                        {
                            switch (myXmlReader.NodeType)
                            {
                            case XmlNodeType.Element:
                                myXmlWriter.WriteStartElement(myXmlReader.Name);
                                myXmlWriter.WriteAttributes(myXmlReader, true);
                                elementName = myXmlReader.Name;

                                break;

                            case XmlNodeType.Text:
                                if (eles.Contains(elementName))
                                {
                                    myXmlWriter.WriteString(XmlConvert.ToDateTime(myXmlReader.Value, XmlDateTimeSerializationMode.Local).ToString("yyyy-MM-dd HH:mm:ss"));
                                    break;
                                }
                                myXmlWriter.WriteString(myXmlReader.Value);
                                break;

                            case XmlNodeType.EndElement:
                                myXmlWriter.WriteEndElement();
                                break;
                            }
                        }
                    }
                }
                newDoc.Load(_filePath);
                return(newDoc);
            } catch (Exception ex) {
                MessageBoxPLM.Show(string.Format("导入ERP文件格式化失败,错误信息:{0}", ex.Message));
                return(null);
            }
        }
Пример #23
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     this.id = this.txtId.Text.Trim();
     if (this.id.Length == 0)
     {
         if (this.itemType == BusinessItemType.Folder)
         {
             MessageBoxPLM.Show("请输入文件夹名称。");
         }
         else
         {
             MessageBoxPLM.Show("请输入对象的新代号。");
         }
         this.txtId.SelectAll();
     }
     else if (this.id.Length > 0x40)
     {
         MessageBoxPLM.Show("代号的长度不能超过64。");
         this.txtId.SelectAll();
     }
     else
     {
         if (this.itemType != BusinessItemType.Folder)
         {
             if (this.cobSecurityLevel.SelectedIndex > -1)
             {
                 this.securityLevel = Convert.ToInt32(this.cobSecurityLevel.SelectedItem);
             }
             else
             {
                 DEMetaClass class2 = ModelContext.MetaModel.GetClass(this.className);
                 if (class2 != null)
                 {
                     this.securityLevel = class2.SecurityLevel;
                 }
                 else
                 {
                     this.securityLevel = 1;
                 }
             }
             if ((this.cobGroup.SelectedItem != null) && (this.cobGroup.SelectedItem is DEOrganization))
             {
                 this.groupOid = ((DEOrganization)this.cobGroup.SelectedItem).Oid;
             }
             else
             {
                 this.groupOid = Guid.Empty;
             }
         }
         this.revLabel     = this.txtRevLabel.Text.Trim();
         this.effway       = (this.cobFolderEffWay.SelectedIndex == 0) ? RevisionEffectivityWay.LastRev : RevisionEffectivityWay.PreciseIter;
         base.DialogResult = DialogResult.OK;
     }
 }
Пример #24
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (this.numStart.Value > this.numEnd.Value)
     {
         MessageBoxPLM.Show("输出的开始页数大于结束页数。", "资源导出选项", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
     }
     else
     {
         base.DialogResult = DialogResult.OK;
     }
 }
Пример #25
0
        /// <summary>
        /// 获取可用ERP导出程序
        /// </summary>
        /// <param name="userOid"></param>
        /// <returns></returns>
        public string GetEAIConfig()
        {
            string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            string[] cfgs = Directory.GetFiles(dir, "*config.xml");
            if (cfgs == null || cfgs.Length == 0)
            {
                MessageBoxPLM.Show("ERP导入配置没有配置在客户端!");
                return(null);
            }
            return(CheckEAIConfig(cfgs[0]));
        }
Пример #26
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (this.lB_Attr.SelectedItems.Count != 0)
     {
         DEResModelPrimaryKey key      = new DEResModelPrimaryKey();
         DEMetaAttribute      metaAttr = new DEMetaAttribute();
         metaAttr = this.GetMetaAttr(this.lB_Attr.SelectedItem.ToString());
         if (((metaAttr.DataType2 == PLMDataType.Guid) || (metaAttr.DataType2 == PLMDataType.Grid)) || (((metaAttr.DataType2 == PLMDataType.Card) || (metaAttr.DataType2 == PLMDataType.Blob)) || (metaAttr.DataType2 == PLMDataType.Clob)))
         {
             MessageBoxPLM.Show("此类型的属性不能设为分类主键!", "模型定义", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else if (this.tV_define.SelectedNode != null)
         {
             if (this.IsExistSameNodeName(this.tV_define.SelectedNode, this.lB_Attr.SelectedItem.ToString()))
             {
                 MessageBoxPLM.Show("同级目录下有相同的主键名!", "模型定义", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 TreeNode             node = new TreeNode();
                 DEResModelPrimaryKey tag  = new DEResModelPrimaryKey();
                 tag               = (DEResModelPrimaryKey)this.tV_define.SelectedNode.Tag;
                 node.Text         = this.lB_Attr.SelectedItem.ToString();
                 key.PLM_OID       = Guid.NewGuid();
                 key.PLM_FATHEROID = tag.PLM_OID;
                 key.PLM_MODELOID  = this.myModel.PLM_OID;
                 key.PLM_ATTROID   = metaAttr.Oid;
                 key.PLM_SHOWNAME  = this.lB_Attr.SelectedItem.ToString();
                 key.PLM_OPTION    = 0;
                 node.Tag          = key;
                 this.tV_define.SelectedNode.Nodes.Add(node);
             }
         }
         else if (this.IsExistSameNodeName(null, this.lB_Attr.SelectedItem.ToString()))
         {
             MessageBoxPLM.Show("同级目录下有相同的主键名!", "模型定义", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             TreeNode node2 = new TreeNode {
                 Text = this.lB_Attr.SelectedItem.ToString()
             };
             key.PLM_OID       = Guid.NewGuid();
             key.PLM_FATHEROID = Guid.Empty;
             key.PLM_MODELOID  = this.myModel.PLM_OID;
             key.PLM_ATTROID   = metaAttr.Oid;
             key.PLM_SHOWNAME  = this.lB_Attr.SelectedItem.ToString();
             key.PLM_OPTION    = 0;
             node2.Tag         = key;
             this.tV_define.Nodes.Add(node2);
         }
     }
 }
Пример #27
0
 private void FrmMarkupByBrowser_Load(object sender, EventArgs e)
 {
     this.browser.AddControl(this.pnlBrowser);
     this.browser.SetSourceFile(this.FileName);
     this.markLocation = ViewFileHelper.Instance.GetTempMarkupPath();
     if (Directory.Exists(this.markLocation))
     {
         if ((Directory.GetFiles(this.markLocation).Length > 0) && (MessageBoxPLM.Show("系统可能正在批注其他的文件,继续操作将使原批注文件丢失,是否继续操作?", "警告", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No))
         {
             return;
         }
         ViewFileHelper.DeleteDirectory(this.markLocation);
         Thread.Sleep(100);
     }
     while (Directory.Exists(this.markLocation))
     {
     }
     Directory.CreateDirectory(this.markLocation);
     new DirectoryInfo(this.markLocation).Attributes = FileAttributes.Hidden;
     try
     {
         this.curMarkup = PLItem.Agent.GetMarkup(this.FileOid, this.workItemOid, this.dataOid, this.UserOid);
         if ((this.curMarkup != null) && (this.Mode == 0))
         {
             this.Mode = 2;
         }
         if ((this.Mode == 0) && (this.curMarkup == null))
         {
             this.curMarkup               = new DEMarkup();
             this.curMarkup.FileOid       = this.FileOid;
             this.curMarkup.ProcessOid    = this.processOid;
             this.curMarkup.WorkItemOid   = this.workItemOid;
             this.curMarkup.DataOid       = this.dataOid;
             this.curMarkup.UserOid       = this.UserOid;
             this.curMarkup.MarkupFileOid = Guid.Empty;
         }
         if (this.curMarkup.MarkupFileOid != Guid.Empty)
         {
             ArrayList files = PLFileService.Agent.GetFiles(this.curMarkup.MarkupFileOid);
             if ((files != null) && (files.Count > 0))
             {
                 this.markFileName = this.markLocation + @"\" + ViewFileHelper.Instance.GetFileName(this.curMarkup.MarkupFileOid);
                 FSClientUtil.DownloadFile("ClaRel_BROWSE", this.curMarkup.MarkupFileOid, this.markFileName);
             }
         }
         this.ShowMarkup();
     }
     catch (Exception exception)
     {
         PrintException.Print(exception);
     }
 }
Пример #28
0
 private void btnAddVirtual_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(this.tB_Virtual.Text.Trim()))
     {
         MessageBoxPLM.Show("虚拟主键不能为空!", "增加虚拟主键提示", MessageBoxButtons.OK);
     }
     else
     {
         DEResModelPrimaryKey key = new DEResModelPrimaryKey();
         if (this.tV_define.SelectedNode != null)
         {
             if (this.IsExistSameNodeName(this.tV_define.SelectedNode, this.tB_Virtual.Text.Trim()))
             {
                 MessageBoxPLM.Show("同级目录下有相同的主键名!", "模型定义", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 TreeNode node = new TreeNode {
                     Text = this.tB_Virtual.Text.Trim()
                 };
                 DEResModelPrimaryKey tag = new DEResModelPrimaryKey();
                 tag               = (DEResModelPrimaryKey)this.tV_define.SelectedNode.Tag;
                 key.PLM_OID       = Guid.NewGuid();
                 key.PLM_FATHEROID = tag.PLM_OID;
                 key.PLM_MODELOID  = this.myModel.PLM_OID;
                 key.PLM_ATTROID   = Guid.Empty;
                 key.PLM_SHOWNAME  = this.tB_Virtual.Text.Trim();
                 key.PLM_OPTION++;
                 node.Tag = key;
                 this.tV_define.SelectedNode.Nodes.Add(node);
             }
         }
         else if (this.IsExistSameNodeName(null, this.tB_Virtual.Text.Trim()))
         {
             MessageBoxPLM.Show("同级目录下有相同的主键名!", "模型定义", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             TreeNode node2 = new TreeNode {
                 Text = this.tB_Virtual.Text.Trim()
             };
             key.PLM_OID       = Guid.NewGuid();
             key.PLM_FATHEROID = Guid.Empty;
             key.PLM_MODELOID  = this.myModel.PLM_OID;
             key.PLM_ATTROID   = Guid.Empty;
             key.PLM_SHOWNAME  = this.tB_Virtual.Text.Trim();
             key.PLM_OPTION++;
             node2.Tag = key;
             this.tV_define.Nodes.Add(node2);
         }
     }
 }
Пример #29
0
 private void btn_ok_Click(object sender, EventArgs e)
 {
     if (this.ProjectSelected != null)
     {
         DEProject projectObject = this.GetProjectObject();
         if (projectObject == null)
         {
             MessageBoxPLM.Show("请选择项目", "项目选择", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             return;
         }
         this.ProjectSelected(projectObject);
     }
     this.CloseParent();
 }
Пример #30
0
 public void Output(DEResFolder curResFolder)
 {
     if (curResFolder != null)
     {
         this.curFolder = curResFolder;
         this.InitResInfo();
         this.TotalNum = this.GetResDataCount();
         if (this.TotalNum == 0)
         {
             MessageBoxPLM.Show("资源的记录数为零,不能导出", "资源数据导出", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         else
         {
             this.TotalPage = ((this.TotalNum % this.showNum) == 0) ? (this.TotalNum / this.showNum) : ((this.TotalNum / this.showNum) + 1);
             this.attrShow  = new PLReference().GetDefAttrLst(this.curFolder.Oid, emTreeType.NodeTree);
             foreach (DEDefAttr attr in this.attrShow)
             {
                 if (!attr.ISVISUAL)
                 {
                     for (int i = this.attrList.Count - 1; i >= 0; i--)
                     {
                         DEMetaAttribute attribute = this.attrList[i] as DEMetaAttribute;
                         if (attribute.Oid == attr.ATTROID)
                         {
                             this.attrList.RemoveAt(i);
                         }
                     }
                 }
             }
             FrmOutputOption option = new FrmOutputOption(this.TotalPage, this.attrList);
             if (option.ShowDialog() == DialogResult.OK)
             {
                 SaveFileDialog dialog;
                 this.StartNum       = option.StartPage;
                 this.EndNum         = option.EndPage;
                 this.IsMultiPageOut = option.IsMultiPage;
                 if (this.saveFile(out dialog))
                 {
                     IProgressCallback progressWindow = ClientData.GetProgressWindow();
                     ArrayList         state          = new ArrayList {
                         progressWindow,
                         dialog.FileName
                     };
                     ThreadPool.QueueUserWorkItem(new WaitCallback(this.outPageExcel), state);
                     progressWindow.ShowWindow();
                 }
             }
         }
     }
 }