void OnSpecialDaysDlg(GXActionArgs arg, GXDLMSSpecialDaysTableDlg dlg, GXDLMSSpecialDay it)
 {
     if (InvokeRequired)
     {
         BeginInvoke(new SpecialDaysDlgEventHandler(OnSpecialDaysDlg), arg, dlg, it).AsyncWaitHandle.WaitOne();
     }
     else
     {
         bool         remove = false;
         ListViewItem li     = null;
         if (it == null)
         {
             remove = true;
             GXDLMSSpecialDaysTable target = Target as GXDLMSSpecialDaysTable;
             if (SpecialDay.SelectedItems.Count != 1)
             {
                 arg.Handled = true;
                 return;
             }
             else
             {
                 li       = SpecialDay.SelectedItems[0];
                 dlg.Item = it = (GXDLMSSpecialDay)li.Tag;
             }
         }
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             GXDLMSSpecialDaysTable target = Target as GXDLMSSpecialDaysTable;
             if (!remove)
             {
                 li = SpecialDay.Items.Add(it.Index.ToString());
                 li.SubItems.Add(it.Date.ToString());
                 li.SubItems.Add(it.DayId.ToString());
                 li.Tag    = it;
                 arg.Value = target.Insert(arg.Client, it);
             }
             else
             {
                 arg.Value = target.Delete(arg.Client, it);
                 li.Remove();
             }
         }
         else
         {
             arg.Handled = true;
         }
     }
 }
Esempio n. 2
0
 public void OnValueChanged(int attributeID, object value)
 {
     if (attributeID == 2)
     {
         GXDLMSSpecialDaysTable target = Target as GXDLMSSpecialDaysTable;
         GXDLMSSpecialDay[]     items  = target.Entries;
         CallingWindowLV.Items.Clear();
         if (items != null)
         {
             foreach (GXDLMSSpecialDay it in items)
             {
                 ListViewItem li = CallingWindowLV.Items.Add(it.Index.ToString());
                 li.SubItems.Add(it.Date.ToString());
                 li.SubItems.Add(it.DayId.ToString());
             }
         }
     }
 }
 public void OnValueChanged(GXDLMSViewArguments arg)
 {
     if (arg.Index == 2)
     {
         GXDLMSSpecialDaysTable target = Target as GXDLMSSpecialDaysTable;
         GXDLMSSpecialDay[]     items  = target.Entries;
         SpecialDay.Items.Clear();
         if (items != null)
         {
             foreach (GXDLMSSpecialDay it in items)
             {
                 ListViewItem li = SpecialDay.Items.Add(it.Index.ToString());
                 li.SubItems.Add(it.Date.ToString());
                 li.SubItems.Add(it.DayId.ToString());
                 li.Tag = it;
             }
         }
     }
 }
 public void OnValueChanged(int index, object value, bool user, bool connected)
 {
     if (index == 2)
     {
         GXDLMSSpecialDaysTable target = Target as GXDLMSSpecialDaysTable;
         GXDLMSSpecialDay[]     items  = target.Entries;
         SpecialDay.Items.Clear();
         if (items != null)
         {
             foreach (GXDLMSSpecialDay it in items)
             {
                 ListViewItem li = SpecialDay.Items.Add(it.Index.ToString());
                 li.SubItems.Add(it.Date.ToString());
                 li.SubItems.Add(it.DayId.ToString());
                 li.Tag = it;
             }
         }
     }
 }