public UploadAttendance(string subjectId) { InitializeComponent(); client = new MongoClient(); db = client.GetDatabase("ProxyKiller"); this.subjectId = subjectId; buffer = db.GetCollection <Buffer>("buffer"); iBuffer = db.GetCollection <ImageBuffer>("imageBuffer"); attendanceMap = db.GetCollection <AttendanceMap>("attendanceMap"); subjectAttendance = db.GetCollection <SubjectAttendance>(subjectId); subject = new SubjectAttendance(); attendance = new AttendanceMap(); map = new StudentMap(); student = new StudentAttendance(); buff = new Buffer(); iBuff = new ImageBuffer(); buff.UserName = subjectId; label1.Text = "Subject : " + subjectId; }
//constructor public TeacherForm() { InitializeComponent(); panel4.Hide(); client = new MongoClient(); db = client.GetDatabase("ProxyKiller"); studentInfo = db.GetCollection <StudentInfo>("students"); studentPicture = db.GetCollection <StudentPicture>("studentPicture"); subjectInfo = db.GetCollection <SubjectInfo>("subjectInfo"); requestInfo = db.GetCollection <RequestInfo>("requestInfo"); buffer = db.GetCollection <Buffer>("buffer"); studentMap = db.GetCollection <StudentMap>("studentMap"); tmp = new StudentMap(); buff = new Buffer(); var list = subjectInfo.AsQueryable().ToList(); List <string> subjectList = new List <string>(); foreach (var ele in list) { subjectList.Add(ele.SubjectName + " ( " + ele.SubjectId + " ) "); } listBox1.DataSource = subjectList; RefreshForm(); }