Exemple #1
0
        private void grdvStopEvents_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            int idx = grdvStopEvents.GetFocusedDataSourceRowIndex();

            if (idx < 0 || idx >= stopEvents.Count)
            {
                return;
            }

            SelectPeriodStopEvent stopEvent = stopEvents[idx];

            List <SelectPeriodAndonEvent> datas = new List <SelectPeriodAndonEvent>();

            for (int i = 0; i < stopEvent.AndonEventFactIDs.Count; i++)
            {
                SelectPeriodAndonEvent data = FindAndonEventWithFactID(andonEvents, stopEvent.AndonEventFactIDs[i]);
                if (data != null)
                {
                    data          = data.Clone();
                    data.Selected = true;
                    datas.Add(data);
                }
            }
            foreach (SelectPeriodAndonEvent data in unUsedAndonEvents)
            {
                datas.Add(data.Clone());
            }

            SelectPeriodAndonEvent_CompareByFactID compare = new SelectPeriodAndonEvent_CompareByFactID();

            datas.Sort(compare);

            grdAndonEvents.DataSource = datas;
            grdvAndonEvents.BestFitColumns();
        }
Exemple #2
0
        private void repositoryItemCheckEdit1_CheckedChanged(object sender, EventArgs e)
        {
            int idx = grdvAndonEvents.GetFocusedDataSourceRowIndex();

            if (grdvAndonEvents.GetFocusedRow() != null)
            {
                SelectPeriodAndonEvent data =
                    grdvAndonEvents.GetFocusedRow() as SelectPeriodAndonEvent;

                SelectPeriodStopEvent stopEvent =
                    grdvStopEvents.GetFocusedRow() as SelectPeriodStopEvent;

                data.Selected = !data.Selected;
                grdvStopEvents.BeginDataUpdate();
                if (data.Selected)
                {
                    RemoveFromUnUsedAndonEvents(data.EventFactID);
                    stopEvent.AndonEventFactIDs.Add(data.EventFactID);
                }
                else
                {
                    unUsedAndonEvents.Add(data.Clone());
                    stopEvent.AndonEventFactIDs.Remove(data.EventFactID);
                }
                grdvStopEvents.EndDataUpdate();
            }
        }
Exemple #3
0
        private void AddToSelectStopEvent(PeriodStopEvent data)
        {
            SelectPeriodStopEvent stopEvent = null;

            if (data != null)
            {
                for (int i = 0; i < stopEvents.Count; i++)
                {
                    if (stopEvents[i].EventFactID == data.EventFactID)
                    {
                        stopEvent = stopEvents[i];
                        break;
                    }
                }

                if (stopEvent == null)
                {
                    stopEvent         = new SelectPeriodStopEvent();
                    stopEvent.Ordinal = stopEvents.Count + 1;
                    stopEvents.Add(stopEvent);
                }
                stopEvent.CopyFrom(data);
            }
        }