Esempio n. 1
0
 public virtual ExpertContainer ExpertSelectAll()
 {
     TraceCallEnterEvent.Raise();
       try
       {
     ExpertContainer result;
     DataSet entitySet = m_DataContext.ndihdExpertSelectAll();
     result = new ExpertContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
Esempio n. 2
0
        /// <summary>
        /// Fill datagrid with data
        /// </summary>
        private void FillDatagridExp(DBGuid ExpertID)
        {
            try
              {
            string sSortColumn = "Name";
            int nSelectedRow = -1;

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

            if (m_allDataExp == null)
            {
              // Retrieving Experts

              // Set filter
              Expert filter = new Expert(Guid.Empty);
              filter.FilterOnIsactive = DBInt.Null;
              filter.FilterOnIsactive = 1;
              filter.IsActive = true;

              // Retrieving data from BusinessServices
              IExpertService srv = ServiceFactory.GetExpertService();
              m_allDataExp = srv.ExpertSelectFiltered(filter);

              // Retrieving ProgramParticipant
              DBGuid ProgramID = new DBGuid(new Guid(m_sCurrentID));
              IProgramService srvP = ServiceFactory.GetProgramService();
              ProgramParticipantContainer allDataPP = srvP.SelectChildrenByProgramParticipant(ProgramID);

              // Hide selected Expert items
              for (int i = 0; i < allDataPP.All.Count; i++)
              {
            DBGuid ExpertRef = ((ProgramParticipant) allDataPP.All.Items[i]).ExpertRef;
            Expert selected = (Expert) m_allDataExp[ExpertRef.ToString()];
            if (selected != null)
            {
              m_allDataExp.Delete(selected);
            }
              }
            }
            // Fill expert grid
            DataTable dt = m_allDataExp.CurrentAsDatatable;
            dt.DefaultView.Sort = sSortColumn;
            dtgExpert.DataSource = dt;

            // Fill expert "detail" grid
            DataTable dtDetail = m_allDataExp.DeletedAsDatatable;
            dtDetail.DefaultView.Sort = sSortColumn;
            dtgExpertDetail.DataSource = dtDetail;

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

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

            // Enabling or disabling the buttons according to record count.
            // And is because of previous disable state.
            bool bIsEmptyGrid = (((DataTable) dtgExpert.DataSource).DefaultView.Count == 0);
            btnAddExpert.Enabled = ! bIsEmptyGrid;
            btnDetailExpert.Enabled = ! bIsEmptyGrid;

            bIsEmptyGrid = (((DataTable) dtgExpertDetail.DataSource).DefaultView.Count == 0);
            btnRemoveExpert.Enabled = ! bIsEmptyGrid;
              }
              catch (Exception ex)
              {
            //	---	Log exception
            ExceptionManager.Publish(ex);
            //	---	Display Exception
            ErrorHandler.DisplayError("Nem várt hiba lépett fel a szakember lista frissítése során.", ex);
              }
        }
 public virtual ExpertContainer SelectChildrenByQualificationOfExpert(DBString IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     ExpertContainer result;
     DataSet entitySet = m_DataContext.ndihdQualificationOfExpertSelectBy(IDVal);
     result = new ExpertContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }