forked from cnunciato/littlegeek
/
Media.cs
146 lines (117 loc) · 3.58 KB
/
Media.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace LittleGeek
{
public abstract class Media : IContent
{
private int id;
private int contentID;
private string fileName;
private string title;
private string caption;
private string description;
private string metadata;
private string recipientAddress;
private string senderAddress;
private Types.MediaTypes mediaType;
private DateTime dateSubmitted;
public Media()
{
}
public int ID
{
get { return this.id; }
set { this.id = value; }
}
public int ContentID
{
get { return this.contentID; }
set { this.contentID = value; }
}
public string FileName
{
get { return this.fileName; }
set { this.fileName = value; }
}
public DateTime DateSubmitted
{
get { return this.dateSubmitted; }
set { this.dateSubmitted = value; }
}
public string Title
{
get { return this.title; }
set { this.title = value; }
}
public string Caption
{
get { return this.caption; }
set { this.caption = value; }
}
public string Description
{
get { return this.description; }
set { this.description = value; }
}
public string Metadata
{
get { return this.metadata; }
set { this.metadata = value; }
}
public string SenderAddress
{
get { return this.senderAddress; }
set { this.senderAddress = value; }
}
public string RecipientAddress
{
get { return this.recipientAddress; }
set { this.recipientAddress = value; }
}
public Types.MediaTypes MediaType
{
get { return this.mediaType; }
set { this.mediaType = value; }
}
/// <summary>
/// Saves descriptive information in the backing store (e.g, the database).
/// </summary>
public void Create()
{
DataConnector dc = new DataConnector();
DataSet ds = dc.GetSet(SQLString.CreateContent(Types.ContentTypes.Media.GetHashCode(), 1));
this.contentID = Convert.ToInt32(ds.Tables[0].Rows[0]["ContentID"]);
ds = dc.GetSet(SQLString.CreateMedia(this));
// If a title's been set, use it
if (this.Title != String.Empty)
{
dc.ExecuteSql(SQLString.CreateTitle(this));
}
// If a caption's been set, use that
if (this.Caption != String.Empty)
{
dc.ExecuteSql(SQLString.CreateCaption(this));
}
}
public void SetTitle(string title)
{
}
public void SetCaption(string Caption)
{
}
public void SetDescription(string description)
{
}
public void SetMetaData(string metaData)
{
}
public void SetMediaInfo(Types.MediaInfoTypes infoType, string info)
{
DataConnector dc = new DataConnector();
dc.ExecuteSql(SQLString.CreateMediaInfo(this, infoType, info));
}
}
}