public EDocumentCategoryContainer EDocumentCategorySelectFiltered(DBString cName, DBString cType, DBInt isActive) { TraceCallEnterEvent.Raise(); try { if (isActive == null) { isActive = DBInt.Null; } EDocumentCategoryContainer result; DataSet entitySet = m_DataContext.ndihdEDocumentCategorySelectFiltered(cName, cType, isActive); result = new EDocumentCategoryContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual EDocumentCategoryContainer SelectChildrenByTypeOfEDocumentCategory(DBString IDVal) { TraceCallEnterEvent.Raise(); try { EDocumentCategoryContainer result; DataSet entitySet = m_DataContext.ndihdTypeOfEDocumentCategorySelectBy(IDVal); result = new EDocumentCategoryContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
public virtual EDocumentCategoryContainer EDocumentCategorySelectAll() { TraceCallEnterEvent.Raise(); try { EDocumentCategoryContainer result; DataSet entitySet = m_DataContext.ndihdEDocumentCategorySelectAll(); result = new EDocumentCategoryContainer(entitySet.Tables[0]); TraceCallReturnEvent.Raise(); return result; } catch (Exception ex) { ExceptionManager.Publish(ex); TraceCallReturnEvent.Raise(false); throw; } }
/// <summary> /// Fill listview with data /// </summary> // ------------------------------------------------------------------------------------- private void FillListView() { try { lvRank.Items.Clear(); IEDocumentCategoryService srv = ServiceFactory.GetEDocumentCategoryService(); DBInt filterOnIsActive; if (CurrentID == DBGuid.Null || CurrentID.IsNull) { filterOnIsActive = 1; } else { if (m_currentDoc == null) { IEDocumentCategoryService edocCatsrv = ServiceFactory.GetEDocumentCategoryService(); m_currentDoc = edocCatsrv.EDocumentCategorySelect(CurrentID); } if (m_currentDoc != null) { filterOnIsActive = Convert.ToInt32(m_currentDoc.IsActive); } else { filterOnIsActive = 1; } } m_EDocumentCategoryContainer = srv.EDocumentCategorySelectFiltered("", ((StringListItem) cmbCategory.SelectedItem).Id, filterOnIsActive); foreach (EDocumentCategory item in m_EDocumentCategoryContainer.All) { string uid = item.ID.ToString(); string[] subitem = {uid, item.Name, item.Rank.ToString(), item.Description}; ListViewItem litem = new ListViewItem(subitem); lvRank.Items.Add(litem); lvRank.Sorting = SortOrder.Ascending; } lvRank.ListViewItemSorter = new ListViewItemComparer(2, lvRank.Sorting, true); } catch (Exception ex) { // --- Log exception ExceptionManager.Publish(ex); // --- Display Exception ErrorHandler.DisplayError("Nem várt hiba a lista frissítése során.", ex); } }
/// <summary> /// Fill datagrid with data /// </summary> // ------------------------------------------------------------------------------------- private void FillDatagrid(DBGuid ID) { try { string sortColumn = "Name"; int selectedRow = -1; // storing the previous sort order if (dtgMain.DataSource != null) { sortColumn = ((DataTable) dtgMain.DataSource).DefaultView.Sort; } // retrieving data from BusinessServices String name = ""; if (txtName.Text.Length > 0) { name = txtName.Text; } DBInt filterOnIsactive = DBInt.Null; if (cmbStatus.SelectedIndex > 0) { bool bIsActive = (cmbStatus.SelectedValue.ToString() == "1" ? true : false); filterOnIsactive = Convert.ToInt32(bIsActive); } IEDocumentTypeService srvType = ServiceFactory.GetEDocumentTypeService(); IEDocumentCategoryService srv = ServiceFactory.GetEDocumentCategoryService(); m_EDocumentCategoryContainer = srv.EDocumentCategorySelectFiltered(name, ((StringListItem) cmbCategory.SelectedItem).Id, filterOnIsactive); DataTable dt = m_EDocumentCategoryContainer.AllAsDatatable; // DataTable dttype = srvType.EDocumentTypeSelectAll().AllAsDatatable; // DataSet ds = new DataSet(); // ds.Tables.Add(dt); // ds.Tables.Add(dttype); // ds.Relations.Add(dt.Columns["DocumentTypeRef"], dttype.Columns["ID"]); dt.DefaultView.Sort = sortColumn; 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"])) { selectedRow = i; break; } bm.Position += 1; } } // makes the row selected if (selectedRow <= ((DataTable) dtgMain.DataSource).DefaultView.Count && selectedRow > -1) { dtgMain.Select(selectedRow); dtgMain.CurrentRowIndex = selectedRow; } 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 a lista frissítése során.", ex); } }