/// <summary> /// 记录属性。 /// </summary> protected void DocProperty() { int rowIndex = -1; if (!(dgvDocList.CurrentRow == null)) { rowIndex = dgvDocList.CurrentCell.RowIndex; } else { return; } if (rowIndex < 0) { return; } DataGridViewRow row = dgvDocList.Rows[rowIndex]; //HYPDM.Entities.PDM_DOCUMENT document = row.DataBoundItem as HYPDM.Entities.PDM_DOCUMENT; //初始化属性值 HYPDM.Entities.PDM_DRAWING document = new PDM_DRAWING(); document.DOCID = row.Cells["DOCID"].Value.ToString(); document.DOCNAME = row.Cells["DOCNAME"].Value.ToString(); document.DOCNO = row.Cells["DOCNO"].Value.ToString(); document.DOCSTATUS = row.Cells["DOCSTATUS"].Value.ToString(); document.DOCTYPE = row.Cells["DOCTYPE"].Value.ToString(); document.REMARK = row.Cells["REMARK"].Value.ToString(); document.VERSION = row.Cells["VERSION"].Value.ToString(); document.LASTUPDATEDATE = row.Cells["LASTUPDATEDATE"].Value.ToString(); document.LASTUPDATEUSER = row.Cells["LASTUPDATEUSER"].Value.ToString(); document.CREATEDATE = row.Cells["CREATEDATE"].Value.ToString(); document.DESCRIPTION = row.Cells["DESCRIPTION"].Value.ToString(); document.CREATEUSER = row.Cells["CREATEUSER"].Value.ToString(); document.DEL_FLAG = row.Cells["DEL_FLAG"].Value.ToString(); if (document == null) { return; } HYPDM.WinUI.DrawingDocument.DrawRegForm o = new HYPDM.WinUI.DrawingDocument.DrawRegForm(); o.Document = document; if (o.ShowDialog() == DialogResult.OK) { HYPDM.Entities.PDM_DRAWING doc = o.Document; //更新当前记录 //row.Cells["DOCID"].Value = document.DOCID; row.Cells["DOCNAME"].Value = document.DOCNAME; row.Cells["DOCNO"].Value = document.DOCNO; row.Cells["DOCSTATUS"].Value = document.DOCSTATUS; row.Cells["DOCTYPE"].Value = document.DOCTYPE; row.Cells["REMARK"].Value = document.REMARK; row.Cells["VERSION"].Value = document.VERSION; row.Cells["LASTUPDATEDATE"].Value = document.LASTUPDATEDATE; row.Cells["LASTUPDATEUSER"].Value = document.LASTUPDATEUSER; row.Cells["CREATEDATE"].Value = document.CREATEDATE; row.Cells["DESCRIPTION"].Value = document.DESCRIPTION; row.Cells["CREATEUSER"].Value = document.CREATEUSER; row.Cells["DEL_FLAG"].Value = document.DEL_FLAG; // this.InitList(); BindDataFile(); } }
/// <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; }
/// <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; }