Example #1
0
        /// <summary>
        /// 记录删除
        /// </summary>
        protected void DocDelete()
        {
            int rowIndex = dgvDocList.CurrentCell.RowIndex;

            if (rowIndex < 0)
            {
                return;
            }

            DataGridViewRow row         = dgvDocList.Rows[rowIndex];
            IDRAWINGService _docService = ServiceContainer.GetService <DRAWINGService>();

            // HYPDM.Entities.PDM_DOCUMENT doc = row.DataBoundItem as HYPDM.Entities.PDM_DOCUMENT;

            HYPDM.Entities.PDM_DRAWING doc = new PDM_DRAWING();
            doc = _docService.GetDrawObjectDCID(row.Cells["DOCID"].Value.ToString());
            //doc.LASTUPDATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            //doc.LASTUPDATEUSER = LoginInfo.LoginCount.ToString();
            //doc.DEL_FLAG = "N";

            //  doc.Update();


            IList <PDM_DRAWING> docList = new List <PDM_DRAWING>();

            docList.Add(doc);

            IList <DOC_FILE_LIST> fileList = new List <DOC_FILE_LIST>();

            fileList = EAS.Services.ServiceContainer.GetService <DocFileListService>().GetDocFileListByDCID(doc.DOCID);


            if (doc == null)
            {
                return;
            }

            if (MessageBox.Show("您确认要删除所选择的文档记录么?\n删除后与其他对象的关联关系也将被解除。\n请确认您的操作。", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                _docService.DocDel(docList, fileList);

                this.dgvDocList.Rows.Remove(row);
            }
        }
Example #2
0
        /// <summary>
        /// 获取form
        /// </summary>
        /// <param name="RelationObjectType"></param>
        /// <param name="objectID"></param>
        /// <returns></returns>
        public static Form GetDetaiFrm(DataType.RelationObjectType RelationObjectType, string objectID)
        {
            Form   FrmDetail = null;
            string tableName = DataType.GetTableName(RelationObjectType);

            switch (RelationObjectType)
            {
            case DataType.RelationObjectType.Document:
            {
                IDocumentService _docService        = ServiceContainer.GetService <DocumentService>();
                HYPDM.WinUI.Document.DocRegForm frm = new Document.DocRegForm(true);
                frm.Document      = _docService.GetDocListByID(objectID)[0];
                frm.StartPosition = FormStartPosition.CenterParent;
                FrmDetail         = frm;
                break;
            }

            case DataType.RelationObjectType.File:
            {
                //tableName = "DOC_FILE_LIST";
                break;
            }

            case DataType.RelationObjectType.Material:
            {
                //tableName = "PDM_MATERAIL";

                HYPDM.WinUI.ProductsAndParts.Material.MaterialConfForm frm = new ProductsAndParts.Material.MaterialConfForm(objectID, 1, true);          //2为半成品  1为成品
                //IDocumentService _docService = ServiceContainer.GetService<DocumentService>();
                //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>();
                FrmDetail         = frm;
                frm.StartPosition = FormStartPosition.CenterParent;
                break;
            }

            case DataType.RelationObjectType.Product:
            {
                // tableName = "PDM_ALL_PRODUCT";  //PRODUCTLEVEL为1的时候表示是产品
                HYPDM.WinUI.ProductsAndParts.Products.ProductsConfForm frm = new ProductsAndParts.Products.ProductsConfForm(objectID, 1, true);          //2为半成品  1为成品
                //IDocumentService _docService = ServiceContainer.GetService<DocumentService>();
                //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>();
                FrmDetail         = frm;
                frm.StartPosition = FormStartPosition.CenterParent;

                break;
            }

            case DataType.RelationObjectType.SemiProduct:
            {
                //tableName = "PDM_ALL_PRODUCT"; //PRODUCTLEVEL为2的时候表示是半产品
                HYPDM.WinUI.ProductsAndParts.Products.ProductsConfForm frm = new ProductsAndParts.Products.ProductsConfForm(objectID, 2, true);          //2为半成品  1为成品
                //IDocumentService _docService = ServiceContainer.GetService<DocumentService>();
                //IAllProductService m_AllProductService = EAS.Services.ServiceContainer.GetService<IAllProductService>();

                //frm.Product = m_AllProductService.GetById(objectID);

                frm.StartPosition = FormStartPosition.CenterParent;
                FrmDetail         = frm;
                break;
            }

            case DataType.RelationObjectType.Drawing:
            {
                IDRAWINGService _docService = ServiceContainer.GetService <DRAWINGService>();
                HYPDM.WinUI.DrawingDocument.DrawRegForm frm = new DrawingDocument.DrawRegForm(true);
                frm.Document      = _docService.GetDrawObjectDCID(objectID);
                frm.StartPosition = FormStartPosition.CenterParent;
                FrmDetail         = frm;
                break;
            }

            default:
            {
                // tableName = "";
                break;
            }
            }
            return(FrmDetail);
        }