/// <summary> /// 记录属性。 /// </summary> protected void DocProperty() { int rowIndex = dgvDocList.CurrentCell.RowIndex; if (rowIndex < 0) { return; } DataGridViewRow row = dgvDocList.Rows[rowIndex]; //HYPDM.Entities.PDM_DOCUMENT document = row.DataBoundItem as HYPDM.Entities.PDM_DOCUMENT; //初始化属性值 HYPDM.Entities.PDM_DOCUMENT document = new PDM_DOCUMENT(); 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; } DocRegForm o = new DocRegForm(); o.Document = document; if (o.ShowDialog() == DialogResult.OK) { HYPDM.Entities.PDM_DOCUMENT 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(); } }
private void btnSearch_Click(object sender, EventArgs e) { StringBuilder stbQueryFields = new StringBuilder("1=1"); Condition condition = PDM_DOCUMENT.Create().CreateCondition(); if (!string.IsNullOrEmpty(txtDocNo.Text)) { // condition.AddElement("DOCNO", txtDocNo.Text, ElementType.Match); stbQueryFields.AppendFormat("AND DOCNO='{0}'", txtDocNo.Text); } if (!string.IsNullOrEmpty(txtVersion.Text)) { //condition.AddElement("VERSION", txtVersion.Text); stbQueryFields.AppendFormat("AND VERSION='{0}'", txtVersion.Text); } if (!string.IsNullOrEmpty(cobFileType.Text)) { //condition.AddElement("FILETYPE", cobFileType.Text); stbQueryFields.AppendFormat("AND DOCTYPE='{0}'", cobFileType.SelectedValue.ToString()); } if (!string.IsNullOrEmpty(txtDesc.Text)) { //condition.AddElement("DESCRIPTION", txtDesc.Text); stbQueryFields.AppendFormat("AND DESCRIPTION='{0}'", txtDesc.Text); } if (!string.IsNullOrEmpty(txtStatus.Text)) { //condition.AddElement("DOCSTATUS", txtStatus.Text, ElementType.Match); stbQueryFields.AppendFormat("AND DOCSTATUS='{0}'", txtStatus.Text); } if (!string.IsNullOrEmpty(txtUpdateUser.Text)) { //condition.AddElement("LASTUPDATEUSER", txtUpdateUser.Text); stbQueryFields.AppendFormat("AND LASTUPDATEUSER='******'", txtUpdateUser.Text); } if (!string.IsNullOrEmpty(dtpCreateDate.Text.Trim())) { //condition.AddElement("CREATEDATE", dtpCreateDate.Text + " 00:00:00", ElementType.GreaterThanAndEqualTo); //condition.AddElement("CREATEDATE", dtpCreateDate.Text + " 23:59:59", ElementType.LessThanAndEqualTo); stbQueryFields.AppendFormat("AND CREATEDATE BETWEEN '{0}' AND '{1}'", dtpCreateDate.Text + " 00:00:00", dtpCreateDate.Text + " 23:59:59"); } if (!string.IsNullOrEmpty(dtpUpdateDate.Text.Trim())) { //condition.AddElement("LASTUPDATEDATE", dtpUpdateDate.Text + " 00:00:00", ElementType.GreaterThanAndEqualTo); //condition.AddElement("LASTUPDATEDATE", dtpUpdateDate.Text + " 23:59:59", ElementType.LessThanAndEqualTo); stbQueryFields.AppendFormat("AND LASTUPDATEDATE BETWEEN '{0}' AND '{1}'", dtpUpdateDate.Text + " 00:00:00", dtpUpdateDate.Text + " 23:59:59"); } //BindData(condition); BindData(stbQueryFields.ToString()); this.DialogResult = DialogResult.OK; }
/// <summary> /// 记录删除 /// </summary> protected void DocDelete() { int rowIndex = dgvDocList.CurrentCell.RowIndex; if (rowIndex < 0) { return; } DataGridViewRow row = dgvDocList.Rows[rowIndex]; IDocumentService _docService = ServiceContainer.GetService <DocumentService>(); // HYPDM.Entities.PDM_DOCUMENT doc = row.DataBoundItem as HYPDM.Entities.PDM_DOCUMENT; HYPDM.Entities.PDM_DOCUMENT doc = new PDM_DOCUMENT(); doc = _docService.GetDocListByID(row.Cells["DOCID"].Value.ToString())[0]; //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_DOCUMENT> docList = new List <PDM_DOCUMENT>(); 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); } }
/// <summary> /// 记录删除 /// </summary> protected void DocDelete() { int rowIndex = dgvDocList.CurrentCell.RowIndex; if (rowIndex < 0) return; DataGridViewRow row = dgvDocList.Rows[rowIndex]; IDocumentService _docService = ServiceContainer.GetService<DocumentService>(); // HYPDM.Entities.PDM_DOCUMENT doc = row.DataBoundItem as HYPDM.Entities.PDM_DOCUMENT; HYPDM.Entities.PDM_DOCUMENT doc = new PDM_DOCUMENT(); doc = _docService.GetDocListByID(row.Cells["DOCID"].Value.ToString())[0] ; //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_DOCUMENT> docList = new List<PDM_DOCUMENT>(); 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); } }
/// <summary> /// 记录属性。 /// </summary> protected void DocProperty() { int rowIndex = dgvDocList.CurrentCell.RowIndex; if (rowIndex < 0) return; DataGridViewRow row = dgvDocList.Rows[rowIndex]; //HYPDM.Entities.PDM_DOCUMENT document = row.DataBoundItem as HYPDM.Entities.PDM_DOCUMENT; //初始化属性值 HYPDM.Entities.PDM_DOCUMENT document = new PDM_DOCUMENT(); 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; DocRegForm o = new DocRegForm(); o.Document = document; if (o.ShowDialog() == DialogResult.OK) { HYPDM.Entities.PDM_DOCUMENT 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(); } }