-
Notifications
You must be signed in to change notification settings - Fork 0
/
Call.cs
97 lines (88 loc) · 2.54 KB
/
Call.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
namespace PhoneComponents
{
using System;
using System.Text;
public class Call
{
private string data;
private string time;
private string dialledPhoneNumber;
private int duration;
public Call(string data, string time, string dialledPhoneNumber, int duration)
{
this.data = data;
this.time = time;
this.dialledPhoneNumber = dialledPhoneNumber;
this.duration = duration;
}
public string Data
{
get
{
return this.data;
}
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Data is not curect input");
}
this.data = value;
}
}
public string Time
{
get
{
return this.time;
}
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Data is not curect input");
}
this.time = value;
}
}
public string DialledPhoneNumber
{
get
{
return this.dialledPhoneNumber;
}
set
{
if (string.IsNullOrEmpty(value))
{
throw new ArgumentException("Dialled phone number is not curect input");
}
this.dialledPhoneNumber = value;
}
}
public int Duration
{
get
{
return this.duration;
}
set
{
if (value<=0)
{
throw new ArgumentException("The minutes can not be negative number");
}
this.duration = value;
}
}
public override string ToString()
{
var infoCall = new StringBuilder();
infoCall.AppendFormat("Call Data - {0} \n",this.data);
infoCall.AppendFormat("Call Time - {0} \n", this.time);
infoCall.AppendFormat("Call DialledPhoneNumber - {0} \n", this.dialledPhoneNumber);
infoCall.AppendFormat("Call Duration - {0} \n", this.duration);
return infoCall.ToString();
}
}
}