public IActionResult EditCourse(int?id)
        {
            //get the UID from the Session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            //get the Course object from the DB using the DALCourse class
            DALCourses             dp         = new DALCourses(configuration);
            DALStudent             ds         = new DALStudent(configuration);
            Student                stu        = ds.getStudent(uID);
            viewModelStudentCourse courseList = new viewModelStudentCourse();

            courseList.UID             = stu.UID;
            courseList.AddedCourse     = new Courses();
            courseList.AddedCourse.UID = stu.UID;  /// This is new

            courseList.SelectedCourses         = new Courselist();
            courseList.SelectedCourses.Courses = dp.getCourses(stu.UID.ToString());

            courseList.FirstName       = stu.FirstName;
            courseList.LastName        = stu.LastName;
            courseList.StudentEmail    = stu.StudentEmail;
            courseList.Courses         = new Courselist();
            courseList.Courses.Courses = dp.GetCourseAvailableForStudent(uID);



            //send the view
            return(View(courseList));
        }
        public IActionResult EditCourse(viewModelStudentCourse viewModel)
        {
            //get the UID from the Session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            //get the Course object from the DB using the DALCourse class
            DALCourses dp = new DALCourses(configuration);
            DALStudent ds = new DALStudent(configuration);

            Student stu = ds.getStudent(uID);

            dp.UpdateCourses(viewModel.AddedCourse.ClassID.ToString(), viewModel.AddedCourse.UID);
            viewModelStudentCourse courseList = new viewModelStudentCourse();

            courseList.UID = stu.UID;

            courseList.FirstName       = stu.FirstName;
            courseList.LastName        = stu.LastName;
            courseList.StudentEmail    = stu.StudentEmail;
            courseList.Courses         = new Courselist();
            courseList.Courses.Courses = dp.GetCourseAvailableForStudent(uID);

            //send the view
            // return View(courseList);
            return(RedirectToAction("EditCourse", new { uID = uID }));
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!validateStudent())
            {
                return;
            }
            string message = string.Empty;

            TheStudent.StudentID = Convert.ToInt32(textBoxID.Text);
            TheStudent.Name      = textBoxName.Text;
            TheStudent.Gender    = comboBoxGender.Text;
            TheStudent.Group     = comboBoxGroup.Text;
            TheStudent.Courses   = _courseList;

            try
            {
                if (TheStudent.SerialNo > 0)
                {
                    DALStudent.Update(TheStudent);
                }
                else
                {
                    DALStudent.Insert(TheStudent);
                }

                MessageBox.Show("Record Saved Successfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public IActionResult UpdateCourse(string class1, string class2, string class3)
        {
            //get the uid from the session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session


            DALCourses dp = new DALCourses(configuration);

            dp.UpdateCourses(class1, uID);
            dp.UpdateCourses(class2, uID);
            dp.UpdateCourses(class3, uID);
            viewModelStudentCourse vwcourse = new viewModelStudentCourse();

            vwcourse.Courses         = new Courselist();
            vwcourse.Courses.Courses = new List <Courses>();
            //vwcourse.Courses.Courses.Add(dp.getCourses(class1));
            //vwcourse.Courses.Courses.Add(dp.getCourses(class2));
            //vwcourse.Courses.Courses.Add(dp.getCourses(class3));

            DALStudent ds  = new DALStudent(configuration);
            Student    stu = ds.getStudent(uID);

            vwcourse.UID          = uID;
            vwcourse.FirstName    = stu.FirstName;
            vwcourse.LastName     = stu.LastName;
            vwcourse.StudentEmail = stu.StudentEmail;
            //vwcourse.ClassTime = stu.ClassTime;
            return(View("UpdateCourse", vwcourse));
        }
Esempio n. 5
0
        private void BtnGiveBook_Click(object sender, EventArgs e)
        {
            // Burada öğrencinin okuduğu kitaplar nesnesini üretiyoruz
            StudentReadInfo studentread = new StudentReadInfo();

            // Üretilen nesnenin hangi öğrenci olduğunu Comboboxtan gelen veriyi StudentList içinde bulup seçtirilir
            studentread.StudentId = DALStudent.StudentList().FirstOrDefault(n => n.StudentName == comboBox1.SelectedItem.ToString());
            // Üretilen nesnenin hangi kitap olduğunu Comboboxtan gelen veriyi BookList içinde bulup seçtirilir
            studentread.BookId = DALBook.BookList().FirstOrDefault(n => n.bookName == comboBox2.SelectedItem.ToString());
            // Öğrencinin okuduğu kitaplar nesnesi üzerinde bulunan kitapın alınma tarihine DateTimePickerdan gelen değeri atanır
            studentread.TakenDate = dateTimePicker1.Value.Date.ToString();
            // Entity katmanında TakenDate String olarak tutulduğu için gerekli tip dönüşüm işlemleri yapılır
            DateTime DueDate = Convert.ToDateTime(studentread.TakenDate);

            // DueDate kitabın teslim edilme tarihini teslim eder bunu DatetimePickerden gelen tarihe 15gün ekleyerek elde edilir.
            DueDate = DueDate.AddDays(15);
            // Entity'miz String olduğu için tekrar tip dönüşümü yapılır
            studentread.GivenDate = DueDate.ToString();
            // Entitymizin Kitabın verilip verilmediğini isGiven değişkeni üzerinde saklanır
            // Kitap verildiği taktirde isGiven true olur.
            studentread.isGiven = true;
            // Gerekli mantıksal işlemler yapılması için LLStudentBookSave methoduna gönderilir.
            LogicStudentRead.LLStudentBookSave(studentread);
            MessageBox.Show("Kitap Verildi");
            // Verilen kitapın alınıp alınmadığını tutan isBookAvailable özelliği ->Busy olarak değiştirilir.
            studentread.BookId.isBookAvailable = "Busy";
            // Kitabın durumunu güncellemek için LLStudentBookUpdate methoduna gönderilir
            LogicStudentRead.LLStudentBookUpdate(studentread.BookId);
            MessageBox.Show("Kitap Durumu Güncellendi");
        }
        private void studentGenderInfo()
        {
            int erkek = DALStudent.StudentList().Where(m => m.StudentGender == "ERKEK").Count();
            int kadın = DALStudent.StudentList().Where(m => m.StudentGender == "KADIN").Count();

            chart3.Titles.Add("Student Gender Info");
            chart3.Series["Öğrenci"].IsValueShownAsLabel = true;
            chart3.Series["Öğrenci"].Points.AddXY("Erkek", erkek);
            chart3.Series["Öğrenci"].Points.AddXY("Kadın", kadın);
        }
Esempio n. 7
0
 // Logic Layer ana form üzerinden erişilen bir katmandır ve gerekli mantıksal kontrollerin katman olarak geçer
 // Gerekli kontrolleri başarılı bir şekilde geçen Logic Methodlar Data Access Layerdan uygun methodu çağırarak programın çalışmasına devam edilir
 public static int LLStudentSignIn(EntityStudent student)
 {
     if (student.StudentUserName != "" && student.StudentName != "" && student.StudentLastName != "" && student.Password != "" && student.Repassword != "" && student.Password == student.Repassword)
     {
         return(DALStudent.StudentSignin(student));
     }
     else
     {
         return(-1);
     }
 }
Esempio n. 8
0
        public IActionResult DeleteStudent()
        {
            //get the uid from the session
            int        uID     = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session
            DALStudent dp      = new DALStudent(configuration);
            Student    student = dp.getStudent(uID);

            dp.DeleteStudent(uID);

            return(View(student));
        }
Esempio n. 9
0
 public static bool LLStudentUpdate(EntityStudent ent)
 {
     if (ent.StudentName != "" && ent.StudentLastName != "" && ent.Password != "" && ent.Repassword != "")
     {
         return(DALStudent.StudentUpdate(ent));
     }
     else
     {
         return(false);
     }
 }
Esempio n. 10
0
        public IActionResult UpdateStudent(Student student)
        {
            //get the uid from the session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            student.UID = uID;

            DALStudent dp = new DALStudent(configuration);

            dp.UpdateUser(student);
            return(View("Registration", student));
        }
Esempio n. 11
0
        public IActionResult EditStudent()
        {
            //get the UID from the Session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            //get the Student object from the DB using the DALStudent class
            DALStudent dp      = new DALStudent(configuration);
            Student    student = dp.getStudent(uID);

            //send the view
            return(View(student));
        }
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         DALStudent.Delete(_theStudent);
         RefreshStudentList();
         MessageBox.Show("Record Deleted Successfully");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        public void RefreshStudentList()
        {
            try
            {
                StudentList = DALStudent.GetAllStudent();

                var bindList = new BindingList <Student>(StudentList); //what is var?
                dataGridViewStudentFile.DataSource = bindList;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 14
0
        //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BURAYA SON KEZ BAK !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        private void BtnTakeBook_Click(object sender, EventArgs e)
        {
            // Burada öğrencinin okuduğu kitaplar nesnesini üretiyoruz
            StudentReadInfo studentread = new StudentReadInfo();

            // Üretilen nesnenin hangi öğrenci olduğunu Comboboxtan gelen veriyi StudentList içinde bulup seçtirilir
            studentread.StudentId = DALStudent.StudentList().FirstOrDefault(n => n.StudentName == comboBox1.SelectedItem.ToString());
            // Üretilen nesnenin hangi kitap olduğunu Comboboxtan gelen veriyi BookList içinde bulup seçtirilir
            studentread.BookId = DALBook.BookList().FirstOrDefault(n => n.bookName == comboBox2.SelectedItem.ToString());
            DateTime date      = DateTime.Now;
            var      shortDate = date.ToString("yyyy-MM-dd");

            studentread.GivenDate = shortDate.ToString();
            studentread.BookId.isBookAvailable = "Available";
            LogicStudentRead.LLStudentBookUpdate(studentread.BookId);
            MessageBox.Show("Kitap Durumu Güncellendi");
        }
Esempio n. 15
0
 protected virtual bool DoStore()
 {
     try
     {
         DALStudent student = new DALStudent();
         if (cand != null)
         {
             student.Insert(cand);
         }
         return(true);
     }
     catch
     {
         ShowMsgBox(this, "数据库读写错误");
         return(false);
     }
 }
Esempio n. 16
0
 public static bool LLStudentLogIn(EntityStudent student)
 {
     foreach (EntityStudent item in DALStudent.StudentList())
     {
         if (item.StudentUserName == student.StudentUserName && item.Password == student.Password)
         {
             student.StudentId       = item.StudentId;
             student.StudentName     = item.StudentName;
             student.StudentLastName = item.StudentLastName;
             student.StudentUserName = item.StudentUserName;
             student.Password        = item.Password;
             student.Repassword      = item.Repassword;
             student.StudentGender   = item.StudentGender;
             student.StudentDebt     = item.StudentDebt;
             return(true);
         }
     }
     return(false);
 }
Esempio n. 17
0
        public bool Insert(DALStudent user)
        {
            int res = 0;

            using (var connection = new SQLiteConnection(connectionString))
            {
                SQLiteCommand command = new SQLiteCommand(null, connection);
                {
                    try
                    {
                        command.CommandText = $"INSERT INTO {UserTableName} ({DALStudent.StudentNameColumn},{DALStudent.StudentPasswordColumn},{DALStudent.StudentIdColumn})" +
                                              $"VALUES (@nameVal,@passwordVal,@idVal)";

                        SQLiteParameter nameParam     = new SQLiteParameter(@"nameVal", user.Name);
                        SQLiteParameter passwordParam = new SQLiteParameter(@"passwordVal", user.Password);
                        SQLiteParameter idParam       = new SQLiteParameter(@"idVal", user.Id);
                        command.Parameters.Add(nameParam);
                        command.Parameters.Add(passwordParam);
                        command.Parameters.Add(idParam);
                        command.Prepare();
                        connection.Open();

                        res = command.ExecuteNonQuery();
                    }
                    catch (Exception e)
                    {
                        if (e != null)
                        {
                            res = -1;
                        }
                    }
                    finally
                    {
                        command.Dispose();
                        connection.Close();
                    }
                }
            }

            return(res > 0);
        }
Esempio n. 18
0
        public IActionResult Registration(viewModelStudentCourse student)
        {
            //send it to the DB
            //validate the info


            DALStudent dp  = new DALStudent(configuration);
            int        uID = dp.addStudent(student);

            student.UID             = uID;
            student.Courses         = new Courselist();
            student.Courses.Courses = dp.getCourses(student.UID);



            //save the User ID to the session
            HttpContext.Session.SetString("uID", uID.ToString()); //write to the session
            string strUID = HttpContext.Session.GetString("uID"); //reads from the session


            return(View(student));
        }
Esempio n. 19
0
        public IActionResult GetReport(viewModelStudentCourse student)
        {
            //get the UID from the Session
            int uID = Convert.ToInt32(HttpContext.Session.GetString("uID")); //reads from the session

            //get the Student object from the DB using the DALStudent class
            DALCourses dp = new DALCourses(configuration);
            DALStudent ds = new DALStudent(configuration);
            //student.Courses.Courses = dp.getReport(student.UID);
            viewModelStudentCourse courseList = new viewModelStudentCourse();

            //courseList.UID = stu.UID;

            //student.FirstName = FirstName;
            //student.LastName = LastName;
            //student.StudentEmail = StudentEmail;



            //send the view
            return(View("GetReport"));
        }
Esempio n. 20
0
        }//update() call

        public static bool deleteStudent(EntityStudent estud)
        {
            bool b = DALStudent.deleteStudent(estud);

            return(b);
        }//delete() call
Esempio n. 21
0
 public static List <EntityStudent> LLStudentList()
 {
     return(DALStudent.StudentList());
 }
Esempio n. 22
0
 public StudentLogic(ApplicationDbContextData context)
 {
     _dal        = new DALStudent(context);
     _dalschool  = new DALSchool(context);
     _dalteacher = new DalTeacher(context);
 }
Esempio n. 23
0
        protected override DALObj ConvertReaderToObject(SQLiteDataReader reader)
        {
            DALStudent ret = new DALStudent(reader.GetString(0), reader.GetInt32(1), reader.GetString(2));

            return(ret);
        }
Esempio n. 24
0
        }//get all rec() call

        public static DataSet getSingeStudentData(EntityStudent estud)
        {
            DataSet dsget = DALStudent.getSingeStudentData(estud);

            return(dsget);
        } //fetch record according to id call
Esempio n. 25
0
        }//delete() call

        public static DataSet getStudentData(EntityStudent estud)
        {
            DataSet dsget = DALStudent.getStudentData(estud);

            return(dsget);
        }//get all rec() call
Esempio n. 26
0
        }//insertion() call

        public static bool updateStudent(EntityStudent estud)
        {
            bool b = DALStudent.updateStudent(estud);

            return(b);
        }//update() call
Esempio n. 27
0
        public static bool insertStudent(EntityStudent estud)
        {
            bool b = DALStudent.insertStudent(estud);

            return(b);
        }//insertion() call