Example #1
0
        public ActionResult Create([Bind(Include = "id,Semester,TM,OM,GP,LG,Student,Department,Faculty,Course,created_at,edited_at")] Semester_Result semester_Result)
        {
            if (ModelState.IsValid)
            {
                db.Semester_Result.Add(semester_Result);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(semester_Result));
        }
        public ActionResult Create([Bind(Include = "id,UserName,Password,Activation,FirstName,LastName,Gender,Picture,Comment,TimeExtension,Designation,created_at,edited_at")] Faculties faculties)
        {
            if (ModelState.IsValid)
            {
                db.Faculties.Add(faculties);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(faculties));
        }
        public ActionResult Create([Bind(Include = "id,Roll_No,First_Name,Last_Name,Password,Session,Gender,Picture,Email,RegistrationNO,Semester,Department,Status,Designation,created_at,edited_at")] Students students)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(students);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(students));
        }
Example #4
0
        public ActionResult Create([Bind(Include = "id,ShortName,FullName,TotalSemesters,Color,Degree,DayTiming,created_at,edited_at")] Departments departments)
        {
            if (ModelState.IsValid)
            {
                db.Departments.Add(departments);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(departments));
        }
Example #5
0
        public ActionResult Create([Bind(Include = "id,Type,created_at,edited_at")] Result_Types result_Types)
        {
            if (ModelState.IsValid)
            {
                db.Result_Types.Add(result_Types);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(result_Types));
        }
        public ActionResult Create([Bind(Include = "id,Timing,created_at,edited_at")] DayTiming dayTiming)
        {
            if (ModelState.IsValid)
            {
                db.DayTiming.Add(dayTiming);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dayTiming));
        }
        public ActionResult Create([Bind(Include = "id,Lower_Range,Upper_Range,Points,Grade,created_at,edited_at")] Grades grades)
        {
            if (ModelState.IsValid)
            {
                db.Grades.Add(grades);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(grades));
        }
        public ActionResult Create([Bind(Include = "id,Title,created_at,edited_at")] Degrees degrees)
        {
            if (ModelState.IsValid)
            {
                db.Degrees.Add(degrees);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(degrees));
        }
Example #9
0
        public ActionResult Create([Bind(Include = "id,Session,Semester,Department,Faculty,Course,created_at,edited_at")] Session_Courses session_Courses)
        {
            if (ModelState.IsValid)
            {
                db.Session_Courses.Add(session_Courses);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(session_Courses));
        }
        public ActionResult Create([Bind(Include = "id,Code,CH,Name,created_at,edited_at")] Courses courses)
        {
            if (ModelState.IsValid)
            {
                db.Courses.Add(courses);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(courses));
        }
Example #11
0
        public ActionResult Create([Bind(Include = "id,Semester,Total,Obtain,Comment,Save,Edit,Extension,Student,Department,Faculty,Course,Result_Type,created_at,edited_at")] Semester_Details_Results semester_Details_Results)
        {
            if (ModelState.IsValid)
            {
                db.Semester_Details_Results.Add(semester_Details_Results);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(semester_Details_Results));
        }
Example #12
0
        public static void seed(ExamDB db)
        {
            IList <DayTime> DayTime = new List <DayTime>()
            {
                /*
                 * new DayTime()
                 * {
                 *  id = 1,
                 *  Title = "Morning",
                 *  Description = "Morning",
                 * },
                 * new DayTime()
                 * {
                 *  id = 2,
                 *  Title = "Evening",
                 *  Description = "Evening",
                 * },
                 */
            };

            foreach (var item in DayTime)
            {
                db.DayTime.AddOrUpdate(item);
            }

            db.SaveChanges();
        }
Example #13
0
        public static void seed(ExamDB db)
        {
            IList <Degree> Degrees = new List <Degree>()
            {
                /*
                 * new Degree()
                 * {
                 *  id = 1,
                 *  Title = "Under graduate",
                 *  Description = "Under graduate"
                 * },
                 * new Degree()
                 * {
                 *  id = 2,
                 *  Title = "Graduate",
                 *  Description = "Graduate"
                 * },
                 * new Degree()
                 * {
                 *  id = 3,
                 *  Title = "Post graduate",
                 *  Description = "Post graduate"
                 * },
                 */
            };

            foreach (var item in Degrees)
            {
                db.Degree.Add(item);
            }

            db.SaveChanges();
        }
