SECI  1
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events
AlertsBox.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Text;
4 using Seci.Definitions;
5 using System.Xml;
6 using System.Xml.Serialization;
7 using System.ComponentModel;
8 
9 namespace Seci.Tools
10 {
11  public class PhoneNumber
12  {
13  public string Name { get; set; }
14  public string Number { get; set; }
15  public Boolean Expires { get; set; }
16  public DateTime Expiration { get; set; }
17 
18  public PhoneNumber()
19  {
20  Name = "";
21  Number = "";
22  Expires = false;
23  Expiration = new DateTime();
24  }
25 
26  public PhoneNumber(string name, string number, bool expires, DateTime date)
27  {
28  Name = name;
29  Number = number;
30  Expires = expires;
31  Expiration = date;
32  }
33  }
34 
35  public class PhoneNumbersList : ICloneable
36  {
37  public SerialisableList<PhoneNumber> Numbers { get; set; }
38 
40  {
41  Numbers = new SerialisableList<PhoneNumber>();
42  }
43 
44  public void Add(string name, string number)
45  {
46  Numbers.Add(new PhoneNumber(name,number, false, new DateTime()));
47  }
48 
49  public void RemoveAt(int index)
50  {
51  if (index < Numbers.Count)
52  {
53  Numbers.RemoveAt(index);
54  }
55  }
56 
57  public object Clone()
58  {
59  PhoneNumbersList clone = new PhoneNumbersList();
60 
61  foreach(PhoneNumber number in Numbers)
62  {
63  clone.Add(number.Name, number.Number);
64  }
65 
66  return clone;
67  }
68  }
69 
70  public class AlertsBox : ICloneable//, IXmlSerializable
71  {
72  public SerialisableDictionary<String, BlockAlert> BlockLimitsAlerts { get; set; }
73  public WaitingAlert WaitingStateAlert { get; set; }
74 
75  public AlertsBox()
76  {
77  BlockLimitsAlerts = new SerialisableDictionary<string, BlockAlert>();
78  }
79 
80  public void AddBlockAlert(String blockname, string type, double lowlimit, double highlimit, Boolean enabled)
81  {
82  BlockLimitsAlerts.Add(blockname.ToLower(), new BlockAlert(blockname, type, lowlimit, highlimit, enabled));
83  }
84 
85  public void SetWaitingStateAlert(TimeSpan waitlimit)
86  {
87  WaitingStateAlert = new WaitingAlert(waitlimit);
88  }
89 
90  #region ICloneable Members
91 
92  public object Clone()
93  {
94  AlertsBox clone = new AlertsBox();
95 
96  foreach (var block in BlockLimitsAlerts.Keys)
97  {
98  clone.AddBlockAlert(BlockLimitsAlerts[block].Blockname, BlockLimitsAlerts[block].BlockType, BlockLimitsAlerts[block].LowLimit, BlockLimitsAlerts[block].HighLimit, BlockLimitsAlerts[block].Enabled);
99  clone.BlockLimitsAlerts[block.ToLower()].OwningConfiguration = BlockLimitsAlerts[block.ToLower()].OwningConfiguration;
100  }
101 
102  if (WaitingStateAlert != null)
103  {
104  clone.SetWaitingStateAlert(WaitingStateAlert.DelayBeforeSms);
105  clone.WaitingStateAlert.OwningConfiguration = WaitingStateAlert.OwningConfiguration;
106  }
107 
108  return clone;
109  }
110 
111  #endregion
112 
113  }
114 }
void RemoveAt(int index)
Definition: AlertsBox.cs:49
void SetWaitingStateAlert(TimeSpan waitlimit)
Definition: AlertsBox.cs:85
void Add(string name, string number)
Definition: AlertsBox.cs:44
void AddBlockAlert(String blockname, string type, double lowlimit, double highlimit, Boolean enabled)
Definition: AlertsBox.cs:80
PhoneNumber(string name, string number, bool expires, DateTime date)
Definition: AlertsBox.cs:26