示例#1
0
        public IActionResult PostFeedbackForTest([FromBody] FeedbackInputModel feedback)
        {
            AuthorDataAccess au = new AuthorDataAccess();
            AdminDataAccess  ad = new AdminDataAccess();

            var q = au.GetQuestionById(feedback.QuestionId);
            var u = ad.GetUserByID(feedback.UserId);

            if (string.IsNullOrWhiteSpace(feedback.Message))
            {
                return(BadRequest("Введите сообщение"));
            }

            if (q == null)
            {
                return(BadRequest("Вопроса не существует"));
            }

            if (u == null)
            {
                return(BadRequest("Юзера не существует"));
            }

            Mapper            mapper  = new Mapper();
            StudentDataAccess student = new StudentDataAccess();
            int id = student.CreateFeedback(mapper.ConvertFeedbackInputModelToFeedbackDTO(feedback));

            return(Ok(id));
        }
示例#2
0
        public ActionResult ConfirmStudentDelete(int id)
        {
            int i = id;

            StudentDataAccess.Delete(i);
            return(RedirectToAction("Index"));
        }
示例#3
0
        private List <QuestionWithListAnswersDTO> CreateListOfQuestions(int userId, int testId)
        {
            List <QuestionWithListAnswersDTO> questions = new List <QuestionWithListAnswersDTO>();
            StudentDataAccess student = new StudentDataAccess();

            return(questions = student.GetQuestionsAndAnswers(testId));
        }
