Ejemplo n.º 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);
            }
        }