Example #14
0
        public static void seed(ExamDB context)
        {
            IList <DayTiming> DayTiming = new List <DayTiming>()
            {
                new DayTiming()
                {
                    id         = 1,
                    Timing     = "Morning",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new DayTiming()
                {
                    id         = 2,
                    Timing     = "Evening",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
            };

            foreach (var item in DayTiming)
            {
                context.DayTiming.AddOrUpdate(item);
            }

            context.SaveChanges();
        }
        public static void seed(ExamDB db)
        {
            IList <Degree> Degrees = new List <Degree>()
            {
                new Degree()
                {
                    id          = 1,
                    Title       = "Under graduate",
                    Description = "Under graduate"
                },
                new Degree()
                {
                    id          = 2,
                    Title       = "Graduate",
                    Description = "Graduate"
                },
                new Degree()
                {
                    id          = 3,
                    Title       = "Post graduate",
                    Description = "Post graduate"
                },
            };

            foreach (var item in Degrees)
            {
                db.Degrees.Add(item);
            }

            db.SaveChanges();
        }
        public ActionResult CreateNow(FormCollection FC)
        {
            var sView    = (GetStudentView)Session["GetStudentView"];
            var students = (List <Students>)Session["StudentsList"];
            var x        = FC;
            int faculty  = db.Faculties.SingleOrDefault(m => m.UserName == User.Identity.Name).id;

            foreach (var stu in students)
            {
                db.Semester_Details_Results.Add(
                    new Semester_Details_Results
                {
                    Student     = stu.id,
                    Department  = sView.dept,
                    Result_Type = sView.result_type,
                    Semester    = sView.semester,
                    Course      = sView.Course,
                    Faculty     = faculty,
                    Total       = double.Parse(FC["Total_" + stu.id]),
                    Obtain      = double.Parse(FC["Obtain_" + stu.id]),
                    Comment     = "",
                    Edit        = true,
                    Save        = true,
                    created_at  = DateTime.Now,
                    edited_at   = DateTime.Now,
                    Extension   = DateTime.Now,
                });
            }
            db.SaveChanges();
            // Deleting sessions
            Session["GetStudentView"] = "";
            Session["StudentsList"]   = "";
            return(RedirectToAction("Success"));
        }
Example #17
0
        public void start()
        {
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Courses");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE DayTimings");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Degrees");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Departments");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Designations");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Faculties");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Grades");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Result_Types");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Semester_Details_Results");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Semester_Result");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Statuses");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Session_Courses");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Students");
            db.SaveChanges();

            seed_Courses.seed(db);
            seed_DayTiming.seed(db);
            seed_Degrees.seed(db);
            seed_Departments.seed(db);
            seed_Designations.seed(db);
            seed_Faculties.seed(db);
            seed_Grades.seed(db);
            seed_Result_Types.seed(db);
            seed_Semester_Details_Results.seed(db);
            seed_Statuses.seed(db);
            seed_Session_Courses.seed(db);
            seed_Students.seed(db);
        }
        public static void seed(ExamDB context)
        {
            context.Student.AddOrUpdate(
                new Student()
            {
                id             = 1,
                Semester       = 1,
                Session        = 2016,
                RegistrationNO = "94384711",
                Designation    = 5,
                Gender         = "Male",
                Picture        = "",
                Status         = 1,
                Department     = 1,
                Comment        = "",
            },
                new Student()
            {
                id             = 2,
                Semester       = 1,
                Session        = 2016,
                RegistrationNo = "94344711",
                Designation    = 5,
                Gender         = "Male",
                Picture        = "",
                Status         = 1,
                Department     = 1,
                Comment        = "",
                created_at     = DateTime.Now,
                edited_at      = DateTime.Now
            }
                );

            context.SaveChanges();
        }