示例#4
0
        private void txtStudentId_KeyDown(object sender, KeyEventArgs e)
        {
            // find student
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    var student = new Student();
                    student.RefNo = txtStudentId.Text;

                    var record = StudentDataAccess.findStudent(student);

                    // check if record is null
                    if (record == null)
                    {
                        MessageBox.Show("Record not found. Please enter correct Student-ID", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else if (record.IsRemoved == true)
                    {
                        MessageBox.Show("Inactive Student-ID found", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        txtStudentName.Text = record.Name;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed : " + ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#5
0
        public void viewButton_Click(object sender, EventArgs e)
        {
            deleteIdtextBox.Text = "";
            //string server = "ali";
            //string database = "hallmanagement";

            //string connectionString = string.Format("server={0};database={1};Integrated security=true;", server,
            //    database);
            //connection = new SqlConnection(connectionString);


            StudentDataAccess  dataAccess = new StudentDataAccess();
            List <StudentInfo> students   = dataAccess.viewStudentInfo();

            studentDataGridView.AutoGenerateColumns          = false;
            studentDataGridView.DataSource                   = students;
            studentDataGridView.Columns[0].DataPropertyName  = "st_Id";
            studentDataGridView.Columns[1].DataPropertyName  = "st_Name";
            studentDataGridView.Columns[2].DataPropertyName  = "st_FatherName";
            studentDataGridView.Columns[3].DataPropertyName  = "st_MotherName";
            studentDataGridView.Columns[4].DataPropertyName  = "st_Address";
            studentDataGridView.Columns[5].DataPropertyName  = "st_Phone";
            studentDataGridView.Columns[6].DataPropertyName  = "st_Email";
            studentDataGridView.Columns[7].DataPropertyName  = "st_Dept";
            studentDataGridView.Columns[8].DataPropertyName  = "st_Roll";
            studentDataGridView.Columns[9].DataPropertyName  = "st_Cgpa";
            studentDataGridView.Columns[10].DataPropertyName = "st_Session";
            studentDataGridView.Columns[11].DataPropertyName = "st_Blood";
            //connection.Open();
            //SqlDataAdapter sdaObj = new SqlDataAdapter("select * from tbl_student", connection);
            //DataTable tb = new DataTable();
            //sdaObj.Fill(tb);
            //studentDataGridView.DataSource = tb;
        }
示例#6
0
        protected void btndisplay_Click(object sender, EventArgs e)
        {
            StudentDataAccess studeuntdata = new StudentDataAccess();

            GridView1.DataSource = studeuntdata.GetStudentInfos();
            GridView1.DataBind();
        }
示例#7
0
        private void txtStudentId_KeyDown(object sender, KeyEventArgs e)
        {
            // find student name
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    var student = new Student();
                    student.RefNo = txtStudentId.Text;
                    var record = StudentDataAccess.findStudent(student);


                    if (record.RefNo == null)
                    {
                        MessageBox.Show("Student-ID not found", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else if (record.IsRemoved == true)
                    {
                        // Detect inactive student id
                        MessageBox.Show("Inactive Student-ID found", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        // fill student name textfield
                        txtStudentName.Text = record.Name;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed : " + ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#8
0
        protected void btnDelete_Click1(object sender, EventArgs e)
        {
            StudentDataAccess studentData = new StudentDataAccess();

            studentData.DeleteStudent(Convert.ToInt32(ddlStudentID.SelectedValue));
            Response.Redirect("DisplayStudent.aspx");
        }
示例#9
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            // Delete student records
            if (MessageBox.Show("Do you want to delete this record ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                try
                {
                    var student = new Student();
                    student.RefNo     = lbl_StudentID.Text;
                    student.IsRemoved = true;

                    StudentDataAccess.deleteStudent(student);

                    MessageBox.Show("Record has been Removed successfully", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    gridRefresh(); // call grid refresh method
                    clearFields(); // call clear field method
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                return;
            }
        }
示例#10
0
 protected void btnInsert_Click(object sender, EventArgs e)
 {
     try
     {
         //int x = 0; int p = 1 / x;
         StudentDataAccess studeuntdata = new StudentDataAccess();
         StudentInfo       student      = new StudentInfo();
         // student.StudentId = Convert.ToInt32(txtStudentId.Text);
         student.FirstName = txtFirstName.Text;
         student.LastName  = txtLastName.Text;
         studeuntdata.insertStudentInfo(student);
     }
     catch (Exception ex)
     {
         string    CurrentClassName  = MethodBase.GetCurrentMethod().DeclaringType.Name.ToString();
         string    CurrentModuleName = MethodBase.GetCurrentMethod().Name.ToString();
         string    Methodis          = "Method:" + CurrentClassName + "(" + CurrentModuleName + ") ";
         string    Msg  = Methodis + ex.ToString();
         Updatelog ulog = new Updatelog();
         ulog.AppDescript = ex.Message;
         ulog.AppModule   = Methodis;
         ulog.AppType     = 1;
         StudentDataAccess.insertLogerror(ulog);
     }
     finally
     {
         // do something
     }
 }
示例#11
0
        public void saveButtonCheck(StudentInfo stObj)
        {
            if (stObj.st_Name == "" || stObj.st_FatherName == "" || stObj.st_MotherName == "" || stObj.st_Address == "" ||
                stObj.st_Dept == "" || stObj.st_Roll == "" || stObj.st_Session == "" || stObj.st_Cgpa == -1)
            {
                MessageBox.Show("please fill up all properties successfully !!!");
            }
            else
            {
                StudentDataAccess dataAccess = new StudentDataAccess();

                int i = dataAccess.haveAnyStuId(stObj);
                if (i == 0)
                {
                    StudentDataAccess ob = new StudentDataAccess();

                    int j = ob.saveStudent(stObj);

                    string Message = j > 0 ? "create successfully" : "data not saved";
                    MessageBox.Show(Message);
                }
                else
                {
                    MessageBox.Show("there is exit another account has same room no !!!\n\t please try again.");
                }
            }
        }
示例#12
0
 public Student GetById(int id, int schoolYearId)
 {
     using (var uow = Read())
     {
         var da = new StudentDataAccess(uow);
         return(da.GetById(id, schoolYearId));
     }
 }
示例#13
0
        public ActionResult DeleteStudent(int id)
        {
            int i = id;
            List <studentModel> student = new List <studentModel>();

            student = StudentDataAccess.SelectStudent(i);
            return(View(student));
        }
示例#14
0
        public Student Get(int id)
        {
            StudentDataAccess sda    = new StudentDataAccess();
            Student           result = new Student();

            result = sda.GetStudentDetailsById(id);
            return(result);
        }
示例#15
0
        public List <Models.Student> Get()
        {
            StudentDataAccess     sda    = new StudentDataAccess();
            List <Models.Student> result = new List <Models.Student>();

            result = sda.GetStudentDetails();
            return(result);
        }
示例#16
0
        public IActionResult GetAttemptsByUserIdTestId(int userId, int testId)
        {
            StudentDataAccess student             = new StudentDataAccess();
            Mapper            mapper              = new Mapper();
            UserIdTestIdDTO   dTO                 = new UserIdTestIdDTO(userId, testId);
            List <AttemptResultOutputModel> model = mapper.ConvertAttemptDTOToAttemptModel(student.GetAttemptsByUserIdTestId(dTO));

            return(Ok(model));
        }
示例#17
0
        private void refreshButton_Click(object sender, EventArgs e)
        {
            deleteIdtextBox.Text = "";
            StudentDataAccess  dataAccess = new StudentDataAccess();
            List <StudentInfo> students   = dataAccess.viewStudentInfo();

            studentDataGridView.AutoGenerateColumns = false;
            studentDataGridView.DataSource          = students;
        }
        private void GetStudentData()
        {
            StudentDataAccess objStudentDataAccess = new StudentDataAccess();

            studentList         = new ObservableCollection <Student>();
            studentList         = objStudentDataAccess.GetStudentsData();
            studentListCopyData = studentList;
            RefreshDataGrid();
        }
        public frmStudentStartup()
        {
            InitializeComponent();
            StartPosition     = FormStartPosition.CenterScreen;
            studentDataAccess = new StudentDataAccess();
            admindataAccess   = new AdminDataAccess();
            teacherDataAccess = new TeacherDataAccess();

            dataGridView1.DataSource = studentDataAccess.GetStudentNotice();
        }
示例#20
0
 public frmStudentReg()
 {
     InitializeComponent();
     StartPosition     = FormStartPosition.CenterScreen;
     studentDataAccess = new StudentDataAccess();
     admindataAccess   = new AdminDataAccess();
     teacherDataAccess = new TeacherDataAccess();
     comboBoxRegSelect.Items.Add("Student");
     comboBoxRegSelect.Items.Add("Teacher");
 }
示例#21
0
        private int AddQuestionsToAttemptInDatabase(int userId, int testId, List <QuestionWithListAnswersDTO> questions)
        {
            StudentDataAccess student = new StudentDataAccess();
            int attemptId             = student.AddAttemptForAttemptCreator(userId, testId);

            foreach (var question in questions)
            {
                student.AddQuestionToAttempt(attemptId, question.Id);
            }
            return(attemptId);
        }
示例#22
0
        public void DeleteStudent(DeleteStudentRequest request)
        {
            if (request != null)
            {
                var dataAccess = new StudentDataAccess(request.Context);

                var student = dataAccess.GetById(request.IdStudent);

                dataAccess.Delete(student.FirstOrDefault());
            }
        }
示例#23
0
    protected void btnAddCourseOffering_Click1(object sender, EventArgs e)
    {
        string studentNumber = txtStudentName.Text;
        string studentName   = txtStudentName.Text;

        List <CourseOffering> coursesOffered = CourseOfferingsDataAccess.retreiveAllCourses();
        int j = ddlCourseOffering.SelectedIndex;

        string test = rblStudentStatus.SelectedValue;

        if (rblStudentStatus.SelectedValue == "Full-Time")
        {
            Student ourStudents = new FullTimeStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            int selectedIndex = ddlCourseOffering.SelectedIndex;

            coursesOffered[selectedIndex].AddStudent(ourStudents);

            RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";
        }

        else if (rblStudentStatus.SelectedValue == "Part-Time")
        {
            Student ourStudents = new PartTimeStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            int selectedIndex = ddlCourseOffering.SelectedIndex;

            coursesOffered[selectedIndex].AddStudent(ourStudents);

            RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";
        }
        else if (rblStudentStatus.SelectedValue == "Co-op")
        {
            Student ourStudents = new CoopStudent(studentNumber, studentName);
            StudentDataAccess.AddStudent(ourStudents);

            int selectedIndex = ddlCourseOffering.SelectedIndex;

            coursesOffered[selectedIndex].AddStudent(ourStudents);

            RegistrationDataAccess.addRegistration(ourStudents, coursesOffered[selectedIndex]);

            txtStudentName.Text   = "";
            txtStudentNumber.Text = "";
        }
    }
示例#24
0
        public IActionResult GetStudentTestsByUserId(int userId)
        {
            StudentDataAccess     student = new StudentDataAccess();
            Mapper                mapper  = new Mapper();
            List <TestAttemptDTO> tests   = student.GetCompleteTests(userId);

            tests.AddRange(student.GetIncompleteTests(userId));
            StudentOutputModel model = mapper.ConvertUserDTOTestAttemptDTOToStudentModel(student.GetUser(userId), mapper.ConvertTestAttemptDTOToTestAttemptModel(tests));

            return(Ok(model));
        }
示例#25
0
 public frmApprove()
 {
     InitializeComponent();
     StartPosition     = FormStartPosition.CenterScreen;
     studentDataAccess = new StudentDataAccess();
     admindataAccess   = new AdminDataAccess();
     teacherDataAccess = new TeacherDataAccess();
     comboBox1.Items.Add("Teacher");
     comboBox1.Items.Add("Student");
     MessageBox.Show("Test1");
 }
        private void DeleteStudentData(object obj)
        {
            IsDelete = true;
            StudentDataAccess objStudentDataAccess = new StudentDataAccess();
            int deletedId = objStudentDataAccess.UpdateStudentData(SelectedStudent, IsDelete);

            // remove the row having Id = result from studentList
            DeleteFromList(deletedId);
            student = new Student(); // clear the controls data after save
            MessageBox.Show("Successfully Deleted!");
        }
示例#27
0
        private void txt_RegistrationId_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                try
                {
                    var registration = new RegistrationIds();
                    registration.RegistrationId = txt_RegistrationId.Text;

                    var record = RegistrationCodesDataAccess.findStudentByRegistrationId(registration);
                    if (record == null)
                    {
                        MessageBox.Show("Registration ID not found. Please check the registration ID", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        //// get parent contact no.
                        var parentInfo = StudentDataAccess.findParentInfo(record.StudentId);
                        if (parentInfo == null)
                        {
                            return;
                        }
                        else if (parentInfo.Mobile == null)
                        {
                            return;
                        }
                        else
                        {
                            parentContact = parentInfo.Pmobile; // assign phone number
                        }
                        var lecturerInfo = CourseEnrollmentDataAccess.findRegistrationDateByStudentId(record.RegistrationId, record.CourseId);
                        if (lecturerInfo == null)
                        {
                            MessageBox.Show("Unable to locate lecturer details", "Message", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            txtStudentId.Text    = record.StudentId;
                            txtStudentName.Text  = record.StudentName;
                            txt_CourseId.Text    = record.CourseId;
                            txt_CourseName.Text  = record.CourseName;
                            txtLecturerID.Text   = lecturerInfo.LecturerId;
                            txtLecturerName.Text = lecturerInfo.LecturerName;

                            Submit(); // call mark attendance
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed : " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#28
0
        public IActionResult GradeCreate(int?value)
        {
            //dropwdown list
            List <SelectListItem> items = new List <SelectListItem>();
            SelectListItem        item1 = new SelectListItem()
            {
                Text = "Select Option", Value = "null"
            };
            SelectListItem item2 = new SelectListItem()
            {
                Text = "Grade 9", Value = "9"
            };
            SelectListItem item3 = new SelectListItem()
            {
                Text = " Grade 10", Value = "10"
            };

            items.Add(item1);
            items.Add(item2);
            items.Add(item3);
            ViewBag.Options = items;

            if (value != null)
            {
                ViewBag.Value = value;

                var currentYear = DateTime.Now.Year;
                ViewBag.CurrentYear = currentYear;

                var lastYear = DateTime.Now.Year - 1;
                ViewBag.LastYear = lastYear;


                List <studentModel> students = new List <studentModel>();
                students = ClassDataAccess.listUngradedStudents(Convert.ToInt32(value));

                //ViewBag.Students = students;

                List <studentModel> allstudents = new List <studentModel>();
                //allstudents = StudentDataAccess.SelectStudentByGrade(Convert.ToInt32(value));
                foreach (var student in students)
                {
                    allstudents.AddRange(StudentDataAccess.SelectStudent(student.StudentId));
                }
                ViewBag.Students = allstudents;


                List <classModel> classes = new List <classModel>();
                classes         = ClassDataAccess.SelectClass(Convert.ToInt32(value));
                ViewBag.Classes = classes;
            }
            return(View());
        }
示例#29
0
        //private void studentDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    deleteIdtextBox.Text = studentDataGridView.SelectedRows[0].Cells[0].Value.ToString();
        //}



        private void searchByBloodGroup_Click_1(object sender, EventArgs e)
        {
            deleteIdtextBox.Text = "";
            StudentInfo stuObj = new StudentInfo()
            {
                st_Blood = studentBloodGroupTextBox.Text
            };
            StudentDataAccess  dataAccess = new StudentDataAccess();
            List <StudentInfo> students   = dataAccess.searchByBloodGroup(stuObj);

            studentDataGridView.DataSource = students;
        }
示例#30
0
        private void searchByRollLabel_Click(object sender, EventArgs e)
        {
            deleteIdtextBox.Text = "";
            StudentInfo stuObj = new StudentInfo()
            {
                st_Roll = studentRollTextBox.Text
            };
            StudentDataAccess  dataAccess = new StudentDataAccess();
            List <StudentInfo> students   = dataAccess.searchByRoll(stuObj);

            studentDataGridView.DataSource = students;
        }