コード例 #1
0
ファイル: EventService.cs プロジェクト: bmadarasz/ndihelpdesk
 public EventContainer EventSelectFiltered(Event filter)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     EventContainer result;
     DataSet entitySet = m_DataContext.ndihdEventSelectFiltered(
       filter.Method,
       filter.PrincipalName,
       filter.FilterOnTimeStampFrom,
       filter.FilterOnTimeStampTo);
     result = new EventContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
コード例 #2
0
        /// <summary>
        /// Fill datagrid with data
        /// </summary>
        private void FillDatagrid(DBInt ID)
        {
            try
              {
            string sSortColumn = "TimeStamp DESC";
            int nSelectedRow = -1;

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

            // Set filter
            Event filter = new Event();
            if (cmbFunctions.SelectedIndex > 0)
            {
              filter.Method = cmbFunctions.SelectedValue.ToString();
            }
            if (txtLoginName.Text.Length > 0)
            {
              filter.PrincipalName = txtLoginName.Text;
            }
            if (dtpFrom.Checked)
            {
              filter.FilterOnTimeStampFrom = new DBDateTime(dtpFrom.Value.Date);
            }
            if (dtpTo.Checked)
            {
              DBDateTime dateTo = new DBDateTime(dtpTo.Value);
              filter.FilterOnTimeStampTo = dateTo.AddDays(1).AddMilliseconds(-1);
            }

            // Retrieving data from BusinessServices
            IEventService srv = ServiceFactory.GetEventService();
            EventContainer allData = srv.EventSelectFiltered(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;
              }
              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);
              }
        }
コード例 #3
0
ファイル: Event.cs プロジェクト: bmadarasz/ndihelpdesk
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public Event(Event origInstance)
     : base(origInstance)
 {
 }
コード例 #4
0
ファイル: Event.cs プロジェクト: bmadarasz/ndihelpdesk
 // -------------------------------------------------------------------------------------
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="IDVal">Value of 'nID' field</param>
 /// <param name="origInstance">Original document data to copy.</param>
 // -------------------------------------------------------------------------------------
 public Event(DBInt IDVal,
          Event origInstance)
     : base(IDVal, origInstance)
 {
 }
コード例 #5
0
 public virtual void EventUpdate(Event entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       int count;
       m_DataContext.ndihdEventUpdate(entity.ID,
                                  entity.TimeStamp,
                                  entity.Severity,
                                  entity.Source,
                                  entity.Method,
                                  entity.ThreadInfo,
                                  entity.WindowsIdentity,
                                  entity.PrincipalName,
                                  entity.Message, 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;
       }
 }
コード例 #6
0
 public virtual Event EventSelect(DBInt IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     Event result = null;
     DataSet entitySet = m_DataContext.ndihdEventSelect(IDVal);
     if (entitySet.Tables[0].Rows.Count != 0)
     {
       result = new Event(entitySet);
     }
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
コード例 #7
0
 public virtual void EventInsert(Event entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdEventInsert(entity.TimeStamp,
                                  entity.Severity,
                                  entity.Source,
                                  entity.Method,
                                  entity.ThreadInfo,
                                  entity.WindowsIdentity,
                                  entity.PrincipalName,
                                  entity.Message);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
コード例 #8
0
 public virtual void EventDelete(Event entity)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     m_DataContext.BeginNestedTran();
     try
     {
       m_DataContext.ndihdEventDelete(entity.ID);
       m_DataContext.CommitNested();
     }
     catch
     {
       m_DataContext.RollbackNested();
       throw;
     }
     TraceCallReturnEvent.Raise();
     return;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }