示例#1
0
        //public studentviewmodel GetByID(int id)
        //{
        //    var set = context.classes.FirstOrDefault(x => x.id == id);
        //    studentviewmodel obj = new studentviewmodel();
        //    obj.seat = set.seat;
        //    return obj;
        //}

        public studentviewmodel Get(int id, int level_id)
        {
            try
            {
                var set = context.Students.Where(x => x.id == id && x.level_id == level_id).Count();
                var sea = context.classes.FirstOrDefault(x => x.id == id && x.level_id == level_id);
                studentviewmodel obj = new studentviewmodel();
                obj.admitted  = set;
                obj.seat      = sea.seat;
                obj.Remaining = sea.seat - set;
                if (obj.Remaining > 0)
                {
                    return(obj);
                }
                else
                {
                    obj.Remaining = -(sea.seat - set);
                    return(obj);
                }
            }
            catch (Exception)
            {
                studentviewmodel obj = new studentviewmodel();
                obj.admitted  = 0;
                obj.seat      = 0;
                obj.Remaining = 0;
                return(obj);
            }
        }
示例#2
0
 public bool updatastudent(studentviewmodel th)
 {
     try
     {
         var obj = context.Students.FirstOrDefault(x => x.studentid == th.studentid);
         if (obj != null)
         {
             obj.Email   = th.Email;
             obj.address = th.address;
             obj.city    = th.city;
             obj.mobile  = th.mobile;
             obj.photo   = th.photo;
             context.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#3
0
        public IEnumerable <studentviewmodel> Getstudent(int id, int level_id, string data_Attendance)
        {
            List <studentviewmodel> s = new List <studentviewmodel>();

            foreach (var item in context.Students.Where(x => x.id == id && x.level_id == level_id && x.student_data == data_Attendance))
            {
                var ss = 1;
                studentviewmodel student = new studentviewmodel();

                var studen = context.Attendances.FirstOrDefault(x => x.data_Attendance == data_Attendance);
                student.attendance1  = studen.Attendance1;
                student.student_name = item.student_name;
                student.student_data = item.student_data;
                student.teacher_name = item.Teacher.teacher_name;
                if (student.attendance1 == ss.ToString())
                {
                    student.attendance1 = "Absent";
                }
                else
                {
                    student.attendance1 = "Leave";
                }
                s.Add(student);
            }
            return(s);
        }
示例#4
0
 public bool updatapassword(studentviewmodel th)
 {
     try
     {
         var obj = context.Students.FirstOrDefault(x => x.studentid == th.studentid);
         if (obj != null)
         {
             obj.password = th.newpassword;
             if (th.newpassword == th.comfirm_password)
             {
                 obj.comfirm_password = th.comfirm_password;
                 context.SaveChanges();
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
        //
        // GET: /admin/

        public ActionResult admin()
        {
            studentviewmodel stvm = new studentviewmodel();
            List <students>  li   = stvm.getallemployees();

            return(View(li));
        }
示例#6
0
        // select of the students
        public studentviewmodel select_student(int id, int level_id)
        {
            var student          = context.Students.Where(x => x.id == id && x.level_id == level_id).Count();
            studentviewmodel obj = new studentviewmodel();

            obj.count = student;
            return(obj);
        }
示例#7
0
        public studentviewmodel Getsofresluts(int id, int level_id, int studentid)
        {
            studentviewmodel obj = new studentviewmodel();

            try
            {
                var std = context.Students.Where(x => x.studentid == studentid).Select(x => x.student_name).FirstOrDefault();
                if (id == -1 && level_id == -1 && studentid == -1)
                {
                    var result = context.Students.Count();
                    obj.result1 = result;
                    return(obj);
                }
                else if (id == -1 && level_id == -1)
                {
                    var result = context.Students.Where(x => x.student_name == std).Count();

                    obj.result1 = result;
                    return(obj);
                }
                else if (id == -1 && studentid == -1)
                {
                    var result = context.Students.Where(x => x.level_id == level_id).Count();

                    obj.result1 = result;
                    return(obj);
                }
                else if (level_id == -1)
                {
                    var result = context.Students.Where(x => x.id == id && x.student_name == std).Count();
                    obj.result1 = result;
                    return(obj);
                }
                else if (id == -1)
                {
                    var result = context.Students.Where(x => x.level_id == level_id && x.student_name == std).Count();
                    obj.result1 = result;
                    return(obj);
                }
                else
                {
                    var result = context.Students.Where(x => x.id == id && x.level_id == level_id && x.student_name == std).Count();

                    obj.result1 = result;
                    return(obj);
                }
            }
            catch (Exception)
            {
                obj.result1 = 0;
                return(obj);
            }
        }
示例#8
0
        public bool Add(studentviewmodel st)
        {
            try
            {
                if (st != null)
                {
                    Student obj = new Student();
                    obj.student_name = st.student_name;
                    obj.mobile       = st.mobile;
                    obj.address      = st.address;
                    var emil  = context.Students.FirstOrDefault(x => x.Email == st.Email);
                    var teach = context.Teachers.FirstOrDefault(x => x.leval_id == st.level_id);
                    var em    = context.Students.FirstOrDefault(x => x.Email == x.Email);
                    if (emil == null)

                    {
                        obj.attendanceid     = em.attendanceid;
                        obj.idi              = teach.id;;
                        obj.Email            = st.Email;
                        obj.city             = st.city;
                        obj.username         = st.username;
                        obj.password         = st.password;
                        obj.id               = st.id;
                        obj.level_id         = st.level_id;
                        obj.student_data     = st.student_data;
                        obj.comfirm_password = st.comfirm_password;
                        if (st.password == st.comfirm_password)
                        {
                            context.Students.Add(obj);
                            context.SaveChanges();
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
示例#9
0
        public JsonResult changepassword2(studentviewmodel th)
        {
            bool log = st.updatapassword(th);

            if (log)
            {
                return(Json(log, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("error", JsonRequestBehavior.AllowGet));
            }
        }
示例#10
0
        public studentviewmodel getstudent(int id)
        {
            var dept             = context.Students.FirstOrDefault(x => x.studentid == id);
            studentviewmodel obj = new studentviewmodel();

            obj.Email   = dept.Email;
            obj.address = dept.address;
            obj.city    = dept.city;
            obj.mobile  = dept.mobile;
            obj.photo   = dept.photo;

            return(obj);
        }
示例#11
0
        public ActionResult Addstudent(studentviewmodel student)
        {
            bool check = st.Add(student);

            if (check)
            {
                return(Json("success", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("error", JsonRequestBehavior.AllowGet));
            }
        }
示例#12
0
 public IEnumerable <studentviewmodel> Dropdownliststudent(int level_id, int id)
 {
     if (level_id == -1 && id == -1)
     {
         List <studentviewmodel> obj = new List <studentviewmodel>();
         foreach (var item in context.Students)
         {
             studentviewmodel stu = new studentviewmodel();
             stu.studentid    = item.studentid;
             stu.student_name = item.student_name;
             obj.Add(stu);
         }
         return(obj);
     }
     else if (id == -1)
     {
         List <studentviewmodel> obj = new List <studentviewmodel>();
         foreach (var item in context.Students.Where(x => x.level_id == level_id))
         {
             studentviewmodel stu = new studentviewmodel();
             stu.studentid    = item.studentid;
             stu.student_name = item.student_name;
             obj.Add(stu);
         }
         return(obj);
     }
     else if (level_id == -1)
     {
         List <studentviewmodel> obj = new List <studentviewmodel>();
         foreach (var item in context.Students.Where(x => x.id == id))
         {
             studentviewmodel stu = new studentviewmodel();
             stu.studentid    = item.studentid;
             stu.student_name = item.student_name;
             obj.Add(stu);
         }
         return(obj);
     }
     else
     {
         List <studentviewmodel> obj = new List <studentviewmodel>();
         foreach (var item in context.Students.Where(x => x.id == id && x.level_id == level_id))
         {
             studentviewmodel stu = new studentviewmodel();
             stu.studentid    = item.studentid;
             stu.student_name = item.student_name;
             obj.Add(stu);
         }
         return(obj);
     }
 }
示例#13
0
        public IEnumerable <studentviewmodel> Getallstudent(int id, int level_id)
        {
            List <studentviewmodel> s = new List <studentviewmodel>();

            foreach (var item in context.Students.Where(x => x.id == id && x.level_id == level_id))
            {
                studentviewmodel student = new studentviewmodel();
                student.student_name = item.student_name;
                student.student_data = item.student_data;
                student.mobile       = item.mobile;
                student.Email        = item.Email;
                s.Add(student);
            }
            return(s);
        }
示例#14
0
        public JsonResult login_student(studentviewmodel login)
        {
            bool log = st.loginstudent(login);

            if (log)
            {
                Class_studentEntities context = new Class_studentEntities();
                var id = context.Students.Where(x => x.username == login.username && x.password == login.password).Select(x => x.studentid).FirstOrDefault();
                return(Json(id, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json("error", JsonRequestBehavior.AllowGet));
            }
        }
示例#15
0
        public studentviewmodel getresult(int id, int level_id, string data_Attendance)
        {
            studentviewmodel obj = new studentviewmodel();

            try
            {
                var result = context.Students.Where(x => x.id == id && x.level_id == level_id && x.student_data == data_Attendance).Count();

                obj.result = result;
                return(obj);
            }
            catch (Exception)
            {
                obj.result = 0;
                return(obj);
            }
        }
示例#16
0
 public bool loginstudent(studentviewmodel st)
 {
     try
     {
         var student = context.Students.Where(x => x.username == st.username && x.password == st.password).Select(x => x.studentid).FirstOrDefault();
         if (student == 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#17
0
        public JsonResult getcount_of_student(int id, int level_id)
        {
            studentviewmodel stu = st.select_student(id, level_id);

            return(Json(stu, JsonRequestBehavior.AllowGet));
        }
示例#18
0
        public IEnumerable <studentviewmodel> Getallsstudent(int id, int level_id, int studentid)
        {
            var std = context.Students.Where(x => x.studentid == studentid).Select(x => x.student_name).FirstOrDefault();

            if (level_id == -1 && id == -1 && studentid == -1)
            {
                List <studentviewmodel> obj = new List <studentviewmodel>();
                foreach (var item in context.Students)
                {
                    var ss = 1;
                    studentviewmodel student = new studentviewmodel();

                    student.attendance1  = item.Attendance.Attendance1;
                    student.student_name = item.student_name;
                    student.student_data = item.student_data;
                    student.teacher_name = item.Teacher.teacher_name;
                    if (student.attendance1 == ss.ToString())
                    {
                        student.attendance1 = "Absent";
                    }
                    else
                    {
                        student.attendance1 = "Leave";
                    }
                    obj.Add(student);
                }
                return(obj);
            }
            else if (id == -1 && level_id == -1)
            {
                List <studentviewmodel> obj = new List <studentviewmodel>();
                foreach (var item in context.Students.Where(x => x.student_name == std))
                {
                    var ss = 1;
                    studentviewmodel student = new studentviewmodel();


                    student.attendance1  = item.Attendance.Attendance1;
                    student.student_name = item.student_name;
                    student.student_data = item.student_data;
                    student.teacher_name = item.Teacher.teacher_name;
                    if (student.attendance1 == ss.ToString())
                    {
                        student.attendance1 = "Absent";
                    }
                    else
                    {
                        student.attendance1 = "Leave";
                    }
                    obj.Add(student);
                }
                return(obj);
            }
            else if (id == -1 && studentid == -1)
            {
                List <studentviewmodel> obj = new List <studentviewmodel>();
                foreach (var item in context.Students.Where(x => x.level_id == level_id))
                {
                    var ss = 1;
                    studentviewmodel student = new studentviewmodel();


                    student.attendance1  = item.Attendance.Attendance1;
                    student.student_name = item.student_name;
                    student.student_data = item.student_data;
                    student.teacher_name = item.Teacher.teacher_name;
                    if (student.attendance1 == ss.ToString())
                    {
                        student.attendance1 = "Absent";
                    }
                    else
                    {
                        student.attendance1 = "Leave";
                    }
                    obj.Add(student);
                }
                return(obj);
            }
            else if (level_id == -1)
            {
                List <studentviewmodel> obj = new List <studentviewmodel>();
                foreach (var item in context.Students.Where(x => x.id == id && x.student_name == std))
                {
                    var ss = 1;
                    studentviewmodel student = new studentviewmodel();


                    student.attendance1  = item.Attendance.Attendance1;
                    student.student_name = item.student_name;
                    student.student_data = item.student_data;
                    student.teacher_name = item.Teacher.teacher_name;
                    if (student.attendance1 == ss.ToString())
                    {
                        student.attendance1 = "Absent";
                    }
                    else
                    {
                        student.attendance1 = "Leave";
                    }
                    obj.Add(student);
                }
                return(obj);
            }
            else if (id == -1)
            {
                List <studentviewmodel> obj = new List <studentviewmodel>();
                foreach (var item in context.Students.Where(x => x.level_id == level_id && x.student_name == std))
                {
                    var ss = 1;
                    studentviewmodel student = new studentviewmodel();


                    student.attendance1  = item.Attendance.Attendance1;
                    student.student_name = item.student_name;
                    student.student_data = item.student_data;
                    student.teacher_name = item.Teacher.teacher_name;
                    if (student.attendance1 == ss.ToString())
                    {
                        student.attendance1 = "Absent";
                    }
                    else
                    {
                        student.attendance1 = "Leave";
                    }
                    obj.Add(student);
                }
                return(obj);
            }
            else
            {
                List <studentviewmodel> obj = new List <studentviewmodel>();
                foreach (var item in context.Students.Where(x => x.id == id && x.level_id == level_id && x.student_name == std))
                {
                    var ss = 1;
                    studentviewmodel student = new studentviewmodel();
                    student.attendance1  = item.Attendance.Attendance1;
                    student.student_name = item.student_name;
                    student.student_data = item.student_data;
                    student.teacher_name = item.Teacher.teacher_name;
                    if (student.attendance1 == ss.ToString())
                    {
                        student.attendance1 = "Absent";
                    }
                    else
                    {
                        student.attendance1 = "Leave";
                    }
                    obj.Add(student);
                }
                return(obj);
            }
        }
示例#19
0
        public JsonResult Edit_student(int id)
        {
            studentviewmodel dep = st.getstudent(id);

            return(Json(dep, JsonRequestBehavior.AllowGet));
        }
示例#20
0
        public JsonResult updata_student(studentviewmodel th)
        {
            var depts = st.updatastudent(th);

            return(Json(depts, JsonRequestBehavior.AllowGet));
        }
示例#21
0
        public ActionResult admission(students stu, HttpPostedFileBase file, HttpPostedFileBase file2)
        {
            string path1 = "null", path2 = "null";

            if (file == null)
            {
                ViewBag.alertmessage = "<script> alert('Matric document is Required!!!');     </script>";
            }
            else if (file2 == null)
            {
                ViewBag.alertmessage = "<script> alert('Inter Document is Required!!!');     </script>";
            }


            else
            {
                if (file != null && file.ContentLength > 0)
                {
                    string fileExtension = System.IO.Path.GetExtension(file.FileName);

                    if (fileExtension.ToLower() != ".jpg" && fileExtension.ToLower() != ".png")
                    {
                        ViewBag.alertmessage = "<script> alert('Matric document should be in proper format i.e (jpg/png)!!!');     </script>";
                    }
                    else
                    {
                        path1 = Server.MapPath("~/Content/" + file.FileName);
                        file.SaveAs(path1);
                        ViewBag.path = path1;
                    }
                }


                if (file2 != null && file2.ContentLength > 0)
                {
                    string fileExtension = System.IO.Path.GetExtension(file2.FileName);

                    if (fileExtension.ToLower() != ".jpg" && fileExtension.ToLower() != ".png")
                    {
                        ViewBag.alertmessage = "<script> alert('Inter document should be in proper format i.e (jpg/png)!!!');     </script>";
                    }
                    else
                    {
                        path2 = Server.MapPath("~/Content/" + file2.FileName);
                        file2.SaveAs(path2);
                        ViewBag.path2 = path2;
                    }
                }



                if (ModelState.IsValid == true)
                {
                    studentviewmodel stvm = new studentviewmodel();
                    string           s    = stvm.insert_loginmethod(stu);
                    stvm.insert_ssc(stu, s);
                    stvm.insert_hsc(stu, s);
                    stvm.insert_filepath(path1, path2, s);
                    ViewBag.alertmessage = "<script> alert('Data Sucessfully uploaded!!!');     </script>";
                    return(RedirectToAction("Index"));
                }
            }

            return(View());
        }
示例#22
0
        //public ActionResult getseat(int id)
        //{
        //    studentviewmodel stu = st.GetByID(id);
        //    return Json(stu, JsonRequestBehavior.AllowGet);
        //}
        public ActionResult getadmited(int id, int level_id)
        {
            studentviewmodel stu = st.Get(id, level_id);

            return(Json(stu, JsonRequestBehavior.AllowGet));
        }