public new void ForumGroupInsert(ForumGroup entity) { // check permission: admin PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permAdmin.Demand(); TraceCallEnterEvent.Raise(); try { // Check required fields if (entity.Name.Length == 0) throw new ArgumentNullException("ForumGroup.Name", "A a fórum téma neve nincs megadva."); // Logical checks ForumGroup selected = base.ForumGroupSelect(entity.ID); if (selected != null) throw new ApplicationException("A megadott azonosítóval már létezik fórum téma."); // Save data base.ForumGroupInsert(entity); BusinessAuditEvent.Success( new EventParameter("ForumGroupID", entity.ID.ToString()), new EventParameter("ForumGroupName", entity.Name) ); TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); BusinessAuditEvent.Fail( new EventParameter("Exception", ex.ToString()), new EventParameter("ForumGroupID", entity.ID.ToString()), new EventParameter("ForumGroupName", entity.Name) ); TraceCallReturnEvent.Raise(false); throw; } }
// ------------------------------------------------------------------------------------- /// <summary> /// Create new or modify existing News item /// </summary> // ------------------------------------------------------------------------------------- private void SaveData() { IForumGroupService srv = ServiceFactory.GetForumGroupService(); ForumGroup fgr = null; if (m_bNewEntity) { fgr = new ForumGroup(new DBGuid(Guid.NewGuid())); } else { fgr = new ForumGroup(CurrentID); } // Get control values fgr.Name = txtName.Text; fgr.VisibleForVisitor = cbxVisibleForVisitor.Checked; fgr.VisibleForRegistered = cbxVisibleForRegistered.Checked; fgr.IsActive = cbxActivate.Checked; // Save data if (m_bNewEntity) { srv.ForumGroupInsert(fgr); } else { srv.ForumGroupUpdate(fgr); } }
/// <summary> /// Fill datagrid with data /// </summary> private void FillDatagrid(DBGuid ID) { try { string sSortColumn = "Name"; int nSelectedRow = -1; // Storing the previous sort order if (dtgMain.DataSource != null) { sSortColumn = ((DataTable) dtgMain.DataSource).DefaultView.Sort; } // Set filter ForumGroup filter = new ForumGroup(Guid.Empty); filter.FilterOnVisibleForRegistered = DBInt.Null; if (cmbVisibleForRegistered.SelectedIndex > 0) { bool bIsVisible = (cmbVisibleForRegistered.SelectedValue.ToString() == "1" ? true : false); filter.FilterOnVisibleForRegistered = (DBInt) Convert.ToInt32(bIsVisible); filter.VisibleForRegistered = bIsVisible; } filter.FilterOnVisibleForVisitor = DBInt.Null; if (cmbVisibleForVisitor.SelectedIndex > 0) { bool bIsVisible = (cmbVisibleForVisitor.SelectedValue.ToString() == "1" ? true : false); filter.FilterOnVisibleForVisitor = (DBInt) Convert.ToInt32(bIsVisible); filter.VisibleForVisitor = bIsVisible; } filter.FilterOnIsactive = DBInt.Null; if (cmbStatus.SelectedIndex > 0) { bool bIsActive = (cmbStatus.SelectedValue.ToString() == "1" ? true : false); filter.FilterOnIsactive = (DBInt) Convert.ToInt32(bIsActive); filter.IsActive = bIsActive; } // Retrieving data from BusinessServices IForumGroupService srv = ServiceFactory.GetForumGroupService(); ForumGroupContainer allData = srv.ForumGroupSelectFiltered(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["ID"])) { 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); } }
public virtual void ForumGroupUpdate(ForumGroup entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { int count; m_DataContext.ndihdForumGroupUpdate(entity.ID, entity.Name, entity.VisibleForVisitor, entity.VisibleForRegistered, 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 ForumGroup ForumGroupSelect(DBGuid IDVal) { TraceCallEnterEvent.Raise(); try { ForumGroup result = null; DataSet entitySet = m_DataContext.ndihdForumGroupSelect(IDVal); if (entitySet.Tables[0].Rows.Count != 0) { result = new ForumGroup(entitySet); } TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual void ForumGroupInsert(ForumGroup entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { m_DataContext.ndihdForumGroupInsert(entity.ID, entity.Name, entity.VisibleForVisitor, entity.VisibleForRegistered, 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 ForumGroupDelete(ForumGroup entity) { TraceCallEnterEvent.Raise(); try { m_DataContext.BeginNestedTran(); try { m_DataContext.ndihdForumGroupDelete(entity.ID); m_DataContext.CommitNested(); } catch { m_DataContext.RollbackNested(); throw; } TraceCallReturnEvent.Raise(); return; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public ForumGroup(ForumGroup origInstance) : base(origInstance) { }
// ------------------------------------------------------------------------------------- /// <summary> /// Copy constructor. /// </summary> /// <param name="IDVal">Value of 'uID' field</param> /// <param name="origInstance">Original document data to copy.</param> // ------------------------------------------------------------------------------------- public ForumGroup(DBGuid IDVal, ForumGroup origInstance) : base(IDVal, origInstance) { }
//kész // ------------------------------------------------------------------------------------- /// <summary> /// Loads combos /// </summary> // ------------------------------------------------------------------------------------- private void LoadCombos() { try { DataTable dt = null; // Load organisations IForumGroupService srv = ServiceFactory.GetForumGroupService(); if (m_bNewItem) { // Active forumgroups ForumGroup filter = new ForumGroup(new DBGuid(Guid.NewGuid())); filter.FilterOnIsactive = 1; ForumGroupContainer allFgr = srv.ForumGroupSelectFiltered(filter); dt = allFgr.AllAsDatatable; } else { // All forumgroups ForumGroupDispsetContainer allFgr = srv.ForumGroupSelectDispsetAll(); dt = allFgr.AllAsDatatable; } cmbForumGroup.Items.Clear(); CreateSimpleCombo(dt, cmbForumGroup); // cmbForumGroup.LoadListItem (dt, "ID", "Name", false); } catch (Exception ex) { // --- Log exception ExceptionManager.Publish(ex); // --- Display Exception ErrorHandler.DisplayError("Hiba lépett fel az adatok feltöltése során", ex); } }
public ForumGroupContainer ForumGroupSelectFiltered(ForumGroup filter) { // Check permission: Admin PrincipalPermission permAdmin = new PrincipalPermission(Thread.CurrentPrincipal.Identity.Name, "Administrator"); permAdmin.Demand(); TraceCallEnterEvent.Raise(); try { ForumGroupContainer result; DataSet entitySet = m_DataContext.ndihdForumGroupSelectFiltered( filter.FilterOnVisibleForVisitor, filter.FilterOnVisibleForRegistered, filter.FilterOnIsactive); result = new ForumGroupContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }