00001 using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 using Shared;
00005
00006 namespace Server
00007 {
00011 [Serializable]
00012 public class Literature : UniquelyIdentifiable
00013 {
00014 private string author;
00015 private string title;
00016 private LiteratureType type;
00017 private string summary;
00018 private string source;
00019 private string isbn;
00020 private DateTime date;
00021 private List<Comment> comments;
00022 private Person creator;
00023 private List<Reference> references;
00024
00037 public Literature(int id, Person creator, string title, string author, string summary, string source, string isbn, DateTime date, LiteratureType type)
00038 : base(id)
00039 {
00040 this.title = title;
00041 this.author = author;
00042 this.summary = summary;
00043 this.source = source;
00044 this.type = type;
00045 this.creator = creator;
00046 this.date = date;
00047 this.isbn = isbn;
00048 this.comments = new List<Comment>();
00049 this.references = new List<Reference>();
00050 }
00051
00055 public List<Comment> Comments
00056 {
00057 get { return comments; }
00058 }
00059
00063 public List<Reference> References
00064 {
00065 get { return references; }
00066 }
00067
00071 public string ISBN
00072 {
00073 get { return isbn; }
00074 set { isbn = value; }
00075 }
00076
00080 public string Source
00081 {
00082 get { return source; }
00083 set { source = value; }
00084 }
00085
00089 public string Summary
00090 {
00091 get { return summary; }
00092 set { summary = value; }
00093 }
00094
00098 public LiteratureType Type
00099 {
00100 get { return type; }
00101 set { type = value; }
00102 }
00103
00107 public string Title
00108 {
00109 get { return title; }
00110 set { title = value; }
00111 }
00112
00116 public string Author
00117 {
00118 get { return author; }
00119 set { author = value; }
00120 }
00121
00125 public Person Creator
00126 {
00127 get { return creator; }
00128 set { creator = value; }
00129 }
00130
00134 public DateTime Date
00135 {
00136 get { return date; }
00137 set { date = value; }
00138 }
00139
00143 public LiteratureInfo Info
00144 {
00145 get
00146 {
00147 return new LiteratureInfo(ID, creator.UserName, isbn, title, author, summary, source, date, type);
00148 }
00149 }
00150
00158 public static Literature FromInfo(LiteratureInfo pi, Person p)
00159 {
00160 Literature li = new Literature(pi.id, p, pi.title, pi.author, pi.summary, pi.source, pi.isbn, pi.date, pi.type);
00161 li.isbn = pi.isbn;
00162 li.summary = pi.summary;
00163 return li;
00164 }
00165 }
00166 }