/// <summary> /// 保存文档基本属性 /// </summary> public void SaveDocment() { #region 文件 HYPDM.Entities.PDM_DRAWING document; string msg = ""; if (this.document == null) //新增 { document = new HYPDM.Entities.PDM_DRAWING(); document.DOCID = Guid.NewGuid().ToString(); document.CREATEDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); document.CREATEUSER = LoginInfo.LoginID; //创建用户 msg = "数据记录添加成功!"; document.DOCNO = txtDocNo.Text; document.DOCSTATUS = "已创建"; document.DESCRIPTION = txtDescription.Text; document.REMARK = txtRemark.Text; document.VERSION = new FileHelper().getNewVer("V"); document.DOCTYPE = cobDocType.SelectedValue.ToString(); document.DEL_FLAG = "N"; } else //修改 { document = this.Document; document.LASTUPDATEDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); document.LASTUPDATEUSER = LoginInfo.LoginID; msg = "数据记录修改成功!"; //document.DOCNO = txtDocNo.Text; //document.DOCSTATUS = "已创建"; document.DESCRIPTION = txtDescription.Text; document.REMARK = txtRemark.Text; //document.VERSION = "V1.0"; document.DOCTYPE = cobDocType.SelectedValue.ToString(); } IList <PDM_DRAWING> documentList = new List <PDM_DRAWING>(); documentList.Add(document); #endregion #region 物理文件 //var fileList = _physicalService.GetList(document.DOCID); //IList<PDM_PHYSICAL_FILE> physicalList = new List<PDM_PHYSICAL_FILE>(); //if (fileList.Count <= 0) //{ // PDM_PHYSICAL_FILE physicalfile = new PDM_PHYSICAL_FILE(); // physicalfile.PHYSICALID = _physicalService.GetMaxID().ToString(); // physicalfile.PAPERS = txtDocNo.Text; // physicalfile.OPERATEUSER = LoginInfo.LoginID; // physicalfile.PARENT = "0"; // physicalfile.FILEID = document.DOCID; // physicalList.Add(physicalfile); //} //_docService.DocSave(documentList, physicalList); _docService.DocSave(documentList); #endregion this.closed = 1; MessageBox.Show(msg); this.Document = document; // this.DialogResult = DialogResult.OK; }