/// <summary> /// Beállítja a kiolvasott adatokat /// </summary> private void RetrieveData() { IEDocumentService srv = ServiceFactory.GetEDocumentService(); IEDocumentAttachmentsService attSrv = ServiceFactory.GetEDocumentAttachmentsService(); IEDocumentPictureService edocPicSrv = ServiceFactory.GetEDocumentPictureService(); if (m_UpdateAction) { if (m_currentDocument == null) { m_currentDocument = srv.EDocumentSelectPicture(CurrentID); } if (txtTitle != null) { txtTitle.Text = m_currentDocument.Title; } if (txtAbstract != null) { txtAbstract.Text = m_currentDocument.Abstract; } if (txtSummary != null) { txtSummary.Text = m_currentDocument.Summary; } if (txtLink != null) { txtLink.Text = m_currentDocument.Link; } if (txtAuthor != null) { txtAuthor.Text = m_currentDocument.Author; } if (cmbCategory != null && m_currentDocument.CategoryRef != DBGuid.Null) { cmbCategory.SelectedValue = m_currentDocument.CategoryRef.Value.ToString(); } if (cmbSubType != null && m_currentDocument.SubTypeRef != DBString.Null) { cmbSubType.SelectedValue = m_currentDocument.SubTypeRef.ToString(); } if (cmbLanguage != null && m_currentDocument.LanguageRef != DBString.Null) { cmbLanguage.SelectedValue = m_currentDocument.LanguageRef.ToString(); } txtModifyDate.Text = m_currentDocument.ModifiedDate.ToShortDateString() + " " + m_currentDocument.ModifiedDate.ToShortTimeString(); txtCreatedDate.Text = m_currentDocument.CreatedDate.ToShortDateString() + " " + m_currentDocument.CreatedDate.ToShortTimeString(); if (cbxVisibleForRegistered != null) { cbxVisibleForRegistered.Checked = m_currentDocument.VisibleForRegistered; } if (cbxVisibleForVisitor != null) { cbxVisibleForVisitor.Checked = m_currentDocument.VisibleForVisitor; } if (cbxIsVirtual != null) { cbxIsVirtual.Checked = m_currentDocument.IsVirtual; } if (txtPictureUrl != null) { txtPictureUrl.Text = m_currentDocument.PictureUrl; // Show picture if (m_currentDocument.PictureData != null && m_currentDocument.PictureData.Length > 0) { MemoryStream imageStream = new MemoryStream(m_currentDocument.PictureData); pbxPictureBase.Image = Image.FromStream(imageStream); } } } else { CurrentID = new DBGuid(Guid.NewGuid()); m_currentDocument = new EDocument(CurrentID); } m_currentDocument.Title = m_type; m_currentDocument.EDocumentAttachments = srv.SelectChildrenByAttachmentOfEDocument(CurrentID); m_currentDocument.EDocumentCommendations = srv.SelectChildrenByCommendationOfEDocument(CurrentID); m_currentDocument.EDocumentPublishers = srv.SelectChildrenByPublisherOfEDocument(CurrentID); m_currentDocument.EDocumentPictures = srv.SelectChildrenByPictureOfEdocument(CurrentID); // txtBasePictureUrl.Text foreach (EDocumentPicture pic in m_currentDocument.EDocumentPictures.All) { EDocumentPicture picData = edocPicSrv.EDocumentPictureSelectPicture(pic.ID); pic.PictureData = picData.PictureData; } // Show picture if (m_currentDocument.PictureData != null && m_currentDocument.PictureData.Length > 0) { MemoryStream imageStream = new MemoryStream(m_currentDocument.PictureData); pbxPictureBase.Image = Image.FromStream(imageStream); pbxPictureBase.Image = Image.FromStream(imageStream); } EDocumentAttachmentsContainer avaiableFiles = new EDocumentAttachmentsContainer(); foreach (EDocumentAttachments file in m_currentDocument.EDocumentAttachments.All) { EDocumentAttachments oldFile = attSrv.EDocumentAttachmentsSelectFile(file.ID); if (oldFile.FileData != null && oldFile.FileData.Length > 0) { file.FileData = oldFile.FileData; file.FileSize = oldFile.FileSize; file.FileSizeInByte = oldFile.FileSizeInByte; if (!avaiableFiles.All.Items.Contains(file)) { avaiableFiles.Add(file); } } } m_currentDocument.EDocumentAttachments = avaiableFiles; //2nd Page FillDatagrid(DBGuid.Null); FillDatagridComm(DBGuid.Null); //PublisherPAge if (m_type.Equals(EDocumentTypeEnum.PUB) && tabPulisher != null && m_currentDocument.EDocumentPublishers.All.Count > 0) { EDocumentPublisher publisher = (EDocumentPublisher) m_currentDocument.EDocumentPublishers.All[0]; txtPublisherName.Text = publisher.Name; txtPublisherContact.Text = publisher.Contact; txtPublisherLink.Text = publisher.Link; txtPublisherCreatedDate.Text = publisher.CreatedDate.ToShortDateString() + " " + publisher.CreatedDate.ToShortTimeString(); //dtpPublishYear.Value = new DBDateTime(publisher.Year, 12, 31); //dtpPublishYear.Text = dtpPublishYear.Value.ToShortDateString(); dateTimePicker1.Value = new DBDateTime(publisher.Year, 12, 31); } }
public virtual EDocumentAttachmentsContainer SelectChildrenByAttachmentOfEDocument(DBGuid IDVal) { TraceCallEnterEvent.Raise(); try { EDocumentAttachmentsContainer result; DataSet entitySet = m_DataContext.ndihdAttachmentOfEDocumentSelectBy(IDVal); result = new EDocumentAttachmentsContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual EDocumentAttachmentsContainer EDocumentAttachmentsSelectAll() { TraceCallEnterEvent.Raise(); try { EDocumentAttachmentsContainer result; DataSet entitySet = m_DataContext.ndihdEDocumentAttachmentsSelectAll(); result = new EDocumentAttachmentsContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }