Пример #1
0
        public int CompareTo(object obj)
        {
            GDMDateItem otherItem = obj as GDMDateItem;

            if (otherItem == null)
            {
                return(-1);
            }

            IComparable cv1 = fDate;
            IComparable cv2 = otherItem.fDate;

            int compRes;

            if (cv1 != null && cv2 != null)
            {
                compRes = cv1.CompareTo(cv2);
            }
            else if (cv1 != null)
            {
                compRes = -1;
            }
            else if (cv2 != null)
            {
                compRes = 1;
            }
            else
            {
                compRes = 0;
            }
            return(compRes);
        }
Пример #2
0
        public override void UpdateContents()
        {
            var dataOwner = fDataOwner as GDMRecordWithEvents;

            if (fSheetList == null || dataOwner == null)
            {
                return;
            }

            try
            {
                fSheetList.ClearItems();

                for (int i = 0; i < dataOwner.Events.Count; i++)
                {
                    GDMCustomEvent evt = dataOwner.Events[i];

                    object[] itemsData = new object[5];
                    itemsData[0] = (i + 1);
                    itemsData[1] = GKUtils.GetEventName(evt);
                    itemsData[2] = new GDMDateItem(evt.Date.Value);
                    if (fPersonsMode)
                    {
                        string st = evt.Place.StringValue;
                        if (evt.StringValue != "")
                        {
                            st = st + " [" + evt.StringValue + "]";
                        }
                        itemsData[3] = st;
                    }
                    else
                    {
                        itemsData[3] = evt.Place.StringValue;
                    }
                    itemsData[4] = GKUtils.GetEventCause(evt);

                    fSheetList.AddItem(evt, itemsData);
                }

                fSheetList.ResizeColumn(1);
                fSheetList.ResizeColumn(2);
                fSheetList.ResizeColumn(3);
            }
            catch (Exception ex)
            {
                Logger.LogWrite("EventsListModel.UpdateContents(): " + ex.Message);
            }
        }