Exemplo n.º 1
0
        public new void DictionaryDelete(Dictionary entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

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

            BusinessAuditEvent.Success(
              new EventParameter("DictionaryID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("ContinuativeID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Exemplo n.º 2
0
        // -------------------------------------------------------------------------------------
        /// <summary>
        /// Prepage Save action
        /// </summary>
        // -------------------------------------------------------------------------------------
        private void SaveData()
        {
            IDictionaryService dictSrv = ServiceFactory.GetDictionaryService();
              Dictionary dict;
              if (m_bNewItem)
              {
            CurrentID = Guid.NewGuid();
            dict = new Dictionary(CurrentID);
            dict.IsActive = true;
            dict.Word = txtWord.Text;
              }
              else
              {
            dict = dictSrv.DictionarySelect(CurrentID);
              }

              // Get control values
              dict.English = txtEnglish.Text;
              dict.Meaning = txtMeaning.Text;
              dict.Professional = rbProfessional.Checked;

              DictionaryAssocContainer assocs = new DictionaryAssocContainer();

              foreach (Dictionary dic in m_data.Current)
              {
            assocs.Add(new DictionaryAssoc(CurrentID, dic.ID));
              }
              dict.Relations = assocs;

              // Save data
              if (m_bNewItem)
            dictSrv.DictionaryInsert(dict);
              else
            dictSrv.DictionaryUpdate(dict);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add a ThesasurusRelation to the list.
        /// </summary>
        private void AddRelation()
        {
            if (txtRelatedWord.Text.Length == 0)
              {
            MessageBox.Show("A kapcsolódó szó nincs megadva. Adja meg a kapcsolódó szót a beviteli mezõben!",
                        "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            txtRelatedWord.Select();
            return;
              }
              if (txtRelatedWord.Text == txtWord.Text)
              {
            MessageBox.Show("A kapcsolódó szó nem lehet önmaga. Adjon meg egy létezõ kapcsolódó szót a beviteli mezõben!",
                        "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information);
            txtRelatedWord.Select();
            return;
              }

              try
              {
            // Logical checks
            string relatedWord = txtRelatedWord.Text;

            IDictionaryService dictSrv = ServiceFactory.GetDictionaryService();
            Dictionary filter = new Dictionary(Guid.NewGuid());
            filter.Word = relatedWord;

            DictionaryContainer dictcont = dictSrv.DictionarySelectFiltered(filter);
            if (dictcont == null || dictcont.AllCount == 0)
            {
              MessageBox.Show("A kapcsolódó szó nem található. Adjon meg már létezõ kapcsolódó szót a beviteli mezõben!",
                          "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information);
              txtRelatedWord.Select();
              return;
            }

            DBGuid relatedWordID = ((Dictionary) dictcont.All[0]).ID;
            //van már ilyen kapcsolat
            if (m_data[relatedWordID.ToString()] != null)
            {
              MessageBox.Show(
            "A kapcsolódó szó már hozzá van rendelve az alapszóhoz. Adjon meg másik kapcsolódó szót a beviteli mezõben!",
            "NDI HelpDesk Adminisztrátor", MessageBoxButtons.OK, MessageBoxIcon.Information);
              txtRelatedWord.Select();
              return;
            }
            // Add to container
            m_data.Add(dictcont[0]);

            // Refresh grid
            FillDatagrid(CurrentID);

            txtRelatedWord.Text = "";
              }
              catch (Exception ex)
              {
            //	---	Log exception
            ExceptionManager.Publish(ex);
            //	---	Display Exception
            ErrorHandler.DisplayError("Nem várt hiba lépett fel a kapcsolódó szó hozzáadása során.", ex);
              }
        }
Exemplo n.º 4
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public Dictionary(Dictionary origInstance)
     : base(origInstance)
 {
 }
Exemplo n.º 5
0
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'nID' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public Dictionary(DBGuid IDVal,
               Dictionary origInstance)
     : base(IDVal, origInstance)
 {
 }
 public virtual void DictionaryUpdate(Dictionary entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdDictionaryUpdate(entity.ID,
                                       entity.Word,
                                       entity.English,
                                       entity.Meaning,
                                       entity.Professional,
                                       entity.IsActive, 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;
       }
 }
 public virtual Dictionary DictionarySelect(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     Dictionary result = null;
     DataSet entitySet = m_DataContext.ndihdDictionarySelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new Dictionary(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual void DictionaryInsert(Dictionary entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdDictionaryInsert(entity.ID,
                                       entity.Word,
                                       entity.English,
                                       entity.Meaning,
                                       entity.Professional,
                                       entity.IsActive);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual void DictionaryDelete(Dictionary entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdDictionaryDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Exemplo n.º 10
0
        private void PopulateAbcList()
        {
            IDictionaryService srvDict = ServiceFactory.GetDictionaryService();
              Ndi.HelpDesk.BusinessDocuments.Dictionary filter = new Ndi.HelpDesk.BusinessDocuments.Dictionary(Guid.Empty);
              if (cmbType.SelectedIndex > 0)
              {
            if (cmbType.SelectedIndex == 1)
            {
              filter.FilterOnProfessional = 1;
            }
            else
            {
              filter.FilterOnProfessional = 0;
            }
              }

              filter.FilterOnIsactive = 1;

              DataSet ds = srvDict.DictionarySelectFirstLetter(filter);

              pnlAbc.Controls.Clear();

              if (ds.Tables.Count > 0)
              {
            if (ds.Tables[0].Rows.Count > 0)
            {
              for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
              {
            Literal lit = new Literal();
            LinkButton lnk = new LinkButton();

            lit.Text = "&nbsp;&nbsp;";
            lnk.Text = ds.Tables[0].Rows[i]["cFirstLetter"].ToString();
            lnk.CommandArgument = lnk.Text;
            lnk.Visible = true;
            lnk.ID = lnk.Text;
            lnk.AccessKey = lnk.Text;

            pnlAbc.Controls.Add(lnk);
            pnlAbc.Controls.Add(lit);
              }
            }
            else //Nincs találat
            {
              Literal lit = new Literal();
              lit.Text = "Nincs találat";
              pnlAbc.Controls.Add(lit);
            }
              }
              else //Nincs találat
              {
            Literal lit = new Literal();
            lit.Text = "Nincs találat";
            pnlAbc.Controls.Add(lit);
              }
        }
Exemplo n.º 11
0
        private DictionaryContainer GetFilteredList()
        {
            #region lekérdezzük a DictinaryContainer -t (a szûrési feltételeknek megfelelõen)

              IDictionaryService srvDict = ServiceFactory.GetDictionaryService();
              Ndi.HelpDesk.BusinessDocuments.Dictionary filter = new Ndi.HelpDesk.BusinessDocuments.Dictionary(Guid.Empty);

              string sortAbc;

              sortAbc = Request["__EVENTTARGET"];

              if (sortAbc != null)
              {
            if (sortAbc.Length == 1)
            {
              txtWord.Text = sortAbc + "*";
            }
              }

              filter.Word = txtWord.Text;
              if (cmbType.SelectedIndex > 0)
              {
            if (cmbType.SelectedIndex == 1)
            {
              filter.FilterOnProfessional = 1;
            }
            else
            {
              filter.FilterOnProfessional = 0;
            }
              }
              filter.FilterOnIsactive = 1;

              DictionaryContainer selected = srvDict.DictionarySelectFiltered(filter);
              return selected;

              #endregion
        }
Exemplo n.º 12
0
        protected void ShowGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            dataGrid.PageSize = GetCurrentPageSize();

              IDictionaryService srvDict = ServiceFactory.GetDictionaryService();
              Ndi.HelpDesk.BusinessDocuments.Dictionary filter = new Ndi.HelpDesk.BusinessDocuments.Dictionary(Guid.Empty);

              string sortAbc;
              sortAbc = Request["__EVENTTARGET"];

              #region : ABC szûrés :

              if (sortAbc != null)
              {
            sortAbc = sortAbc.Replace("ctl00$bodycontent$", "");
            if (sortAbc.Length == 1)
            {
              txtWord.Text = sortAbc + "*";
              index = 0;
            }
              }

              #endregion

              #region : Kiválasztott szó részletei :

              if (sortAbc != null)
              {
            if ((sortAbc.IndexOf("lnkRefWord") > -1) || (sortAbc.IndexOf("lnkDictionaryWordDetails") > -1))
            {
              index = dataGrid.CurrentPageIndex;
              if (sortAbc.IndexOf('#') > 0)
              {
            string id = sortAbc.Split('#')[1];
            Guid currentID = new Guid(id);
            ShowDetails(currentID);
              }
            }
              }

              #endregion

              bool isNormalFilter = sortAbc == null ||
                            (sortAbc != null && (sortAbc.Length == 0 || sortAbc.Length > 1) &&
                             sortAbc.IndexOf("lnkRefWord") < 0 && sortAbc.IndexOf("lnkDictionaryWordDetails") < 0);
              filter.Word = isNormalFilter ? Helpers.CreateLikeSearchText(txtWord.Text) : txtWord.Text;
              filter.English = isNormalFilter ? Helpers.CreateLikeSearchText(txtEnglish.Text) : txtEnglish.Text;
              if (cmbType.SelectedIndex > 0)
              {
            if (cmbType.SelectedIndex == 1)
            {
              filter.FilterOnProfessional = 1;
            }
            else
            {
              filter.FilterOnProfessional = 0;
            }
              }
              filter.FilterOnIsactive = 1;

              DictionaryContainer selected = srvDict.DictionarySelectFiltered(filter);

              if (selected.All.Count == 0)
              {
            dataGrid.Visible = false;
            lblNotFound.Visible = true;
              }
              else
              {
            dataGrid.Visible = true;
            lblNotFound.Visible = false;
              }

              ArrayList sortableList;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;

              if (sort != null)
              {
            dataGrid.CurrentSortExpression = sort;
              }
              if (order != null)
              {
            dataGrid.CurrentSortOrder = order;
              }
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
Exemplo n.º 13
0
        public new void DictionaryInsert(Dictionary entity)
        {
            //check permission: Admin
              PrincipalPermission permAdm = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator");
              permAdm.Demand();

              DictionaryAssocService srv = new DictionaryAssocService(m_DataContext);
              m_DataContext.BeginNestedTran();
              try
              {
            // Thesaurus
            base.DictionaryInsert(entity);

            // ThesaurusRelations - delete and insert
            m_DataContext.ndihdWordOfDictionaryDeleteBy(entity.ID);
            foreach (DictionaryAssoc rel in entity.Relations.Current)
            {
              srv.DictionaryAssocInsert(rel);
            }

            m_DataContext.CommitNested();

            BusinessAuditEvent.Success(
              new EventParameter("DictionaryID", entity.ID)
              );
            TraceCallReturnEvent.Raise();
            return;
              }
              catch (Exception ex)
              {
            ExceptionManager.Publish(ex);
            BusinessAuditEvent.Fail(
              new EventParameter("Exception", ex.ToString()),
              new EventParameter("DictionaryID", entity.ID));
            TraceCallReturnEvent.Raise(false);
            throw;
              }
        }
Exemplo n.º 14
0
 public DataSet DictionarySelectFirstLetter(Dictionary filter)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     DataSet entitySet =
       m_DataContext.ndihdDictionarySelectFirstLetter(filter.Word, filter.FilterOnProfessional,
                                                  filter.FilterOnIsactive);
     TraceCallReturnEvent.Raise();
     return entitySet;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Exemplo n.º 15
0
 public DictionaryContainer DictionarySelectFiltered(Dictionary filter)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     DictionaryContainer result;
     DataSet entitySet =
       m_DataContext.ndihdDictionarySelectFiltered(filter.Word, filter.English, filter.FilterOnProfessional,
                                               filter.FilterOnIsactive);
     result = new DictionaryContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Exemplo n.º 16
0
        /// <summary>
        /// Fill datagrid with data
        /// </summary>
        private void FillDatagrid(DBGuid ID)
        {
            try
              {
            string sSortColumn = "Word";
            int nSelectedRow = -1;

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

            // Set filter
            Dictionary filter = new Dictionary(ID);
            if (txtWord.Text.Length > 0)
            {
              filter.Word = txtWord.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;
            }

            filter.FilterOnProfessional = DBInt.Null;
            if (cmbProfessional.SelectedIndex > 0)
            {
              bool bProfessional = (cmbProfessional.SelectedValue.ToString() == "1" ? true : false);
              filter.FilterOnProfessional = Convert.ToInt32(bProfessional);
              filter.IsActive = bProfessional;
            }

            // Retrieving data from BusinessServices
            IDictionaryService srv = ServiceFactory.GetDictionaryService();
            DictionaryContainer allData = srv.DictionarySelectFiltered(filter);
            DataTable dt = allData.AllAsDatatable;
            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["Word"]))
            {
              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);
              }
        }