Beispiel #1
0
        public Subject(string subjectId)
        {
            InitializeComponent();
            subjects = db.GetCollection <SubjectAttendance>(subjectId);
            list     = subjects.Find <SubjectAttendance>(n => true).ToList();
            var bindList = new BindingList <SubjectAttendance>(list);

            dataGridView1.DataSource = bindList;
            subject     = new SubjectAttendance();
            label1.Text = "Subject : " + subjectId;
        }
        //panel3 aprove button
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                if (student3 == null)
                {
                    throw new Exception();
                }
                int count = 0;
                try
                {
                    count = (int)studentMap.Find(n => n.UserName == student3.UserName).CountDocuments();
                }
                catch { }
                if (count == 0)
                {
                    Thread t1 = new Thread(AddPerson);
                    panel4.Show();
                    t1.Start(student3);
                    t1.Join();
                    buffer = db.GetCollection <Buffer>("buffer");
                    if (buffer.Find(n => true).CountDocuments() != 0)
                    {
                        buffer.DeleteMany(n => true);
                        throw new Exception();
                    }
                }
                attendance3          = new SubjectAttendance();
                attendance3.UserName = student3.UserName;
                attendance3.Name     = student3.Name;

                att3             = new StudentAttendance();
                att3.SubjectId   = subject3.SubjectId;
                att3.SubjectName = subject3.SubjectName;

                subjectAttendance3 = db.GetCollection <SubjectAttendance>(subject3.SubjectId);
                subjectAttendance3.InsertOne(attendance3);

                studentAttendance3 = db.GetCollection <StudentAttendance>(student3.UserName);
                studentAttendance3.InsertOne(att3);
                requestInfo.DeleteOne(n => n.UserNameSubjectId == request3.UserNameSubjectId);
                MessageBox.Show("Operation Sucessfull!");
                panel4.Hide();

                RefreshForm();
            }
            catch
            {
            }
        }
Beispiel #3
0
 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;
 }
Beispiel #4
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            int index;

            try
            {
                index               = dataGridView1.SelectedRows[0].Index;
                subject             = subjects.Find(n => n.UserName == list[index].UserName).First();
                listBox1.DataSource = subject.listOfAbsents;
            }
            catch { }
            try
            {
                index               = dataGridView1.CurrentCell.RowIndex;
                subject             = subjects.Find(n => n.UserName == list[index].UserName).First();
                listBox1.DataSource = subject.listOfAbsents;
            }
            catch { }
        }