コード例 #1
0
        public new void EDocumentDelete(EDocument entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            base.EDocumentDelete(entity);

            BusinessAuditEvent.Success(
              new EventParameter("EDocumentID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("EDocumentID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        private void CreateControl(DBGuid id, string name)
        {
            //Létrehozzuk a lista controlt és hozzáadjuk a contrlok közzé
              DataListControl control;
              control = (DataListControl) LoadControl("Controls/DataListControl.ascx");

              //pnlOtherDb.Controls.Add(control);
              //Controls.Add(control);

              IEDocumentService srvEDoc = ServiceFactory.GetEDocumentService();
              Ndi.HelpDesk.BusinessDocuments.EDocument filter = new Ndi.HelpDesk.BusinessDocuments.EDocument(Guid.Empty);
              filter.TypeRef = EDocumentTypeEnum.KDB;
              filter.CategoryRef = id;
              filter.Title = Helpers.CreateLikeSearchText(txtName.Text);
              if (Context.User.Identity.IsAuthenticated)
              {
            filter.FilterOnVisibleForRegistered = 1;
            filter.FilterOnVisibleForVisitor = DBInt.Null;
              }
              else
              {
            filter.FilterOnVisibleForRegistered = DBInt.Null;
            filter.FilterOnVisibleForVisitor = 1;
              }

              DataSet eOtherDoc = srvEDoc.EDocumentSelectFiltered(filter, 0);

              control.Caption = name;
              control.DataSource = eOtherDoc;
              pnlOtherDb.Controls.Add(control);
        }
コード例 #3
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="categoryID"></param>
        /// <param name="categoryName"></param>
        protected override void CreateControl(Guid categoryID, string categoryName)
        {
            IEDocumentService srvEDoc = ServiceFactory.GetEDocumentService();
              EDocumentListControl control = (EDocumentListControl) LoadControl("Controls/EDocumentListControl.ascx");
              control.ID = "grid" + categoryID.ToString();
              plDocumentList.Controls.Add(control);
              Ndi.HelpDesk.BusinessDocuments.EDocument filter = new Ndi.HelpDesk.BusinessDocuments.EDocument(Guid.Empty);

              filter.TypeRef = EDocumentTypeEnum.DOC;
              filter.CategoryRef = categoryID;
              filter.Title = Helpers.CreateLikeSearchText(txtTitle.Text);
              ;
              filter.Author = Helpers.CreateLikeSearchText(txtAuthor.Text);
              filter.LanguageRef = cmbLanguage.SelectedValue;
            //      filter.SubTypeRef = cmbBookOrPeriodical.SelectedValue;

              if (Context.User.Identity.IsAuthenticated)
              {
            filter.FilterOnVisibleForRegistered = 1;
            filter.FilterOnVisibleForVisitor = DBInt.Null;
              }
              else
              {
            filter.FilterOnVisibleForRegistered = DBInt.Null;
            filter.FilterOnVisibleForVisitor = 1;
              }

              _eDocDs = srvEDoc.EDocumentSelectFiltered(filter, 0);

              //legelõször
              if (!Page.IsPostBack)
              {
            SelectedGridOrder = "Descending";
            SelectedGridSort = "dModifiedDate";
              }
              control.Caption = categoryName;
              control.DataSource = _eDocDs;
              control.PageSize = Helpers.GetPageSize("PageSize.EDocument");
              //control.SortOrder = "Descending";
              //control.SortExpression = "ModifiedDate";
        }
コード例 #4
0
 public virtual void EDocumentUpdate(EDocument entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdEDocumentUpdate(entity.ID,
                                      entity.Title,
                                      entity.Abstract,
                                      entity.Link,
                                      entity.Author,
                                      entity.CategoryRef,
                                      entity.TypeRef,
                                      entity.SubTypeRef,
                                      entity.LanguageRef,
                                      entity.VisibleForVisitor,
                                      entity.VisibleForRegistered,
                                      entity.IsVirtual,
                                      entity.CreatedDate,
                                      entity.ModifiedDate,
     entity.IsActive,
     entity.Summary, entity.PictureUrl, out count);
       if (count == 0) throw new ServiceUpdateException();
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
コード例 #5
0
        public new void EDocumentInsert(EDocument entity)
        {
            // check permission: admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // check required fields:
            if (entity.Title.Length == 0)
              throw new ArgumentNullException("EDocument.Title", "A dokumentum címe nincs megadva.");

            // save data
            entity.CreatedDate = DBDateTime.Now;
            entity.ModifiedDate = DBDateTime.Now;

            // logical checks:
            if (entity.PictureUrl.Length > 0 && entity.PictureUrl != DBString.Null)
            {
              string ext = Path.GetExtension(entity.PictureUrl).ToLower();
              if (!(ext.Equals(".gif") || ext.Equals(".jpg") || ext.Equals("jpeg")))
            throw new ApplicationException("Csak jpeg vagy gif formátumú kép csatolható.");
              if (entity.PictureData == null || entity.PictureData.Length == 0)
            throw new ApplicationException("A fájlnévhez nem tartozik adat.");

            }
            if (entity.PictureData != null && entity.PictureData.Length > 0)
            {
              if (entity.PictureUrl.Length == 0)
            throw new ApplicationException("A kép adathoz nem tartozik fájlnév.");
            }

            EDocumentAttachmentsService attachSrv = new EDocumentAttachmentsService(m_DataContext);
            EDocumentCommendationService commSrv = new EDocumentCommendationService(m_DataContext);
            EDocumentPublisherService pubSrv = new EDocumentPublisherService(m_DataContext);
            EDocumentPictureService pictureSrv = new EDocumentPictureService(m_DataContext);

            m_DataContext.BeginNestedTran();

            try
            {
              // EDocuments
              base.EDocumentInsert(entity);
              EDocumentPictureContainer oldPicts = base.SelectChildrenByPictureOfEdocument(entity.ID);
              foreach (EDocumentPicture oldFile in oldPicts.All)
              {
            pictureSrv.EDocumentPictureDelete(oldFile);
              }

              if (entity.PictureData != null && entity.PictureData.Length > 0)
              {
            FileDataContext fileDataContext = new FileDataContext();
            fileDataContext.EDocumentInsert(entity.ID, entity.PictureData);
              }

              // EDocumentPictures
              foreach (EDocumentPicture pic in entity.EDocumentPictures.Current)
              {
            pictureSrv.EDocumentPictureInsert(pic);
              }
              // Files
              foreach (EDocumentAttachments attach in entity.EDocumentAttachments.Current)
              {
            attachSrv.EDocumentAttachmentsInsert(attach);
              }

              // Commendation
              foreach (EDocumentCommendation comm in entity.EDocumentCommendations.Current)
              {
            commSrv.EDocumentCommendationInsert(comm);
              }

              // Publisher
              foreach (EDocumentPublisher pub in entity.EDocumentPublishers.Current)
              {
            pub.CreatedDate = DateTime.Now;
            pubSrv.EDocumentPublisherInsert(pub);
              }
              m_DataContext.CommitNested();
            }
            catch
            {
              m_DataContext.RollbackNested();
              throw;
            }

            BusinessAuditEvent.Success(
              new EventParameter("EDocumentID", entity.ID.ToString()),
              new EventParameter("EDocumentTitle", entity.Title)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("EDocumentID", entity.ID.ToString()),
              new EventParameter("EDocumentTitle", entity.Title)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #6
0
 public virtual void EDocumentDelete(EDocument entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdEDocumentDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
コード例 #7
0
 public virtual EDocument EDocumentSelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     EDocument result = null;
     DataSet entitySet = m_DataContext.ndihdEDocumentSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new EDocument(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
コード例 #8
0
ファイル: Default.aspx.cs プロジェクト: bmadarasz/ndihelpdesk
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ConfigurationManager.AppSettings["StartBoxRowCount"] != null)
              {
            if ((!int.TryParse(ConfigurationManager.AppSettings["StartBoxRowCount"], out _startBoxNum)))
            {
              _startBoxNum = 5;
            }
              }

              INewsService srvNews = ServiceFactory.GetNewsService();
              IEDocumentService srvEdoc = ServiceFactory.GetEDocumentService();

              //Hírek
              DataSet dsNews = srvNews.NewsSelectDispsetTop(DBGuid.Null,
                                                    new DBGuid(new Guid("58B15351-C3C0-416F-8F45-FC7595B490B0")),
                                                    _startBoxNum);
              EnsureRowNumber(dsNews);
              grdNews.DataSource = dsNews;
              grdNews.DataBind();

              //események
              DataSet dsEsemenyek = srvNews.NewsSelectDispsetTop(new DBGuid(new Guid("58B15351-C3C0-416F-8F45-FC7595B490B0")),
                                                         DBGuid.Null, _startBoxNum);
              EnsureRowNumber(dsEsemenyek);
              grdEsemenyek.DataSource = dsEsemenyek;
              grdEsemenyek.DataBind();

              //Könyvek, folyóiratok
              DataSet dsBookPeriodicals = srvEdoc.EDocumentSelectDispsetTop(DBGuid.Null, EDocumentTypeEnum.PUB, _startBoxNum);

              //filter felparaméterezése
              Ndi.HelpDesk.BusinessDocuments.EDocument filter = new Ndi.HelpDesk.BusinessDocuments.EDocument(Guid.Empty);
              filter.TypeRef = EDocumentTypeEnum.PUB;
              filter.FilterOnIsactive = 1;
              DataSet dsBookPeriodicals2= srvEdoc.EDocumentSelectFiltered(filter, 0);
              dsBookPeriodicals2.Tables[0].DefaultView.Sort = "nPublishedYear desc, dModifiedDate desc, dCreatedDate desc";
              //for (int j = _startBoxNum; j < dsBookPeriodicals2.Tables[0].Rows.Count; j++ )
              //{
              //  dsBookPeriodicals2.Tables[0].Rows[j].Delete();
              //}
               dsBookPeriodicals2.Tables[0].AcceptChanges();

               EnsureRowNumber(dsBookPeriodicals2);
               grdBookPeriodicals.DataSource = dsBookPeriodicals2.Tables[0].DefaultView;
               grdBookPeriodicals.PageSize = _startBoxNum;
              grdBookPeriodicals.AllowPaging = true;
            grdBookPeriodicals.PagerStyle.Visible = !(grdBookPeriodicals.PageCount < 2);

              grdBookPeriodicals.DataBind();

              grdEbookAlap.ItemDataBound += grdView_ItemDataBound;

              //Alapdokumentumok
              DataSet dsEbookAlap =
            srvEdoc.EDocumentSelectDispsetTop(new DBGuid(new Guid("4673721C-CFA8-4225-81E4-6C4877AF4F56")), "", _startBoxNum);
              EnsureRowNumber(dsEbookAlap);
              grdEbookAlap.DataSource = dsEbookAlap;
              grdEbookAlap.DataBind();

              //Jogszabályok
              DataSet dsEbookJogsz =
            srvEdoc.EDocumentSelectDispsetTop(new DBGuid(new Guid("E36A74FB-8C90-40EC-A21E-A6226792CAE7")), "", _startBoxNum);
              EnsureRowNumber(dsEbookJogsz);
              grdEbookJogsz.DataSource = dsEbookJogsz;
              grdEbookJogsz.DataBind();

              //Jelentések
              DataSet dsEbookJelent =
            srvEdoc.EDocumentSelectDispsetTop(new DBGuid(new Guid("AE9BB3A7-5A65-410E-9F10-52BE974F5EBB")), "", _startBoxNum);
              EnsureRowNumber(dsEbookJelent);
              grdEbookJelent.DataSource = dsEbookJelent;
              grdEbookJelent.DataBind();

              //Állásfoglalások
              DataSet dsEbookAllasfogl =
            srvEdoc.EDocumentSelectDispsetTop(new DBGuid(new Guid("D4445B12-230C-4BA5-8294-67A10F3F956C")), "", _startBoxNum);
              EnsureRowNumber(dsEbookAllasfogl);
              grdEbookAllasfogl.DataSource = dsEbookAllasfogl;
              grdEbookAllasfogl.DataBind();

              //Elterelés
              DataSet dsEbookElterel =
            srvEdoc.EDocumentSelectDispsetTop(new DBGuid(new Guid("18B7FEDF-54B3-4C76-8DD0-935B6C83FA36")), "", _startBoxNum);
              EnsureRowNumber(dsEbookElterel);
              grdEbookdsEbookElterel.DataSource = dsEbookElterel;
              grdEbookdsEbookElterel.DataBind();

              DataTable competition = ShowCompetition();
              DataSet ds = new DataSet();
              ds.Tables.Add(competition);
              EnsureRowNumber(ds);
              grdCompetition.DataSource = competition;
              grdCompetition.DataBind();
        }
コード例 #9
0
        /// <summary>
        /// Fill datagrid with data
        /// </summary>
        private void FillDatagrid(DBGuid ID)
        {
            try
              {
            string sSortColumn = "cTitle";
            int nSelectedRow = -1;
            string commTitle = "";
            string commAuthor = "";
            string pubTitle = "";
            DBInt pubYear = DBInt.Null;

            // Storing the previous sort order
            if (dtgMain.DataSource != null)
            {
              sSortColumn = ((DataTable) dtgMain.DataSource).DefaultView.Sort;
            }

            // Set filter
            EDocument filter = new EDocument(Guid.Empty);
            filter.TypeRef = m_type;
            if (cmbLanguage.SelectedIndex > 0)
            {
              filter.LanguageRef = cmbLanguage.SelectedValue.ToString();
            }
            if (cmbSubType != null && cmbSubType.SelectedIndex > 0)
            {
              filter.SubTypeRef = cmbSubType.SelectedValue.ToString();
            }
            if (cmbCategoryRef != null && cmbCategoryRef.SelectedIndex > 0)
            {
              filter.CategoryRef = new Guid(cmbCategoryRef.SelectedValue.ToString());
            }
            if (txtTitle != null && txtTitle.Text.Length > 0)
            {
              filter.Title = txtTitle.Text;
            }

            if (txtAuthor != null && txtAuthor.Text.Length > 0)
            {
              filter.Author = txtAuthor.Text;
            }
            if (txtCommTitle != null && txtCommTitle.Text.Length > 0)
            {
              commTitle = txtCommTitle.Text;
            }

            if (txtCommAuthor != null && txtCommAuthor.Text.Length > 0)
            {
              commAuthor = txtCommAuthor.Text;
            }
            if (txtPublisherName != null && txtPublisherName.Text.Length > 0)
            {
              pubTitle = txtPublisherName.Text;
            }

            if (txtPublishYear != null && txtPublishYear.Text.Length > 0)
            {
              pubYear = new DBInt(Convert.ToInt16(txtPublishYear.Text));
            }
            if (txtLink != null && txtLink.Text.Length > 0)
            {
              filter.Link = txtLink.Text;
            }
            filter.FilterOnIsactive = DBInt.Null;
            if (cmbStatus.SelectedIndex > 0)
            {
              bool bIsActive = (cmbStatus.SelectedValue.ToString() == "1" ? true : false);
              filter.FilterOnIsactive = Convert.ToInt32(bIsActive);
              filter.IsActive = bIsActive;
            }
            // Retrieving data from BusinessServices
            IEDocumentService srv = ServiceFactory.GetEDocumentService();
            DataSet allData = srv.EDocumentSelectFiltered(filter, 0, commTitle, commAuthor, pubTitle, pubYear);
            DataTable dt = allData.Tables[0];
            dt.DefaultView.Sort = sSortColumn;
            dtgMain.DataSource = dt;

            // Locates the row specified by ID param
            if (!ID.IsNull)
            {
              BindingManagerBase bm = dtgMain.BindingContext[dtgMain.DataSource, dtgMain.DataMember];
              DataRow dr;
              for (int i = 0; i < bm.Count; i++)
              {
            dr = ((DataRowView) bm.Current).Row;
            if (ID.Value.Equals(dr["uID"]))
            {
              nSelectedRow = i;
              break;
            }
            bm.Position += 1;
              }
            }

            // Makes the row selected
            if (nSelectedRow <= ((DataTable) dtgMain.DataSource).DefaultView.Count && nSelectedRow > -1)
            {
              dtgMain.Select(nSelectedRow);
              dtgMain.CurrentRowIndex = nSelectedRow;
            }
            else if (((DataTable) dtgMain.DataSource).DefaultView.Count != 0)
            {
              dtgMain.Select(0);
            }

            // Enabling or disabling the buttons according to record count.
            // And is because of previous disable state.
            bool bIsEmptyGrid = (((DataTable) dtgMain.DataSource).DefaultView.Count == 0);
            tbbModify.Enabled = ! bIsEmptyGrid;
            tbbInactivate.Enabled = ! bIsEmptyGrid;
              }
              catch (Exception ex)
              {
            //	---	Log exception
            ExceptionManager.Publish(ex);
            //	---	Display Exception
            ErrorHandler.DisplayError("Nem várt hiba lépett fel a lista frissítése során.", ex);
              }
        }
コード例 #10
0
        /// <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);

              }
        }
コード例 #11
0
        protected void frmDocumentEdit_Load(object sender, EventArgs e)
        {
            tabControl1.SelectedTab = tabBaseData;
              IEDocumentService srv = ServiceFactory.GetEDocumentService();
              if (m_UpdateAction)
              {
            m_currentDocument = srv.EDocumentSelectPicture(CurrentID);
              }
              LoadCombos();

              if (ConfigurationManager.AppSettings["EBook.CoverSizeKBMax"] != null)
              {
            if ((!int.TryParse(ConfigurationManager.AppSettings["EBook.CoverSizeKBMax"], out _maxSize)))
            {
              _maxSize = 200;
            }
              }
              if (ConfigurationManager.AppSettings["EBook.CoverSizeWidth"] != null)
              {
            if ((!int.TryParse(ConfigurationManager.AppSettings["EBook.CoverSizeWidth"], out _maxWidth)))
            {
              _maxWidth = 500;
            }
              }
              if (ConfigurationManager.AppSettings["EBook.CoverSizeHeight"] != null)
              {
            if ((!int.TryParse(ConfigurationManager.AppSettings["EBook.CoverSizeHeight"], out _maxHeight)))
            {
              _maxHeight = 500;
            }
              }
              RetrieveData();
        }
コード例 #12
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dataGrid">Grid</param>
        /// <param name="index">Lapszám</param>
        /// <param name="sort">Sorrendezõ oszlop</param>
        /// <param name="order">Sorrend</param>
        protected void ShowGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            string publisher = "";
              DBInt publishYear = DBInt.Null;
              dataGrid.PageSize = Helpers.GetPageSize("PageSize.EBookPeriodical");

              IEDocumentService srvEDoc = ServiceFactory.GetEDocumentService();
              Ndi.HelpDesk.BusinessDocuments.EDocument filter = new Ndi.HelpDesk.BusinessDocuments.EDocument(Guid.Empty);

              //filter felparaméterezése
              filter.Title = Helpers.CreateLikeSearchText(txtTitle.Text);
              ;
              filter.Author = Helpers.CreateLikeSearchText(txtAuthor.Text);
              filter.LanguageRef = cmbLanguage.SelectedValue;
              filter.SubTypeRef = cmbBookOrPeriodical.SelectedValue;
              filter.TypeRef = EDocumentTypeEnum.PUB;
              filter.FilterOnIsactive = 1;
              if (Context.User.Identity.IsAuthenticated)
              {
            filter.FilterOnVisibleForRegistered = 1;
            filter.FilterOnVisibleForVisitor = DBInt.Null;
              }
              else
              {
            filter.FilterOnVisibleForRegistered = DBInt.Null;
            filter.FilterOnVisibleForVisitor = 1;
              }
              DataSet ds;
              if (txtPublisherName.Text.Length > 0 || txtDate.Text.Length > 0)
              {
            if (txtPublisherName.Text.Length > 0)
            {
              publisher = Helpers.CreateLikeSearchText(txtPublisherName.Text);
            }
            if (txtDate.Text.Length > 0)
            {
              publishYear = Convert.ToInt16(txtDate.Text);
            }
            ds = srvEDoc.EDocumentSelectFiltered(filter, 0, "", "", publisher, publishYear);
              }
              else
              {
            ds = srvEDoc.EDocumentSelectFiltered(filter, 0);
              }

              gridEBookPeriodical.Visible = false;

              if (ds.Tables.Count > 0)
              {
            if (ds.Tables[0].Rows.Count > 0)
            {
              gridEBookPeriodical.Visible = true;
              lblNotFound.Visible = false;
            }
            else
            {
              lblNotFound.Visible = true;
            }
              }
              else
              {
            lblNotFound.Visible = true;
              }
              DataView dv = ds.Tables[0].DefaultView;
              if (dataGrid.CurrentSortExpression != null && dataGrid.CurrentSortExpression != "")
              {
            if (order == "Ascending")
            {
              dv.Sort = dataGrid.CurrentSortExpression + " ASC";
            }
            else
            {
              dv.Sort = dataGrid.CurrentSortExpression + " DESC";
            }
              }
              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;

              if (!Page.IsPostBack)
              {
            dv.Sort = "nPublishedYear desc, dModifiedDate desc, dCreatedDate desc";
            dataGrid.CurrentSortExpression = "nPublishedYear";
            dataGrid.CurrentSortOrder = "Descending";
              }
            else
            {
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
            }
              dataGrid.DataSource = dv;
              dataGrid.DataBind();

              //dataGrid.Sort(new RowComparer(SortOrder.Descending));
        }
コード例 #13
0
   public DataSet EDocumentSelectFiltered(
 EDocument filter, int isVirtual)
   {
       return EDocumentSelectFiltered(filter, isVirtual, "", "", "", DBInt.Null);
   }
コード例 #14
0
ファイル: EDocument.cs プロジェクト: bmadarasz/ndihelpdesk
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'uID' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public EDocument(DBGuid IDVal,
              EDocument origInstance)
     : base(IDVal, origInstance)
 {
 }
コード例 #15
0
ファイル: EDocument.cs プロジェクト: bmadarasz/ndihelpdesk
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public EDocument(EDocument origInstance)
     : base(origInstance)
 {
 }
コード例 #16
0
        public DataSet EDocumentSelectFiltered(
      EDocument filter, int isVirtual, string commTitle, string commAuthor, string publisherName, DBInt publishDate)
        {
            TraceCallEnterEvent.Raise();

              try
              {
            DataSet result;
            //DBString Title, DBString Author, DBGuid CategoryRef, DBString LanguageRef

            result = m_DataContext.ndihdEDocumentSelectFiltered(
              filter.Title,
              filter.Abstract,
              filter.Link,
              filter.Author,
              filter.CategoryRef,
              filter.TypeRef,
              filter.SubTypeRef,
              filter.LanguageRef,
              filter.FilterOnVisibleForVisitor,
              filter.FilterOnVisibleForRegistered,
              isVirtual,
              commTitle,
              commAuthor,
              publisherName,
              publishDate,
              filter.FilterOnIsactive);

            TraceCallReturnEvent.Raise();
            return result;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #17
0
        public void EDocumentUpdateSimple(EDocument entity)
        {
            // Check permission: Admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // Check required fields:
            if (entity.Title.Length == 0) throw new ArgumentNullException("News.Title", "A dokumentum címe nincs megadva.");

            // Logical checks
            EDocument selected = EDocumentSelect(entity.ID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik dokumentum.");

            entity.ModifiedDate = DateTime.Now;

            base.EDocumentUpdate(entity);

            BusinessAuditEvent.Success(
              new EventParameter("EDocumentID", entity.ID.ToString()),
              new EventParameter("EDocumentTitle", entity.Title)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("EDocumentID", entity.ID.ToString()),
              new EventParameter("EDocumentTitle", entity.Title)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
コード例 #18
0
        public new void EDocumentUpdate(EDocument entity)
        {
            // Check permission: Admin
              PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdmin.Demand();

              TraceCallEnterEvent.Raise();
              try
              {
            // Check required fields:
            if (entity.Title.Length == 0) throw new ArgumentNullException("News.Title", "A dokumentum címe nincs megadva.");

            // Logical checks
            EDocument selected = EDocumentSelect(entity.ID);
            if (selected == null)
              throw new ApplicationException("A megadott azonosítóval nem létezik dokumentum.");

            if (entity.PictureUrl.Length > 0 && entity.PictureUrl != DBString.Null)
            {
              string ext = Path.GetExtension(entity.PictureUrl).ToLower();
              if (!(ext.Equals(".gif") || ext.Equals(".jpg") || ext.Equals(".jpeg")))
            throw new ApplicationException("Csak jpeg vagy gif formátumú kép csatolható.");
              if (entity.PictureData == null || entity.PictureData.Length == 0)
            throw new ApplicationException("A fájlnévhez nem tartozik adat.");

              if (entity.PictureData != null && entity.PictureData.Length > 0)
              {
            if (entity.PictureUrl.Length == 0)
              throw new ApplicationException("A kép adathoz nem tartozik fájlnév.");
              }
            }

            // Save data
            selected.Title = entity.Title;
            selected.Abstract = entity.Abstract;
            selected.Author = entity.Author;
            selected.CategoryRef = entity.CategoryRef;
            selected.CreatedDate = entity.CreatedDate;
            selected.IsVirtual = entity.IsVirtual;
            selected.LanguageRef = entity.LanguageRef;
            selected.Link = entity.Link;
            selected.SubTypeRef = entity.SubTypeRef;
            selected.Title = entity.Title;
            selected.TypeRef = entity.TypeRef;
            selected.VisibleForRegistered = entity.VisibleForRegistered;
            selected.VisibleForVisitor = entity.VisibleForVisitor;
            selected.ModifiedDate = DateTime.Now;
            selected.Summary = entity.Summary;
            selected.PictureUrl = entity.PictureUrl;

            EDocumentAttachmentsService attSrv = new EDocumentAttachmentsService(m_DataContext);
            EDocumentCommendationService commSrv = new EDocumentCommendationService(m_DataContext);
            EDocumentPublisherService pubSrv = new EDocumentPublisherService(m_DataContext);
            EDocumentPictureService pictureSrv = new EDocumentPictureService(m_DataContext);
            FileDataContext fileDataContext = new FileDataContext();
            m_DataContext.BeginNestedTran();
            try
            {

              // Clear old files:
              EDocumentPictureContainer oldPics = base.SelectChildrenByPictureOfEdocument(entity.ID);
              foreach (EDocumentPicture oldPic in oldPics.All)
              {
            pictureSrv.EDocumentPictureDelete(oldPic);
              }
              // EDocumentPictures
              foreach (EDocumentPicture pic in entity.EDocumentPictures.Current)
              {
            if (pic.PicturePath.Length > 0 && entity.PictureUrl != DBString.Null && entity.PictureData != null && pic.PictureData.Length > 0)
             pictureSrv.EDocumentPictureInsert(pic);
              }

              // Clear old files:
              EDocumentAttachmentsContainer oldFiles = base.SelectChildrenByAttachmentOfEDocument(entity.ID);
              foreach (EDocumentAttachments oldFile in oldFiles.All)
              {
            attSrv.EDocumentAttachmentsDelete(oldFile);
              }

              // EDocumentAttachments - insert:
              foreach (EDocumentAttachments file in  entity.EDocumentAttachments.Current)
              {
            attSrv.EDocumentAttachmentsInsert(file);
              }
              EDocumentCommendationContainer oldComms = base.SelectChildrenByCommendationOfEDocument(entity.ID);

              // Commendation
              foreach (EDocumentCommendation comm in entity.EDocumentCommendations.Current)
              {
            if (oldComms[comm.ID.Value.ToString()] != null)
            {
              commSrv.EDocumentCommendationUpdate(comm);
            }
            else
            {
              commSrv.EDocumentCommendationInsert(comm);
            }
              }
              // Commendation
              foreach (EDocumentCommendation comm in entity.EDocumentCommendations.Deleted)
              {
            commSrv.EDocumentCommendationDelete(comm);
              }

              EDocumentPublisherContainer oldpubs = base.SelectChildrenByPublisherOfEDocument(entity.ID);

              // Publisher
              foreach (EDocumentPublisher pub in entity.EDocumentPublishers.Current)
              {
            if (oldpubs[pub.ID.Value.ToString()] != null)
            {
              pubSrv.EDocumentPublisherUpdate(pub);
            }
            else
            {
              pub.CreatedDate = DateTime.Now;
              pubSrv.EDocumentPublisherInsert(pub);
            }
              }
              // Publisher
              foreach (EDocumentPublisher pub in entity.EDocumentPublishers.Deleted)
              {
            pubSrv.EDocumentPublisherDelete(pub);
              }
              // EDocument
              base.EDocumentUpdate(selected);

              // News base picture update
              fileDataContext.EDocumentDelete(selected.ID);
              if (entity.PictureData != null && entity.PictureData.Length > 0)
              {
            fileDataContext.EDocumentInsert(entity.ID, entity.PictureData);
              }

              m_DataContext.CommitNested();
            }
            catch
            {
              m_DataContext.RollbackNested();
              throw;
            }

            BusinessAuditEvent.Success(
              new EventParameter("EDocumentID", entity.ID.ToString()),
              new EventParameter("EDocumentTitle", entity.Title)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("EDocumentID", entity.ID.ToString()),
              new EventParameter("EDocumentTitle", entity.Title)
              );
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }