public MailMessagePage(int mailId) { InitializeComponent(); aMail = new DataBase().loadMailReal(mailId); this.richTextBox1.Text = aMail.text; this.richTextBox1.ReadOnly = true; }
internal Mails loadMailReal(int id) { string query = "select Mails.mailid, Mails.fromp, Mails.message, Mails.date FROM Mails WHERE Mails.mailid='" + id + "'"; SqlDataReader dr = getReader(query); dr.Read(); Mails aMail = new Mails((int)dr[0], (string)dr[1], (string)dr[2], (DateTime)dr[3]); con.Close(); return(aMail); }
internal Mails loadMailTeacher(int id) { string query = "select Mails.mailid, StudentInfo.fullname, Mails.message, Mails.date FROM StudentInfo, Mails WHERE StudentInfo.username = Mails.fromp and Mails.mailid='" + id + "'"; SqlDataReader dr = getReader(query); dr.Read(); Mails aMail = new Mails((int)dr[0], (string)dr[1], (string)dr[2], (DateTime)dr[3]); con.Close(); return(aMail); }
internal void teacherGetMails(Teacher _atc) { string query = "select Mails.mailid, StudentInfo.fullname, Mails.message, Mails.date FROM StudentInfo, Mails WHERE StudentInfo.username = Mails.fromp and Mails.topr='" + _atc.userName + "'"; SqlDataReader dr = getReader(query); _atc.mails = new List <Mails>(); while (dr.Read()) { Mails temp = new Mails((int)dr[0], (string)dr[1], (string)dr[2], (DateTime)dr[3]); _atc.mails.Add(temp); } con.Close(); }
internal void studentGetMails(Student _ast) { string query = "select TeacherInfo.fullname, Mails.mailid, Mails.message, Mails.date from TeacherInfo, Mails WHERE TeacherInfo.username = Mails.fromp and Mails.topr='" + _ast.userName + "'"; SqlDataReader dr = getReader(query); //new MesBox(new LogInPage(), "CHK", true).Show(); _ast.mails = new List <Mails>(); while (dr.Read()) { Mails temp = new Mails((int)dr[1], (string)dr[0], (string)dr[2], (DateTime)dr[3]); _ast.mails.Add(temp); } con.Close(); }
public MailControl(int _no, Form _f) { InitializeComponent(); id = _no; toForm = _f; if (Session.isTeacher) { aMail = new DataBase().loadMailTeacher(id); } else { aMail = new DataBase().loadMailStudent(id); } this.label1.Text += aMail.from; this.label2.Text += aMail.date.ToString(GenProperty.dateFormate); }