Ejemplo n.º 1
0
        /* D O  F E T C H */

        /*----------------------------------------------------------------------------
        *       %%Function: DoFetch
        *       %%Qualified: AzLog.AzLogWindow.DoFetch
        *       %%Contact: rlittle
        *
        *  ----------------------------------------------------------------------------*/
        private void DoFetch(object sender, EventArgs e)
        {
            DateTime dttmMin, dttmMac;

            AzLogModel.FillMinMacFromStartEnd(m_ebStart.Text, m_ebEnd.Text, out dttmMin, out dttmMac);

            // update our filter so we will see this

            // we intimately know which items to edit. if this ever turns out to be false, then we will have to find
            // the right parts of the filter, or just rebuild it. but that will be slower (ack)
            AzLogFilter.AzLogFilterOperation azlfo = m_azlv.Filter.Operations[0]; // start is first item, end is last


            if (azlfo.Op != AzLogFilter.AzLogFilterOperation.OperationType.Value || azlfo.Condition.LHS.Source != AzLogFilter.AzLogFilterValue.DataSource.DttmRow)
            {
                throw new Exception("did not find correct value type in filter");
            }

            azlfo.Condition.RHS.OValue = dttmMin; // update our filter to include the new date range, otherwise the model will get new data and we won't show it

            azlfo = m_azlv.Filter.Operations[1];  // start is first item, end is last


            if (azlfo.Op != AzLogFilter.AzLogFilterOperation.OperationType.Value || azlfo.Condition.LHS.Source != AzLogFilter.AzLogFilterValue.DataSource.DttmRow)
            {
                throw new Exception("did not find correct value type in filter");
            }

            azlfo.Condition.RHS.OValue = dttmMac; // update our filter to include the new date range, otherwise the model will get new data and we won't show it
            m_azlv.RebuildView();

            m_azlm.FFetchPartitionsForDateRange(dttmMin, dttmMac);
        }
Ejemplo n.º 2
0
        /* B U M P  D T T M  F I L T E R */

        /*----------------------------------------------------------------------------
        *       %%Function: BumpDttmFilter
        *       %%Qualified: AzLog.AzLogWindow.BumpDttmFilter
        *       %%Contact: rlittle
        *
        *   Bump forward or backward the datetime filter by the given nHours. fStart
        *   determines if we are bumping the start or end of the range
        *  ----------------------------------------------------------------------------*/
        private void BumpDttmFilter(TextBox eb, int nHours, bool fStart)
        {
            // figure out the timespan being requested
            DateTime dttmMin, dttmMac;

            AzLogModel.FillMinMacFromStartEnd(eb.Text, eb.Text, out dttmMin, out dttmMac);

            // update our filter so we will see this

            // we intimately know which items to edit. if this ever turns out to be false, then we will have to find
            // the right parts of the filter, or just rebuild it. but that will be slower (ack)
            AzLogFilter.AzLogFilterOperation azlfo = m_azlv.Filter.Operations[fStart ? 0 : 1]; // start is first item, end is last

            if (azlfo.Op != AzLogFilter.AzLogFilterOperation.OperationType.Value ||
                !azlfo.Condition.RHS.FEvaluate(AzLogFilter.AzLogFilterCondition.CmpOp.Eq, new AzLogFilter.AzLogFilterValue(dttmMac), null))
            {
                throw new Exception("did not find correct end date value in filter");
            }

            // now add an hour to the end
            dttmMac = dttmMac.AddHours(nHours);
            azlfo.Condition.RHS.OValue = dttmMac; // update our filter to include the new date range, otherwise the model will get new data and we won't show it
            m_azlv.RebuildView();
            // 10/26/2015 9:00

            eb.Text = dttmMac.ToLocalTime().ToString("MM/dd/yyyy HH:mm");

            // at this point, all our changes were to "dttmMac" (dttmMin started out same as dttmMac...so we could just
            // blissfully use dttmMac.  But for the fetch, it matters if we are growing or shrinking our range
            if (fStart)
            {
                if (nHours < 0)
                {
                    m_azlm.FFetchPartitionsForDateRange(dttmMac, dttmMin); // i know, confusing. but we modified dttmMac...
                }
            }
            else
            {
                if (nHours > 0)
                {
                    m_azlm.FFetchPartitionsForDateRange(dttmMin, dttmMac);
                }
            }
        }