예제 #1
0
파일: S_D_DBS.cs 프로젝트: tianzhifeng/EPC
 /// <summary>
 /// 添加文件
 /// </summary>
 /// <param name="document">文档对象</param>
 public void AddDocument(S_D_Document document)
 {
     document.DBSID         = this.ID;
     document.ProjectInfoID = this.ProjectInfoID;
     document.CreateDate    = DateTime.Now;
     document.DBSFullID     = this.FullID;
     if (!document.IsPublic.HasValue)
     {
         document.IsPublic = true;
     }
     if (String.IsNullOrEmpty(document.CreateUserID))
     {
         var userInfo = FormulaHelper.GetUserInfo();
         document.CreateUserID = userInfo.UserID;
         document.CreateUser   = userInfo.UserName;
     }
     this.S_D_Document.Add(document);
 }
예제 #2
0
파일: S_D_DBS.cs 프로젝트: tianzhifeng/EPC
        void _archiveProduct(S_D_DBS dbs, S_E_Product product)
        {
            #region 增加成果至归档目录
            //20190508 一个成果本版一个document记录,不用version表记录,为了多个版本独立档案记录
            var productVersion = product.Version.HasValue ? product.Version.Value.ToString() : "";
            var doc            = dbs.S_D_Document.FirstOrDefault(d => d.RelateID == product.ID && d.Version == productVersion);
            if (doc == null)
            {
                doc              = new S_D_Document();
                doc.ID           = FormulaHelper.CreateGuid();
                doc.Name         = product.Name;
                doc.Code         = product.Code;
                doc.MajorValue   = product.MajorValue;
                doc.Attr         = JsonHelper.ToJson(product);
                doc.Catagory     = product.MonomerInfo;
                doc.RelateID     = product.ID;
                doc.RelateTable  = "S_E_Product";
                doc.CreateUser   = product.CreateUser;
                doc.CreateUserID = product.CreateUserID;
                doc.State        = "Normal";
                doc.MainFiles    = product.MainFile;
                doc.PDFFile      = product.PdfFile;
                doc.PlotFile     = product.PlotFile;
                doc.XrefFile     = product.XrefFile;
                doc.DwfFile      = product.DwfFile;
                doc.TiffFile     = product.TiffFile;
                doc.SignPdfFile  = product.SignPdfFile;
                doc.Version      = productVersion;
                doc.ArchiveDate  = null;
                dbs.AddDocument(doc);
                //doc.AddDocumentVersion();
            }
            //else if (doc.Version != productVersion)
            //{
            //    doc.Name = product.Name;
            //    doc.Code = product.Code;
            //    doc.Attr = JsonHelper.ToJson(product);
            //    doc.Catagory = product.MonomerInfo;

            //    doc.MajorValue = product.MajorValue;
            //    doc.MainFiles = product.MainFile;
            //    doc.PDFFile = product.PdfFile;
            //    doc.PlotFile = product.PlotFile;
            //    doc.XrefFile = product.XrefFile;
            //    doc.DwfFile = product.DwfFile;
            //    doc.TiffFile = product.TiffFile;
            //    doc.SignPdfFile = product.SignPdfFile;
            //    doc.Version = product.Version.HasValue ? product.Version.Value.ToString() : "";
            //    doc.ArchiveDate = null;
            //    doc.State = "Normal";
            //    doc.AddDocumentVersion();
            //}
            else if (doc.State != "Archive")
            {
                doc.PDFFile     = product.PdfFile;
                doc.PlotFile    = product.PlotFile;
                doc.XrefFile    = product.XrefFile;
                doc.DwfFile     = product.DwfFile;
                doc.TiffFile    = product.TiffFile;
                doc.SignPdfFile = product.SignPdfFile;

                var docVer = doc.S_D_DocumentVersion.FirstOrDefault(a => a.Version == doc.Version);
                if (docVer != null)
                {
                    docVer.PDFFile     = doc.PDFFile;
                    docVer.PlotFile    = doc.PlotFile;
                    docVer.XrefFile    = doc.XrefFile;
                    docVer.DwfFile     = doc.DwfFile;
                    docVer.TiffFile    = doc.TiffFile;
                    docVer.SignPdfFile = doc.SignPdfFile;
                }
            }
            #endregion
        }