private void EditDayId(GXDLMSActivityCalendar target, GXDLMSDayProfile[] list, int index, ListViewItem li, ListView lv)
        {
            GXDLMSDayProfile item = (GXDLMSDayProfile)li.Tag;
            GXDLMSActivityCalendarDayProfileDlg dlg = new GXDLMSActivityCalendarDayProfileDlg(item);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                UpdateDayProfile(item, li, index);
                errorProvider1.SetError(lv, Properties.Resources.ValueChangedTxt);
                Target.UpdateDirty(index, list);
            }
        }
        private void AddDayId(GXDLMSActivityCalendar target, int index, ListView li)
        {
            GXDLMSDayProfile item = new GXDLMSDayProfile();

            GXDLMSDayProfile[] list;
            if (index == 5)
            {
                list = target.DayProfileTableActive;
            }
            else
            {
                list = target.DayProfileTablePassive;
            }
            GXDLMSActivityCalendarDayProfileDlg dlg = new GXDLMSActivityCalendarDayProfileDlg(item);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                List <GXDLMSDayProfile> items = new List <GXDLMSDayProfile>();
                if (list != null)
                {
                    items.AddRange(list);
                }
                items.Add(item);
                if (index == 5)
                {
                    target.DayProfileTableActive = items.ToArray();
                }
                else
                {
                    target.DayProfileTablePassive = items.ToArray();
                }
                UpdateDayProfile(item, null, index);
                errorProvider1.SetError(li, Properties.Resources.ValueChangedTxt);
                target.UpdateDirty(index, list);
            }
        }