Пример #1
0
        public ActionResult Create(FormCollection collection)
        {
            Student.Models.Student _student = new Student.Models.Student();
            try
            {
                // TODO: Add insert logic here
                using (TritonEntities EFDbContext = new TritonEntities())
                {
                    Student.Models.Student _info = new Student.Models.Student();
                    TryUpdateModel <Student.Models.Student>(_info, collection);
                    // Student _student = new Student();
                    //_student.StudentID = _info.StudentID;
                    _student.St_address  = _info.St_address;
                    _student.St_birthday = _info.St_birthday;
                    _student.St_name     = _info.St_name;
                    _student.St_la       = _info.St_la;
                    _student.St_long     = _info.St_long;
                    EFDbContext.Students.Add(_student);
                    EFDbContext.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #2
0
        // GET: Course/Edit/5
        public ActionResult Edit(int id)
        {
            Student.Models.Course _Course = new Student.Models.Course();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                var CourseData = from CourseTable in EFDbContext.Courses
                                 where CourseTable.CourseID == id
                                 select CourseTable;
                if (CourseData.Any())
                {
                    _Course.CourseID = CourseData.First().CourseID;
                    _Course.Co_name  = CourseData.First().Co_name;

                    return(View(_Course));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            return(View(_Course));
        }
Пример #3
0
        // GET: Student/Details/5
        public ActionResult Details(int?id)
        {
            Student.Models.Student _student = new Student.Models.Student();
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }


                var studentData = from studenTable in EFDbContext.Students
                                  where studenTable.StudentID == id
                                  select studenTable;
                if (studentData.Any())
                {
                    _student.StudentID   = studentData.First().StudentID;
                    _student.St_address  = studentData.First().St_address;
                    _student.St_birthday = studentData.First().St_birthday;
                    _student.St_name     = studentData.First().St_name;
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            return(View(_student));
        }
Пример #4
0
        // GET: Student/Delete/5
        public ActionResult Delete(int id)
        {
            Student.Models.Student _student = new Student.Models.Student();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                var studentData = from studenTable in EFDbContext.Students
                                  where studenTable.StudentID == id
                                  select studenTable;
                if (studentData.Any())
                {
                    //_student = studentData.First();
                    //EFDbContext.Students.Remove(_student);
                    //EFDbContext.SaveChanges();

                    return(View(_student));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            return(View());
        }
Пример #5
0
        // GET: Benchmark/Details/5
        public ActionResult Details(int id)
        {
            Student.Models.Benchmark _Benchmark = new Student.Models.Benchmark();
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }


                var BenchmarkData = from BenchmarkTable in EFDbContext.Benchmarks
                                    where BenchmarkTable.BenchmarkID == id
                                    select BenchmarkTable;
                if (BenchmarkData.Any())
                {
                    _Benchmark.BenchmarkID    = BenchmarkData.First().BenchmarkID;
                    _Benchmark.CourseID       = BenchmarkData.First().CourseID;
                    _Benchmark.StudentID      = BenchmarkData.First().StudentID;
                    _Benchmark.benchmarkRange = BenchmarkData.First().benchmarkRange;
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            return(View(_Benchmark));
        }
Пример #6
0
        public ActionResult Create(FormCollection collection)
        {
            Student.Models.Course _Course = new Student.Models.Course();
            try
            {
                // TODO: Add insert logic here
                using (TritonEntities EFDbContext = new TritonEntities())
                {
                    Student.Models.Course _info = new Student.Models.Course();
                    TryUpdateModel <Student.Models.Course>(_info, collection);
                    // Student _student = new Student();
                    //_Course.StudentID = _info.StudentID;
                    _Course.Co_name = _info.Co_name;
                    //_parent.Pa_sex = _info.Pa_sex;

                    EFDbContext.Courses.Add(_Course);
                    EFDbContext.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #7
0
        public ActionResult Create(FormCollection collection)
        {
            Student.Models.Benchmark _Benchmark = new Student.Models.Benchmark();
            try
            {
                // TODO: Add insert logic here
                using (TritonEntities EFDbContext = new TritonEntities())
                {
                    Student.Models.Benchmark _info = new Student.Models.Benchmark();
                    TryUpdateModel <Student.Models.Benchmark>(_info, collection);
                    // Student _student = new Student();
                    _Benchmark.StudentID      = _info.StudentID;
                    _Benchmark.CourseID       = _info.CourseID;
                    _Benchmark.benchmarkRange = _info.benchmarkRange;

                    EFDbContext.Benchmarks.Add(_Benchmark);
                    EFDbContext.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #8
0
 // GET: Benchmark/Edit/5
 public ActionResult Edit(int id)
 {
     Student.Models.Benchmark _Benchmark = new Student.Models.Benchmark();
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     using (TritonEntities EFDbContext = new TritonEntities())
     {
         var BenchmarkData = from BenchmarkTable in EFDbContext.Benchmarks
                             where BenchmarkTable.BenchmarkID == id
                             select BenchmarkTable;
         if (BenchmarkData.Any())
         {
             Dropdownlist _student = new Dropdownlist();
             ViewBag.studentID = _student.DrowStudentID();
             Dropdownlist _Course = new Dropdownlist();
             ViewBag.CourseID          = _Course.DrowCourseID();
             _Benchmark.StudentID      = BenchmarkData.First().StudentID;
             _Benchmark.BenchmarkID    = BenchmarkData.First().BenchmarkID;
             _Benchmark.CourseID       = BenchmarkData.First().CourseID;
             _Benchmark.benchmarkRange = BenchmarkData.First().benchmarkRange;
             //EFDbContext.SaveChanges();
             return(View(_Benchmark));
         }
         else
         {
             return(HttpNotFound());
         }
     }
     return(View(_Benchmark));
 }
Пример #9
0
        // GET: Google/Details/5
        public ActionResult Details(int id)
        {
            Student.Models.Student _student = new Student.Models.Student();
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }


                var studentData = from studenTable in EFDbContext.Students
                                  where studenTable.StudentID == id
                                  select studenTable;
                if (studentData.Any())
                {
                    ViewBag.la = studentData.First().St_la;
                    ViewBag.lo = studentData.First().St_long;
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            return(View());
        }
Пример #10
0
        // GET: Parent/Details/5
        public ActionResult Details(int id)
        {
            Student.Models.Parent _parent = new Student.Models.Parent();
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }


                var ParentData = from ParentTable in EFDbContext.Parents
                                 where ParentTable.ParentID == id
                                 select ParentTable;
                if (ParentData.Any())
                {
                    _parent.ParentID  = ParentData.First().ParentID;
                    _parent.Pa_name   = ParentData.First().Pa_name;
                    _parent.Pa_sex    = ParentData.First().Pa_sex;
                    _parent.StudentID = ParentData.First().StudentID;
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            return(View(_parent));
        }
Пример #11
0
 // GET: Parent/Edit/5
 public ActionResult Edit(int id)
 {
     Student.Models.Parent _parent = new Student.Models.Parent();
     if (id == null)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
     }
     using (TritonEntities EFDbContext = new TritonEntities())
     {
         var ParentData = from ParentTable in EFDbContext.Parents
                          where ParentTable.ParentID == id
                          select ParentTable;
         if (ParentData.Any())
         {
             Dropdownlist _student = new Dropdownlist();
             ViewBag.studentID = _student.DrowStudentID();
             _parent.StudentID = ParentData.First().StudentID;
             _parent.ParentID  = ParentData.First().ParentID;
             _parent.Pa_name   = ParentData.First().Pa_name;
             _parent.Pa_sex    = ParentData.First().Pa_sex;
             //EFDbContext.SaveChanges();
             return(View(_parent));
         }
         else
         {
             return(HttpNotFound());
         }
     }
     return(View(_parent));
 }
Пример #12
0
        public ActionResult Edit(int?id, FormCollection collection)
        {
            Student.Models.Student _student = new Student.Models.Student();

            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                if (ModelState.IsValid)
                {
                    using (TritonEntities EFDbContext = new TritonEntities())
                    {
                        Student.Models.Student _info = new Student.Models.Student();
                        TryUpdateModel <Student.Models.Student>(_info, collection);
                        //var studentData = from studenTable in EFDbContext.Students
                        //                  where studenTable.StudentID == id
                        //                  select studenTable;
                        //if (studentData.Any())
                        //{
                        //_student.StudentID = _info.StudentID;
                        _student.St_address  = _info.St_address;
                        _student.St_birthday = _info.St_birthday;
                        _student.St_name     = _info.St_name;
                        EFDbContext.SaveChanges();
                        return(RedirectToAction("Index"));
                        //}
                        //else
                        //{
                        //    return HttpNotFound();
                        //}
                    }
                }
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #13
0
        // GET: Report
        public ActionResult Index()
        {
            LocalReport localReport = new LocalReport();

            localReport.ReportPath = Server.MapPath("~/Report/ReportStPa.rdlc");
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                var ViewData = from ViewTable in EFDbContext.StudenParents

                               select ViewTable;
                if (ViewData.Any())
                {
                    ReportDataSource ReportData = new ReportDataSource("DataSet1", ViewData.ToList());
                    localReport.DataSources.Add(ReportData);
                    string reportType = "PDF";
                    string mimeType;
                    string encoding;
                    string fileNameExtension;
                    string deviceInfo =
                        "<DeviceInfo>" +
                        "  <OutputFormat>PDF</OutputFormat>" +
                        "  <PageWidth>8.5in</PageWidth>" +
                        "  <PageHeight>11in</PageHeight>" +
                        "  <MarginTop>0.5in</MarginTop>" +
                        "  <MarginLeft>1in</MarginLeft>" +
                        "  <MarginRight>1in</MarginRight>" +
                        "  <MarginBottom>0.5in</MarginBottom>" +
                        "</DeviceInfo>";
                    Warning[] warnings;
                    string[]  streams;
                    byte[]    renderedBytes;
                    renderedBytes = localReport.Render(
                        reportType,
                        deviceInfo,
                        out mimeType,
                        out encoding,
                        out fileNameExtension,
                        out streams,
                        out warnings);
                    return(File(renderedBytes, mimeType));
                }
                return(View());
            }
        }
Пример #14
0
        // GET: Course
        public ActionResult Index()
        {
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                var CourseData = from CourseTable in EFDbContext.Courses
                                 select CourseTable;
                if (CourseData.Any())
                {
                    //_student = studentData.ToList();
                    //    _student.St_address = studentData.First().St_address;

                    //}
                    //else
                    //{
                    //    return HttpNotFound();
                    return(View(CourseData.ToList()));
                }
            }
            return(View());
        }
Пример #15
0
        // GET: Student
        public ActionResult Index()
        {
            //Student.Models.Student _student = new Student.Models.Student();
            using (TritonEntities EFDbContext = new TritonEntities())
            {
                var studentData = from studenTable in EFDbContext.Students
                                  select studenTable;
                if (studentData.Any())
                {
                    //_student = studentData.ToList();
                    //    _student.St_address = studentData.First().St_address;

                    //}
                    //else
                    //{
                    //    return HttpNotFound();
                    return(View(studentData.ToList()));
                }
            }
            return(View());
        }
Пример #16
0
        public ActionResult Delete(int?id, FormCollection collection)
        {
            Student.Models.Student _student = new Student.Models.Student();
            try
            {
                // TODO: Add delete logic here
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                using (TritonEntities EFDbContext = new TritonEntities())
                {
                    Student.Models.Student _info = new Student.Models.Student();
                    TryUpdateModel <Student.Models.Student>(_info, collection);

                    //var studentData = from studenTable in EFDbContext.Students
                    //                  where studenTable.StudentID == id
                    //                  select studenTable;
                    //if (studentData.Any())
                    //{
                    _student = _info;
                    EFDbContext.Students.Remove(_student);
                    EFDbContext.SaveChanges();

                    return(RedirectToAction("Index"));
                    //}
                    //else
                    //{
                    //    return HttpNotFound();
                    //}
                }
            }
            catch
            {
                return(View());
            }
        }