Example #19
0
        public static void seed(ExamDB context)
        {
            IList <Session_Courses> Session_Courses = new List <Session_Courses>()
            {
                new Session_Courses()
                {
                    id         = 1,
                    Course     = 1,
                    Department = 1,
                    Faculty    = 2,
                    Semester   = 1,
                    Session    = 2016,
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new Session_Courses()
                {
                    id         = 2,
                    Course     = 2,
                    Department = 1,
                    Faculty    = 2,
                    Semester   = 2,
                    Session    = 2016,
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
            };

            foreach (var item in Session_Courses)
            {
                context.Session_Courses.Add(item);
            }

            context.SaveChanges();
        }
        public static void seed(ExamDB context)
        {
            IList <Degrees> Degrees = new List <Degrees>()
            {
                new Degrees()
                {
                    id         = 1,
                    Title      = "Under graduate",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new Degrees()
                {
                    id         = 2,
                    Title      = "Graduate",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new Degrees()
                {
                    id         = 3,
                    Title      = "Post graduate",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
            };

            foreach (var item in Degrees)
            {
                context.Degrees.Add(item);
            }

            context.SaveChanges();
        }
        public static void seed(ExamDB db)
        {
            IList <DayTiming> DayTiming = new List <DayTiming>()
            {
                new DayTiming()
                {
                    id          = 1,
                    Title       = "Morning",
                    Description = "Morning",
                },
                new DayTiming()
                {
                    id          = 2,
                    Title       = "Evening",
                    Description = "Evening",
                },
            };

            foreach (var item in DayTiming)
            {
                db.DayTiming.AddOrUpdate(item);
            }

            db.SaveChanges();
        }
        // other methods
        public void CreatetNow(Students student, List <Semester_Details_Results> results)
        {
            var courses = results.GroupBy(m => m.Course).ToList();

            foreach (var course in courses)
            {
                // getting subject results
                double sessionalObtain = SessionalMarks(course.ToList()); // obtain sessional marks

                var final = course.SingleOrDefault(m => m.Result_Type == 1);
                var mid   = course.SingleOrDefault(m => m.Result_Type == 2);

                double finalMarks = final != null ? final.Obtain : 0;
                double midMarks   = mid != null ? mid.Obtain : 0;

                double marks  = 100 * (finalMarks + midMarks + sessionalObtain) / (50 + 30 + 20);
                var    grades = tool.getGP(marks);

                //course id
                int cid = course.First().id;
                // check if student of course already exists
                var Sem_Result = db.Semester_Result.SingleOrDefault(m => m.Course == cid);
                if (Sem_Result != null)
                {
                    //Sem_Result.Student = student.id;
                    //Sem_Result.Semester = student.Semester;
                    Sem_Result.Faculty = ActiveUser.id;
                    //Sem_Result.Department = student.Department;
                    //Sem_Result.Course = final.Course;
                    Sem_Result.OM = marks;
                    Sem_Result.TM = 100;
                    Sem_Result.GP = grades.Points;
                    Sem_Result.LG = grades.Grade;
                    //Sem_Result.created_at = DateTime.Now;
                    Sem_Result.edited_at = DateTime.Now;
                }
                else
                {
                    db.Semester_Result.Add(
                        new Semester_Result()
                    {
                        Student    = student.id,
                        Semester   = student.Semester,
                        Faculty    = ActiveUser.id,
                        Department = student.Department,
                        Course     = final.Course,
                        OM         = marks,
                        TM         = 100,
                        GP         = grades.Points,
                        LG         = grades.Grade,
                        created_at = DateTime.Now,
                        edited_at  = DateTime.Now,
                    }
                        );
                }
            }
            db.SaveChanges();
        }
        public static void seed(ExamDB context)
        {
            IList <ResultType> ResultTypes = new List <ResultType>()
            {
            };

            foreach (var item in ResultTypes)
            {
                context.ResultType.Add(item);
            }

            context.SaveChanges();
        }
        public ActionResult ChangeStudentStatus(FormCollection FC)
        {
            string rollNo  = FC["rollNo"];
            int    status  = int.Parse(FC["status"]);
            string comment = FC["comment"];

            var student = db.Students.SingleOrDefault(m => m.Roll_No == rollNo);

            student.Status  = status;
            student.Comment = comment;
            db.SaveChanges();
            return(RedirectToAction("showStudent", new { RollNo = rollNo }));
        }
Example #25
0
        public static void seed(ExamDB context)
        {
            IList <Faculty> Faculties = new List <Faculty>()
            {
            };

            foreach (var item in Faculties)
            {
                context.Faculty.Add(item);
            }

            context.SaveChanges();
        }
        public static void seed(ExamDB context)
        {
            IList <Designations> Designations = new List <Designations>()
            {
                new Designations()
                {
                    id         = 1,
                    Title      = "Admin",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new Designations()
                {
                    id         = 2,
                    Title      = "Lecturer",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new Designations()
                {
                    id         = 3,
                    Title      = "Lab_Incharge",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new Designations()
                {
                    id         = 4,
                    Title      = "Worker",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
                new Designations()
                {
                    id         = 5,
                    Title      = "Student",
                    created_at = DateTime.Now,
                    edited_at  = DateTime.Now
                },
            };

            foreach (var item in Designations)
            {
                context.Designations.Add(item);
            }

            context.SaveChanges();
        }
Example #27
0
        public static void seed(ExamDB db)
        {
            USER             user       = db.User.Find(1);
            IList <Activity> Activities = new List <Activity>()
            {
                // new Activity{Id=, Title = "", Description = ""},
                //new Activity{Id=1, Title = "Create User", Description = "For creating new user"},
            };

            foreach (var item in Activities)
            {
                db.Activity.Add(item);
            }

            db.SaveChanges();
        }
        public static void seed(ExamDB context)
        {
            context.Students.AddOrUpdate(
                new Students()
            {
                id             = 1,
                First_Name     = "Muzammal",
                Last_Name      = "Hussain",
                Roll_No        = "BCS.F16.32",
                Email          = "*****@*****.**",
                Password       = "******",
                Semester       = 1,
                Session        = 2016,
                RegistrationNO = "94384711",
                Designation    = 5,
                Gender         = "Male",
                Picture        = "",
                Status         = 1,
                Department     = 1,
                Comment        = "",
                created_at     = DateTime.Now,
                edited_at      = DateTime.Now
            },
                new Students()
            {
                id             = 2,
                First_Name     = "Ali",
                Last_Name      = "Hamza",
                Roll_No        = "BCS.F16.01",
                Email          = "*****@*****.**",
                Password       = "******",
                Semester       = 1,
                Session        = 2016,
                RegistrationNO = "94344711",
                Designation    = 5,
                Gender         = "Male",
                Picture        = "",
                Status         = 1,
                Department     = 1,
                Comment        = "",
                created_at     = DateTime.Now,
                edited_at      = DateTime.Now
            }
                );

            context.SaveChanges();
        }
Example #29
0
        public void start()
        {
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Course");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE DayTimings");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Degrees");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Departments");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Designations");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Faculties");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Grades");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Result_Types");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Semester_Details_Results");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Semester_Result");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Statuses");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Session_Courses");
            db.Database.ExecuteSqlCommand("TRUNCATE TABLE Students");
            db.SaveChanges();

            User user = new User()
            {
                id        = 1,
                UserName  = "******",
                Password  = "******",
                FirstName = "System",
                LastName  = "Exam",
                Email     = "*****@*****.**",
            };

            seed_User.seed(db);



            seed_DayTiming.seed(db);
            seed_Degrees.seed(db);

            seed_Course.seed(db);


            seed_Departments.seed(db);
            seed_Designations.seed(db);
            seed_Faculties.seed(db);
            seed_Grades.seed(db);
            seed_Result_Types.seed(db);
            seed_Semester_Details_Results.seed(db);
            seed_Statuses.seed(db);
            seed_Session_Courses.seed(db);
            seed_Students.seed(db);
        }
        public ActionResult TaskDate(FormCollection FC)
        {
            int      designation = int.Parse(FC["designation"]);
            DateTime date        = DateTime.Parse(FC["date"]);
            string   comment     = FC["comment"];

            var des = db.Faculties.Where(m => m.Designation == designation);

            des.ToList().ForEach(m => m.TimeExtension = date);
            des.ToList().ForEach(m => m.edited_at     = DateTime.Now);
            des.ToList().ForEach(m => m.Comment       = comment);

            db.SaveChanges();
            ViewBag.Message = "Successfully";

            return(View());
        }